lpac-jni: Expose refresh flag to Kotlin
All checks were successful
/ build-debug (push) Successful in 5m1s
All checks were successful
/ build-debug (push) Successful in 5m1s
This commit is contained in:
parent
01e1b2b9a4
commit
20cdb99a7b
|
@ -10,8 +10,8 @@ interface LocalProfileAssistant {
|
|||
|
||||
// All blocking functions in this class assume that they are executed on non-Main threads
|
||||
// The IO context in Kotlin's coroutine library is recommended.
|
||||
fun enableProfile(iccid: String): Boolean
|
||||
fun disableProfile(iccid: String): Boolean
|
||||
fun enableProfile(iccid: String, refresh: Boolean = false): Boolean
|
||||
fun disableProfile(iccid: String, refresh: Boolean = false): Boolean
|
||||
fun deleteProfile(iccid: String): Boolean
|
||||
|
||||
fun downloadProfile(smdp: String, matchingId: String?, imei: String?,
|
||||
|
|
|
@ -15,8 +15,8 @@ internal object LpacJni {
|
|||
// null returns signify errors
|
||||
external fun es10cGetEid(handle: Long): String?
|
||||
external fun es10cGetProfilesInfo(handle: Long): Array<LocalProfileInfo>?
|
||||
external fun es10cEnableProfile(handle: Long, iccid: String): Int
|
||||
external fun es10cDisableProfile(handle: Long, iccid: String): Int
|
||||
external fun es10cEnableProfile(handle: Long, iccid: String, refresh: Boolean): Int
|
||||
external fun es10cDisableProfile(handle: Long, iccid: String, refresh: Boolean): Int
|
||||
external fun es10cDeleteProfile(handle: Long, iccid: String): Int
|
||||
external fun es10cSetNickname(handle: Long, iccid: String, nick: String): Int
|
||||
|
||||
|
|
|
@ -58,13 +58,13 @@ class LocalProfileAssistantImpl(
|
|||
override val euiccInfo2: EuiccInfo2?
|
||||
get() = LpacJni.es10cexGetEuiccInfo2(contextHandle)
|
||||
|
||||
override fun enableProfile(iccid: String): Boolean =
|
||||
(LpacJni.es10cEnableProfile(contextHandle, iccid) == 0).also {
|
||||
override fun enableProfile(iccid: String, refresh: Boolean): Boolean =
|
||||
(LpacJni.es10cEnableProfile(contextHandle, iccid, refresh) == 0).also {
|
||||
_profiles = null
|
||||
}
|
||||
|
||||
override fun disableProfile(iccid: String): Boolean =
|
||||
(LpacJni.es10cDisableProfile(contextHandle, iccid) == 0).also {
|
||||
override fun disableProfile(iccid: String, refresh: Boolean): Boolean =
|
||||
(LpacJni.es10cDisableProfile(contextHandle, iccid, refresh) == 0).also {
|
||||
_profiles = null
|
||||
}
|
||||
|
||||
|
|
|
@ -242,26 +242,26 @@ Java_net_typeblog_lpac_1jni_LpacJni_es10cGetProfilesInfo(JNIEnv *env, jobject th
|
|||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_net_typeblog_lpac_1jni_LpacJni_es10cEnableProfile(JNIEnv *env, jobject thiz, jlong handle,
|
||||
jstring iccid) {
|
||||
jstring iccid, jboolean refresh) {
|
||||
struct euicc_ctx *ctx = (struct euicc_ctx *) handle;
|
||||
const char *_iccid = NULL;
|
||||
int ret;
|
||||
|
||||
_iccid = (*env)->GetStringUTFChars(env, iccid, NULL);
|
||||
ret = es10c_enable_profile(ctx, _iccid, 1);
|
||||
ret = es10c_enable_profile(ctx, _iccid, refresh ? 1 : 0);
|
||||
(*env)->ReleaseStringUTFChars(env, iccid, _iccid);
|
||||
return ret;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_net_typeblog_lpac_1jni_LpacJni_es10cDisableProfile(JNIEnv *env, jobject thiz, jlong handle,
|
||||
jstring iccid) {
|
||||
jstring iccid, jboolean refresh) {
|
||||
struct euicc_ctx *ctx = (struct euicc_ctx *) handle;
|
||||
const char *_iccid = NULL;
|
||||
int ret;
|
||||
|
||||
_iccid = (*env)->GetStringUTFChars(env, iccid, NULL);
|
||||
ret = es10c_disable_profile(ctx, _iccid, 1);
|
||||
ret = es10c_disable_profile(ctx, _iccid, refresh ? 1 : 0);
|
||||
(*env)->ReleaseStringUTFChars(env, iccid, _iccid);
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue