dash ble: check for RTS

This commit is contained in:
Andrei Vereha 2021-04-03 23:31:43 +02:00
parent 9597922058
commit 547454de6c
2 changed files with 5 additions and 2 deletions

View file

@ -84,7 +84,11 @@ class MessageIO(
}
fun receiveMessage(): MessagePacket? {
cmdBleIO.expectCommandType(BleCommandRTS, MESSAGE_READ_TIMEOUT_MS)
val expectRTS = cmdBleIO.expectCommandType(BleCommandRTS, MESSAGE_READ_TIMEOUT_MS)
if (expectRTS !is BleConfirmSuccess) {
aapsLogger.warn(LTag.PUMPBTCOMM, "Error reading RTS: $expectRTS")
return null
}
val sendResult = cmdBleIO.sendAndConfirmPacket(BleCommandCTS.data)
if (sendResult !is BleSendSuccess) {

View file

@ -91,7 +91,6 @@ class Connection(val podDevice: BluetoothDevice, private val aapsLogger: AAPSLog
val discovered = discoverer.discoverServices()
dataBleIO.characteristic = discovered[CharacteristicType.DATA]!!
cmdBleIO.characteristic = discovered[CharacteristicType.CMD]!!
cmdBleIO.hello()
cmdBleIO.readyToRead()
dataBleIO.readyToRead()