Skip to content

Commit

Permalink
Added one minute timeout set for IsoDep and NfcA to hopefully handle …
Browse files Browse the repository at this point in the history
…some tag lost exceptions I'm seeing in certain cases.
  • Loading branch information
h0ker committed Jul 2, 2024
1 parent 46eb390 commit dba52db
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
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.10"
version = "1.2.0"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class IsodepControllerImpl @Inject constructor(
return try {
isoDep?.let {
it.connect()
it.timeout = 60000
_connectionStatus.emit(true)
startConnectionCheckJob()
OperationResult.Success(Unit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@ class NfcAControllerImpl @Inject constructor(
return try {
close()
nfcA = NfcA.get(tag)
nfcA?.connect()
Log.i("ApexConnection", "----NFC_A CONNECTED")
startConnectionCheckJob()
_connectionStatus.emit(true)
OperationResult.Success(Unit)
nfcA?.let {
it.connect()
it.timeout = 60000
Log.i("ApexConnection", "----NFC_A CONNECTED")
startConnectionCheckJob()
_connectionStatus.emit(true)
OperationResult.Success(Unit)
}
OperationResult.Failure(Exception("NfcA.connect() came back as null"))
} catch (e: Exception) {
OperationResult.Failure(e)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ class NfcVControllerImpl @Inject constructor(
return try {
close()
nfcV = NfcV.get(tag)
nfcV?.connect()
startConnectionCheckJob()
_connectionStatus.emit(true)
OperationResult.Success(Unit)
nfcV?.let {
it.connect()
startConnectionCheckJob()
_connectionStatus.emit(true)
OperationResult.Success(Unit)
}
OperationResult.Failure(Exception("NfcV.connect() came back as null"))
} catch (e: Exception) {
OperationResult.Failure(e)
}
Expand Down

0 comments on commit dba52db

Please sign in to comment.