mirror of
https://github.com/twinksoftware/Gearslip.git
synced 2026-11-10 16:02:25 +01:00
wireless: Disconnect works while the car hasn't answered yet
This commit is contained in:
1 parent
10e8568aba
commit
4f1e6dcbfa
1 file changed
+6
@@ -115,6 +115,7 @@ object WirelessLink {
|
||||
/** Closes the Bluetooth channel, the socket and the Wi-Fi request. Safe to call any time. */
|
||||
fun stop(context: Context) {
|
||||
tcpRun++
|
||||
val starting = worker != null && SessionStatus.state.value.phase == SessionStatus.Phase.CONNECTING
|
||||
worker?.interrupt()
|
||||
worker = null
|
||||
runCatching { listener?.close() }
|
||||
@@ -127,6 +128,11 @@ object WirelessLink {
|
||||
runCatching { context.getSystemService(ConnectivityManager::class.java).unregisterNetworkCallback(cb) }
|
||||
}
|
||||
network = null
|
||||
// Stopped before the car's session began, so nothing else resets Home's card.
|
||||
if (starting) {
|
||||
log.i("wireless start-up stopped")
|
||||
SessionStatus.disconnected()
|
||||
}
|
||||
}
|
||||
|
||||
/** A stable id for this phone as this app sees it, standing in for the serial a real phone sends. */
|
||||
|
||||
Reference in new issue
Block a user