stay with old api for now, because too much change hurts reliaiblity ;-)

This commit is contained in:
geeksville
2020-05-24 10:12:12 -07:00
parent ae72081917
commit a191dac0f4
2 changed files with 5 additions and 4 deletions

View File

@@ -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) {

View File

@@ -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() {