amazon fire requires a longer delay for the nasty BLE force-refresh hack

pull/106/head
geeksville 2020-07-17 14:12:46 -07:00
rodzic c10beb816a
commit 8d6af24488
3 zmienionych plików z 8 dodań i 4 usunięć

Wyświetl plik

@ -17,8 +17,8 @@ android {
applicationId "com.geeksville.mesh"
minSdkVersion 21 // The oldest emulator image I have tried is 22 (though 21 probably works)
targetSdkVersion 29
versionCode 10795 // format is Mmmss (where M is 1+the numeric major number
versionName "0.7.95"
versionCode 10796 // format is Mmmss (where M is 1+the numeric major number
versionName "0.7.96"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {

Wyświetl plik

@ -193,6 +193,8 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String
// NRF52 targets do not need the nasty force refresh hack that ESP32 needs (because they keep their
// BLE handles stable. So turn the hack off for these devices. FIXME - find a better way to know that the board is NRF52 based
// and Amazon fire devices seem to not need this hack either
// Build.MANUFACTURER != "Amazon" &&
private var needForceRefresh = !address.startsWith("FD:10:04")
init {
@ -415,7 +417,9 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String
if (needForceRefresh) { // Our ESP32 code doesn't properly generate "service changed" indications. Therefore we need to force a refresh on initial start
//needForceRefresh = false // In fact, because of tearing down BLE in sleep on the ESP32, our handle # assignments are not stable across sleep - so we much refetch every time
forceServiceRefresh() // this article says android should not be caching, but it does on some phones: https://punchthrough.com/attribute-caching-in-ble-advantages-and-pitfalls/
delay(200) // From looking at the android C code it seems that we need to give some time for the refresh message to reach that worked _before_ we try to set mtu/get services
delay(500) // From looking at the android C code it seems that we need to give some time for the refresh message to reach that worked _before_ we try to set mtu/get services
// 200ms was not enough on an Amazon Fire
}
// we begin by setting our MTU size as high as it can go (if we can)

@ -1 +1 @@
Subproject commit cfe31d66e4de324fa91a2978a76ffcfba5e01085
Subproject commit bdb2685aefd04791d62f018e9299173ec3002a6c