Merge pull request #116 from 0pen-dash/avereha/unconfirmed
bugfix: ALARM_ILLEGAL_PUMP_STATE
This commit is contained in:
commit
829f5fec6a
2 changed files with 6 additions and 10 deletions
|
@ -177,10 +177,10 @@ class MessageIO(
|
||||||
}
|
}
|
||||||
|
|
||||||
BleCommandSuccess -> {
|
BleCommandSuccess -> {
|
||||||
if (index != packets.size)
|
if (index == packets.size-1)
|
||||||
MessageSendErrorSending("Received SUCCESS before sending all the data. $index")
|
|
||||||
else
|
|
||||||
MessageSendSuccess
|
MessageSendSuccess
|
||||||
|
else
|
||||||
|
MessageSendErrorSending("Received SUCCESS before sending all the data. $index")
|
||||||
}
|
}
|
||||||
|
|
||||||
else ->
|
else ->
|
||||||
|
|
|
@ -37,7 +37,6 @@ class Session(
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Sending command: ${cmd.encoded.toHex()} in packet $cmd")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "Sending command: ${cmd.encoded.toHex()} in packet $cmd")
|
||||||
|
|
||||||
val msg = getCmdMessage(cmd)
|
val msg = getCmdMessage(cmd)
|
||||||
var possiblyUnconfirmedCommand = false
|
|
||||||
for (i in 0..MAX_TRIES) {
|
for (i in 0..MAX_TRIES) {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Sending command(wrapped): ${msg.payload.toHex()}")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "Sending command(wrapped): ${msg.payload.toHex()}")
|
||||||
|
|
||||||
|
@ -46,8 +45,8 @@ class Session(
|
||||||
return CommandSendSuccess
|
return CommandSendSuccess
|
||||||
|
|
||||||
is MessageSendErrorConfirming -> {
|
is MessageSendErrorConfirming -> {
|
||||||
possiblyUnconfirmedCommand = true
|
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Error confirming command: $sendResult")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "Error confirming command: $sendResult")
|
||||||
|
return CommandSendErrorConfirming(sendResult.msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
is MessageSendErrorSending ->
|
is MessageSendErrorSending ->
|
||||||
|
@ -55,11 +54,8 @@ class Session(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val errMsg = "Maximum number of tries reached. Could not send command\""
|
val errMsg = "Maximum number of tries reached. Could not send command"
|
||||||
return if (possiblyUnconfirmedCommand)
|
return CommandSendErrorSending(errMsg)
|
||||||
CommandSendErrorConfirming(errMsg)
|
|
||||||
else
|
|
||||||
CommandSendErrorSending(errMsg)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("ReturnCount")
|
@Suppress("ReturnCount")
|
||||||
|
|
Loading…
Reference in a new issue