From 678a0358a575f4219e756ecc684d68aaec6e35d6 Mon Sep 17 00:00:00 2001 From: Mike Cumings Date: Fri, 6 May 2022 11:18:24 -0700 Subject: [PATCH] Fix local props being uninitialized prior to constructor execution --- .../repository/radio/RadioInterfaceService.kt | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/com/geeksville/mesh/repository/radio/RadioInterfaceService.kt b/app/src/main/java/com/geeksville/mesh/repository/radio/RadioInterfaceService.kt index ce14c3210..f8ae8fe88 100644 --- a/app/src/main/java/com/geeksville/mesh/repository/radio/RadioInterfaceService.kt +++ b/app/src/main/java/com/geeksville/mesh/repository/radio/RadioInterfaceService.kt @@ -51,6 +51,27 @@ class RadioInterfaceService @Inject constructor( private val _receivedData = MutableSharedFlow() val receivedData: SharedFlow = _receivedData + private val logSends = false + private val logReceives = false + private lateinit var sentPacketsLog: BinaryLogFile // inited in onCreate + private lateinit var receivedPacketsLog: BinaryLogFile + + /** + * We recreate this scope each time we stop an interface + */ + var serviceScope = CoroutineScope(Dispatchers.IO + Job()) + + private var radioIf: IRadioInterface = NopInterface() + + /** true if we have started our interface + * + * Note: an interface may be started without necessarily yet having a connection + */ + private var isStarted = false + + /// true if our interface is currently connected to a device + private var isConnected = false + init { processLifecycle.coroutineScope.launch { bluetoothRepository.state.collect { state -> @@ -145,27 +166,6 @@ class RadioInterfaceService @Inject constructor( } } - private val logSends = false - private val logReceives = false - private lateinit var sentPacketsLog: BinaryLogFile // inited in onCreate - private lateinit var receivedPacketsLog: BinaryLogFile - - /** - * We recreate this scope each time we stop an interface - */ - var serviceScope = CoroutineScope(Dispatchers.IO + Job()) - - private var radioIf: IRadioInterface = NopInterface() - - /** true if we have started our interface - * - * Note: an interface may be started without necessarily yet having a connection - */ - private var isStarted = false - - /// true if our interface is currently connected to a device - private var isConnected = false - private fun broadcastConnectionChanged(isConnected: Boolean, isPermanent: Boolean) { debug("Broadcasting connection=$isConnected")