|
@@ -3,6 +3,7 @@ package im.angry.openeuicc.core
|
|
|
import android.se.omapi.Channel
|
|
import android.se.omapi.Channel
|
|
|
import android.se.omapi.SEService
|
|
import android.se.omapi.SEService
|
|
|
import android.se.omapi.Session
|
|
import android.se.omapi.Session
|
|
|
|
|
+import android.util.Log
|
|
|
import im.angry.openeuicc.util.*
|
|
import im.angry.openeuicc.util.*
|
|
|
import net.typeblog.lpac_jni.ApduInterface
|
|
import net.typeblog.lpac_jni.ApduInterface
|
|
|
|
|
|
|
@@ -10,6 +11,10 @@ class OmapiApduInterface(
|
|
|
private val service: SEService,
|
|
private val service: SEService,
|
|
|
private val port: UiccPortInfoCompat
|
|
private val port: UiccPortInfoCompat
|
|
|
): ApduInterface {
|
|
): ApduInterface {
|
|
|
|
|
+ companion object {
|
|
|
|
|
+ const val TAG = "OmapiApduInterface"
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private lateinit var session: Session
|
|
private lateinit var session: Session
|
|
|
private lateinit var lastChannel: Channel
|
|
private lateinit var lastChannel: Channel
|
|
|
|
|
|
|
@@ -44,7 +49,17 @@ class OmapiApduInterface(
|
|
|
"Unknown channel"
|
|
"Unknown channel"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return lastChannel.transmit(tx)
|
|
|
|
|
|
|
+ Log.d(TAG, "OMAPI APDU: ${tx.encodeHex()}")
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ return lastChannel.transmit(tx).also {
|
|
|
|
|
+ Log.d(TAG, "OMAPI APDU response: ${it.encodeHex()}")
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (e: Exception) {
|
|
|
|
|
+ Log.e(TAG, "OMAPI APDU exception")
|
|
|
|
|
+ e.printStackTrace()
|
|
|
|
|
+ throw e
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|