Skip to content

Commit

Permalink
Debugging close() logic
Browse files Browse the repository at this point in the history
  • Loading branch information
h0ker committed May 24, 2024
1 parent 3829304 commit 4108975
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
applicationId = "com.hoker.intra_example"
minSdk = 28
targetSdk = 34
versionCode = 23
versionName = "1.1.5"
versionCode = 24
versionName = "1.1.6"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
2 changes: 1 addition & 1 deletion intra/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ afterEvaluate {
from(components["release"])
groupId = "com.github.CarbideCowboy"
artifactId = "Intra"
version = "1.1.5"
version = "1.1.6"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ class IsodepControllerImpl @Inject constructor(
}

override suspend fun close() {
isoDep?.close()
try {
isoDep?.close()
} catch(e: Exception) {
Log.d(this::class.java.simpleName, "Tag was out of date")
}
isoDep = null
stopConnectionCheckJob()
_connectionStatus.emit(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ class NfcAControllerImpl @Inject constructor(
}

override suspend fun close() {
nfcA?.let {
it.close()
stopConnectionCheckJob()
nfcA = null
Log.i("ApexConnection", "----NFC_A CLOSED")
_connectionStatus.emit(false)
try {
nfcA?.close()
} catch(e: Exception) {
Log.d(this::class.java.simpleName, "Tag was out of date")
}
stopConnectionCheckJob()
nfcA = null
Log.i("ApexConnection", "----NFC_A CLOSED")
_connectionStatus.emit(false)
}

override suspend fun getAtr(): OperationResult<ByteArray?> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,14 @@ class NfcVControllerImpl @Inject constructor(
}

override suspend fun close() {
nfcV?.let {
it.close()
stopConnectionCheckJob()
nfcV = null
_connectionStatus.emit(false)
try {
nfcV?.close()
} catch(e: Exception) {
Log.d(this::class.java.simpleName, "Tag was out of date")
}
stopConnectionCheckJob()
nfcV = null
_connectionStatus.emit(false)
}

override suspend fun getAts(): OperationResult<ByteArray?> {
Expand Down

0 comments on commit 4108975

Please sign in to comment.