From a191dac0f498ffb3e59fe4d1f65967ba179eec4e Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 24 May 2020 10:12:12 -0700 Subject: [PATCH] stay with old api for now, because too much change hurts reliaiblity ;-) --- .../com/geeksville/mesh/service/RadioInterfaceService.kt | 7 ++++--- .../main/java/com/geeksville/mesh/service/SafeBluetooth.kt | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/geeksville/mesh/service/RadioInterfaceService.kt b/app/src/main/java/com/geeksville/mesh/service/RadioInterfaceService.kt index 2a4b2fee4..dd9da9553 100644 --- a/app/src/main/java/com/geeksville/mesh/service/RadioInterfaceService.kt +++ b/app/src/main/java/com/geeksville/mesh/service/RadioInterfaceService.kt @@ -149,9 +149,9 @@ class RadioInterfaceService : Service(), Logging { private var runningService: RadioInterfaceService? = null /** - * Temp hack (until old API deprecated), we now hardwire for the new API, I'll delete the old code in about a week + * Temp hack (until old API deprecated), we now probe for the API */ - var isOldApi: Boolean? = false + var isOldApi: Boolean? = null /// This is public only so that SimRadio can bootstrap our message flow fun broadcastReceivedFromRadio(context: Context, payload: ByteArray) { @@ -436,7 +436,8 @@ class RadioInterfaceService : Service(), Logging { delay(1000) // android BLE is buggy and needs a 500ms sleep before calling getChracteristic, or you might get back null // service could be null, test this by throwing BLEException and testing it on my machine - // isOldApi = service.getCharacteristic(BTM_RADIO_CHARACTER) != null + if (isOldApi == null) + isOldApi = service.getCharacteristic(BTM_RADIO_CHARACTER) != null warn("Use oldAPI = $isOldApi") /* if (isFirstTime) { diff --git a/app/src/main/java/com/geeksville/mesh/service/SafeBluetooth.kt b/app/src/main/java/com/geeksville/mesh/service/SafeBluetooth.kt index 982cb18fe..a7a134e90 100644 --- a/app/src/main/java/com/geeksville/mesh/service/SafeBluetooth.kt +++ b/app/src/main/java/com/geeksville/mesh/service/SafeBluetooth.kt @@ -152,7 +152,7 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD // Our own custom BLE status codes private val STATUS_RELIABLE_WRITE_FAILED = 4403 - private val STATUS_TIMEOUT = 4403 + private val STATUS_TIMEOUT = 4404 private val gattCallback = object : BluetoothGattCallback() {