Log OmnipodMessages exchanged in OmnipodCommunicationService
This commit is contained in:
parent
bee2a1b21c
commit
9dcb8d5137
21 changed files with 190 additions and 9 deletions
|
@ -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) {
|
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++) {
|
for (int i = 0; 2 > i; i++) {
|
||||||
|
|
||||||
if (podState.hasNonceState() && message.isNonceResyncable()) {
|
if (podState.hasNonceState() && message.isNonceResyncable()) {
|
||||||
|
|
|
@ -105,15 +105,6 @@ public class OmnipodMessage {
|
||||||
return sequenceNumber;
|
return sequenceNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "OmnipodMessage{" +
|
|
||||||
"address=" + address +
|
|
||||||
", encoded=" + ByteUtil.shortHexString(getEncoded()) +
|
|
||||||
", sequenceNumber=" + sequenceNumber +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isNonceResyncable() {
|
public boolean isNonceResyncable() {
|
||||||
return containsBlock(NonceResyncableMessageBlock.class);
|
return containsBlock(NonceResyncableMessageBlock.class);
|
||||||
}
|
}
|
||||||
|
@ -143,4 +134,15 @@ public class OmnipodMessage {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "OmnipodMessage{" +
|
||||||
|
"address=" + address +
|
||||||
|
", messageBlocks=" + messageBlocks +
|
||||||
|
", encoded=" + ByteUtil.shortHexStringWithoutSpaces(getEncoded()) +
|
||||||
|
", sequenceNumber=" + sequenceNumber +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,4 +43,12 @@ public class AcknowledgeAlertsCommand extends NonceResyncableMessageBlock {
|
||||||
this.nonce = nonce;
|
this.nonce = nonce;
|
||||||
encode();
|
encode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "AcknowledgeAlertsCommand{" +
|
||||||
|
"alerts=" + alerts +
|
||||||
|
", nonce=" + nonce +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,4 +22,10 @@ public class AssignAddressCommand extends MessageBlock {
|
||||||
return MessageBlockType.ASSIGN_ADDRESS;
|
return MessageBlockType.ASSIGN_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "AssignAddressCommand{" +
|
||||||
|
"address=" + address +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,4 +111,17 @@ public class BasalScheduleExtraCommand extends MessageBlock {
|
||||||
public List<RateEntry> getRateEntries() {
|
public List<RateEntry> getRateEntries() {
|
||||||
return new ArrayList<>(rateEntries);
|
return new ArrayList<>(rateEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "BasalScheduleExtraCommand{" +
|
||||||
|
"acknowledgementBeep=" + acknowledgementBeep +
|
||||||
|
", completionBeep=" + completionBeep +
|
||||||
|
", programReminderInterval=" + programReminderInterval +
|
||||||
|
", currentEntryIndex=" + currentEntryIndex +
|
||||||
|
", remainingPulses=" + remainingPulses +
|
||||||
|
", delayUntilNextTenthOfPulseInSeconds=" + delayUntilNextTenthOfPulseInSeconds +
|
||||||
|
", rateEntries=" + rateEntries +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,4 +45,17 @@ public class BeepConfigCommand extends MessageBlock {
|
||||||
public MessageBlockType getType() {
|
public MessageBlockType getType() {
|
||||||
return MessageBlockType.BEEP_CONFIG;
|
return MessageBlockType.BEEP_CONFIG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "BeepConfigCommand{" +
|
||||||
|
"beepType=" + beepType +
|
||||||
|
", basalCompletionBeep=" + basalCompletionBeep +
|
||||||
|
", basalIntervalBeep=" + basalIntervalBeep +
|
||||||
|
", tempBasalCompletionBeep=" + tempBasalCompletionBeep +
|
||||||
|
", tempBasalIntervalBeep=" + tempBasalIntervalBeep +
|
||||||
|
", bolusCompletionBeep=" + bolusCompletionBeep +
|
||||||
|
", bolusIntervalBeep=" + bolusIntervalBeep +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,4 +60,17 @@ public class BolusExtraCommand extends MessageBlock {
|
||||||
public MessageBlockType getType() {
|
public MessageBlockType getType() {
|
||||||
return MessageBlockType.BOLUS_EXTRA;
|
return MessageBlockType.BOLUS_EXTRA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "BolusExtraCommand{" +
|
||||||
|
"acknowledgementBeep=" + acknowledgementBeep +
|
||||||
|
", completionBeep=" + completionBeep +
|
||||||
|
", programReminderInterval=" + programReminderInterval +
|
||||||
|
", units=" + units +
|
||||||
|
", timeBetweenPulses=" + timeBetweenPulses +
|
||||||
|
", squareWaveUnits=" + squareWaveUnits +
|
||||||
|
", squareWaveDuration=" + squareWaveDuration +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,4 +59,13 @@ public class CancelDeliveryCommand extends NonceResyncableMessageBlock {
|
||||||
this.nonce = nonce;
|
this.nonce = nonce;
|
||||||
encode();
|
encode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "CancelDeliveryCommand{" +
|
||||||
|
"beepType=" + beepType +
|
||||||
|
", deliveryTypes=" + deliveryTypes +
|
||||||
|
", nonce=" + nonce +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,4 +39,12 @@ public class ConfigureAlertsCommand extends NonceResyncableMessageBlock {
|
||||||
this.nonce = nonce;
|
this.nonce = nonce;
|
||||||
encode();
|
encode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ConfigureAlertsCommand{" +
|
||||||
|
"configurations=" + configurations +
|
||||||
|
", nonce=" + nonce +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,4 +43,14 @@ public class ConfigurePodCommand extends MessageBlock {
|
||||||
encodedData = ByteUtil.concat(encodedData, ByteUtil.getBytesFromInt(lot));
|
encodedData = ByteUtil.concat(encodedData, ByteUtil.getBytesFromInt(lot));
|
||||||
encodedData = ByteUtil.concat(encodedData, ByteUtil.getBytesFromInt(tid));
|
encodedData = ByteUtil.concat(encodedData, ByteUtil.getBytesFromInt(tid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ConfigurePodCommand{" +
|
||||||
|
"lot=" + lot +
|
||||||
|
", tid=" + tid +
|
||||||
|
", date=" + date +
|
||||||
|
", address=" + address +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,4 +31,11 @@ public class DeactivatePodCommand extends NonceResyncableMessageBlock {
|
||||||
this.nonce = nonce;
|
this.nonce = nonce;
|
||||||
encode();
|
encode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "DeactivatePodCommand{" +
|
||||||
|
"nonce=" + nonce +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,4 +38,13 @@ public class FaultConfigCommand extends NonceResyncableMessageBlock {
|
||||||
this.nonce = nonce;
|
this.nonce = nonce;
|
||||||
encode();
|
encode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "FaultConfigCommand{" +
|
||||||
|
"tab5sub16=" + tab5sub16 +
|
||||||
|
", tab5sub17=" + tab5sub17 +
|
||||||
|
", nonce=" + nonce +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,4 +20,11 @@ public class GetStatusCommand extends MessageBlock {
|
||||||
public MessageBlockType getType() {
|
public MessageBlockType getType() {
|
||||||
return MessageBlockType.GET_STATUS;
|
return MessageBlockType.GET_STATUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "GetStatusCommand{" +
|
||||||
|
"podInfoType=" + podInfoType +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,4 +87,12 @@ public class SetInsulinScheduleCommand extends NonceResyncableMessageBlock {
|
||||||
this.nonce = nonce;
|
this.nonce = nonce;
|
||||||
encode();
|
encode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "SetInsulinScheduleCommand{" +
|
||||||
|
"schedule=" + schedule +
|
||||||
|
", nonce=" + nonce +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,4 +93,16 @@ public class TempBasalExtraCommand extends MessageBlock {
|
||||||
public List<RateEntry> getRateEntries() {
|
public List<RateEntry> getRateEntries() {
|
||||||
return new ArrayList<>(rateEntries);
|
return new ArrayList<>(rateEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "TempBasalExtraCommand{" +
|
||||||
|
"acknowledgementBeep=" + acknowledgementBeep +
|
||||||
|
", completionBeep=" + completionBeep +
|
||||||
|
", programReminderInterval=" + programReminderInterval +
|
||||||
|
", remainingPulses=" + remainingPulses +
|
||||||
|
", delayUntilNextPulse=" + delayUntilNextPulse +
|
||||||
|
", rateEntries=" + rateEntries +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,4 +48,14 @@ public class BasalDeliverySchedule extends DeliverySchedule implements IRawRepre
|
||||||
|
|
||||||
return checksum;
|
return checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "BasalDeliverySchedule{" +
|
||||||
|
"currentSegment=" + currentSegment +
|
||||||
|
", secondsRemaining=" + secondsRemaining +
|
||||||
|
", pulsesRemaining=" + pulsesRemaining +
|
||||||
|
", basalTable=" + basalTable +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,13 @@ public class BasalDeliveryTable {
|
||||||
return numSegments;
|
return numSegments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "BasalDeliveryTable{" +
|
||||||
|
"entries=" + entries +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
private class TempSegment {
|
private class TempSegment {
|
||||||
private int pulses;
|
private int pulses;
|
||||||
|
|
||||||
|
|
|
@ -41,4 +41,13 @@ public class BasalTableEntry implements IRawRepresentable {
|
||||||
public boolean isAlternateSegmentPulse() {
|
public boolean isAlternateSegmentPulse() {
|
||||||
return alternateSegmentPulse;
|
return alternateSegmentPulse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "BasalTableEntry{" +
|
||||||
|
"segments=" + segments +
|
||||||
|
", pulses=" + pulses +
|
||||||
|
", alternateSegmentPulse=" + alternateSegmentPulse +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,4 +49,12 @@ public class BolusDeliverySchedule extends DeliverySchedule implements IRawRepre
|
||||||
}
|
}
|
||||||
return checksum;
|
return checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "BolusDeliverySchedule{" +
|
||||||
|
"units=" + units +
|
||||||
|
", timeBetweenPulses=" + timeBetweenPulses +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,4 +66,12 @@ public class RateEntry implements IRawRepresentable {
|
||||||
}
|
}
|
||||||
return rawData;
|
return rawData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "RateEntry{" +
|
||||||
|
"totalPulses=" + totalPulses +
|
||||||
|
", delayBetweenPulsesInSeconds=" + delayBetweenPulsesInSeconds +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,4 +57,13 @@ public class TempBasalDeliverySchedule extends DeliverySchedule implements IRawR
|
||||||
public BasalDeliveryTable getBasalTable() {
|
public BasalDeliveryTable getBasalTable() {
|
||||||
return basalTable;
|
return basalTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "TempBasalDeliverySchedule{" +
|
||||||
|
"secondsRemaining=" + secondsRemaining +
|
||||||
|
", firstSegmentPulses=" + firstSegmentPulses +
|
||||||
|
", basalTable=" + basalTable +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue