Fix local props being uninitialized prior to constructor execution

pull/420/head
Mike Cumings 2022-05-06 11:18:24 -07:00
rodzic 9687fb7370
commit 678a0358a5
1 zmienionych plików z 21 dodań i 21 usunięć

Wyświetl plik

@ -51,6 +51,27 @@ class RadioInterfaceService @Inject constructor(
private val _receivedData = MutableSharedFlow<ByteArray>()
val receivedData: SharedFlow<ByteArray> = _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")