dash ble: Supress deteket

This commit is contained in:
Andrei Vereha 2021-04-04 21:04:21 +02:00
parent 40ac1d189a
commit 821135edec
3 changed files with 5 additions and 0 deletions

View file

@ -53,6 +53,7 @@ open class BleIO(
* @param characteristic where to write to(CMD or DATA) * @param characteristic where to write to(CMD or DATA)
* @param payload the data to send * @param payload the data to send
*/ */
@Suppress("ReturnCount")
fun sendAndConfirmPacket(payload: ByteArray): BleSendResult { fun sendAndConfirmPacket(payload: ByteArray): BleSendResult {
aapsLogger.debug(LTag.PUMPBTCOMM, "BleIO: Sending on $type: ${payload.toHex()}") aapsLogger.debug(LTag.PUMPBTCOMM, "BleIO: Sending on $type: ${payload.toHex()}")
val set = characteristic.setValue(payload) val set = characteristic.setValue(payload)

View file

@ -33,6 +33,7 @@ class MessageIO(
var maxMessageReadTries = 3 var maxMessageReadTries = 3
var messageReadTries = 0 var messageReadTries = 0
@Suppress("ReturnCount")
fun sendMessage(msg: MessagePacket): MessageSendResult { fun sendMessage(msg: MessagePacket): MessageSendResult {
cmdBleIO.flushIncomingQueue() cmdBleIO.flushIncomingQueue()
dataBleIO.flushIncomingQueue() dataBleIO.flushIncomingQueue()
@ -83,6 +84,7 @@ class MessageIO(
} }
} }
@Suppress("ReturnCount")
fun receiveMessage(): MessagePacket? { fun receiveMessage(): MessagePacket? {
val expectRTS = cmdBleIO.expectCommandType(BleCommandRTS, MESSAGE_READ_TIMEOUT_MS) val expectRTS = cmdBleIO.expectCommandType(BleCommandRTS, MESSAGE_READ_TIMEOUT_MS)
if (expectRTS !is BleConfirmSuccess) { if (expectRTS !is BleConfirmSuccess) {
@ -179,6 +181,7 @@ class MessageIO(
} }
} }
@Suppress("ReturnCount")
private fun expectBlePacket(index: Byte, nackOnTimeout: Boolean = false): PacketReceiveResult { private fun expectBlePacket(index: Byte, nackOnTimeout: Boolean = false): PacketReceiveResult {
receivedOutOfOrder[index]?.let { receivedOutOfOrder[index]?.let {
return PacketReceiveSuccess(it) return PacketReceiveSuccess(it)

View file

@ -69,6 +69,7 @@ class Session(
CommandSendErrorSending(errMsg) CommandSendErrorSending(errMsg)
} }
@Suppress("ReturnCount")
fun readAndAckResponse(responseType: KClass<out Response>): CommandReceiveResult { fun readAndAckResponse(responseType: KClass<out Response>): CommandReceiveResult {
var responseMsgPacket: MessagePacket? = null var responseMsgPacket: MessagePacket? = null
for (i in 0..MAX_TRIES) { for (i in 0..MAX_TRIES) {