interface updates
This commit is contained in:
parent
b7e705b581
commit
b7db79f296
6 changed files with 5 additions and 605 deletions
|
@ -1,209 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.dash;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector;
|
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
|
||||||
import info.nightscout.androidaps.interfaces.Profile;
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
|
|
||||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
|
||||||
import info.nightscout.androidaps.interfaces.Pump;
|
|
||||||
import info.nightscout.androidaps.interfaces.PumpPluginBase;
|
|
||||||
import info.nightscout.androidaps.interfaces.PumpSync;
|
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
|
||||||
import info.nightscout.androidaps.logging.LTag;
|
|
||||||
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
|
||||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
|
|
||||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.OmnipodDashOverviewFragment;
|
|
||||||
import info.nightscout.androidaps.queue.commands.CustomCommand;
|
|
||||||
import info.nightscout.androidaps.utils.TimeChangeType;
|
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
public class OmnipodDashPumpPlugin extends PumpPluginBase implements Pump {
|
|
||||||
private static final PumpDescription PUMP_DESCRIPTION = new PumpDescription(PumpType.OMNIPOD_DASH);
|
|
||||||
|
|
||||||
private final AAPSLogger aapsLogger;
|
|
||||||
private final ResourceHelper resourceHelper;
|
|
||||||
private final CommandQueueProvider commandQueue;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public OmnipodDashPumpPlugin(HasAndroidInjector injector, AAPSLogger aapsLogger, ResourceHelper resourceHelper, CommandQueueProvider commandQueue) {
|
|
||||||
super(new PluginDescription() //
|
|
||||||
.mainType(PluginType.PUMP) //
|
|
||||||
.fragmentClass(OmnipodDashOverviewFragment.class.getName()) //
|
|
||||||
.pluginIcon(R.drawable.ic_pod_128)
|
|
||||||
.pluginName(R.string.omnipod_dash_name) //
|
|
||||||
.shortName(R.string.omnipod_dash_name_short) //
|
|
||||||
.preferencesId(R.xml.omnipod_dash_preferences) //
|
|
||||||
.description(R.string.omnipod_dash_pump_description), injector, aapsLogger, resourceHelper, commandQueue);
|
|
||||||
this.aapsLogger = aapsLogger;
|
|
||||||
this.resourceHelper = resourceHelper;
|
|
||||||
this.commandQueue = commandQueue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean isInitialized() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean isSuspended() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean isBusy() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean isConnected() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean isConnecting() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean isHandshakeInProgress() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void finishHandshaking() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void connect(@NotNull String reason) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void disconnect(@NotNull String reason) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void stopConnecting() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void getPumpStatus(@NotNull String reason) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull @Override public PumpEnactResult setNewBasalProfile(@NotNull Profile profile) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean isThisProfileSet(@NotNull Profile profile) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public long lastDataTime() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public double getBaseBasalRate() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public double getReservoirLevel() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public int getBatteryLevel() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull @Override public PumpEnactResult deliverTreatment(@NotNull DetailedBolusInfo detailedBolusInfo) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void stopBolusDelivering() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull @Override public PumpEnactResult setTempBasalAbsolute(double absoluteRate, int durationInMinutes, @NotNull Profile profile, boolean enforceNew, @NonNull PumpSync.TemporaryBasalType tbrType) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull @Override public PumpEnactResult setTempBasalPercent(int percent, int durationInMinutes, @NotNull Profile profile, boolean enforceNew, @NonNull PumpSync.TemporaryBasalType tbrType) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull @Override public PumpEnactResult setExtendedBolus(double insulin, int durationInMinutes) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull @Override public PumpEnactResult cancelTempBasal(boolean enforceNew) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull @Override public PumpEnactResult cancelExtendedBolus() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull @Override public JSONObject getJSONStatus(@NotNull Profile profile, @NotNull String profileName, @NotNull String version) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull @Override public ManufacturerType manufacturer() {
|
|
||||||
return getPumpDescription().getPumpType().getManufacturer();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull @Override public PumpType model() {
|
|
||||||
return getPumpDescription().getPumpType();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull @Override public String serialNumber() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull @Override public PumpDescription getPumpDescription() {
|
|
||||||
return PUMP_DESCRIPTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull @Override public String shortStatus(boolean veryShort) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean isFakingTempsByExtendedBoluses() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull @Override public PumpEnactResult loadTDDs() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean canHandleDST() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<CustomAction> getCustomActions() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void executeCustomAction(@NotNull CustomActionType customActionType) {
|
|
||||||
aapsLogger.warn(LTag.PUMP, "Unsupported custom action: " + customActionType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable @Override public PumpEnactResult executeCustomCommand(@NotNull CustomCommand customCommand) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void timezoneOrDSTChanged(@NotNull TimeChangeType timeChangeType) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,7 +2,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
import info.nightscout.androidaps.data.Profile
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.*
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger
|
import info.nightscout.androidaps.logging.AAPSLogger
|
||||||
|
@ -41,7 +40,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
aapsLogger: AAPSLogger,
|
aapsLogger: AAPSLogger,
|
||||||
resourceHelper: ResourceHelper,
|
resourceHelper: ResourceHelper,
|
||||||
commandQueue: CommandQueueProvider
|
commandQueue: CommandQueueProvider
|
||||||
) : PumpPluginBase(pluginDescription, injector, aapsLogger, resourceHelper, commandQueue), PumpInterface {
|
) : PumpPluginBase(pluginDescription, injector, aapsLogger, resourceHelper, commandQueue), Pump {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
@ -230,7 +229,8 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
absoluteRate: Double,
|
absoluteRate: Double,
|
||||||
durationInMinutes: Int,
|
durationInMinutes: Int,
|
||||||
profile: Profile,
|
profile: Profile,
|
||||||
enforceNew: Boolean
|
enforceNew: Boolean,
|
||||||
|
tbrType: PumpSync.TemporaryBasalType
|
||||||
): PumpEnactResult {
|
): PumpEnactResult {
|
||||||
// TODO history
|
// TODO history
|
||||||
// TODO update Treatments
|
// TODO update Treatments
|
||||||
|
@ -265,7 +265,8 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
percent: Int,
|
percent: Int,
|
||||||
durationInMinutes: Int,
|
durationInMinutes: Int,
|
||||||
profile: Profile,
|
profile: Profile,
|
||||||
enforceNew: Boolean
|
enforceNew: Boolean,
|
||||||
|
tbrType: PumpSync.TemporaryBasalType
|
||||||
): PumpEnactResult {
|
): PumpEnactResult {
|
||||||
// TODO i18n
|
// TODO i18n
|
||||||
return PumpEnactResult(injector).success(false).enacted(false)
|
return PumpEnactResult(injector).success(false).enacted(false)
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.CommandType;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.NonceEnabledCommand;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.builder.NonceEnabledCommandBuilder;
|
|
||||||
|
|
||||||
public final class DeactivateCommand extends NonceEnabledCommand {
|
|
||||||
private static final short LENGTH = 6;
|
|
||||||
private static final byte BODY_LENGTH = 4;
|
|
||||||
|
|
||||||
DeactivateCommand(int uniqueId, short sequenceNumber, boolean multiCommandFlag, int nonce) {
|
|
||||||
super(CommandType.DEACTIVATE, uniqueId, sequenceNumber, multiCommandFlag, nonce);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public byte[] getEncoded() {
|
|
||||||
return appendCrc(ByteBuffer.allocate(LENGTH + HEADER_LENGTH) //
|
|
||||||
.put(encodeHeader(uniqueId, sequenceNumber, LENGTH, multiCommandFlag)) //
|
|
||||||
.put(commandType.getValue()) //
|
|
||||||
.put(BODY_LENGTH) //
|
|
||||||
.putInt(nonce) //
|
|
||||||
.array());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override @NonNull public String toString() {
|
|
||||||
return "DeactivateCommand{" +
|
|
||||||
"nonce=" + nonce +
|
|
||||||
", commandType=" + commandType +
|
|
||||||
", uniqueId=" + uniqueId +
|
|
||||||
", sequenceNumber=" + sequenceNumber +
|
|
||||||
", multiCommandFlag=" + multiCommandFlag +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class Builder extends NonceEnabledCommandBuilder<Builder, DeactivateCommand> {
|
|
||||||
@Override protected final DeactivateCommand buildCommand() {
|
|
||||||
return new DeactivateCommand(uniqueId, sequenceNumber, multiCommandFlag, nonce);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.CommandType;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.HeaderEnabledCommand;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.builder.HeaderEnabledCommandBuilder;
|
|
||||||
|
|
||||||
public final class GetVersionCommand extends HeaderEnabledCommand {
|
|
||||||
public static final int DEFAULT_UNIQUE_ID = -1; // FIXME move
|
|
||||||
|
|
||||||
private static final short LENGTH = 6;
|
|
||||||
private static final byte BODY_LENGTH = 4;
|
|
||||||
|
|
||||||
GetVersionCommand(int uniqueId, short sequenceNumber, boolean multiCommandFlag) {
|
|
||||||
super(CommandType.GET_VERSION, uniqueId, sequenceNumber, multiCommandFlag);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public byte[] getEncoded() {
|
|
||||||
return appendCrc(ByteBuffer.allocate(LENGTH + HEADER_LENGTH) //
|
|
||||||
.put(encodeHeader(uniqueId, sequenceNumber, LENGTH, multiCommandFlag)) //
|
|
||||||
.put(commandType.getValue()) //
|
|
||||||
.put(BODY_LENGTH) //
|
|
||||||
.putInt(uniqueId) //
|
|
||||||
.array());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override @NonNull public String toString() {
|
|
||||||
return "GetVersionCommand{" +
|
|
||||||
"commandType=" + commandType +
|
|
||||||
", uniqueId=" + uniqueId +
|
|
||||||
", sequenceNumber=" + sequenceNumber +
|
|
||||||
", multiCommandFlag=" + multiCommandFlag +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class Builder extends HeaderEnabledCommandBuilder<Builder, GetVersionCommand> {
|
|
||||||
@Override protected final GetVersionCommand buildCommand() {
|
|
||||||
return new GetVersionCommand(uniqueId, sequenceNumber, multiCommandFlag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,63 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
|
|
||||||
public class AlertConfiguration implements Encodable {
|
|
||||||
private AlertSlot slot;
|
|
||||||
private boolean enabled;
|
|
||||||
private short durationInMinutes;
|
|
||||||
private boolean autoOff;
|
|
||||||
private AlertTriggerType triggerType;
|
|
||||||
private short offsetInMinutesOrThresholdInMicroLiters;
|
|
||||||
private BeepType beepType;
|
|
||||||
private BeepRepetitionType beepRepetition;
|
|
||||||
|
|
||||||
public AlertConfiguration(AlertSlot slot, boolean enabled, short durationInMinutes, boolean autoOff, AlertTriggerType triggerType, short offsetInMinutesOrThresholdInMicroLiters, BeepType beepType, BeepRepetitionType beepRepetition) {
|
|
||||||
this.slot = slot;
|
|
||||||
this.enabled = enabled;
|
|
||||||
this.durationInMinutes = durationInMinutes;
|
|
||||||
this.autoOff = autoOff;
|
|
||||||
this.triggerType = triggerType;
|
|
||||||
this.offsetInMinutesOrThresholdInMicroLiters = offsetInMinutesOrThresholdInMicroLiters;
|
|
||||||
this.beepType = beepType;
|
|
||||||
this.beepRepetition = beepRepetition;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public byte[] getEncoded() {
|
|
||||||
byte firstByte = (byte) (slot.getValue() << 4);
|
|
||||||
if (enabled) {
|
|
||||||
firstByte |= 1 << 3;
|
|
||||||
}
|
|
||||||
if (triggerType == AlertTriggerType.RESERVOIR_VOLUME_TRIGGER) {
|
|
||||||
firstByte |= 1 << 2;
|
|
||||||
}
|
|
||||||
if (autoOff) {
|
|
||||||
firstByte |= 1 << 1;
|
|
||||||
}
|
|
||||||
firstByte |= ((durationInMinutes >> 8) & 0x01);
|
|
||||||
|
|
||||||
return ByteBuffer.allocate(6) //
|
|
||||||
.put(firstByte)
|
|
||||||
.put((byte) durationInMinutes) //
|
|
||||||
.putShort(offsetInMinutesOrThresholdInMicroLiters) //
|
|
||||||
.put(beepRepetition.getValue()) //
|
|
||||||
.put(beepType.getValue()) //
|
|
||||||
.array();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull @Override public String toString() {
|
|
||||||
return "AlertConfiguration{" +
|
|
||||||
"slot=" + slot +
|
|
||||||
", enabled=" + enabled +
|
|
||||||
", durationInMinutes=" + durationInMinutes +
|
|
||||||
", autoOff=" + autoOff +
|
|
||||||
", triggerType=" + triggerType +
|
|
||||||
", offsetInMinutesOrThresholdInMicroLiters=" + offsetInMinutesOrThresholdInMicroLiters +
|
|
||||||
", beepType=" + beepType +
|
|
||||||
", beepRepetition=" + beepRepetition +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,242 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlarmType;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.DeliveryStatus;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus;
|
|
||||||
|
|
||||||
public class AlarmStatusResponse extends AdditionalStatusResponseBase {
|
|
||||||
private final byte messageType;
|
|
||||||
private final short messageLength;
|
|
||||||
private final byte additionalStatusResponseType;
|
|
||||||
private final PodStatus podStatus;
|
|
||||||
private final DeliveryStatus deliveryStatus;
|
|
||||||
private final short bolusPulsesRemaining;
|
|
||||||
private final short sequenceNumberOfLastProgrammingCommand;
|
|
||||||
private final short totalPulsesDelivered;
|
|
||||||
private final AlarmType alarmType;
|
|
||||||
private final short alarmTime;
|
|
||||||
private final short reservoirPulsesRemaining;
|
|
||||||
private final short minutesSinceActivation;
|
|
||||||
private final boolean alert0Active;
|
|
||||||
private final boolean alert1Active;
|
|
||||||
private final boolean alert2Active;
|
|
||||||
private final boolean alert3Active;
|
|
||||||
private final boolean alert4Active;
|
|
||||||
private final boolean alert5Active;
|
|
||||||
private final boolean alert6Active;
|
|
||||||
private final boolean alert7Active;
|
|
||||||
private final boolean occlusionAlarm;
|
|
||||||
private final boolean pulseInfoInvalid;
|
|
||||||
private final PodStatus podStatusWhenAlarmOccurred;
|
|
||||||
private final boolean immediateBolusWhenAlarmOccurred;
|
|
||||||
private final byte occlusionType;
|
|
||||||
private final boolean occurredWhenFetchingImmediateBolusActiveInformation;
|
|
||||||
private final short rssi;
|
|
||||||
private final short receiverLowerGain;
|
|
||||||
private final PodStatus podStatusWhenAlarmOccurred2;
|
|
||||||
private final short returnAddressOfPodAlarmHandlerCaller;
|
|
||||||
|
|
||||||
public AlarmStatusResponse(byte[] encoded) {
|
|
||||||
super(ResponseType.AdditionalStatusResponseType.ALARM_STATUS, encoded);
|
|
||||||
messageType = encoded[0];
|
|
||||||
messageLength = (short) (encoded[1] & 0xff);
|
|
||||||
additionalStatusResponseType = encoded[2];
|
|
||||||
podStatus = PodStatus.byValue((byte) (encoded[3] & 0x0f));
|
|
||||||
deliveryStatus = DeliveryStatus.byValue((byte) (encoded[4] & 0x0f));
|
|
||||||
bolusPulsesRemaining = (short) (ByteBuffer.wrap(new byte[]{encoded[5], encoded[6]}).getShort() & 2047);
|
|
||||||
sequenceNumberOfLastProgrammingCommand = (short) (encoded[7] & 0x0f);
|
|
||||||
totalPulsesDelivered = ByteBuffer.wrap(new byte[]{encoded[8], encoded[9]}).getShort();
|
|
||||||
alarmType = AlarmType.byValue(encoded[10]);
|
|
||||||
alarmTime = ByteBuffer.wrap(new byte[]{encoded[11], encoded[12]}).getShort();
|
|
||||||
reservoirPulsesRemaining = ByteBuffer.wrap(new byte[]{encoded[13], encoded[14]}).getShort();
|
|
||||||
minutesSinceActivation = ByteBuffer.wrap(new byte[]{encoded[15], encoded[16]}).getShort();
|
|
||||||
|
|
||||||
byte activeAlerts = encoded[17];
|
|
||||||
alert0Active = (activeAlerts & 1) == 1;
|
|
||||||
alert1Active = ((activeAlerts >>> 1) & 1) == 1;
|
|
||||||
alert2Active = ((activeAlerts >>> 2) & 1) == 1;
|
|
||||||
alert3Active = ((activeAlerts >>> 3) & 1) == 1;
|
|
||||||
alert4Active = ((activeAlerts >>> 4) & 1) == 1;
|
|
||||||
alert5Active = ((activeAlerts >>> 5) & 1) == 1;
|
|
||||||
alert6Active = ((activeAlerts >>> 6) & 1) == 1;
|
|
||||||
alert7Active = ((activeAlerts >>> 7) & 1) == 1;
|
|
||||||
|
|
||||||
byte alarmFlags = encoded[18];
|
|
||||||
occlusionAlarm = (alarmFlags & 1) == 1;
|
|
||||||
pulseInfoInvalid = ((alarmFlags >> 1) & 1) == 1;
|
|
||||||
|
|
||||||
byte byte19 = encoded[19];
|
|
||||||
byte byte20 = encoded[20];
|
|
||||||
podStatusWhenAlarmOccurred = PodStatus.byValue((byte) (byte19 & 0x0f));
|
|
||||||
immediateBolusWhenAlarmOccurred = ((byte19 >> 4) & 1) == 1;
|
|
||||||
occlusionType = (byte) ((byte19 >> 5) & 3);
|
|
||||||
occurredWhenFetchingImmediateBolusActiveInformation = ((byte19 >> 7) & 1) == 1;
|
|
||||||
rssi = (short) (byte20 & 0x3f);
|
|
||||||
receiverLowerGain = (short) ((byte20 >> 6) & 0x03);
|
|
||||||
podStatusWhenAlarmOccurred2 = PodStatus.byValue((byte) (encoded[21] & 0x0f));
|
|
||||||
returnAddressOfPodAlarmHandlerCaller = ByteBuffer.wrap(new byte[]{encoded[22], encoded[23]}).getShort();
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte getMessageType() {
|
|
||||||
return messageType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getMessageLength() {
|
|
||||||
return messageLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte getAdditionalStatusResponseType() {
|
|
||||||
return additionalStatusResponseType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PodStatus getPodStatus() {
|
|
||||||
return podStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DeliveryStatus getDeliveryStatus() {
|
|
||||||
return deliveryStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getBolusPulsesRemaining() {
|
|
||||||
return bolusPulsesRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getSequenceNumberOfLastProgrammingCommand() {
|
|
||||||
return sequenceNumberOfLastProgrammingCommand;
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getTotalPulsesDelivered() {
|
|
||||||
return totalPulsesDelivered;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AlarmType getAlarmType() {
|
|
||||||
return alarmType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getAlarmTime() {
|
|
||||||
return alarmTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getReservoirPulsesRemaining() {
|
|
||||||
return reservoirPulsesRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getMinutesSinceActivation() {
|
|
||||||
return minutesSinceActivation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAlert0Active() {
|
|
||||||
return alert0Active;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAlert1Active() {
|
|
||||||
return alert1Active;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAlert2Active() {
|
|
||||||
return alert2Active;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAlert3Active() {
|
|
||||||
return alert3Active;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAlert4Active() {
|
|
||||||
return alert4Active;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAlert5Active() {
|
|
||||||
return alert5Active;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAlert6Active() {
|
|
||||||
return alert6Active;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAlert7Active() {
|
|
||||||
return alert7Active;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isOcclusionAlarm() {
|
|
||||||
return occlusionAlarm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isPulseInfoInvalid() {
|
|
||||||
return pulseInfoInvalid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PodStatus getPodStatusWhenAlarmOccurred() {
|
|
||||||
return podStatusWhenAlarmOccurred;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isImmediateBolusWhenAlarmOccurred() {
|
|
||||||
return immediateBolusWhenAlarmOccurred;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte getOcclusionType() {
|
|
||||||
return occlusionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isOccurredWhenFetchingImmediateBolusActiveInformation() {
|
|
||||||
return occurredWhenFetchingImmediateBolusActiveInformation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getRssi() {
|
|
||||||
return rssi;
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getReceiverLowerGain() {
|
|
||||||
return receiverLowerGain;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PodStatus getPodStatusWhenAlarmOccurred2() {
|
|
||||||
return podStatusWhenAlarmOccurred2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getReturnAddressOfPodAlarmHandlerCaller() {
|
|
||||||
return returnAddressOfPodAlarmHandlerCaller;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull @Override public String toString() {
|
|
||||||
return "AlarmStatusResponse{" +
|
|
||||||
"messageType=" + messageType +
|
|
||||||
", messageLength=" + messageLength +
|
|
||||||
", additionalStatusResponseType=" + additionalStatusResponseType +
|
|
||||||
", podStatus=" + podStatus +
|
|
||||||
", deliveryStatus=" + deliveryStatus +
|
|
||||||
", bolusPulsesRemaining=" + bolusPulsesRemaining +
|
|
||||||
", sequenceNumberOfLastProgrammingCommand=" + sequenceNumberOfLastProgrammingCommand +
|
|
||||||
", totalPulsesDelivered=" + totalPulsesDelivered +
|
|
||||||
", alarmType=" + alarmType +
|
|
||||||
", alarmTime=" + alarmTime +
|
|
||||||
", reservoirPulsesRemaining=" + reservoirPulsesRemaining +
|
|
||||||
", minutesSinceActivation=" + minutesSinceActivation +
|
|
||||||
", alert0Active=" + alert0Active +
|
|
||||||
", alert1Active=" + alert1Active +
|
|
||||||
", alert2Active=" + alert2Active +
|
|
||||||
", alert3Active=" + alert3Active +
|
|
||||||
", alert4Active=" + alert4Active +
|
|
||||||
", alert5Active=" + alert5Active +
|
|
||||||
", alert6Active=" + alert6Active +
|
|
||||||
", alert7Active=" + alert7Active +
|
|
||||||
", occlusionAlarm=" + occlusionAlarm +
|
|
||||||
", pulseInfoInvalid=" + pulseInfoInvalid +
|
|
||||||
", podStatusWhenAlarmOccurred=" + podStatusWhenAlarmOccurred +
|
|
||||||
", immediateBolusWhenAlarmOccurred=" + immediateBolusWhenAlarmOccurred +
|
|
||||||
", occlusionType=" + occlusionType +
|
|
||||||
", occurredWhenFetchingImmediateBolusActiveInformation=" + occurredWhenFetchingImmediateBolusActiveInformation +
|
|
||||||
", rssi=" + rssi +
|
|
||||||
", receiverLowerGain=" + receiverLowerGain +
|
|
||||||
", podStatusWhenAlarmOccurred2=" + podStatusWhenAlarmOccurred2 +
|
|
||||||
", returnAddressOfPodAlarmHandlerCaller=" + returnAddressOfPodAlarmHandlerCaller +
|
|
||||||
", statusResponseType=" + statusResponseType +
|
|
||||||
", responseType=" + responseType +
|
|
||||||
", encoded=" + Arrays.toString(encoded) +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue