kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
Fix #23: autobug, if we get mystery BLE error 133 while reading messages
drop the BLE link and reconnect and try again.pull/28/head
rodzic
d28eb97497
commit
5822dddc6c
|
@ -295,6 +295,7 @@ class RadioInterfaceService : Service(), Logging {
|
||||||
else {
|
else {
|
||||||
val fromRadio = getCharacteristic(BTM_FROMRADIO_CHARACTER)
|
val fromRadio = getCharacteristic(BTM_FROMRADIO_CHARACTER)
|
||||||
safe!!.asyncReadCharacteristic(fromRadio) {
|
safe!!.asyncReadCharacteristic(fromRadio) {
|
||||||
|
try {
|
||||||
val b = it.getOrThrow()
|
val b = it.getOrThrow()
|
||||||
.value.clone() // We clone the array just in case, I'm not sure if they keep reusing the array
|
.value.clone() // We clone the array just in case, I'm not sure if they keep reusing the array
|
||||||
|
|
||||||
|
@ -309,6 +310,13 @@ class RadioInterfaceService : Service(), Logging {
|
||||||
if (firstRead) // If we just finished our initial download, now we want to start listening for notifies
|
if (firstRead) // If we just finished our initial download, now we want to start listening for notifies
|
||||||
startWatchingFromNum()
|
startWatchingFromNum()
|
||||||
}
|
}
|
||||||
|
} catch (ex: BLEException) {
|
||||||
|
errormsg(
|
||||||
|
"error during doReadFromRadio",
|
||||||
|
ex
|
||||||
|
)
|
||||||
|
serviceScope.handledLaunch { retryDueToException() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -418,7 +418,9 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD
|
||||||
cb: (Result<Unit>) -> Unit,
|
cb: (Result<Unit>) -> Unit,
|
||||||
lostConnectCb: () -> Unit
|
lostConnectCb: () -> Unit
|
||||||
) {
|
) {
|
||||||
logAssert(workQueue.isEmpty() && currentWork == null) // I don't think anything should be able to sneak in front
|
logAssert(workQueue.isEmpty())
|
||||||
|
logAssert(currentWork == null) // I don't think anything should be able to sneak in front
|
||||||
|
|
||||||
lostConnectCallback = lostConnectCb
|
lostConnectCallback = lostConnectCb
|
||||||
connectionCallback = if (autoConnect)
|
connectionCallback = if (autoConnect)
|
||||||
cb
|
cb
|
||||||
|
|
Ładowanie…
Reference in New Issue