Merge pull request #151 from lgoix/master

Connect to a device without updating owner #119
pull/152/head
lgoix 2020-09-03 08:03:31 -04:00 zatwierdzone przez GitHub
commit b46f6e1a7b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 5 dodań i 4 usunięć

Wyświetl plik

@ -583,6 +583,8 @@ class MainActivity : AppCompatActivity(), Logging,
try { try {
// Pull down our real node ID - This must be done AFTER reading the nodedb because we need the DB to find our nodeinof object // Pull down our real node ID - This must be done AFTER reading the nodedb because we need the DB to find our nodeinof object
model.nodeDB.myId.value = service.myId model.nodeDB.myId.value = service.myId
val ourNodeInfo = model.nodeDB.ourNodeInfo
model.ownerName.value = ourNodeInfo?.user?.longName
} catch (ex: Exception) { } catch (ex: Exception) {
warn("Ignoring failure to get myId, service is probably just uninited... ${ex.message}") warn("Ignoring failure to get myId, service is probably just uninited... ${ex.message}")
} }
@ -595,9 +597,6 @@ class MainActivity : AppCompatActivity(), Logging,
debug("connchange ${model.isConnected.value}") debug("connchange ${model.isConnected.value}")
if (connected == MeshService.ConnectionState.CONNECTED) { if (connected == MeshService.ConnectionState.CONNECTED) {
// everytime the radio reconnects, we slam in our current owner data, the radio is smart enough to only broadcast if needed
model.setOwner()
model.meshService?.let { service -> model.meshService?.let { service ->
debug("Getting latest radioconfig from service") debug("Getting latest radioconfig from service")
model.radioConfig.value = model.radioConfig.value =

Wyświetl plik

@ -349,7 +349,7 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String
} }
service.onDisconnect(false) // assume we will fail service.onDisconnect(false) // assume we will fail
delay(1000) // Give some nasty time for buggy BLE stacks to shutdown (500ms was not enough) delay(1500) // Give some nasty time for buggy BLE stacks to shutdown (500ms was not enough)
reconnectJob = null // Any new reconnect requests after this will be allowed to run reconnectJob = null // Any new reconnect requests after this will be allowed to run
warn("Attempting reconnect") warn("Attempting reconnect")
if (safe != null) // check again, because we just slept for 1sec, and someone might have closed our interface if (safe != null) // check again, because we just slept for 1sec, and someone might have closed our interface

Wyświetl plik

@ -542,6 +542,8 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
// Only let user edit their name or set software update while connected to a radio // Only let user edit their name or set software update while connected to a radio
model.isConnected.observe(viewLifecycleOwner, Observer { connected -> model.isConnected.observe(viewLifecycleOwner, Observer { connected ->
usernameView.isEnabled = connected == MeshService.ConnectionState.CONNECTED usernameView.isEnabled = connected == MeshService.ConnectionState.CONNECTED
if(connected == MeshService.ConnectionState.DISCONNECTED)
model.ownerName.value = ""
initNodeInfo() initNodeInfo()
}) })