ソースを参照

feat: expose ES10c.EuiccMemoryReset (#88)

Co-authored-by: Peter Cai <peter@typeblog.net>
Reviewed-on: https://gitea.angry.im/PeterCxy/OpenEUICC/pulls/88
Co-authored-by: septs <github@septs.pw>
Co-committed-by: septs <github@septs.pw>
septs 1 年間 前
コミット
4ae19aea3b

+ 2 - 0
libs/lpac-jni/src/main/java/net/typeblog/lpac_jni/LocalProfileAssistant.kt

@@ -37,6 +37,8 @@ interface LocalProfileAssistant {
     fun deleteNotification(seqNumber: Long): Boolean
     fun handleNotification(seqNumber: Long): Boolean
 
+    fun euiccMemoryReset()
+
     fun setNickname(
         iccid: String, nickname: String
     ): Boolean

+ 2 - 0
libs/lpac-jni/src/main/java/net/typeblog/lpac_jni/LpacJni.kt

@@ -33,6 +33,8 @@ internal object LpacJni {
     // Cancel any ongoing es9p and/or es10b sessions
     external fun cancelSessions(handle: Long)
 
+    // ES10c
+    external fun es10cEuiccMemoryReset(handle: Long): Int
     // es10cex (actually part of es10b)
     external fun es10cexGetEuiccInfo2(handle: Long): Long
 

+ 4 - 0
libs/lpac-jni/src/main/java/net/typeblog/lpac_jni/impl/LocalProfileAssistantImpl.kt

@@ -241,6 +241,10 @@ class LocalProfileAssistantImpl(
     override fun setNickname(iccid: String, nickname: String): Boolean =
         LpacJni.es10cSetNickname(contextHandle, iccid, nickname) == 0
 
+    override fun euiccMemoryReset() {
+        LpacJni.es10cEuiccMemoryReset(contextHandle)
+    }
+
     @Synchronized
     override fun close() {
         if (!finalized) {

+ 9 - 0
libs/lpac-jni/src/main/jni/lpac-jni/lpac-jni.c

@@ -245,6 +245,15 @@ Java_net_typeblog_lpac_1jni_LpacJni_es10cexGetEuiccInfo2(JNIEnv *env, jobject th
     return (jlong) info;
 }
 
+
+JNIEXPORT jint JNICALL
+Java_net_typeblog_lpac_1jni_LpacJni_es10cEuiccMemoryReset(JNIEnv *env, jobject thiz, jlong handle) {
+    struct euicc_ctx *ctx = (struct euicc_ctx *) handle;
+    int ret;
+    ret = es10c_euicc_memory_reset(ctx);
+    return ret
+}
+
 JNIEXPORT jstring JNICALL
 Java_net_typeblog_lpac_1jni_LpacJni_stringDeref(JNIEnv *env, jobject thiz, jlong curr) {
     return toJString(env, *((char **) curr));