Fix #67, see that issue for writeup. gatt needs to be @Volatile

pull/66/head
geeksville 2020-06-25 17:56:31 -07:00
rodzic 2780a08931
commit 1fd80c06d8
2 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -322,7 +322,8 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String
val s = safe val s = safe
if (s != null) { if (s != null) {
warn("Forcing disconnect and hopefully device will comeback (disabling forced refresh)") warn("Forcing disconnect and hopefully device will comeback (disabling forced refresh)")
hasForcedRefresh = true hasForcedRefresh =
true // We've already tossed any old service caches, no need to do it again
ignoreException { ignoreException {
s.closeConnection() s.closeConnection()
} }

Wyświetl plik

@ -38,6 +38,7 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD
var timeoutMsec = 15 * 1000L var timeoutMsec = 15 * 1000L
/// Users can access the GATT directly as needed /// Users can access the GATT directly as needed
@Volatile
var gatt: BluetoothGatt? = null var gatt: BluetoothGatt? = null
@Volatile @Volatile