call readyToRead on BleIOs
This commit is contained in:
parent
2f87620050
commit
96b1b177a6
|
@ -1,6 +1,7 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<option name="AUTODETECT_INDENTS" value="false" />
|
||||
<option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="true" />
|
||||
<JetCodeStyleSettings>
|
||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||
<value>
|
||||
|
|
|
@ -52,19 +52,20 @@ class Connection(val podDevice: BluetoothDevice, private val aapsLogger: AAPSLog
|
|||
private val discoveredCharacteristics = discoverer.discoverServices()
|
||||
private val cmdBleIO = CmdBleIO(aapsLogger, discoveredCharacteristics[CharacteristicType.CMD]!!, incomingPackets
|
||||
.cmdQueue, gattConnection, bleCommCallbacks)
|
||||
private val dataBleIO = DataBleIO(aapsLogger, discoveredCharacteristics[CharacteristicType.DATA]!!, incomingPackets
|
||||
.dataQueue, gattConnection, bleCommCallbacks)
|
||||
val msgIO = MessageIO(aapsLogger, cmdBleIO, dataBleIO)
|
||||
var session: Session? = null
|
||||
|
||||
init {
|
||||
val sendResult = cmdBleIO.hello()
|
||||
if (sendResult !is BleSendSuccess) {
|
||||
throw FailedToConnectException("Could not send HELLO command to ${podDevice.address}")
|
||||
}
|
||||
cmdBleIO.readyToRead()
|
||||
dataBleIO.readyToRead()
|
||||
}
|
||||
|
||||
private val dataBleIO = DataBleIO(aapsLogger, discoveredCharacteristics[CharacteristicType.DATA]!!, incomingPackets
|
||||
.dataQueue, gattConnection, bleCommCallbacks)
|
||||
val msgIO = MessageIO(aapsLogger, cmdBleIO, dataBleIO)
|
||||
var session: Session? = null
|
||||
|
||||
fun connect() {
|
||||
if (!gattConnection.connect()) {
|
||||
throw FailedToConnectException("connect() returned false")
|
||||
|
|
Loading…
Reference in a new issue