Dana pumps: better detect wrong profile in pump
This commit is contained in:
parent
50a5e70051
commit
ebb97be8c5
|
@ -18,19 +18,17 @@ import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingUserOptions;
|
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetUserOptions;
|
|
||||||
import info.nightscout.androidaps.plugins.Treatments.Treatment;
|
|
||||||
import info.nightscout.androidaps.events.EventAppExit;
|
import info.nightscout.androidaps.events.EventAppExit;
|
||||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||||
|
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
|
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
||||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
|
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.SerialIOThread;
|
import info.nightscout.androidaps.plugins.PumpDanaR.SerialIOThread;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MessageBase;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MessageBase;
|
||||||
|
@ -47,6 +45,7 @@ import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetExtendedBolusStop
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetTempBasalStart;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetTempBasalStart;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetTempBasalStop;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetTempBasalStop;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetTime;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetTime;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetUserOptions;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingActiveProfile;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingActiveProfile;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingBasal;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingBasal;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingGlucose;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingGlucose;
|
||||||
|
@ -56,12 +55,15 @@ import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingProfileRatios
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingProfileRatiosAll;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingProfileRatiosAll;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingPumpTime;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingPumpTime;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingShippingInfo;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingShippingInfo;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingUserOptions;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatus;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatus;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusBasic;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusBasic;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusBolusExtended;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusBolusExtended;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusTempBasal;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusTempBasal;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
|
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
|
||||||
|
import info.nightscout.androidaps.plugins.Treatments.Treatment;
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
|
import info.nightscout.androidaps.queue.commands.Command;
|
||||||
import info.nightscout.utils.NSUpload;
|
import info.nightscout.utils.NSUpload;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
@ -166,7 +168,19 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingbolusstatus)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingbolusstatus)));
|
||||||
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
if (mDanaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !MainApp.getSpecificPlugin(DanaRPlugin.class).isInitialized()) {
|
mDanaRPump.lastConnection = now;
|
||||||
|
|
||||||
|
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||||
|
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
||||||
|
if (profile != null && Math.abs(mDanaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
|
||||||
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
||||||
|
mSerialIOThread.sendMessage(new MsgSettingBasal());
|
||||||
|
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
|
||||||
|
MainApp.bus().post(new EventProfileSwitchChange());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mDanaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !pump.isInitialized()) {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
||||||
mSerialIOThread.sendMessage(new MsgSettingShippingInfo());
|
mSerialIOThread.sendMessage(new MsgSettingShippingInfo());
|
||||||
mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
|
mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
|
||||||
|
@ -192,7 +206,6 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
||||||
mDanaRPump.lastSettingsRead = now;
|
mDanaRPump.lastSettingsRead = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDanaRPump.lastConnection = now;
|
|
||||||
MainApp.bus().post(new EventDanaRNewStatus());
|
MainApp.bus().post(new EventDanaRNewStatus());
|
||||||
MainApp.bus().post(new EventInitializationChanged());
|
MainApp.bus().post(new EventInitializationChanged());
|
||||||
NSUpload.uploadDeviceStatus();
|
NSUpload.uploadDeviceStatus();
|
||||||
|
|
|
@ -18,11 +18,12 @@ import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.plugins.Treatments.Treatment;
|
|
||||||
import info.nightscout.androidaps.events.EventAppExit;
|
import info.nightscout.androidaps.events.EventAppExit;
|
||||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||||
|
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
|
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
|
@ -38,6 +39,7 @@ import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetSingleBasalProfil
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetTempBasalStart;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetTempBasalStart;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetTempBasalStop;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetTempBasalStop;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetTime;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetTime;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingBasal;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingGlucose;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingGlucose;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingMaxValues;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingMaxValues;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingMeal;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingMeal;
|
||||||
|
@ -53,9 +55,10 @@ import info.nightscout.androidaps.plugins.PumpDanaRKorean.SerialIOThread;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRKorean.comm.MsgCheckValue_k;
|
import info.nightscout.androidaps.plugins.PumpDanaRKorean.comm.MsgCheckValue_k;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRKorean.comm.MsgSettingBasal_k;
|
import info.nightscout.androidaps.plugins.PumpDanaRKorean.comm.MsgSettingBasal_k;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRKorean.comm.MsgStatusBasic_k;
|
import info.nightscout.androidaps.plugins.PumpDanaRKorean.comm.MsgStatusBasic_k;
|
||||||
|
import info.nightscout.androidaps.plugins.Treatments.Treatment;
|
||||||
|
import info.nightscout.androidaps.queue.commands.Command;
|
||||||
import info.nightscout.utils.NSUpload;
|
import info.nightscout.utils.NSUpload;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
import info.nightscout.utils.ToastUtils;
|
|
||||||
|
|
||||||
public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
||||||
|
|
||||||
|
@ -173,7 +176,19 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingbolusstatus)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingbolusstatus)));
|
||||||
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
if (mDanaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).isInitialized()) {
|
mDanaRPump.lastConnection = now;
|
||||||
|
|
||||||
|
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||||
|
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
||||||
|
if (profile != null && Math.abs(mDanaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
|
||||||
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
||||||
|
mSerialIOThread.sendMessage(new MsgSettingBasal());
|
||||||
|
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
|
||||||
|
MainApp.bus().post(new EventProfileSwitchChange());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mDanaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !pump.isInitialized()) {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
||||||
mSerialIOThread.sendMessage(new MsgSettingShippingInfo());
|
mSerialIOThread.sendMessage(new MsgSettingShippingInfo());
|
||||||
mSerialIOThread.sendMessage(new MsgSettingMeal());
|
mSerialIOThread.sendMessage(new MsgSettingMeal());
|
||||||
|
@ -195,7 +210,6 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
||||||
mDanaRPump.lastSettingsRead = now;
|
mDanaRPump.lastSettingsRead = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDanaRPump.lastConnection = now;
|
|
||||||
MainApp.bus().post(new EventDanaRNewStatus());
|
MainApp.bus().post(new EventDanaRNewStatus());
|
||||||
MainApp.bus().post(new EventInitializationChanged());
|
MainApp.bus().post(new EventInitializationChanged());
|
||||||
NSUpload.uploadDeviceStatus();
|
NSUpload.uploadDeviceStatus();
|
||||||
|
|
|
@ -19,17 +19,17 @@ import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity;
|
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Get_User_Option;
|
|
||||||
import info.nightscout.androidaps.plugins.Treatments.Treatment;
|
|
||||||
import info.nightscout.androidaps.events.EventAppExit;
|
import info.nightscout.androidaps.events.EventAppExit;
|
||||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||||
|
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
|
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
|
||||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
|
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
|
||||||
|
@ -71,9 +71,12 @@ import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_History_
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Notify_Delivery_Complete;
|
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Notify_Delivery_Complete;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Notify_Delivery_Rate_Display;
|
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Notify_Delivery_Rate_Display;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Get_Pump_Time;
|
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Get_Pump_Time;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Get_User_Option;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Set_Pump_Time;
|
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Set_Pump_Time;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Set_User_Option;
|
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Set_User_Option;
|
||||||
|
import info.nightscout.androidaps.plugins.Treatments.Treatment;
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
|
import info.nightscout.androidaps.queue.commands.Command;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.NSUpload;
|
import info.nightscout.utils.NSUpload;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
|
@ -136,6 +139,19 @@ public class DanaRSService extends Service {
|
||||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Step_Bolus_Information()); // last bolus, bolusStep, maxBolus
|
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Step_Bolus_Information()); // last bolus, bolusStep, maxBolus
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingtempbasalstatus)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingtempbasalstatus)));
|
||||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State());
|
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State());
|
||||||
|
|
||||||
|
danaRPump.lastConnection = System.currentTimeMillis();
|
||||||
|
|
||||||
|
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||||
|
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
||||||
|
if (profile != null && Math.abs(danaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
|
||||||
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
||||||
|
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Basal_Rate()); // basal profile, basalStep, maxBasal
|
||||||
|
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
|
||||||
|
MainApp.bus().post(new EventProfileSwitchChange());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime)));
|
||||||
bleComm.sendMessage(new DanaRS_Packet_Option_Get_Pump_Time());
|
bleComm.sendMessage(new DanaRS_Packet_Option_Get_Pump_Time());
|
||||||
|
|
||||||
|
@ -166,10 +182,9 @@ public class DanaRSService extends Service {
|
||||||
log.debug("Pump time difference: " + timeDiff + " seconds");
|
log.debug("Pump time difference: " + timeDiff + " seconds");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
danaRPump.lastConnection = System.currentTimeMillis();
|
|
||||||
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
if (danaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !MainApp.getSpecificPlugin(DanaRSPlugin.class).isInitialized()) {
|
if (danaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !pump.isInitialized()) {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
||||||
bleComm.sendMessage(new DanaRS_Packet_General_Get_Shipping_Information()); // serial no
|
bleComm.sendMessage(new DanaRS_Packet_General_Get_Shipping_Information()); // serial no
|
||||||
bleComm.sendMessage(new DanaRS_Packet_General_Get_Pump_Check()); // firmware
|
bleComm.sendMessage(new DanaRS_Packet_General_Get_Pump_Check()); // firmware
|
||||||
|
|
|
@ -19,16 +19,15 @@ import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity;
|
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingUserOptions;
|
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetUserOptions;
|
|
||||||
import info.nightscout.androidaps.plugins.Treatments.Treatment;
|
|
||||||
import info.nightscout.androidaps.events.EventAppExit;
|
import info.nightscout.androidaps.events.EventAppExit;
|
||||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||||
|
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
|
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
||||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||||
|
@ -46,6 +45,7 @@ import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetExtendedBolusStop
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetTempBasalStart;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetTempBasalStart;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetTempBasalStop;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetTempBasalStop;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetTime;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetTime;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetUserOptions;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingActiveProfile;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingActiveProfile;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingBasal;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingBasal;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingGlucose;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingGlucose;
|
||||||
|
@ -55,6 +55,7 @@ import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingProfileRatios
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingProfileRatiosAll;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingProfileRatiosAll;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingPumpTime;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingPumpTime;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingShippingInfo;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingShippingInfo;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingUserOptions;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatus;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatus;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusBasic;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusBasic;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
|
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
|
||||||
|
@ -67,7 +68,9 @@ import info.nightscout.androidaps.plugins.PumpDanaRv2.comm.MsgSetAPSTempBasalSta
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRv2.comm.MsgSetHistoryEntry_v2;
|
import info.nightscout.androidaps.plugins.PumpDanaRv2.comm.MsgSetHistoryEntry_v2;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRv2.comm.MsgStatusBolusExtended_v2;
|
import info.nightscout.androidaps.plugins.PumpDanaRv2.comm.MsgStatusBolusExtended_v2;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRv2.comm.MsgStatusTempBasal_v2;
|
import info.nightscout.androidaps.plugins.PumpDanaRv2.comm.MsgStatusTempBasal_v2;
|
||||||
|
import info.nightscout.androidaps.plugins.Treatments.Treatment;
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
|
import info.nightscout.androidaps.queue.commands.Command;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.NSUpload;
|
import info.nightscout.utils.NSUpload;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
|
@ -189,6 +192,19 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
||||||
mSerialIOThread.sendMessage(tempStatusMsg);
|
mSerialIOThread.sendMessage(tempStatusMsg);
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingextendedbolusstatus)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingextendedbolusstatus)));
|
||||||
mSerialIOThread.sendMessage(exStatusMsg);
|
mSerialIOThread.sendMessage(exStatusMsg);
|
||||||
|
|
||||||
|
mDanaRPump.lastConnection = System.currentTimeMillis();
|
||||||
|
|
||||||
|
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||||
|
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
||||||
|
if (profile != null && Math.abs(mDanaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
|
||||||
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
||||||
|
mSerialIOThread.sendMessage(new MsgSettingBasal());
|
||||||
|
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
|
||||||
|
MainApp.bus().post(new EventProfileSwitchChange());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime)));
|
||||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime());
|
mSerialIOThread.sendMessage(new MsgSettingPumpTime());
|
||||||
long timeDiff = (mDanaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
|
long timeDiff = (mDanaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
|
||||||
|
@ -218,10 +234,9 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
||||||
log.debug("Pump time difference: " + timeDiff + " seconds");
|
log.debug("Pump time difference: " + timeDiff + " seconds");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mDanaRPump.lastConnection = System.currentTimeMillis();
|
|
||||||
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
if (mDanaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !MainApp.getSpecificPlugin(DanaRv2Plugin.class).isInitialized()) {
|
if (mDanaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !pump.isInitialized()) {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
||||||
mSerialIOThread.sendMessage(new MsgSettingShippingInfo());
|
mSerialIOThread.sendMessage(new MsgSettingShippingInfo());
|
||||||
mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
|
mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
|
||||||
|
|
Loading…
Reference in a new issue