RS: handle not received time
This commit is contained in:
parent
8b502c93c9
commit
118b4bc0d1
4 changed files with 17 additions and 0 deletions
|
@ -58,6 +58,9 @@ public class DanaRS_Packet {
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void handleMessageNotReceived() {
|
||||||
|
}
|
||||||
|
|
||||||
public String getFriendlyName() {
|
public String getFriendlyName() {
|
||||||
return "UNKNOWN_PACKET";
|
return "UNKNOWN_PACKET";
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,11 @@ public class DanaRS_Packet_Option_Get_Pump_Time extends DanaRS_Packet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleMessageNotReceived() {
|
||||||
|
DanaRPump.getInstance().pumpTime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFriendlyName() {
|
public String getFriendlyName() {
|
||||||
return "OPTION__GET_PUMP_TIME";
|
return "OPTION__GET_PUMP_TIME";
|
||||||
|
|
|
@ -643,6 +643,7 @@ public class BLEComm {
|
||||||
//SystemClock.sleep(200);
|
//SystemClock.sleep(200);
|
||||||
if (!message.isReceived()) {
|
if (!message.isReceived()) {
|
||||||
log.warn("Reply not received " + message.getFriendlyName());
|
log.warn("Reply not received " + message.getFriendlyName());
|
||||||
|
message.handleMessageNotReceived();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,6 +158,14 @@ public class DanaRSService extends Service {
|
||||||
bleComm.sendMessage(new DanaRS_Packet_Option_Get_Pump_Time());
|
bleComm.sendMessage(new DanaRS_Packet_Option_Get_Pump_Time());
|
||||||
|
|
||||||
long timeDiff = (danaRPump.pumpTime - System.currentTimeMillis()) / 1000L;
|
long timeDiff = (danaRPump.pumpTime - System.currentTimeMillis()) / 1000L;
|
||||||
|
if (danaRPump.pumpTime == 0) {
|
||||||
|
// initial handshake was not successfull
|
||||||
|
// deinitialize pump
|
||||||
|
danaRPump.lastConnection = 0;
|
||||||
|
RxBus.INSTANCE.send(new EventDanaRNewStatus());
|
||||||
|
MainApp.bus().post(new EventInitializationChanged());
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (L.isEnabled(L.PUMPCOMM))
|
if (L.isEnabled(L.PUMPCOMM))
|
||||||
log.debug("Pump time difference: " + timeDiff + " seconds");
|
log.debug("Pump time difference: " + timeDiff + " seconds");
|
||||||
if (Math.abs(timeDiff) > 3) {
|
if (Math.abs(timeDiff) > 3) {
|
||||||
|
|
Loading…
Reference in a new issue