Merge pull request #89 from geeksville/dev

Dev
pull/90/head
Kevin Hester 2020-07-04 12:50:32 -07:00 zatwierdzone przez GitHub
commit 73b8eef25b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 64 dodań i 47 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 10788 // format is Mmmss (where M is 1+the numeric major number
versionName "0.7.88"
versionCode 10789 // format is Mmmss (where M is 1+the numeric major number
versionName "0.7.89"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {

Wyświetl plik

@ -354,7 +354,11 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String
private var isFirstTime = true
private fun doDiscoverServicesAndInit() {
safe!!.asyncDiscoverServices { discRes ->
val s = safe
if (s == null)
warn("Interface is shutting down, so skipping discover")
else
s.asyncDiscoverServices { discRes ->
try {
discRes.getOrThrow()

Wyświetl plik

@ -392,15 +392,19 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD
// startup next job in queue before calling the completion handler
val work =
synchronized(workQueue) {
val w =
currentWork
?: throw Exception("currentWork was null") // will throw if null, which is helpful (FIXME - throws in the field - because of a bogus mtu completion gatt call)
val w = currentWork
if (w != null) {
stopCurrentWork() // We are now no longer working on anything
startNewWork()
}
w
}
if (work == null)
warn("wor completed, but we already killed it via failsafetimer? status=$status, res=$res")
else {
debug("work ${work.tag} is completed, resuming status=$status, res=$res")
if (status != 0)
work.completion.resumeWithException(
@ -413,6 +417,7 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD
work.completion.resume(Result.success(res) as Result<Nothing>)
}
}
}
/**
* Something went wrong, abort all queued
@ -421,7 +426,14 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD
synchronized(workQueue) {
warn("Failing ${workQueue.size} works, because ${ex.message}")
workQueue.forEach {
try {
it.completion.resumeWithException(ex)
} catch (ex: Exception) {
errormsg(
"Mystery exception, why were we informed about our own exceptions?",
ex
)
}
}
workQueue.clear()
stopCurrentWork()
@ -607,7 +619,7 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD
private fun queueRequestMtu(
len: Int,
cont: Continuation<Unit>
) = queueWork("reqMtu", cont, 5 * 1000) {
) = queueWork("reqMtu", cont, 10 * 1000) {
isSettingMtu = true
gatt?.requestMtu(len) ?: false
}

Wyświetl plik

@ -268,7 +268,8 @@ class SoftwareUpdateService : JobIntentService(), Logging {
fun doUpdate(context: Context, sync: SafeBluetooth, assetName: String) {
try {
val g = sync.gatt!!
val service = g.services.find { it.uuid == SW_UPDATE_UUID }!!
val service = g.services.find { it.uuid == SW_UPDATE_UUID }
?: throw BLEException("Couldn't find update service")
info("Starting firmware update for $assetName")

@ -1 +1 @@
Subproject commit 95c5a9aa950f917857a3cc0c7cd84a4a56993032
Subproject commit 99dbf61fad087db910be7f74867a8f14aba877a4