Reorganized packages and removed a few unused classes
This commit is contained in:
parent
aede5648a9
commit
ddd9687425
|
@ -34,7 +34,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyL
|
|||
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightFragment
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicFragment
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.dialog.RileyLinkStatusDeviceMedtronic
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodFragment
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.OmnipodFragment
|
||||
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpFragment
|
||||
import info.nightscout.androidaps.plugins.source.BGSourceFragment
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsFragment
|
||||
|
|
|
@ -4,17 +4,17 @@ import dagger.Module
|
|||
import dagger.Provides
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.PodHistoryActivity
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.PodManagementActivity
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.InitActionFragment
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.InitPodTask
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.InitPodRefreshAction
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.PodInfoFragment
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.removepod.RemoveActionFragment
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsPodStateManager
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.OmnipodRileyLinkCommunicationManager
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.PodHistoryActivity
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.PodManagementActivity
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.initpod.InitActionFragment
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.initpod.InitPodTask
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.pages.InitPodRefreshAction
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.pages.PodInfoFragment
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.removepod.RemoveActionFragment
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.manager.AapsOmnipodManager
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.manager.AapsPodStateManager
|
||||
|
||||
@Module
|
||||
@Suppress("unused")
|
||||
|
@ -32,7 +32,7 @@ abstract class OmnipodModule {
|
|||
|
||||
// Service
|
||||
@ContributesAndroidInjector
|
||||
abstract fun omnipodCommunicationManagerProvider(): OmnipodCommunicationManager
|
||||
abstract fun omnipodCommunicationManagerProvider(): OmnipodRileyLinkCommunicationManager
|
||||
@ContributesAndroidInjector abstract fun aapsOmnipodManagerProvider(): AapsOmnipodManager
|
||||
|
||||
// Data
|
||||
|
|
|
@ -10,7 +10,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.Riley
|
|||
import info.nightscout.androidaps.plugins.pump.insight.InsightAlertService
|
||||
import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.RileyLinkOmnipodService
|
||||
import info.nightscout.androidaps.services.AlarmSoundService
|
||||
import info.nightscout.androidaps.services.DataService
|
||||
import info.nightscout.androidaps.services.LocationService
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
|
||||
<application>
|
||||
<service
|
||||
android:name=".service.RileyLinkOmnipodService"
|
||||
android:name=".rileylink.RileyLinkOmnipodService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
|
||||
<activity android:name=".dialogs.PodManagementActivity" />
|
||||
<activity android:name=".dialogs.PodHistoryActivity" />
|
||||
<activity android:name=".ui.PodManagementActivity" />
|
||||
<activity android:name=".ui.PodHistoryActivity" />
|
||||
<activity
|
||||
android:name="com.atech.android.library.wizardpager.WizardPagerActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
|
|
|
@ -66,17 +66,18 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.Riley
|
|||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor;
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.definition.OmnipodStorageKeys;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo.PodInfoRecentPulseLog;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.data.RLHistoryItemOmnipod;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodStatusRequest;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.definition.OmnipodCommandType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.definition.OmnipodCustomActionType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.definition.OmnipodStatusRequestType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodProgressStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.manager.AapsOmnipodManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.RileyLinkOmnipodService;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.OmnipodFragment;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.AapsOmnipodUtil;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||
|
@ -98,7 +99,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
private final RileyLinkServiceData rileyLinkServiceData;
|
||||
private final ServiceTaskExecutor serviceTaskExecutor;
|
||||
private final AapsOmnipodManager aapsOmnipodManager;
|
||||
private final OmnipodUtil omnipodUtil;
|
||||
private final AapsOmnipodUtil aapsOmnipodUtil;
|
||||
private final RileyLinkUtil rileyLinkUtil;
|
||||
private final AAPSLogger aapsLogger;
|
||||
private final RxBusWrapper rxBus;
|
||||
|
@ -113,7 +114,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
private final PumpType pumpType = PumpType.Insulet_Omnipod;
|
||||
|
||||
private final List<CustomAction> customActions = new ArrayList<>();
|
||||
private final List<OmnipodStatusRequest> omnipodStatusRequestList = new ArrayList<>();
|
||||
private final List<OmnipodStatusRequestType> omnipodStatusRequestList = new ArrayList<>();
|
||||
private final CompositeDisposable disposables = new CompositeDisposable();
|
||||
|
||||
// variables for handling statuses and history
|
||||
|
@ -145,7 +146,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
RileyLinkServiceData rileyLinkServiceData,
|
||||
ServiceTaskExecutor serviceTaskExecutor,
|
||||
DateUtil dateUtil,
|
||||
OmnipodUtil omnipodUtil,
|
||||
AapsOmnipodUtil aapsOmnipodUtil,
|
||||
RileyLinkUtil rileyLinkUtil
|
||||
) {
|
||||
super(new PluginDescription() //
|
||||
|
@ -168,7 +169,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
this.rileyLinkServiceData = rileyLinkServiceData;
|
||||
this.serviceTaskExecutor = serviceTaskExecutor;
|
||||
this.aapsOmnipodManager = aapsOmnipodManager;
|
||||
this.omnipodUtil = omnipodUtil;
|
||||
this.aapsOmnipodUtil = aapsOmnipodUtil;
|
||||
this.rileyLinkUtil = rileyLinkUtil;
|
||||
|
||||
pumpDescription = new PumpDescription(pumpType);
|
||||
|
@ -250,16 +251,16 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
// If so, add it to history
|
||||
// Needs to be done after EventAppInitialized because otherwise, TreatmentsPlugin.onStart() hasn't been called yet
|
||||
// so it didn't initialize a TreatmentService yet, resulting in a NullPointerException
|
||||
if (sp.contains(OmnipodConst.Prefs.CurrentBolus)) {
|
||||
String currentBolusString = sp.getString(OmnipodConst.Prefs.CurrentBolus, "");
|
||||
if (sp.contains(OmnipodStorageKeys.Prefs.CurrentBolus)) {
|
||||
String currentBolusString = sp.getString(OmnipodStorageKeys.Prefs.CurrentBolus, "");
|
||||
aapsLogger.warn(LTag.PUMP, "Found active bolus in SP. Adding Treatment: {}", currentBolusString);
|
||||
try {
|
||||
DetailedBolusInfo detailedBolusInfo = omnipodUtil.getGsonInstance().fromJson(currentBolusString, DetailedBolusInfo.class);
|
||||
DetailedBolusInfo detailedBolusInfo = aapsOmnipodUtil.getGsonInstance().fromJson(currentBolusString, DetailedBolusInfo.class);
|
||||
aapsOmnipodManager.addBolusToHistory(detailedBolusInfo);
|
||||
} catch (Exception ex) {
|
||||
aapsLogger.error(LTag.PUMP, "Failed to add active bolus to history", ex);
|
||||
}
|
||||
sp.remove(OmnipodConst.Prefs.CurrentBolus);
|
||||
sp.remove(OmnipodStorageKeys.Prefs.CurrentBolus);
|
||||
}
|
||||
}, fabricPrivacy::logException)
|
||||
);
|
||||
|
@ -397,10 +398,10 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
if (firstRun) {
|
||||
initializeAfterRileyLinkConnection();
|
||||
} else if (!omnipodStatusRequestList.isEmpty()) {
|
||||
Iterator<OmnipodStatusRequest> iterator = omnipodStatusRequestList.iterator();
|
||||
Iterator<OmnipodStatusRequestType> iterator = omnipodStatusRequestList.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
OmnipodStatusRequest statusRequest = iterator.next();
|
||||
OmnipodStatusRequestType statusRequest = iterator.next();
|
||||
switch (statusRequest) {
|
||||
case GetPodPulseLog:
|
||||
try {
|
||||
|
@ -580,7 +581,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
aapsLogger.info(LTag.PUMP, "setTempBasalAbsolute - setTBR. Response: " + result.success);
|
||||
|
||||
if (result.success) {
|
||||
incrementStatistics(OmnipodConst.Statistics.TBRsSet);
|
||||
incrementStatistics(OmnipodStorageKeys.Statistics.TBRsSet);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -765,7 +766,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
return false;
|
||||
}
|
||||
|
||||
public void addPodStatusRequest(OmnipodStatusRequest pumpStatusRequest) {
|
||||
public void addPodStatusRequest(OmnipodStatusRequestType pumpStatusRequest) {
|
||||
omnipodStatusRequestList.add(pumpStatusRequest);
|
||||
}
|
||||
|
||||
|
@ -850,8 +851,8 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
PumpEnactResult result = executeCommand(OmnipodCommandType.SetBolus, () -> aapsOmnipodManager.bolus(detailedBolusInfo));
|
||||
|
||||
if (result.success) {
|
||||
incrementStatistics(detailedBolusInfo.isSMB ? OmnipodConst.Statistics.SMBBoluses
|
||||
: OmnipodConst.Statistics.StandardBoluses);
|
||||
incrementStatistics(detailedBolusInfo.isSMB ? OmnipodStorageKeys.Statistics.SMBBoluses
|
||||
: OmnipodStorageKeys.Statistics.StandardBoluses);
|
||||
|
||||
result.carbsDelivered(detailedBolusInfo.carbs);
|
||||
}
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.GetStatusCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||
|
||||
public class GetPodInfoAction implements OmnipodAction<PodInfoResponse> {
|
||||
private final PodStateManager podStateManager;
|
||||
private final PodInfoType podInfoType;
|
||||
|
||||
public GetPodInfoAction(PodStateManager podStateManager, PodInfoType podInfoType) {
|
||||
if (podStateManager == null) {
|
||||
throw new ActionInitializationException("Pod state manager cannot be null");
|
||||
}
|
||||
if (podInfoType == null) {
|
||||
throw new ActionInitializationException("Pod info type cannot be null");
|
||||
}
|
||||
this.podStateManager = podStateManager;
|
||||
this.podInfoType = podInfoType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PodInfoResponse execute(OmnipodCommunicationManager communicationService) {
|
||||
return communicationService.sendCommand(PodInfoResponse.class, podStateManager, new GetStatusCommand(podInfoType));
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.GetStatusCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||
|
||||
public class GetStatusAction implements OmnipodAction<StatusResponse> {
|
||||
private final PodStateManager podStateManager;
|
||||
|
||||
public GetStatusAction(PodStateManager podState) {
|
||||
if (podState == null) {
|
||||
throw new ActionInitializationException("Pod state manager cannot be null");
|
||||
}
|
||||
this.podStateManager = podState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatusResponse execute(OmnipodCommunicationManager communicationService) {
|
||||
return communicationService.sendCommand(StatusResponse.class, podStateManager, new GetStatusCommand(PodInfoType.NORMAL));
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
|
||||
|
||||
public interface OmnipodAction<T> {
|
||||
T execute(OmnipodCommunicationManager communicationService);
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action.service;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.BolusAction;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.ConfigureAlertsAction;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.SetBasalScheduleAction;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertConfiguration;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertConfigurationFactory;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalSchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
|
||||
public class InsertCannulaService {
|
||||
public StatusResponse programInitialBasalSchedule(OmnipodCommunicationManager communicationService,
|
||||
PodStateManager podStateManager, BasalSchedule basalSchedule) {
|
||||
return communicationService.executeAction(new SetBasalScheduleAction(podStateManager, basalSchedule,
|
||||
true, podStateManager.getScheduleOffset(), false));
|
||||
}
|
||||
|
||||
public StatusResponse executeExpirationRemindersAlertCommand(OmnipodCommunicationManager communicationService,
|
||||
PodStateManager podStateManager) {
|
||||
AlertConfiguration lowReservoirAlertConfiguration = AlertConfigurationFactory.createLowReservoirAlertConfiguration(OmnipodConst.LOW_RESERVOIR_ALERT);
|
||||
|
||||
DateTime endOfServiceTime = podStateManager.getActivatedAt().plus(OmnipodConst.SERVICE_DURATION);
|
||||
|
||||
Duration timeUntilExpirationAdvisoryAlarm = new Duration(DateTime.now(),
|
||||
endOfServiceTime.minus(OmnipodConst.EXPIRATION_ADVISORY_WINDOW));
|
||||
Duration timeUntilShutdownImminentAlarm = new Duration(DateTime.now(),
|
||||
endOfServiceTime.minus(OmnipodConst.END_OF_SERVICE_IMMINENT_WINDOW));
|
||||
|
||||
AlertConfiguration expirationAdvisoryAlertConfiguration = AlertConfigurationFactory.createExpirationAdvisoryAlertConfiguration(
|
||||
timeUntilExpirationAdvisoryAlarm, OmnipodConst.EXPIRATION_ADVISORY_WINDOW);
|
||||
AlertConfiguration shutdownImminentAlertConfiguration = AlertConfigurationFactory.createShutdownImminentAlertConfiguration(
|
||||
timeUntilShutdownImminentAlarm);
|
||||
AlertConfiguration autoOffAlertConfiguration = AlertConfigurationFactory.createAutoOffAlertConfiguration(
|
||||
false, Duration.ZERO);
|
||||
|
||||
List<AlertConfiguration> alertConfigurations = Arrays.asList( //
|
||||
lowReservoirAlertConfiguration, //
|
||||
expirationAdvisoryAlertConfiguration, //
|
||||
shutdownImminentAlertConfiguration, //
|
||||
autoOffAlertConfiguration //
|
||||
);
|
||||
|
||||
return communicationService.executeAction(new ConfigureAlertsAction(podStateManager, alertConfigurations));
|
||||
}
|
||||
|
||||
public StatusResponse executeInsertionBolusCommand(OmnipodCommunicationManager communicationService, PodStateManager podStateManager) {
|
||||
return communicationService.executeAction(new BolusAction(podStateManager, OmnipodConst.POD_CANNULA_INSERTION_BOLUS_UNITS,
|
||||
Duration.standardSeconds(1), false, false));
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action.service;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.BolusAction;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.ConfigureAlertsAction;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.OmnipodMessage;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.FaultConfigCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertConfiguration;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertConfigurationFactory;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
|
||||
public class PrimeService {
|
||||
|
||||
public StatusResponse executeDisableTab5Sub16FaultConfigCommand(OmnipodCommunicationManager communicationService, PodStateManager podStateManager) {
|
||||
FaultConfigCommand faultConfigCommand = new FaultConfigCommand(podStateManager.getCurrentNonce(), (byte) 0x00, (byte) 0x00);
|
||||
OmnipodMessage faultConfigMessage = new OmnipodMessage(podStateManager.getAddress(),
|
||||
Collections.singletonList(faultConfigCommand), podStateManager.getMessageNumber());
|
||||
return communicationService.exchangeMessages(StatusResponse.class, podStateManager, faultConfigMessage);
|
||||
}
|
||||
|
||||
public StatusResponse executeFinishSetupReminderAlertCommand(OmnipodCommunicationManager communicationService, PodStateManager podStateManager) {
|
||||
AlertConfiguration finishSetupReminderAlertConfiguration = AlertConfigurationFactory.createFinishSetupReminderAlertConfiguration();
|
||||
return communicationService.executeAction(new ConfigureAlertsAction(podStateManager,
|
||||
Collections.singletonList(finishSetupReminderAlertConfiguration)));
|
||||
}
|
||||
|
||||
public StatusResponse executePrimeBolusCommand(OmnipodCommunicationManager communicationService, PodStateManager podStateManager) {
|
||||
return communicationService.executeAction(new BolusAction(podStateManager, OmnipodConst.POD_PRIME_BOLUS_UNITS,
|
||||
Duration.standardSeconds(1), false, false));
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException;
|
||||
|
||||
public class NonceOutOfSyncException extends OmnipodException {
|
||||
public NonceOutOfSyncException() {
|
||||
super("Nonce out of sync", true);
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException;
|
||||
|
||||
public class NonceResyncException extends OmnipodException {
|
||||
public NonceResyncException() {
|
||||
super("Nonce resync failed", true);
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message;
|
||||
|
||||
public interface IRawRepresentable {
|
||||
byte[] getRawData();
|
||||
}
|
|
@ -4,7 +4,7 @@ import org.joda.time.LocalDateTime;
|
|||
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.definition.OmnipodCommandType;
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||
|
||||
public class RLHistoryItemOmnipod extends RLHistoryItem {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.definition;
|
||||
|
||||
/**
|
||||
* Created by andy on 4.8.2019
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.definition;
|
||||
|
||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
|
||||
|
||||
|
@ -7,14 +7,7 @@ import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
|
|||
*/
|
||||
|
||||
public enum OmnipodCustomActionType implements CustomActionType {
|
||||
|
||||
ResetRileyLinkConfiguration(), //
|
||||
PairAndPrime(), //
|
||||
FillCanulaSetBasalProfile(), //
|
||||
//InitPod(), //
|
||||
DeactivatePod(), //
|
||||
ResetPodStatus(), //
|
||||
;
|
||||
ResetRileyLinkConfiguration;
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
|
@ -0,0 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.definition;
|
||||
|
||||
public enum OmnipodStatusRequestType {
|
||||
AcknowledgeAlerts,
|
||||
GetPodState,
|
||||
GetPodPulseLog
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.definition;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.R;
|
||||
|
||||
public class OmnipodStorageKeys {
|
||||
static final String Prefix = "AAPS.Omnipod.";
|
||||
|
||||
public static class Prefs {
|
||||
public static final String PodState = Prefix + "pod_state";
|
||||
public static final String CurrentBolus = Prefix + "current_bolus";
|
||||
public static final int BeepBasalEnabled = R.string.key_omnipod_beep_basal_enabled;
|
||||
public static final int BeepBolusEnabled = R.string.key_omnipod_beep_bolus_enabled;
|
||||
public static final int BeepSMBEnabled = R.string.key_omnipod_beep_smb_enabled;
|
||||
public static final int BeepTBREnabled = R.string.key_omnipod_beep_tbr_enabled;
|
||||
public static final int PodDebuggingOptionsEnabled = R.string.key_omnipod_pod_debugging_options_enabled;
|
||||
public static final int TimeChangeEventEnabled = R.string.key_omnipod_timechange_enabled;
|
||||
}
|
||||
|
||||
public static class Statistics {
|
||||
public static final String StatsPrefix = "omnipod_";
|
||||
public static final String TBRsSet = StatsPrefix + "tbrs_set";
|
||||
public static final String StandardBoluses = StatsPrefix + "std_boluses_delivered";
|
||||
public static final String SMBBoluses = StatsPrefix + "smb_boluses_delivered";
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.db;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.definition;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.definition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.definition;
|
||||
|
||||
public interface PodInitReceiver {
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class NonceState {
|
||||
private final long[] table = new long[21];
|
||||
private int index;
|
||||
|
||||
public NonceState(int lot, int tid) {
|
||||
initializeTable(lot, tid, (byte) 0x00);
|
||||
}
|
||||
|
||||
public NonceState(int lot, int tid, byte seed) {
|
||||
initializeTable(lot, tid, seed);
|
||||
}
|
||||
|
||||
private void initializeTable(int lot, int tid, byte seed) {
|
||||
table[0] = (long) (lot & 0xFFFF) + 0x55543DC3L + (((long) (lot) & 0xFFFFFFFFL) >> 16);
|
||||
table[0] = table[0] & 0xFFFFFFFFL;
|
||||
table[1] = (tid & 0xFFFF) + 0xAAAAE44EL + (((long) (tid) & 0xFFFFFFFFL) >> 16);
|
||||
table[1] = table[1] & 0xFFFFFFFFL;
|
||||
index = 0;
|
||||
table[0] += seed;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
table[2 + i] = generateEntry();
|
||||
}
|
||||
index = (int) ((table[0] + table[1]) & 0X0F);
|
||||
}
|
||||
|
||||
private int generateEntry() {
|
||||
table[0] = (((table[0] >> 16) + (table[0] & 0xFFFF) * 0x5D7FL) & 0xFFFFFFFFL);
|
||||
table[1] = (((table[1] >> 16) + (table[1] & 0xFFFF) * 0x8CA0L) & 0xFFFFFFFFL);
|
||||
return (int) ((table[1] + (table[0] << 16)) & 0xFFFFFFFFL);
|
||||
}
|
||||
|
||||
public int getCurrentNonce() {
|
||||
return (int) table[(2 + index)];
|
||||
}
|
||||
|
||||
public void advanceToNextNonce() {
|
||||
int nonce = getCurrentNonce();
|
||||
table[(2 + index)] = generateEntry();
|
||||
index = (nonce & 0x0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NonceState{" +
|
||||
"table=" + Arrays.toString(table) +
|
||||
", index=" + index +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
|
||||
public enum OmnipodStatusRequest {
|
||||
AcknowledgeAlerts,
|
||||
GetPodState,
|
||||
GetPodPulseLog
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
|
||||
/**
|
||||
* Created by andy on 10/18/18.
|
||||
*/
|
||||
|
||||
public enum OmnipodUIResponseType {
|
||||
|
||||
Data,
|
||||
Error,
|
||||
Invalid;
|
||||
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
|
||||
public enum PodResponseType {
|
||||
|
||||
Acknowledgment, // set commands would just acknowledge if data was sent
|
||||
Data, // query commands would return data
|
||||
Error, // communication/response produced an error
|
||||
Invalid; // invalid response (not supported, should never be returned)
|
||||
|
||||
public boolean isError() {
|
||||
return this == Error || this == Invalid;
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.IRawRepresentable;
|
||||
|
||||
public abstract class DeliverySchedule implements IRawRepresentable {
|
||||
|
||||
public abstract InsulinScheduleType getType();
|
||||
|
||||
public abstract int getChecksum();
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.defs;
|
||||
|
||||
public enum PodActionType {
|
||||
InitPod,
|
||||
RemovePod,
|
||||
ResetPod
|
||||
}
|
|
@ -1,14 +1,14 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.AcknowledgeAlertsCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertSet;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertSlot;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.OmnipodRileyLinkCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.AcknowledgeAlertsCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertSet;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertSlot;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
|
||||
|
||||
public class AcknowledgeAlertsAction implements OmnipodAction<StatusResponse> {
|
||||
private final PodStateManager podStateManager;
|
||||
|
@ -32,7 +32,7 @@ public class AcknowledgeAlertsAction implements OmnipodAction<StatusResponse> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public StatusResponse execute(OmnipodCommunicationManager communicationService) {
|
||||
public StatusResponse execute(OmnipodRileyLinkCommunicationManager communicationService) {
|
||||
return communicationService.sendCommand(StatusResponse.class, podStateManager,
|
||||
new AcknowledgeAlertsCommand(podStateManager.getCurrentNonce(), alerts));
|
||||
}
|
|
@ -1,20 +1,20 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
|
||||
|
||||
import org.joda.time.DateTimeZone;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Random;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalMessageAddressException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalPodProgressException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalVersionResponseTypeException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.OmnipodMessage;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.AssignAddressCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.VersionResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.OmnipodRileyLinkCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalMessageAddressException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalPodProgressException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalVersionResponseTypeException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.OmnipodMessage;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.AssignAddressCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.VersionResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodProgressStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
|
||||
|
||||
public class AssignAddressAction implements OmnipodAction<VersionResponse> {
|
||||
private final PodStateManager podStateManager;
|
||||
|
@ -27,7 +27,7 @@ public class AssignAddressAction implements OmnipodAction<VersionResponse> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public VersionResponse execute(OmnipodCommunicationManager communicationService) {
|
||||
public VersionResponse execute(OmnipodRileyLinkCommunicationManager communicationService) {
|
||||
if (!podStateManager.hasPodState()) {
|
||||
podStateManager.initState(generateRandomAddress());
|
||||
}
|
||||
|
@ -36,11 +36,11 @@ public class AssignAddressAction implements OmnipodAction<VersionResponse> {
|
|||
}
|
||||
|
||||
AssignAddressCommand assignAddress = new AssignAddressCommand(podStateManager.getAddress());
|
||||
OmnipodMessage assignAddressMessage = new OmnipodMessage(OmnipodConst.DEFAULT_ADDRESS,
|
||||
OmnipodMessage assignAddressMessage = new OmnipodMessage(OmnipodConstants.DEFAULT_ADDRESS,
|
||||
Collections.singletonList(assignAddress), podStateManager.getMessageNumber());
|
||||
|
||||
VersionResponse assignAddressResponse = communicationService.exchangeMessages(VersionResponse.class, podStateManager, assignAddressMessage,
|
||||
OmnipodConst.DEFAULT_ADDRESS, podStateManager.getAddress());
|
||||
OmnipodConstants.DEFAULT_ADDRESS, podStateManager.getAddress());
|
||||
|
||||
if (!assignAddressResponse.isAssignAddressVersionResponse()) {
|
||||
throw new IllegalVersionResponseTypeException("assignAddress", "setupPod");
|
|
@ -1,17 +1,17 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.OmnipodMessage;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.BolusExtraCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.SetInsulinScheduleCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BolusDeliverySchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.OmnipodRileyLinkCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.OmnipodMessage;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.BolusExtraCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.SetInsulinScheduleCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule.BolusDeliverySchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
|
||||
|
||||
public class BolusAction implements OmnipodAction<StatusResponse> {
|
||||
private final PodStateManager podStateManager;
|
||||
|
@ -40,7 +40,7 @@ public class BolusAction implements OmnipodAction<StatusResponse> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public StatusResponse execute(OmnipodCommunicationManager communicationService) {
|
||||
public StatusResponse execute(OmnipodRileyLinkCommunicationManager communicationService) {
|
||||
BolusDeliverySchedule bolusDeliverySchedule = new BolusDeliverySchedule(units, timeBetweenPulses);
|
||||
SetInsulinScheduleCommand setInsulinScheduleCommand = new SetInsulinScheduleCommand(
|
||||
podStateManager.getCurrentNonce(), bolusDeliverySchedule);
|
|
@ -1,18 +1,18 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.OmnipodMessage;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.CancelDeliveryCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.BeepType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.DeliveryType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.OmnipodRileyLinkCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.OmnipodMessage;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.CancelDeliveryCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.BeepType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.DeliveryType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
|
||||
|
||||
public class CancelDeliveryAction implements OmnipodAction<StatusResponse> {
|
||||
private final PodStateManager podStateManager;
|
||||
|
@ -33,7 +33,7 @@ public class CancelDeliveryAction implements OmnipodAction<StatusResponse> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public StatusResponse execute(OmnipodCommunicationManager communicationService) {
|
||||
public StatusResponse execute(OmnipodRileyLinkCommunicationManager communicationService) {
|
||||
List<MessageBlock> messageBlocks = new ArrayList<>();
|
||||
|
||||
if (acknowledgementBeep && deliveryTypes.size() > 1) {
|
|
@ -1,13 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.ConfigureAlertsCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertConfiguration;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.OmnipodRileyLinkCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.ConfigureAlertsCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertConfiguration;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
|
||||
|
||||
public class ConfigureAlertsAction implements OmnipodAction<StatusResponse> {
|
||||
private final PodStateManager podStateManager;
|
||||
|
@ -25,7 +25,7 @@ public class ConfigureAlertsAction implements OmnipodAction<StatusResponse> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public StatusResponse execute(OmnipodCommunicationManager communicationService) {
|
||||
public StatusResponse execute(OmnipodRileyLinkCommunicationManager communicationService) {
|
||||
ConfigureAlertsCommand configureAlertsCommand = new ConfigureAlertsCommand(podStateManager.getCurrentNonce(), alertConfigurations);
|
||||
StatusResponse statusResponse = communicationService.sendCommand(StatusResponse.class, podStateManager, configureAlertsCommand);
|
||||
for (AlertConfiguration alertConfiguration : alertConfigurations) {
|
|
@ -1,14 +1,14 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.PodFaultException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.DeactivatePodCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.DeliveryType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.OmnipodRileyLinkCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.PodFaultException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.DeactivatePodCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.DeliveryType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
|
||||
|
||||
public class DeactivatePodAction implements OmnipodAction<StatusResponse> {
|
||||
private final PodStateManager podStateManager;
|
||||
|
@ -23,7 +23,7 @@ public class DeactivatePodAction implements OmnipodAction<StatusResponse> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public StatusResponse execute(OmnipodCommunicationManager communicationService) {
|
||||
public StatusResponse execute(OmnipodRileyLinkCommunicationManager communicationService) {
|
||||
if (!podStateManager.isSuspended() && !podStateManager.hasFaultEvent()) {
|
||||
try {
|
||||
communicationService.executeAction(new CancelDeliveryAction(podStateManager,
|
|
@ -0,0 +1,29 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.OmnipodRileyLinkCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.GetStatusCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo.PodInfoResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodInfoType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
|
||||
|
||||
public class GetPodInfoAction implements OmnipodAction<PodInfoResponse> {
|
||||
private final PodStateManager podStateManager;
|
||||
private final PodInfoType podInfoType;
|
||||
|
||||
public GetPodInfoAction(PodStateManager podStateManager, PodInfoType podInfoType) {
|
||||
if (podStateManager == null) {
|
||||
throw new ActionInitializationException("Pod state manager cannot be null");
|
||||
}
|
||||
if (podInfoType == null) {
|
||||
throw new ActionInitializationException("Pod info type cannot be null");
|
||||
}
|
||||
this.podStateManager = podStateManager;
|
||||
this.podInfoType = podInfoType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PodInfoResponse execute(OmnipodRileyLinkCommunicationManager communicationService) {
|
||||
return communicationService.sendCommand(PodInfoResponse.class, podStateManager, new GetStatusCommand(podInfoType));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.OmnipodRileyLinkCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.GetStatusCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodInfoType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
|
||||
|
||||
public class GetStatusAction implements OmnipodAction<StatusResponse> {
|
||||
private final PodStateManager podStateManager;
|
||||
|
||||
public GetStatusAction(PodStateManager podState) {
|
||||
if (podState == null) {
|
||||
throw new ActionInitializationException("Pod state manager cannot be null");
|
||||
}
|
||||
this.podStateManager = podState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatusResponse execute(OmnipodRileyLinkCommunicationManager communicationService) {
|
||||
return communicationService.sendCommand(StatusResponse.class, podStateManager, new GetStatusCommand(PodInfoType.NORMAL));
|
||||
}
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.service.InsertCannulaService;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalPodProgressException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalSchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.OmnipodRileyLinkCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action.service.InsertCannulaService;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalPodProgressException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodProgressStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule.BasalSchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
|
||||
|
||||
public class InsertCannulaAction implements OmnipodAction<StatusResponse> {
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class InsertCannulaAction implements OmnipodAction<StatusResponse> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public StatusResponse execute(OmnipodCommunicationManager communicationService) {
|
||||
public StatusResponse execute(OmnipodRileyLinkCommunicationManager communicationService) {
|
||||
if (!podStateManager.isPodInitialized() || podStateManager.getPodProgressStatus().isBefore(PodProgressStatus.PRIMING_COMPLETED)) {
|
||||
throw new IllegalPodProgressException(PodProgressStatus.PRIMING_COMPLETED, podStateManager.isPodInitialized() ? podStateManager.getPodProgressStatus() : null);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.OmnipodRileyLinkCommunicationManager;
|
||||
|
||||
public interface OmnipodAction<T> {
|
||||
T execute(OmnipodRileyLinkCommunicationManager communicationService);
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.service.PrimeService;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalPodProgressException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.OmnipodRileyLinkCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action.service.PrimeService;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalPodProgressException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodProgressStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
|
||||
|
||||
public class PrimeAction implements OmnipodAction<StatusResponse> {
|
||||
|
||||
|
@ -25,7 +25,7 @@ public class PrimeAction implements OmnipodAction<StatusResponse> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public StatusResponse execute(OmnipodCommunicationManager communicationService) {
|
||||
public StatusResponse execute(OmnipodRileyLinkCommunicationManager communicationService) {
|
||||
if (!podStateManager.isPodInitialized() || podStateManager.getPodProgressStatus().isBefore(PodProgressStatus.PAIRING_COMPLETED)) {
|
||||
throw new IllegalPodProgressException(PodProgressStatus.PAIRING_COMPLETED, podStateManager.isPodInitialized() ? podStateManager.getPodProgressStatus() : null);
|
||||
}
|
|
@ -1,17 +1,17 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.OmnipodMessage;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.BasalScheduleExtraCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.SetInsulinScheduleCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalSchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.OmnipodRileyLinkCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.OmnipodMessage;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.BasalScheduleExtraCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.SetInsulinScheduleCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule.BasalSchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
|
||||
|
||||
public class SetBasalScheduleAction implements OmnipodAction<StatusResponse> {
|
||||
private final PodStateManager podStateManager;
|
||||
|
@ -39,7 +39,7 @@ public class SetBasalScheduleAction implements OmnipodAction<StatusResponse> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public StatusResponse execute(OmnipodCommunicationManager communicationService) {
|
||||
public StatusResponse execute(OmnipodRileyLinkCommunicationManager communicationService) {
|
||||
SetInsulinScheduleCommand setBasal = new SetInsulinScheduleCommand(podStateManager.getCurrentNonce(), basalSchedule, scheduleOffset);
|
||||
BasalScheduleExtraCommand extraCommand = new BasalScheduleExtraCommand(basalSchedule, scheduleOffset,
|
||||
acknowledgementBeep, confidenceReminder, Duration.ZERO);
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Duration;
|
||||
|
@ -6,15 +6,15 @@ import org.joda.time.Duration;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.OmnipodMessage;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.SetInsulinScheduleCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.TempBasalExtraCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.OmnipodRileyLinkCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.OmnipodMessage;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.SetInsulinScheduleCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.TempBasalExtraCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
|
||||
|
||||
public class SetTempBasalAction implements OmnipodAction<StatusResponse> {
|
||||
private final PodStateManager podStateManager;
|
||||
|
@ -39,14 +39,14 @@ public class SetTempBasalAction implements OmnipodAction<StatusResponse> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public StatusResponse execute(OmnipodCommunicationManager communicationService) {
|
||||
public StatusResponse execute(OmnipodRileyLinkCommunicationManager communicationService) {
|
||||
List<MessageBlock> messageBlocks = Arrays.asList( //
|
||||
new SetInsulinScheduleCommand(podStateManager.getCurrentNonce(), rate, duration),
|
||||
new TempBasalExtraCommand(rate, duration, acknowledgementBeep, completionBeep, Duration.ZERO));
|
||||
|
||||
OmnipodMessage message = new OmnipodMessage(podStateManager.getAddress(), messageBlocks, podStateManager.getMessageNumber());
|
||||
StatusResponse statusResponse = communicationService.exchangeMessages(StatusResponse.class, podStateManager, message);
|
||||
podStateManager.setLastTempBasal(DateTime.now().minus(OmnipodConst.AVERAGE_TEMP_BASAL_COMMAND_COMMUNICATION_DURATION), rate, duration);
|
||||
podStateManager.setLastTempBasal(DateTime.now().minus(OmnipodConstants.AVERAGE_TEMP_BASAL_COMMAND_COMMUNICATION_DURATION), rate, duration);
|
||||
return statusResponse;
|
||||
}
|
||||
}
|
|
@ -1,19 +1,19 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalMessageAddressException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalPodProgressException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalVersionResponseTypeException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.OmnipodMessage;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.SetupPodCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.VersionResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.OmnipodRileyLinkCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalMessageAddressException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalPodProgressException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalVersionResponseTypeException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.OmnipodMessage;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.SetupPodCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.VersionResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodProgressStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
|
||||
|
||||
public class SetupPodAction implements OmnipodAction<VersionResponse> {
|
||||
private final PodStateManager podStateManager;
|
||||
|
@ -26,7 +26,7 @@ public class SetupPodAction implements OmnipodAction<VersionResponse> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public VersionResponse execute(OmnipodCommunicationManager communicationService) {
|
||||
public VersionResponse execute(OmnipodRileyLinkCommunicationManager communicationService) {
|
||||
if (!podStateManager.isPodInitialized() || !podStateManager.getPodProgressStatus().equals(PodProgressStatus.REMINDER_INITIALIZED)) {
|
||||
throw new IllegalPodProgressException(PodProgressStatus.REMINDER_INITIALIZED, podStateManager.isPodInitialized() ? podStateManager.getPodProgressStatus() : null);
|
||||
}
|
||||
|
@ -34,11 +34,11 @@ public class SetupPodAction implements OmnipodAction<VersionResponse> {
|
|||
|
||||
SetupPodCommand setupPodCommand = new SetupPodCommand(podStateManager.getAddress(), activationDate,
|
||||
podStateManager.getLot(), podStateManager.getTid());
|
||||
OmnipodMessage message = new OmnipodMessage(OmnipodConst.DEFAULT_ADDRESS,
|
||||
OmnipodMessage message = new OmnipodMessage(OmnipodConstants.DEFAULT_ADDRESS,
|
||||
Collections.singletonList(setupPodCommand), podStateManager.getMessageNumber());
|
||||
VersionResponse setupPodResponse;
|
||||
setupPodResponse = communicationService.exchangeMessages(VersionResponse.class, podStateManager,
|
||||
message, OmnipodConst.DEFAULT_ADDRESS, podStateManager.getAddress());
|
||||
message, OmnipodConstants.DEFAULT_ADDRESS, podStateManager.getAddress());
|
||||
|
||||
if (!setupPodResponse.isSetupPodVersionResponse()) {
|
||||
throw new IllegalVersionResponseTypeException("setupPod", "assignAddress");
|
|
@ -0,0 +1,59 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action.service;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.OmnipodRileyLinkCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action.BolusAction;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action.ConfigureAlertsAction;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action.SetBasalScheduleAction;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertConfiguration;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.util.AlertConfigurationUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule.BasalSchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
|
||||
|
||||
public class InsertCannulaService {
|
||||
public StatusResponse programInitialBasalSchedule(OmnipodRileyLinkCommunicationManager communicationService,
|
||||
PodStateManager podStateManager, BasalSchedule basalSchedule) {
|
||||
return communicationService.executeAction(new SetBasalScheduleAction(podStateManager, basalSchedule,
|
||||
true, podStateManager.getScheduleOffset(), false));
|
||||
}
|
||||
|
||||
public StatusResponse executeExpirationRemindersAlertCommand(OmnipodRileyLinkCommunicationManager communicationService,
|
||||
PodStateManager podStateManager) {
|
||||
AlertConfiguration lowReservoirAlertConfiguration = AlertConfigurationUtil.createLowReservoirAlertConfiguration(OmnipodConstants.LOW_RESERVOIR_ALERT);
|
||||
|
||||
DateTime endOfServiceTime = podStateManager.getActivatedAt().plus(OmnipodConstants.SERVICE_DURATION);
|
||||
|
||||
Duration timeUntilExpirationAdvisoryAlarm = new Duration(DateTime.now(),
|
||||
endOfServiceTime.minus(OmnipodConstants.EXPIRATION_ADVISORY_WINDOW));
|
||||
Duration timeUntilShutdownImminentAlarm = new Duration(DateTime.now(),
|
||||
endOfServiceTime.minus(OmnipodConstants.END_OF_SERVICE_IMMINENT_WINDOW));
|
||||
|
||||
AlertConfiguration expirationAdvisoryAlertConfiguration = AlertConfigurationUtil.createExpirationAdvisoryAlertConfiguration(
|
||||
timeUntilExpirationAdvisoryAlarm, OmnipodConstants.EXPIRATION_ADVISORY_WINDOW);
|
||||
AlertConfiguration shutdownImminentAlertConfiguration = AlertConfigurationUtil.createShutdownImminentAlertConfiguration(
|
||||
timeUntilShutdownImminentAlarm);
|
||||
AlertConfiguration autoOffAlertConfiguration = AlertConfigurationUtil.createAutoOffAlertConfiguration(
|
||||
false, Duration.ZERO);
|
||||
|
||||
List<AlertConfiguration> alertConfigurations = Arrays.asList( //
|
||||
lowReservoirAlertConfiguration, //
|
||||
expirationAdvisoryAlertConfiguration, //
|
||||
shutdownImminentAlertConfiguration, //
|
||||
autoOffAlertConfiguration //
|
||||
);
|
||||
|
||||
return communicationService.executeAction(new ConfigureAlertsAction(podStateManager, alertConfigurations));
|
||||
}
|
||||
|
||||
public StatusResponse executeInsertionBolusCommand(OmnipodRileyLinkCommunicationManager communicationService, PodStateManager podStateManager) {
|
||||
return communicationService.executeAction(new BolusAction(podStateManager, OmnipodConstants.POD_CANNULA_INSERTION_BOLUS_UNITS,
|
||||
Duration.standardSeconds(1), false, false));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action.service;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.OmnipodRileyLinkCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action.BolusAction;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action.ConfigureAlertsAction;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.OmnipodMessage;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.FaultConfigCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertConfiguration;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.util.AlertConfigurationUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
|
||||
|
||||
public class PrimeService {
|
||||
|
||||
public StatusResponse executeDisableTab5Sub16FaultConfigCommand(OmnipodRileyLinkCommunicationManager communicationService, PodStateManager podStateManager) {
|
||||
FaultConfigCommand faultConfigCommand = new FaultConfigCommand(podStateManager.getCurrentNonce(), (byte) 0x00, (byte) 0x00);
|
||||
OmnipodMessage faultConfigMessage = new OmnipodMessage(podStateManager.getAddress(),
|
||||
Collections.singletonList(faultConfigCommand), podStateManager.getMessageNumber());
|
||||
return communicationService.exchangeMessages(StatusResponse.class, podStateManager, faultConfigMessage);
|
||||
}
|
||||
|
||||
public StatusResponse executeFinishSetupReminderAlertCommand(OmnipodRileyLinkCommunicationManager communicationService, PodStateManager podStateManager) {
|
||||
AlertConfiguration finishSetupReminderAlertConfiguration = AlertConfigurationUtil.createFinishSetupReminderAlertConfiguration();
|
||||
return communicationService.executeAction(new ConfigureAlertsAction(podStateManager,
|
||||
Collections.singletonList(finishSetupReminderAlertConfiguration)));
|
||||
}
|
||||
|
||||
public StatusResponse executePrimeBolusCommand(OmnipodRileyLinkCommunicationManager communicationService, PodStateManager podStateManager) {
|
||||
return communicationService.executeAction(new BolusAction(podStateManager, OmnipodConstants.POD_PRIME_BOLUS_UNITS,
|
||||
Duration.standardSeconds(1), false, false));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message;
|
||||
|
||||
public interface IRawRepresentable {
|
||||
byte[] getRawData();
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
|
||||
public abstract class MessageBlock {
|
||||
protected byte[] encodedData = new byte[0];
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message;
|
||||
|
||||
public abstract class NonceResyncableMessageBlock extends MessageBlock {
|
||||
public abstract int getNonce();
|
|
@ -1,16 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CrcMismatchException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.MessageDecodingException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.NotEnoughDataException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.GetStatusCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmniCRC;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.CrcMismatchException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.MessageDecodingException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.NotEnoughDataException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.GetStatusCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodInfoType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodCrc;
|
||||
|
||||
public class OmnipodMessage {
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class OmnipodMessage {
|
|||
}
|
||||
int sequenceNumber = (((int) b9 >> 2) & 0b11111);
|
||||
int crc = ByteUtil.toInt(data[data.length - 2], data[data.length - 1]);
|
||||
int calculatedCrc = OmniCRC.crc16(ByteUtil.substring(data, 0, data.length - 2));
|
||||
int calculatedCrc = OmnipodCrc.crc16(ByteUtil.substring(data, 0, data.length - 2));
|
||||
if (crc != calculatedCrc) {
|
||||
throw new CrcMismatchException(calculatedCrc, crc);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ public class OmnipodMessage {
|
|||
header = ByteUtil.concat(header, (byte) (((sequenceNumber & 0x1F) << 2) + ((encodedData.length >> 8) & 0x03)));
|
||||
header = ByteUtil.concat(header, (byte) (encodedData.length & 0xFF));
|
||||
encodedData = ByteUtil.concat(header, encodedData);
|
||||
int crc = OmniCRC.crc16(encodedData);
|
||||
int crc = OmnipodCrc.crc16(encodedData);
|
||||
encodedData = ByteUtil.concat(encodedData, ByteUtil.substring(ByteUtil.getBytesFromInt(crc), 2, 2));
|
||||
return encodedData;
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RLMessage;
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CrcMismatchException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalPacketTypeException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PacketType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmniCRC;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.CrcMismatchException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalPacketTypeException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PacketType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodCrc;
|
||||
|
||||
/**
|
||||
* Created by andy on 6/1/18.
|
||||
|
@ -29,7 +29,7 @@ public class OmnipodPacket implements RLMessage {
|
|||
throw new IllegalPacketTypeException(null, null);
|
||||
}
|
||||
this.sequenceNumber = (encoded[4] & 0b11111);
|
||||
byte crc = OmniCRC.crc8(ByteUtil.substring(encoded, 0, encoded.length - 1));
|
||||
byte crc = OmnipodCrc.crc8(ByteUtil.substring(encoded, 0, encoded.length - 1));
|
||||
if (crc != encoded[encoded.length - 1]) {
|
||||
throw new CrcMismatchException(crc, encoded[encoded.length - 1]);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class OmnipodPacket implements RLMessage {
|
|||
output = ByteUtil.concat(output, ByteUtil.getBytesFromInt(this.packetAddress));
|
||||
output = ByteUtil.concat(output, (byte) ((this.packetType.getValue() << 5) + (sequenceNumber & 0b11111)));
|
||||
output = ByteUtil.concat(output, encodedMessage);
|
||||
output = ByteUtil.concat(output, OmniCRC.crc8(output));
|
||||
output = ByteUtil.concat(output, OmnipodCrc.crc8(output));
|
||||
return output;
|
||||
}
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.NonceResyncableMessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertSet;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertSlot;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.NonceResyncableMessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertSet;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertSlot;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
|
||||
public class AcknowledgeAlertsCommand extends NonceResyncableMessageBlock {
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
|
||||
public class AssignAddressCommand extends MessageBlock {
|
||||
private final int address;
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
|
@ -6,11 +6,11 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalSchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.RateEntry;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule.BasalSchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule.RateEntry;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
|
||||
|
||||
public class BasalScheduleExtraCommand extends MessageBlock {
|
||||
private final boolean acknowledgementBeep;
|
||||
|
@ -55,7 +55,7 @@ public class BasalScheduleExtraCommand extends MessageBlock {
|
|||
currentEntryIndex = (byte) entryLookupResult.getIndex();
|
||||
double timeRemainingInEntryInSeconds = entryLookupResult.getStartTime().minus(scheduleOffsetNearestSecond.minus(entryLookupResult.getDuration())).getMillis() / 1000.0;
|
||||
double rate = mergedSchedule.rateAt(scheduleOffsetNearestSecond);
|
||||
int pulsesPerHour = (int) Math.round(rate / OmnipodConst.POD_PULSE_SIZE);
|
||||
int pulsesPerHour = (int) Math.round(rate / OmnipodConstants.POD_PULSE_SIZE);
|
||||
double timeBetweenPulses = 3600.0 / pulsesPerHour;
|
||||
delayUntilNextTenthOfPulseInSeconds = (timeRemainingInEntryInSeconds % (timeBetweenPulses / 10.0));
|
||||
remainingPulses = pulsesPerHour * (timeRemainingInEntryInSeconds - delayUntilNextTenthOfPulseInSeconds) / 3600.0 + 0.1;
|
|
@ -1,11 +1,11 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.BeepConfigType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.BeepConfigType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
|
||||
public class BeepConfigCommand extends MessageBlock {
|
||||
private final BeepConfigType beepType;
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommandInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.CommandInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
|
||||
|
||||
public class BolusExtraCommand extends MessageBlock {
|
||||
private final boolean acknowledgementBeep;
|
||||
|
@ -30,7 +30,7 @@ public class BolusExtraCommand extends MessageBlock {
|
|||
Duration programReminderInterval, Duration timeBetweenPulses) {
|
||||
if (units <= 0D) {
|
||||
throw new CommandInitializationException("Units should be > 0");
|
||||
} else if (units > OmnipodConst.MAX_BOLUS) {
|
||||
} else if (units > OmnipodConstants.MAX_BOLUS) {
|
||||
throw new CommandInitializationException("Units exceeds max bolus");
|
||||
}
|
||||
this.units = units;
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.NonceResyncableMessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.BeepType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.DeliveryType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.NonceResyncableMessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.BeepType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.DeliveryType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
|
||||
public class CancelDeliveryCommand extends NonceResyncableMessageBlock {
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.NonceResyncableMessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertConfiguration;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.NonceResyncableMessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertConfiguration;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
|
||||
public class ConfigureAlertsCommand extends NonceResyncableMessageBlock {
|
||||
private final List<AlertConfiguration> configurations;
|
|
@ -1,8 +1,8 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.NonceResyncableMessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.NonceResyncableMessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
|
||||
public class DeactivatePodCommand extends NonceResyncableMessageBlock {
|
||||
private int nonce;
|
|
@ -1,8 +1,8 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.NonceResyncableMessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.NonceResyncableMessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
|
||||
public class FaultConfigCommand extends NonceResyncableMessageBlock {
|
||||
private final byte tab5sub16;
|
|
@ -1,8 +1,8 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodInfoType;
|
||||
|
||||
public class GetStatusCommand extends MessageBlock {
|
||||
private final PodInfoType podInfoType;
|
|
@ -1,18 +1,18 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommandInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.NonceResyncableMessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalDeliverySchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalDeliveryTable;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalSchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BolusDeliverySchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.DeliverySchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.TempBasalDeliverySchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.CommandInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.NonceResyncableMessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule.BasalDeliverySchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule.BasalDeliveryTable;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule.BasalSchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule.BolusDeliverySchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule.DeliverySchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule.TempBasalDeliverySchedule;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
|
||||
|
||||
public class SetInsulinScheduleCommand extends NonceResyncableMessageBlock {
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class SetInsulinScheduleCommand extends NonceResyncableMessageBlock {
|
|||
|
||||
int timeRemainingInSegment = BasalDeliveryTable.SEGMENT_DURATION - segmentOffset;
|
||||
|
||||
double timeBetweenPulses = 3600 / (rate / OmnipodConst.POD_PULSE_SIZE);
|
||||
double timeBetweenPulses = 3600 / (rate / OmnipodConstants.POD_PULSE_SIZE);
|
||||
|
||||
double offsetToNextTenth = timeRemainingInSegment % (timeBetweenPulses / 10.0);
|
||||
|
||||
|
@ -52,13 +52,13 @@ public class SetInsulinScheduleCommand extends NonceResyncableMessageBlock {
|
|||
public SetInsulinScheduleCommand(int nonce, double tempBasalRate, Duration duration) {
|
||||
if (tempBasalRate < 0D) {
|
||||
throw new CommandInitializationException("Rate should be >= 0");
|
||||
} else if (tempBasalRate > OmnipodConst.MAX_BASAL_RATE) {
|
||||
} else if (tempBasalRate > OmnipodConstants.MAX_BASAL_RATE) {
|
||||
throw new CommandInitializationException("Rate exceeds max basal rate");
|
||||
}
|
||||
if (duration.isLongerThan(OmnipodConst.MAX_TEMP_BASAL_DURATION)) {
|
||||
if (duration.isLongerThan(OmnipodConstants.MAX_TEMP_BASAL_DURATION)) {
|
||||
throw new CommandInitializationException("Duration exceeds max temp basal duration");
|
||||
}
|
||||
int pulsesPerHour = (int) Math.round(tempBasalRate / OmnipodConst.POD_PULSE_SIZE);
|
||||
int pulsesPerHour = (int) Math.round(tempBasalRate / OmnipodConstants.POD_PULSE_SIZE);
|
||||
int pulsesPerSegment = pulsesPerHour / 2;
|
||||
this.nonce = nonce;
|
||||
this.schedule = new TempBasalDeliverySchedule(BasalDeliveryTable.SEGMENT_DURATION, pulsesPerSegment, new BasalDeliveryTable(tempBasalRate, duration));
|
|
@ -1,10 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
|
||||
public class SetupPodCommand extends MessageBlock {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
|
@ -6,11 +6,11 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommandInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.RateEntry;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.CommandInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule.RateEntry;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
|
||||
|
||||
public class TempBasalExtraCommand extends MessageBlock {
|
||||
private final boolean acknowledgementBeep;
|
||||
|
@ -25,10 +25,10 @@ public class TempBasalExtraCommand extends MessageBlock {
|
|||
Duration programReminderInterval) {
|
||||
if (rate < 0D) {
|
||||
throw new CommandInitializationException("Rate should be >= 0");
|
||||
} else if (rate > OmnipodConst.MAX_BASAL_RATE) {
|
||||
} else if (rate > OmnipodConstants.MAX_BASAL_RATE) {
|
||||
throw new CommandInitializationException("Rate exceeds max basal rate");
|
||||
}
|
||||
if (duration.isLongerThan(OmnipodConst.MAX_TEMP_BASAL_DURATION)) {
|
||||
if (duration.isLongerThan(OmnipodConstants.MAX_TEMP_BASAL_DURATION)) {
|
||||
throw new CommandInitializationException("Duration exceeds max temp basal duration");
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.FaultEventCode;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.FaultEventCode;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodProgressStatus;
|
||||
|
||||
public class ErrorResponse extends MessageBlock {
|
||||
public static final byte ERROR_RESPONSE_CODE_BAD_NONCE = (byte) 0x14;
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
|
@ -6,12 +6,12 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.IOException;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertSet;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.DeliveryStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertSet;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.DeliveryStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodProgressStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
|
||||
|
||||
public class StatusResponse extends MessageBlock {
|
||||
private static final int MESSAGE_LENGTH = 10;
|
||||
|
@ -40,14 +40,14 @@ public class StatusResponse extends MessageBlock {
|
|||
int highInsulinBits = (encodedData[2] & 0xF) << 9;
|
||||
int middleInsulinBits = ByteUtil.convertUnsignedByteToInt(encodedData[3]) << 1;
|
||||
int lowInsulinBits = ByteUtil.convertUnsignedByteToInt(encodedData[4]) >>> 7;
|
||||
insulinDelivered = OmnipodConst.POD_PULSE_SIZE * (highInsulinBits | middleInsulinBits | lowInsulinBits);
|
||||
insulinDelivered = OmnipodConstants.POD_PULSE_SIZE * (highInsulinBits | middleInsulinBits | lowInsulinBits);
|
||||
podMessageCounter = (byte) ((encodedData[4] >>> 3) & 0xf);
|
||||
|
||||
insulinNotDelivered = OmnipodConst.POD_PULSE_SIZE * (((encodedData[4] & 0x03) << 8) | ByteUtil.convertUnsignedByteToInt(encodedData[5]));
|
||||
insulinNotDelivered = OmnipodConstants.POD_PULSE_SIZE * (((encodedData[4] & 0x03) << 8) | ByteUtil.convertUnsignedByteToInt(encodedData[5]));
|
||||
alerts = new AlertSet((byte) (((encodedData[6] & 0x7f) << 1) | (ByteUtil.convertUnsignedByteToInt(encodedData[7]) >>> 7)));
|
||||
|
||||
double reservoirValue = (((encodedData[8] & 0x3) << 8) + ByteUtil.convertUnsignedByteToInt(encodedData[9])) * OmnipodConst.POD_PULSE_SIZE;
|
||||
if (reservoirValue > OmnipodConst.MAX_RESERVOIR_READING) {
|
||||
double reservoirValue = (((encodedData[8] & 0x3) << 8) + ByteUtil.convertUnsignedByteToInt(encodedData[9])) * OmnipodConstants.POD_PULSE_SIZE;
|
||||
if (reservoirValue > OmnipodConstants.MAX_RESERVOIR_READING) {
|
||||
reservoirLevel = null;
|
||||
} else {
|
||||
reservoirLevel = reservoirValue;
|
|
@ -1,10 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.FirmwareVersion;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.FirmwareVersion;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodProgressStatus;
|
||||
|
||||
public class VersionResponse extends MessageBlock {
|
||||
private static final int ASSIGN_ADDRESS_VERSION_RESPONSE_LENGTH = 0x15;
|
|
@ -1,6 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodInfoType;
|
||||
|
||||
public abstract class PodInfo {
|
||||
private final byte[] encodedData;
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
|
@ -7,9 +7,9 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertSlot;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertSlot;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodInfoType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
|
||||
|
||||
public class PodInfoActiveAlerts extends PodInfo {
|
||||
private static final int MINIMUM_MESSAGE_LENGTH = 11;
|
||||
|
@ -69,7 +69,7 @@ public class PodInfoActiveAlerts extends PodInfo {
|
|||
}
|
||||
|
||||
public double getValueAsUnits() {
|
||||
return value * OmnipodConst.POD_PULSE_SIZE;
|
||||
return value * OmnipodConstants.POD_PULSE_SIZE;
|
||||
}
|
||||
|
||||
public Duration getValueAsDuration() {
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
|
@ -7,8 +7,8 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.FaultEventCode;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.FaultEventCode;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodInfoType;
|
||||
|
||||
public class PodInfoDataLog extends PodInfo {
|
||||
private static final int MINIMUM_MESSAGE_LENGTH = 8;
|
|
@ -1,10 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.FaultEventCode;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.FaultEventCode;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodInfoType;
|
||||
|
||||
public class PodInfoFaultAndInitializationTime extends PodInfo {
|
||||
private static final int MINIMUM_MESSAGE_LENGTH = 17;
|
|
@ -1,15 +1,15 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertSet;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.DeliveryStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.FaultEventCode;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.LogEventErrorCode;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertSet;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.DeliveryStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.FaultEventCode;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.LogEventErrorCode;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodInfoType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodProgressStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
|
||||
|
||||
public class PodInfoFaultEvent extends PodInfo {
|
||||
private static final int MINIMUM_MESSAGE_LENGTH = 21;
|
||||
|
@ -41,9 +41,9 @@ public class PodInfoFaultEvent extends PodInfo {
|
|||
|
||||
podProgressStatus = PodProgressStatus.fromByte(encodedData[1]);
|
||||
deliveryStatus = DeliveryStatus.fromByte(encodedData[2]);
|
||||
insulinNotDelivered = OmnipodConst.POD_PULSE_SIZE * ByteUtil.toInt(encodedData[3], encodedData[4]);
|
||||
insulinNotDelivered = OmnipodConstants.POD_PULSE_SIZE * ByteUtil.toInt(encodedData[3], encodedData[4]);
|
||||
podMessageCounter = encodedData[5];
|
||||
totalInsulinDelivered = OmnipodConst.POD_PULSE_SIZE * ByteUtil.toInt(encodedData[6], encodedData[7]);
|
||||
totalInsulinDelivered = OmnipodConstants.POD_PULSE_SIZE * ByteUtil.toInt(encodedData[6], encodedData[7]);
|
||||
faultEventCode = FaultEventCode.fromByte(encodedData[8]);
|
||||
|
||||
int minutesSinceActivation = ByteUtil.toInt(encodedData[9], encodedData[10]);
|
||||
|
@ -54,8 +54,8 @@ public class PodInfoFaultEvent extends PodInfo {
|
|||
}
|
||||
|
||||
double reservoirValue = ((encodedData[11] & 0x03) << 8) +
|
||||
ByteUtil.convertUnsignedByteToInt(encodedData[12]) * OmnipodConst.POD_PULSE_SIZE;
|
||||
if (reservoirValue > OmnipodConst.MAX_RESERVOIR_READING) {
|
||||
ByteUtil.convertUnsignedByteToInt(encodedData[12]) * OmnipodConstants.POD_PULSE_SIZE;
|
||||
if (reservoirValue > OmnipodConstants.MAX_RESERVOIR_READING) {
|
||||
reservoirLevel = null;
|
||||
} else {
|
||||
reservoirLevel = reservoirValue;
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
|
@ -7,7 +7,7 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodInfoType;
|
||||
|
||||
public class PodInfoOlderPulseLog extends PodInfo {
|
||||
private static final int MINIMUM_MESSAGE_LENGTH = 3;
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
|
@ -7,7 +7,7 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodInfoType;
|
||||
|
||||
public class PodInfoRecentPulseLog extends PodInfo {
|
||||
private static final int MINIMUM_MESSAGE_LENGTH = 3;
|
|
@ -1,9 +1,9 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.MessageBlockType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodInfoType;
|
||||
|
||||
public class PodInfoResponse extends MessageBlock {
|
||||
private final PodInfoType subType;
|
|
@ -1,9 +1,8 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
|
||||
public class AlertConfiguration {
|
||||
private final AlertType alertType;
|
||||
|
@ -56,7 +55,7 @@ public class AlertConfiguration {
|
|||
};
|
||||
|
||||
if (alertTrigger instanceof UnitsRemainingAlertTrigger) {
|
||||
int ticks = (int) (((UnitsRemainingAlertTrigger) alertTrigger).getValue() / OmnipodConst.POD_PULSE_SIZE / 2);
|
||||
int ticks = (int) (((UnitsRemainingAlertTrigger) alertTrigger).getValue() / OmnipodConstants.POD_PULSE_SIZE / 2);
|
||||
encodedData = ByteUtil.concat(encodedData, ByteUtil.getBytesFromInt16(ticks));
|
||||
} else if (alertTrigger instanceof TimerAlertTrigger) {
|
||||
int durationInMinutes = (int) ((TimerAlertTrigger) alertTrigger).getValue().getStandardMinutes();
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
public enum AlertSlot {
|
||||
SLOT0((byte) 0x00),
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
public abstract class AlertTrigger<T> {
|
||||
protected T value;
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
public enum AlertType {
|
||||
FINISH_PAIRING_REMINDER,
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
|
||||
// BeepConfigType is used only for the $1E Beep Config Command.
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
public enum BeepRepeat {
|
||||
ONCE((byte) 0x00),
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
// BeepType is used for the $19 Configure Alerts and $1F Cancel Commands
|
||||
public enum BeepType {
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
public enum DeliveryStatus {
|
||||
SUSPENDED((byte) 0x00),
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
public enum DeliveryType {
|
||||
NONE((byte) 0x00),
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
import java.util.Locale;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
import java.util.Locale;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
public enum LogEventErrorCode {
|
||||
NONE((byte) 0x00),
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
import org.apache.commons.lang3.NotImplementedException;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.ErrorResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.VersionResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.MessageBlock;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.ErrorResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.VersionResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo.PodInfoResponse;
|
||||
|
||||
public enum MessageBlockType {
|
||||
VERSION_RESPONSE(0x01),
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.util;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
|
@ -8,29 +8,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R;
|
|||
* Created by andy on 4.8.2019
|
||||
*/
|
||||
|
||||
public class OmnipodConst {
|
||||
|
||||
static final String Prefix = "AAPS.Omnipod.";
|
||||
|
||||
public static class Prefs {
|
||||
public static final String PodState = Prefix + "pod_state";
|
||||
public static final String CurrentBolus = Prefix + "current_bolus";
|
||||
public static final int BeepBasalEnabled = R.string.key_omnipod_beep_basal_enabled;
|
||||
public static final int BeepBolusEnabled = R.string.key_omnipod_beep_bolus_enabled;
|
||||
public static final int BeepSMBEnabled = R.string.key_omnipod_beep_smb_enabled;
|
||||
public static final int BeepTBREnabled = R.string.key_omnipod_beep_tbr_enabled;
|
||||
public static final int PodDebuggingOptionsEnabled = R.string.key_omnipod_pod_debugging_options_enabled;
|
||||
public static final int TimeChangeEventEnabled = R.string.key_omnipod_timechange_enabled;
|
||||
}
|
||||
|
||||
public static class Statistics {
|
||||
public static final String StatsPrefix = "omnipod_";
|
||||
public static final String LastGoodPumpCommunicationTime = Prefix + "lastGoodPumpCommunicationTime";
|
||||
public static final String TBRsSet = StatsPrefix + "tbrs_set";
|
||||
public static final String StandardBoluses = StatsPrefix + "std_boluses_delivered";
|
||||
public static final String SMBBoluses = StatsPrefix + "smb_boluses_delivered";
|
||||
}
|
||||
|
||||
public class OmnipodConstants {
|
||||
public static final double POD_PULSE_SIZE = 0.05;
|
||||
public static final double POD_BOLUS_DELIVERY_RATE = 0.025; // units per second
|
||||
public static final double POD_PRIMING_DELIVERY_RATE = 0.05; // units per second
|
|
@ -1,6 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.util;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
public class OmniCRC {
|
||||
public class OmnipodCrc {
|
||||
public static final int[] crc16lookup = new int[]{
|
||||
0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011,
|
||||
0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022,
|
||||
|
@ -35,6 +35,7 @@ public class OmniCRC {
|
|||
0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231,
|
||||
0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202
|
||||
};
|
||||
|
||||
public static final int[] crc8lookup = new int[]{
|
||||
0x00, 0x07, 0x0E, 0x09, 0x1C, 0x1B, 0x12, 0x15, 0x38, 0x3F, 0x36, 0x31, 0x24, 0x23, 0x2A, 0x2D,
|
||||
0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65, 0x48, 0x4F, 0x46, 0x41, 0x54, 0x53, 0x5A, 0x5D,
|
||||
|
@ -54,7 +55,6 @@ public class OmniCRC {
|
|||
0xDE, 0xD9, 0xD0, 0xD7, 0xC2, 0xC5, 0xCC, 0xCB, 0xE6, 0xE1, 0xE8, 0xEF, 0xFA, 0xFD, 0xF4, 0xF3
|
||||
};
|
||||
|
||||
|
||||
public static int crc16(byte[] bytes) {
|
||||
int crc = 0x0000;
|
||||
for (byte b : bytes) {
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
public enum PacketType {
|
||||
INVALID((byte) 0),
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfo;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoActiveAlerts;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoDataLog;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoFaultAndInitializationTime;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoFaultEvent;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoOlderPulseLog;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo.PodInfo;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo.PodInfoActiveAlerts;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo.PodInfoDataLog;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo.PodInfoFaultAndInitializationTime;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo.PodInfoFaultEvent;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo.PodInfoOlderPulseLog;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo.PodInfoRecentPulseLog;
|
||||
|
||||
public enum PodInfoType {
|
||||
NORMAL((byte) 0x00),
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
public enum PodProgressStatus {
|
||||
INITIALIZED((byte) 0x00),
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
|
||||
|
||||
public class UnitsRemainingAlertTrigger extends AlertTrigger<Double> {
|
||||
public UnitsRemainingAlertTrigger(Double value) {
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.IRawRepresentable;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.IRawRepresentable;
|
||||
|
||||
public class BasalDeliverySchedule extends DeliverySchedule implements IRawRepresentable {
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
|
||||
|
||||
public class BasalDeliveryTable {
|
||||
|
||||
|
@ -23,7 +23,7 @@ public class BasalDeliveryTable {
|
|||
boolean halfPulseRemainder = false;
|
||||
for (int i = 0; i < NUM_SEGMENTS; i++) {
|
||||
double rate = schedule.rateAt(Duration.standardMinutes(i * 30));
|
||||
int pulsesPerHour = (int) Math.round(rate / OmnipodConst.POD_PULSE_SIZE);
|
||||
int pulsesPerHour = (int) Math.round(rate / OmnipodConstants.POD_PULSE_SIZE);
|
||||
int pulsesPerSegment = pulsesPerHour >>> 1;
|
||||
boolean halfPulse = (pulsesPerHour & 0b1) != 0;
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class BasalDeliveryTable {
|
|||
}
|
||||
|
||||
public BasalDeliveryTable(double tempBasalRate, Duration duration) {
|
||||
int pulsesPerHour = (int) Math.round(tempBasalRate / OmnipodConst.POD_PULSE_SIZE);
|
||||
int pulsesPerHour = (int) Math.round(tempBasalRate / OmnipodConstants.POD_PULSE_SIZE);
|
||||
int pulsesPerSegment = pulsesPerHour >> 1;
|
||||
boolean alternateSegmentPulse = (pulsesPerHour & 0b1) != 0;
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
|
@ -1,10 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
|
||||
|
||||
public class BasalScheduleEntry {
|
||||
private final double rate;
|
||||
|
@ -15,9 +15,9 @@ public class BasalScheduleEntry {
|
|||
throw new IllegalArgumentException("Invalid start time");
|
||||
} else if (rate < 0D) {
|
||||
throw new IllegalArgumentException("Rate should be >= 0");
|
||||
} else if (rate > OmnipodConst.MAX_BASAL_RATE) {
|
||||
} else if (rate > OmnipodConstants.MAX_BASAL_RATE) {
|
||||
throw new IllegalArgumentException("Rate exceeds max basal rate");
|
||||
} else if (rate % OmnipodConst.POD_PULSE_SIZE > 0.000001 && rate % OmnipodConst.POD_PULSE_SIZE - OmnipodConst.POD_PULSE_SIZE < -0.000001) {
|
||||
} else if (rate % OmnipodConstants.POD_PULSE_SIZE > 0.000001 && rate % OmnipodConstants.POD_PULSE_SIZE - OmnipodConstants.POD_PULSE_SIZE < -0.000001) {
|
||||
throw new IllegalArgumentException("Unsupported basal rate precision");
|
||||
}
|
||||
this.rate = rate;
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.IRawRepresentable;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.IRawRepresentable;
|
||||
|
||||
public class BasalTableEntry implements IRawRepresentable {
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule;
|
||||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.IRawRepresentable;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.IRawRepresentable;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
|
||||
|
||||
public class BolusDeliverySchedule extends DeliverySchedule implements IRawRepresentable {
|
||||
|
||||
|
@ -14,7 +14,7 @@ public class BolusDeliverySchedule extends DeliverySchedule implements IRawRepre
|
|||
public BolusDeliverySchedule(double units, Duration timeBetweenPulses) {
|
||||
if (units <= 0D) {
|
||||
throw new IllegalArgumentException("Units should be > 0");
|
||||
} else if (units > OmnipodConst.MAX_BOLUS) {
|
||||
} else if (units > OmnipodConstants.MAX_BOLUS) {
|
||||
throw new IllegalArgumentException("Units exceeds max bolus");
|
||||
}
|
||||
this.units = units;
|
||||
|
@ -25,7 +25,7 @@ public class BolusDeliverySchedule extends DeliverySchedule implements IRawRepre
|
|||
public byte[] getRawData() {
|
||||
byte[] rawData = new byte[]{1}; // Number of half hour segments
|
||||
|
||||
int pulseCount = (int) Math.round(units / OmnipodConst.POD_PULSE_SIZE);
|
||||
int pulseCount = (int) Math.round(units / OmnipodConstants.POD_PULSE_SIZE);
|
||||
int multiplier = (int) timeBetweenPulses.getStandardSeconds() * 8;
|
||||
int fieldA = pulseCount * multiplier;
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.IRawRepresentable;
|
||||
|
||||
public abstract class DeliverySchedule implements IRawRepresentable {
|
||||
|
||||
public abstract InsulinScheduleType getType();
|
||||
|
||||
public abstract int getChecksum();
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue