Log OmnipodMessages exchanged in OmnipodCommunicationService

This commit is contained in:
Bart Sopers 2020-01-19 18:52:33 +01:00
parent bee2a1b21c
commit 9dcb8d5137
21 changed files with 190 additions and 9 deletions

View file

@ -102,6 +102,11 @@ public class OmnipodCommunicationService extends RileyLinkCommunicationManager {
}
public synchronized <T extends MessageBlock> T exchangeMessages(Class<T> responseClass, PodState podState, OmnipodMessage message, Integer addressOverride, Integer ackAddressOverride, boolean automaticallyResyncNonce) {
if (isLoggingEnabled()) {
LOG.debug("Exchanging OmnipodMessage [responseClass={}, podState={}, message={}, addressOverride={}, ackAddressOverride={}, automaticallyResyncNonce={}]: {}", //
responseClass.getSimpleName(), podState, message, addressOverride, ackAddressOverride, automaticallyResyncNonce, message);
}
for (int i = 0; 2 > i; i++) {
if (podState.hasNonceState() && message.isNonceResyncable()) {

View file

@ -105,15 +105,6 @@ public class OmnipodMessage {
return sequenceNumber;
}
@Override
public String toString() {
return "OmnipodMessage{" +
"address=" + address +
", encoded=" + ByteUtil.shortHexString(getEncoded()) +
", sequenceNumber=" + sequenceNumber +
'}';
}
public boolean isNonceResyncable() {
return containsBlock(NonceResyncableMessageBlock.class);
}
@ -143,4 +134,15 @@ public class OmnipodMessage {
}
return false;
}
@Override
public String toString() {
return "OmnipodMessage{" +
"address=" + address +
", messageBlocks=" + messageBlocks +
", encoded=" + ByteUtil.shortHexStringWithoutSpaces(getEncoded()) +
", sequenceNumber=" + sequenceNumber +
'}';
}
}

View file

@ -43,4 +43,12 @@ public class AcknowledgeAlertsCommand extends NonceResyncableMessageBlock {
this.nonce = nonce;
encode();
}
@Override
public String toString() {
return "AcknowledgeAlertsCommand{" +
"alerts=" + alerts +
", nonce=" + nonce +
'}';
}
}

View file

@ -22,4 +22,10 @@ public class AssignAddressCommand extends MessageBlock {
return MessageBlockType.ASSIGN_ADDRESS;
}
@Override
public String toString() {
return "AssignAddressCommand{" +
"address=" + address +
'}';
}
}

View file

@ -111,4 +111,17 @@ public class BasalScheduleExtraCommand extends MessageBlock {
public List<RateEntry> getRateEntries() {
return new ArrayList<>(rateEntries);
}
@Override
public String toString() {
return "BasalScheduleExtraCommand{" +
"acknowledgementBeep=" + acknowledgementBeep +
", completionBeep=" + completionBeep +
", programReminderInterval=" + programReminderInterval +
", currentEntryIndex=" + currentEntryIndex +
", remainingPulses=" + remainingPulses +
", delayUntilNextTenthOfPulseInSeconds=" + delayUntilNextTenthOfPulseInSeconds +
", rateEntries=" + rateEntries +
'}';
}
}

View file

@ -45,4 +45,17 @@ public class BeepConfigCommand extends MessageBlock {
public MessageBlockType getType() {
return MessageBlockType.BEEP_CONFIG;
}
@Override
public String toString() {
return "BeepConfigCommand{" +
"beepType=" + beepType +
", basalCompletionBeep=" + basalCompletionBeep +
", basalIntervalBeep=" + basalIntervalBeep +
", tempBasalCompletionBeep=" + tempBasalCompletionBeep +
", tempBasalIntervalBeep=" + tempBasalIntervalBeep +
", bolusCompletionBeep=" + bolusCompletionBeep +
", bolusIntervalBeep=" + bolusIntervalBeep +
'}';
}
}

View file

@ -60,4 +60,17 @@ public class BolusExtraCommand extends MessageBlock {
public MessageBlockType getType() {
return MessageBlockType.BOLUS_EXTRA;
}
@Override
public String toString() {
return "BolusExtraCommand{" +
"acknowledgementBeep=" + acknowledgementBeep +
", completionBeep=" + completionBeep +
", programReminderInterval=" + programReminderInterval +
", units=" + units +
", timeBetweenPulses=" + timeBetweenPulses +
", squareWaveUnits=" + squareWaveUnits +
", squareWaveDuration=" + squareWaveDuration +
'}';
}
}

View file

@ -59,4 +59,13 @@ public class CancelDeliveryCommand extends NonceResyncableMessageBlock {
this.nonce = nonce;
encode();
}
@Override
public String toString() {
return "CancelDeliveryCommand{" +
"beepType=" + beepType +
", deliveryTypes=" + deliveryTypes +
", nonce=" + nonce +
'}';
}
}

View file

@ -39,4 +39,12 @@ public class ConfigureAlertsCommand extends NonceResyncableMessageBlock {
this.nonce = nonce;
encode();
}
@Override
public String toString() {
return "ConfigureAlertsCommand{" +
"configurations=" + configurations +
", nonce=" + nonce +
'}';
}
}

View file

@ -43,4 +43,14 @@ public class ConfigurePodCommand extends MessageBlock {
encodedData = ByteUtil.concat(encodedData, ByteUtil.getBytesFromInt(lot));
encodedData = ByteUtil.concat(encodedData, ByteUtil.getBytesFromInt(tid));
}
@Override
public String toString() {
return "ConfigurePodCommand{" +
"lot=" + lot +
", tid=" + tid +
", date=" + date +
", address=" + address +
'}';
}
}

View file

@ -31,4 +31,11 @@ public class DeactivatePodCommand extends NonceResyncableMessageBlock {
this.nonce = nonce;
encode();
}
@Override
public String toString() {
return "DeactivatePodCommand{" +
"nonce=" + nonce +
'}';
}
}

View file

@ -38,4 +38,13 @@ public class FaultConfigCommand extends NonceResyncableMessageBlock {
this.nonce = nonce;
encode();
}
@Override
public String toString() {
return "FaultConfigCommand{" +
"tab5sub16=" + tab5sub16 +
", tab5sub17=" + tab5sub17 +
", nonce=" + nonce +
'}';
}
}

View file

@ -20,4 +20,11 @@ public class GetStatusCommand extends MessageBlock {
public MessageBlockType getType() {
return MessageBlockType.GET_STATUS;
}
@Override
public String toString() {
return "GetStatusCommand{" +
"podInfoType=" + podInfoType +
'}';
}
}

View file

@ -87,4 +87,12 @@ public class SetInsulinScheduleCommand extends NonceResyncableMessageBlock {
this.nonce = nonce;
encode();
}
@Override
public String toString() {
return "SetInsulinScheduleCommand{" +
"schedule=" + schedule +
", nonce=" + nonce +
'}';
}
}

View file

@ -93,4 +93,16 @@ public class TempBasalExtraCommand extends MessageBlock {
public List<RateEntry> getRateEntries() {
return new ArrayList<>(rateEntries);
}
@Override
public String toString() {
return "TempBasalExtraCommand{" +
"acknowledgementBeep=" + acknowledgementBeep +
", completionBeep=" + completionBeep +
", programReminderInterval=" + programReminderInterval +
", remainingPulses=" + remainingPulses +
", delayUntilNextPulse=" + delayUntilNextPulse +
", rateEntries=" + rateEntries +
'}';
}
}

View file

@ -48,4 +48,14 @@ public class BasalDeliverySchedule extends DeliverySchedule implements IRawRepre
return checksum;
}
@Override
public String toString() {
return "BasalDeliverySchedule{" +
"currentSegment=" + currentSegment +
", secondsRemaining=" + secondsRemaining +
", pulsesRemaining=" + pulsesRemaining +
", basalTable=" + basalTable +
'}';
}
}

View file

@ -90,6 +90,13 @@ public class BasalDeliveryTable {
return numSegments;
}
@Override
public String toString() {
return "BasalDeliveryTable{" +
"entries=" + entries +
'}';
}
private class TempSegment {
private int pulses;

View file

@ -41,4 +41,13 @@ public class BasalTableEntry implements IRawRepresentable {
public boolean isAlternateSegmentPulse() {
return alternateSegmentPulse;
}
@Override
public String toString() {
return "BasalTableEntry{" +
"segments=" + segments +
", pulses=" + pulses +
", alternateSegmentPulse=" + alternateSegmentPulse +
'}';
}
}

View file

@ -49,4 +49,12 @@ public class BolusDeliverySchedule extends DeliverySchedule implements IRawRepre
}
return checksum;
}
@Override
public String toString() {
return "BolusDeliverySchedule{" +
"units=" + units +
", timeBetweenPulses=" + timeBetweenPulses +
'}';
}
}

View file

@ -66,4 +66,12 @@ public class RateEntry implements IRawRepresentable {
}
return rawData;
}
@Override
public String toString() {
return "RateEntry{" +
"totalPulses=" + totalPulses +
", delayBetweenPulsesInSeconds=" + delayBetweenPulsesInSeconds +
'}';
}
}

View file

@ -57,4 +57,13 @@ public class TempBasalDeliverySchedule extends DeliverySchedule implements IRawR
public BasalDeliveryTable getBasalTable() {
return basalTable;
}
@Override
public String toString() {
return "TempBasalDeliverySchedule{" +
"secondsRemaining=" + secondsRemaining +
", firstSegmentPulses=" + firstSegmentPulses +
", basalTable=" + basalTable +
'}';
}
}