Merged branch dev into dev
This commit is contained in:
commit
ba254f8829
22 changed files with 238 additions and 74 deletions
|
@ -17,6 +17,8 @@ import info.nightscout.client.data.NSProfile;
|
||||||
public interface PumpInterface {
|
public interface PumpInterface {
|
||||||
|
|
||||||
boolean isInitialized();
|
boolean isInitialized();
|
||||||
|
boolean isSuspended();
|
||||||
|
boolean isBusy();
|
||||||
|
|
||||||
boolean isTempBasalInProgress();
|
boolean isTempBasalInProgress();
|
||||||
boolean isExtendedBoluslInProgress();
|
boolean isExtendedBoluslInProgress();
|
||||||
|
|
|
@ -94,19 +94,19 @@ public class ActionsFragment extends Fragment implements FragmentBase, View.OnCl
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable || !MainApp.getConfigBuilder().isInitialized())
|
if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended())
|
||||||
profileSwitch.setVisibility(View.GONE);
|
profileSwitch.setVisibility(View.GONE);
|
||||||
else
|
else
|
||||||
profileSwitch.setVisibility(View.VISIBLE);
|
profileSwitch.setVisibility(View.VISIBLE);
|
||||||
if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized())
|
if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended())
|
||||||
extendedBolus.setVisibility(View.GONE);
|
extendedBolus.setVisibility(View.GONE);
|
||||||
else
|
else
|
||||||
extendedBolus.setVisibility(View.VISIBLE);
|
extendedBolus.setVisibility(View.VISIBLE);
|
||||||
if (!MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable || !MainApp.getConfigBuilder().isInitialized())
|
if (!MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended())
|
||||||
tempBasal.setVisibility(View.GONE);
|
tempBasal.setVisibility(View.GONE);
|
||||||
else
|
else
|
||||||
tempBasal.setVisibility(View.VISIBLE);
|
tempBasal.setVisibility(View.VISIBLE);
|
||||||
if (!MainApp.getConfigBuilder().getPumpDescription().isRefillingCapable || !MainApp.getConfigBuilder().isInitialized())
|
if (!MainApp.getConfigBuilder().getPumpDescription().isRefillingCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended())
|
||||||
fill.setVisibility(View.GONE);
|
fill.setVisibility(View.GONE);
|
||||||
else
|
else
|
||||||
fill.setVisibility(View.VISIBLE);
|
fill.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -481,7 +481,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!MainApp.getConfigBuilder().isInitialized() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
||||||
profileswitchButton.setVisibility(View.GONE);
|
profileswitchButton.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
profileswitchButton.setVisibility(View.VISIBLE);
|
profileswitchButton.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -18,6 +18,10 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Config;
|
import info.nightscout.androidaps.Config;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
@ -73,7 +77,8 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
|
|
||||||
static ArrayList<PluginBase> pluginList;
|
static ArrayList<PluginBase> pluginList;
|
||||||
|
|
||||||
static Date lastDeviceStatusUpload = new Date(0);
|
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
|
||||||
|
private static ScheduledFuture<?> scheduledPost = null;
|
||||||
|
|
||||||
PowerManager.WakeLock mWakeLock;
|
PowerManager.WakeLock mWakeLock;
|
||||||
|
|
||||||
|
@ -334,6 +339,16 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
return activePump.isInitialized();
|
return activePump.isInitialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSuspended() {
|
||||||
|
return activePump.isSuspended();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBusy() {
|
||||||
|
return activePump.isBusy();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTempBasalInProgress() {
|
public boolean isTempBasalInProgress() {
|
||||||
return activePump.isTempBasalInProgress();
|
return activePump.isTempBasalInProgress();
|
||||||
|
@ -596,6 +611,17 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
result.comment = MainApp.sResources.getString(R.string.pumpNotInitialized);
|
result.comment = MainApp.sResources.getString(R.string.pumpNotInitialized);
|
||||||
result.enacted = false;
|
result.enacted = false;
|
||||||
result.success = false;
|
result.success = false;
|
||||||
|
log.debug("applyAPSRequest: " + MainApp.sResources.getString(R.string.pumpNotInitialized));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSuspended()) {
|
||||||
|
result = new PumpEnactResult();
|
||||||
|
result.comment = MainApp.sResources.getString(R.string.pumpsuspended);
|
||||||
|
result.enacted = false;
|
||||||
|
result.success = false;
|
||||||
|
log.debug("applyAPSRequest: " + MainApp.sResources.getString(R.string.pumpsuspended));
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.logCongigBuilderActions)
|
if (Config.logCongigBuilderActions)
|
||||||
|
@ -780,22 +806,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatusEvent(final EventNewBG ev) {
|
public void onStatusEvent(final EventNewBG ev) {
|
||||||
Thread t = new Thread(new Runnable() {
|
uploadDeviceStatus(120);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
// Give some time to Loop
|
|
||||||
try {
|
|
||||||
Thread.sleep(120 * 1000L);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
// if status not uploaded, upload pump status only
|
|
||||||
if (new Date().getTime() - lastDeviceStatusUpload.getTime() > 120 * 1000L) {
|
|
||||||
uploadDeviceStatus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
t.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uploadTempBasalStartAbsolute(Double absolute, double durationInMinutes) {
|
public void uploadTempBasalStartAbsolute(Double absolute, double durationInMinutes) {
|
||||||
|
@ -901,7 +912,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uploadDeviceStatus() {
|
public void doUploadDeviceStatus() {
|
||||||
DeviceStatus deviceStatus = new DeviceStatus();
|
DeviceStatus deviceStatus = new DeviceStatus();
|
||||||
try {
|
try {
|
||||||
LoopPlugin.LastRun lastRun = LoopPlugin.lastRun;
|
LoopPlugin.LastRun lastRun = LoopPlugin.lastRun;
|
||||||
|
@ -942,13 +953,28 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
deviceStatus.created_at = DateUtil.toISOString(new Date());
|
deviceStatus.created_at = DateUtil.toISOString(new Date());
|
||||||
|
|
||||||
deviceStatus.sendToNSClient();
|
deviceStatus.sendToNSClient();
|
||||||
lastDeviceStatusUpload = new Date();
|
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public void uploadDeviceStatus(int sec) {
|
||||||
|
class PostRunnable implements Runnable {
|
||||||
|
public void run() {
|
||||||
|
MainApp.getConfigBuilder().doUploadDeviceStatus();
|
||||||
|
scheduledPost = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// prepare task for execution
|
||||||
|
// cancel waiting task to prevent sending multiple posts
|
||||||
|
if (scheduledPost != null)
|
||||||
|
scheduledPost.cancel(false);
|
||||||
|
Runnable task = new PostRunnable();
|
||||||
|
scheduledPost = worker.schedule(task, sec, TimeUnit.SECONDS);
|
||||||
|
log.debug("Scheduling devicestatus upload in " + sec + " sec");
|
||||||
|
}
|
||||||
|
|
||||||
public void uploadBolusWizardRecord(Treatment t, double glucose, String glucoseType, int carbTime, JSONObject boluscalc) {
|
public void uploadBolusWizardRecord(Treatment t, double glucose, String glucoseType, int carbTime, JSONObject boluscalc) {
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -211,6 +211,17 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
return getDanaRPump().lastConnection.getTime() > 0 && getDanaRPump().isExtendedBolusEnabled;
|
return getDanaRPump().lastConnection.getTime() > 0 && getDanaRPump().isExtendedBolusEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSuspended() {
|
||||||
|
return getDanaRPump().pumpSuspended;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBusy() {
|
||||||
|
if (sExecutionService == null) return false;
|
||||||
|
return sExecutionService.isConnected() || sExecutionService.isConnecting();
|
||||||
|
}
|
||||||
|
|
||||||
// Pump interface
|
// Pump interface
|
||||||
@Override
|
@Override
|
||||||
public boolean isTempBasalInProgress() {
|
public boolean isTempBasalInProgress() {
|
||||||
|
@ -705,7 +716,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
JSONObject extended = new JSONObject();
|
JSONObject extended = new JSONObject();
|
||||||
try {
|
try {
|
||||||
battery.put("percent", getDanaRPump().batteryRemaining);
|
battery.put("percent", getDanaRPump().batteryRemaining);
|
||||||
status.put("status", "normal");
|
status.put("status", getDanaRPump().pumpSuspended ? "suspended" : "normal");
|
||||||
status.put("timestamp", DateUtil.toISOString(getDanaRPump().lastConnection));
|
status.put("timestamp", DateUtil.toISOString(getDanaRPump().lastConnection));
|
||||||
extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION);
|
extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION);
|
||||||
extended.put("PumpIOB", getDanaRPump().iob);
|
extended.put("PumpIOB", getDanaRPump().iob);
|
||||||
|
|
|
@ -276,6 +276,7 @@ public class ExecutionService extends Service {
|
||||||
|
|
||||||
private boolean getPumpStatus() {
|
private boolean getPumpStatus() {
|
||||||
try {
|
try {
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.gettingpumpstatus)));
|
||||||
MsgStatus statusMsg = new MsgStatus();
|
MsgStatus statusMsg = new MsgStatus();
|
||||||
MsgStatusBasic statusBasicMsg = new MsgStatusBasic();
|
MsgStatusBasic statusBasicMsg = new MsgStatusBasic();
|
||||||
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal();
|
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal();
|
||||||
|
@ -336,6 +337,7 @@ public class ExecutionService extends Service {
|
||||||
danaRPump.lastConnection = now;
|
danaRPump.lastConnection = now;
|
||||||
MainApp.bus().post(new EventDanaRNewStatus());
|
MainApp.bus().post(new EventDanaRNewStatus());
|
||||||
MainApp.bus().post(new EventInitializationChanged());
|
MainApp.bus().post(new EventInitializationChanged());
|
||||||
|
MainApp.getConfigBuilder().uploadDeviceStatus(60);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -345,30 +347,37 @@ public class ExecutionService extends Service {
|
||||||
public boolean tempBasal(int percent, int durationInHours) {
|
public boolean tempBasal(int percent, int durationInHours) {
|
||||||
connect("tempBasal");
|
connect("tempBasal");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.settingtempbasal)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(percent, durationInHours));
|
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(percent, durationInHours));
|
||||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean tempBasalStop() {
|
public boolean tempBasalStop() {
|
||||||
connect("tempBasalStop");
|
connect("tempBasalStop");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.stoppingtempbasal)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop());
|
mSerialIOThread.sendMessage(new MsgSetTempBasalStop());
|
||||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean extendedBolus(double insulin, int durationInHalfHours) {
|
public boolean extendedBolus(double insulin, int durationInHalfHours) {
|
||||||
connect("extendedBolus");
|
connect("extendedBolus");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.settingextendedbolus)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(insulin, (byte) (durationInHalfHours & 0xFF)));
|
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(insulin, (byte) (durationInHalfHours & 0xFF)));
|
||||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean extendedBolusStop() {
|
public boolean extendedBolusStop() {
|
||||||
connect("extendedBolusStop");
|
connect("extendedBolusStop");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.stoppingextendedbolus)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop());
|
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop());
|
||||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
||||||
return true;
|
return true;
|
||||||
|
@ -482,6 +491,7 @@ public class ExecutionService extends Service {
|
||||||
public boolean updateBasalsInPump(final NSProfile profile) {
|
public boolean updateBasalsInPump(final NSProfile profile) {
|
||||||
connect("updateBasalsInPump");
|
connect("updateBasalsInPump");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.updatingbasalrates)));
|
||||||
double[] basal = buildDanaRProfileRecord(profile);
|
double[] basal = buildDanaRProfileRecord(profile);
|
||||||
MsgSetBasalProfile msgSet = new MsgSetBasalProfile((byte) 0, basal);
|
MsgSetBasalProfile msgSet = new MsgSetBasalProfile((byte) 0, basal);
|
||||||
mSerialIOThread.sendMessage(msgSet);
|
mSerialIOThread.sendMessage(msgSet);
|
||||||
|
@ -489,6 +499,7 @@ public class ExecutionService extends Service {
|
||||||
mSerialIOThread.sendMessage(msgActivate);
|
mSerialIOThread.sendMessage(msgActivate);
|
||||||
danaRPump.lastSettingsRead = new Date(0); // force read full settings
|
danaRPump.lastSettingsRead = new Date(0); // force read full settings
|
||||||
getPumpStatus();
|
getPumpStatus();
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,20 @@ public class EventDanaRConnectionStatus {
|
||||||
public static final int CONNECTING = 0;
|
public static final int CONNECTING = 0;
|
||||||
public static final int CONNECTED = 1;
|
public static final int CONNECTED = 1;
|
||||||
public static final int DISCONNECTED = 2;
|
public static final int DISCONNECTED = 2;
|
||||||
|
public static final int PERFORMING = 3;
|
||||||
|
|
||||||
public int sStatus = DISCONNECTED;
|
public int sStatus = DISCONNECTED;
|
||||||
public int sSecondsElapsed = 0;
|
public int sSecondsElapsed = 0;
|
||||||
|
public String sAction = "";
|
||||||
|
|
||||||
public EventDanaRConnectionStatus(int status, int secondsElapsed) {
|
public EventDanaRConnectionStatus(int status, int secondsElapsed) {
|
||||||
sStatus = status;
|
sStatus = status;
|
||||||
sSecondsElapsed = secondsElapsed;
|
sSecondsElapsed = secondsElapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EventDanaRConnectionStatus(int status, int secondsElapsed, String action) {
|
||||||
|
sStatus = status;
|
||||||
|
sSecondsElapsed = secondsElapsed;
|
||||||
|
sAction = action;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,6 +211,17 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
||||||
return getDanaRPump().lastConnection.getTime() > 0 && !getDanaRPump().isConfigUD && !getDanaRPump().isEasyModeEnabled && getDanaRPump().isExtendedBolusEnabled;
|
return getDanaRPump().lastConnection.getTime() > 0 && !getDanaRPump().isConfigUD && !getDanaRPump().isEasyModeEnabled && getDanaRPump().isExtendedBolusEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSuspended() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBusy() {
|
||||||
|
if (sExecutionService == null) return false;
|
||||||
|
return sExecutionService.isConnected() || sExecutionService.isConnecting();
|
||||||
|
}
|
||||||
|
|
||||||
// Pump interface
|
// Pump interface
|
||||||
@Override
|
@Override
|
||||||
public boolean isTempBasalInProgress() {
|
public boolean isTempBasalInProgress() {
|
||||||
|
|
|
@ -272,6 +272,7 @@ public class ExecutionService extends Service {
|
||||||
|
|
||||||
private boolean getPumpStatus() {
|
private boolean getPumpStatus() {
|
||||||
try {
|
try {
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.gettingpumpstatus)));
|
||||||
//MsgStatus statusMsg = new MsgStatus();
|
//MsgStatus statusMsg = new MsgStatus();
|
||||||
MsgStatusBasic statusBasicMsg = new MsgStatusBasic();
|
MsgStatusBasic statusBasicMsg = new MsgStatusBasic();
|
||||||
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal();
|
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal();
|
||||||
|
@ -330,6 +331,7 @@ public class ExecutionService extends Service {
|
||||||
danaRKoreanPump.lastConnection = now;
|
danaRKoreanPump.lastConnection = now;
|
||||||
MainApp.bus().post(new EventDanaRNewStatus());
|
MainApp.bus().post(new EventDanaRNewStatus());
|
||||||
MainApp.bus().post(new EventInitializationChanged());
|
MainApp.bus().post(new EventInitializationChanged());
|
||||||
|
MainApp.getConfigBuilder().uploadDeviceStatus(60);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -339,32 +341,40 @@ public class ExecutionService extends Service {
|
||||||
public boolean tempBasal(int percent, int durationInHours) {
|
public boolean tempBasal(int percent, int durationInHours) {
|
||||||
connect("tempBasal");
|
connect("tempBasal");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.settingtempbasal)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(percent, durationInHours));
|
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(percent, durationInHours));
|
||||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean tempBasalStop() {
|
public boolean tempBasalStop() {
|
||||||
connect("tempBasalStop");
|
connect("tempBasalStop");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.stoppingtempbasal)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop());
|
mSerialIOThread.sendMessage(new MsgSetTempBasalStop());
|
||||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean extendedBolus(double insulin, int durationInHalfHours) {
|
public boolean extendedBolus(double insulin, int durationInHalfHours) {
|
||||||
connect("extendedBolus");
|
connect("extendedBolus");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.settingextendedbolus)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(insulin, (byte) (durationInHalfHours & 0xFF)));
|
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(insulin, (byte) (durationInHalfHours & 0xFF)));
|
||||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean extendedBolusStop() {
|
public boolean extendedBolusStop() {
|
||||||
connect("extendedBolusStop");
|
connect("extendedBolusStop");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.stoppingextendedbolus)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop());
|
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop());
|
||||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,11 +486,13 @@ public class ExecutionService extends Service {
|
||||||
public boolean updateBasalsInPump(final NSProfile profile) {
|
public boolean updateBasalsInPump(final NSProfile profile) {
|
||||||
connect("updateBasalsInPump");
|
connect("updateBasalsInPump");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.updatingbasalrates)));
|
||||||
double[] basal = buildDanaRProfileRecord(profile);
|
double[] basal = buildDanaRProfileRecord(profile);
|
||||||
MsgSetSingleBasalProfile msgSet = new MsgSetSingleBasalProfile(basal);
|
MsgSetSingleBasalProfile msgSet = new MsgSetSingleBasalProfile(basal);
|
||||||
mSerialIOThread.sendMessage(msgSet);
|
mSerialIOThread.sendMessage(msgSet);
|
||||||
danaRKoreanPump.lastSettingsRead = new Date(0); // force read full settings
|
danaRKoreanPump.lastSettingsRead = new Date(0); // force read full settings
|
||||||
getPumpStatus();
|
getPumpStatus();
|
||||||
|
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ public class LocalProfileFragment extends Fragment implements FragmentBase {
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!MainApp.getConfigBuilder().isInitialized() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
||||||
profileswitchButton.setVisibility(View.GONE);
|
profileswitchButton.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
profileswitchButton.setVisibility(View.VISIBLE);
|
profileswitchButton.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -228,7 +228,7 @@ public class LoopPlugin implements PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
MainApp.bus().post(new EventLoopUpdateGui());
|
MainApp.bus().post(new EventLoopUpdateGui());
|
||||||
MainApp.getConfigBuilder().uploadDeviceStatus();
|
MainApp.getConfigBuilder().uploadDeviceStatus(15);
|
||||||
} finally {
|
} finally {
|
||||||
if (Config.logFunctionCalls)
|
if (Config.logFunctionCalls)
|
||||||
log.debug("invoke end");
|
log.debug("invoke end");
|
||||||
|
|
|
@ -115,6 +115,16 @@ public class MDIPlugin implements PluginBase, PumpInterface {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSuspended() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBusy() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTempBasalInProgress() {
|
public boolean isTempBasalInProgress() {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -71,6 +71,7 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRConnectionStatus;
|
||||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Loop.events.EventNewOpenLoopNotification;
|
import info.nightscout.androidaps.plugins.Loop.events.EventNewOpenLoopNotification;
|
||||||
import info.nightscout.androidaps.plugins.Objectives.ObjectivesPlugin;
|
import info.nightscout.androidaps.plugins.Objectives.ObjectivesPlugin;
|
||||||
|
@ -116,7 +117,7 @@ public class OverviewFragment extends Fragment {
|
||||||
TextView iobView;
|
TextView iobView;
|
||||||
TextView apsModeView;
|
TextView apsModeView;
|
||||||
TextView tempTargetView;
|
TextView tempTargetView;
|
||||||
TextView initializingView;
|
TextView pumpStatusView;
|
||||||
GraphView bgGraph;
|
GraphView bgGraph;
|
||||||
CheckBox showPredictionView;
|
CheckBox showPredictionView;
|
||||||
|
|
||||||
|
@ -162,7 +163,7 @@ public class OverviewFragment extends Fragment {
|
||||||
baseBasalView = (TextView) view.findViewById(R.id.overview_basebasal);
|
baseBasalView = (TextView) view.findViewById(R.id.overview_basebasal);
|
||||||
basalLayout = (LinearLayout) view.findViewById(R.id.overview_basallayout);
|
basalLayout = (LinearLayout) view.findViewById(R.id.overview_basallayout);
|
||||||
activeProfileView = (TextView) view.findViewById(R.id.overview_activeprofile);
|
activeProfileView = (TextView) view.findViewById(R.id.overview_activeprofile);
|
||||||
initializingView = (TextView) view.findViewById(R.id.overview_initializing);
|
pumpStatusView = (TextView) view.findViewById(R.id.overview_initializing);
|
||||||
|
|
||||||
iobView = (TextView) view.findViewById(R.id.overview_iob);
|
iobView = (TextView) view.findViewById(R.id.overview_iob);
|
||||||
apsModeView = (TextView) view.findViewById(R.id.overview_apsmode);
|
apsModeView = (TextView) view.findViewById(R.id.overview_apsmode);
|
||||||
|
@ -268,7 +269,7 @@ public class OverviewFragment extends Fragment {
|
||||||
finalLastRun.setByPump = applyResult;
|
finalLastRun.setByPump = applyResult;
|
||||||
finalLastRun.lastEnact = new Date();
|
finalLastRun.lastEnact = new Date();
|
||||||
finalLastRun.lastOpenModeAccept = new Date();
|
finalLastRun.lastOpenModeAccept = new Date();
|
||||||
MainApp.getConfigBuilder().uploadDeviceStatus();
|
MainApp.getConfigBuilder().uploadDeviceStatus(15);
|
||||||
ObjectivesPlugin objectivesPlugin = (ObjectivesPlugin) MainApp.getSpecificPlugin(ObjectivesPlugin.class);
|
ObjectivesPlugin objectivesPlugin = (ObjectivesPlugin) MainApp.getSpecificPlugin(ObjectivesPlugin.class);
|
||||||
if (objectivesPlugin != null) {
|
if (objectivesPlugin != null) {
|
||||||
objectivesPlugin.manualEnacts++;
|
objectivesPlugin.manualEnacts++;
|
||||||
|
@ -287,6 +288,19 @@ public class OverviewFragment extends Fragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
pumpStatusView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
if (MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().isInitialized())
|
||||||
|
sHandler.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
MainApp.getConfigBuilder().updateStatus("RefreshClicked");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
updateGUI();
|
updateGUI();
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
@ -443,16 +457,41 @@ public class OverviewFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatusEvent(final EventNewBasalProfile ev) { updateGUIIfVisible(); }
|
public void onStatusEvent(final EventNewBasalProfile ev) {
|
||||||
|
updateGUIIfVisible();
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatusEvent(final EventTempTargetRangeChange ev) {updateGUIIfVisible();}
|
public void onStatusEvent(final EventTempTargetRangeChange ev) {
|
||||||
|
updateGUIIfVisible();
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatusEvent(final EventNewNotification n) { updateNotifications(); }
|
public void onStatusEvent(final EventNewNotification n) {
|
||||||
|
updateNotifications();
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatusEvent(final EventDismissNotification n) { updateNotifications(); }
|
public void onStatusEvent(final EventDismissNotification n) {
|
||||||
|
updateNotifications();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onStatusEvent(final EventDanaRConnectionStatus s) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (activity != null)
|
||||||
|
activity.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (s.sStatus == EventDanaRConnectionStatus.CONNECTING)
|
||||||
|
updatePumpStatus(String.format(getString(R.string.danar_history_connectingfor), s.sSecondsElapsed));
|
||||||
|
else if (s.sStatus == EventDanaRConnectionStatus.PERFORMING)
|
||||||
|
updatePumpStatus(s.sAction);
|
||||||
|
else if (s.sStatus == EventDanaRConnectionStatus.DISCONNECTED)
|
||||||
|
updatePumpStatus(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void hideTempRecommendation() {
|
private void hideTempRecommendation() {
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
|
@ -476,6 +515,35 @@ public class OverviewFragment extends Fragment {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updatePumpStatus(String status) {
|
||||||
|
PumpInterface pump = MainApp.getConfigBuilder();
|
||||||
|
if (status != null) {
|
||||||
|
pumpStatusView.setText(status);
|
||||||
|
pumpStatusView.setVisibility(View.VISIBLE);
|
||||||
|
} else if (pump.isBusy()) {
|
||||||
|
pumpStatusView.setText(R.string.pumpbusy);
|
||||||
|
pumpStatusView.setVisibility(View.VISIBLE);
|
||||||
|
} else if (pump.isSuspended()) {
|
||||||
|
// disable all treatment buttons because we are not able to check constraints without profile
|
||||||
|
wizardButton.setVisibility(View.INVISIBLE);
|
||||||
|
treatmentButton.setVisibility(View.INVISIBLE);
|
||||||
|
quickWizardButton.setVisibility(View.INVISIBLE);
|
||||||
|
pumpStatusView.setText(R.string.pumpsuspendedclicktorefresh);
|
||||||
|
pumpStatusView.setVisibility(View.VISIBLE);
|
||||||
|
} else if (!pump.isInitialized()) {
|
||||||
|
// disable all treatment buttons because we are not able to check constraints without profile
|
||||||
|
wizardButton.setVisibility(View.INVISIBLE);
|
||||||
|
treatmentButton.setVisibility(View.INVISIBLE);
|
||||||
|
quickWizardButton.setVisibility(View.INVISIBLE);
|
||||||
|
pumpStatusView.setText(R.string.waitingforpump);
|
||||||
|
pumpStatusView.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
wizardButton.setVisibility(View.VISIBLE);
|
||||||
|
treatmentButton.setVisibility(View.VISIBLE);
|
||||||
|
pumpStatusView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
public void updateGUI() {
|
public void updateGUI() {
|
||||||
updateNotifications();
|
updateNotifications();
|
||||||
|
@ -483,11 +551,11 @@ public class OverviewFragment extends Fragment {
|
||||||
BgReading lastBG = GlucoseStatus.lastBg();
|
BgReading lastBG = GlucoseStatus.lastBg();
|
||||||
|
|
||||||
if (MainApp.getConfigBuilder() == null || MainApp.getConfigBuilder().getActiveProfile() == null || MainApp.getConfigBuilder().getActiveProfile().getProfile() == null) {// app not initialized yet
|
if (MainApp.getConfigBuilder() == null || MainApp.getConfigBuilder().getActiveProfile() == null || MainApp.getConfigBuilder().getActiveProfile().getProfile() == null) {// app not initialized yet
|
||||||
initializingView.setText(R.string.noprofileset);
|
pumpStatusView.setText(R.string.noprofileset);
|
||||||
initializingView.setVisibility(View.VISIBLE);
|
pumpStatusView.setVisibility(View.VISIBLE);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
initializingView.setVisibility(View.GONE);
|
pumpStatusView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip if not initialized yet
|
// Skip if not initialized yet
|
||||||
|
@ -504,7 +572,7 @@ public class OverviewFragment extends Fragment {
|
||||||
apsModeView.setBackgroundResource(R.drawable.loopmodeborder);
|
apsModeView.setBackgroundResource(R.drawable.loopmodeborder);
|
||||||
apsModeView.setTextColor(Color.BLACK);
|
apsModeView.setTextColor(Color.BLACK);
|
||||||
final LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
|
final LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
|
||||||
if(activeloop != null && activeloop.isEnabled(activeloop.getType())) {
|
if (activeloop != null && activeloop.isEnabled(activeloop.getType())) {
|
||||||
if (MainApp.getConfigBuilder().isClosedModeEnabled()) {
|
if (MainApp.getConfigBuilder().isClosedModeEnabled()) {
|
||||||
apsModeView.setText(MainApp.sResources.getString(R.string.closedloop));
|
apsModeView.setText(MainApp.sResources.getString(R.string.closedloop));
|
||||||
} else {
|
} else {
|
||||||
|
@ -522,10 +590,10 @@ public class OverviewFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View view) {
|
public boolean onLongClick(View view) {
|
||||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
||||||
if (activeloop == null){
|
if (activeloop == null) {
|
||||||
log.error("no active loop?");
|
log.error("no active loop?");
|
||||||
return true;
|
return true;
|
||||||
} else if (activeloop.isEnabled(PluginBase.LOOP)){
|
} else if (activeloop.isEnabled(PluginBase.LOOP)) {
|
||||||
activeloop.setFragmentEnabled(PluginBase.LOOP, false);
|
activeloop.setFragmentEnabled(PluginBase.LOOP, false);
|
||||||
activeloop.setFragmentVisible(PluginBase.LOOP, false);
|
activeloop.setFragmentVisible(PluginBase.LOOP, false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -578,7 +646,7 @@ public class OverviewFragment extends Fragment {
|
||||||
showAcceptButton = showAcceptButton && (finalLastRun.lastOpenModeAccept == null || finalLastRun.lastOpenModeAccept.getTime() < finalLastRun.lastAPSRun.getTime()); // never accepted or before last result
|
showAcceptButton = showAcceptButton && (finalLastRun.lastOpenModeAccept == null || finalLastRun.lastOpenModeAccept.getTime() < finalLastRun.lastAPSRun.getTime()); // never accepted or before last result
|
||||||
showAcceptButton = showAcceptButton && finalLastRun.constraintsProcessed.changeRequested; // change is requested
|
showAcceptButton = showAcceptButton && finalLastRun.constraintsProcessed.changeRequested; // change is requested
|
||||||
|
|
||||||
if (showAcceptButton && pump.isInitialized() && ConfigBuilderPlugin.getActiveLoop() != null) {
|
if (showAcceptButton && pump.isInitialized() && !pump.isSuspended() && ConfigBuilderPlugin.getActiveLoop() != null) {
|
||||||
acceptTempLayout.setVisibility(View.VISIBLE);
|
acceptTempLayout.setVisibility(View.VISIBLE);
|
||||||
acceptTempButton.setText(getContext().getString(R.string.setbasalquestion) + "\n" + finalLastRun.constraintsProcessed);
|
acceptTempButton.setText(getContext().getString(R.string.setbasalquestion) + "\n" + finalLastRun.constraintsProcessed);
|
||||||
} else {
|
} else {
|
||||||
|
@ -644,7 +712,7 @@ public class OverviewFragment extends Fragment {
|
||||||
|
|
||||||
// QuickWizard button
|
// QuickWizard button
|
||||||
QuickWizard.QuickWizardEntry quickWizardEntry = getPlugin().quickWizard.getActive();
|
QuickWizard.QuickWizardEntry quickWizardEntry = getPlugin().quickWizard.getActive();
|
||||||
if (quickWizardEntry != null && lastBG != null && pump.isInitialized()) {
|
if (quickWizardEntry != null && lastBG != null && pump.isInitialized() && !pump.isSuspended()) {
|
||||||
quickWizardButton.setVisibility(View.VISIBLE);
|
quickWizardButton.setVisibility(View.VISIBLE);
|
||||||
String text = MainApp.sResources.getString(R.string.bolus) + ": " + quickWizardEntry.buttonText() + " " + DecimalFormatter.to0Decimal(quickWizardEntry.carbs()) + "g";
|
String text = MainApp.sResources.getString(R.string.bolus) + ": " + quickWizardEntry.buttonText() + " " + DecimalFormatter.to0Decimal(quickWizardEntry.carbs()) + "g";
|
||||||
BolusWizard wizard = new BolusWizard();
|
BolusWizard wizard = new BolusWizard();
|
||||||
|
@ -663,7 +731,7 @@ public class OverviewFragment extends Fragment {
|
||||||
bgView.setText(lastBG.valueToUnitsToString(profile.getUnits()));
|
bgView.setText(lastBG.valueToUnitsToString(profile.getUnits()));
|
||||||
arrowView.setText(lastBG.directionToSymbol());
|
arrowView.setText(lastBG.directionToSymbol());
|
||||||
GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData();
|
GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData();
|
||||||
if (glucoseStatus != null){
|
if (glucoseStatus != null) {
|
||||||
deltaView.setText("Δ " + NSProfile.toUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) + " " + units);
|
deltaView.setText("Δ " + NSProfile.toUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) + " " + units);
|
||||||
avgdeltaView.setText("øΔ15m: " + NSProfile.toUnitsString(glucoseStatus.short_avgdelta, glucoseStatus.short_avgdelta * Constants.MGDL_TO_MMOLL, units) +
|
avgdeltaView.setText("øΔ15m: " + NSProfile.toUnitsString(glucoseStatus.short_avgdelta, glucoseStatus.short_avgdelta * Constants.MGDL_TO_MMOLL, units) +
|
||||||
" øΔ40m: " + NSProfile.toUnitsString(glucoseStatus.long_avgdelta, glucoseStatus.long_avgdelta * Constants.MGDL_TO_MMOLL, units));
|
" øΔ40m: " + NSProfile.toUnitsString(glucoseStatus.long_avgdelta, glucoseStatus.long_avgdelta * Constants.MGDL_TO_MMOLL, units));
|
||||||
|
@ -717,7 +785,7 @@ public class OverviewFragment extends Fragment {
|
||||||
long fromTime;
|
long fromTime;
|
||||||
long endTime;
|
long endTime;
|
||||||
if (showPrediction) {
|
if (showPrediction) {
|
||||||
int predHours = (int) (Math.ceil(((DetermineBasalResultAMA)finalLastRun.constraintsProcessed).getLatestPredictionsTime() - new Date().getTime()) / (60 * 60 * 1000));
|
int predHours = (int) (Math.ceil(((DetermineBasalResultAMA) finalLastRun.constraintsProcessed).getLatestPredictionsTime() - new Date().getTime()) / (60 * 60 * 1000));
|
||||||
predHours = Math.min(2, predHours);
|
predHours = Math.min(2, predHours);
|
||||||
predHours = Math.max(0, predHours);
|
predHours = Math.max(0, predHours);
|
||||||
hoursToFetch = (int) (6 - predHours);
|
hoursToFetch = (int) (6 - predHours);
|
||||||
|
@ -734,11 +802,11 @@ public class OverviewFragment extends Fragment {
|
||||||
Double lowLine = SafeParse.stringToDouble(prefs.getString("low_mark", "0"));
|
Double lowLine = SafeParse.stringToDouble(prefs.getString("low_mark", "0"));
|
||||||
Double highLine = SafeParse.stringToDouble(prefs.getString("high_mark", "0"));
|
Double highLine = SafeParse.stringToDouble(prefs.getString("high_mark", "0"));
|
||||||
|
|
||||||
if (lowLine < 1){
|
if (lowLine < 1) {
|
||||||
lowLine = NSProfile.fromMgdlToUnits(OverviewPlugin.bgTargetLow, units);
|
lowLine = NSProfile.fromMgdlToUnits(OverviewPlugin.bgTargetLow, units);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(highLine < 1){
|
if (highLine < 1) {
|
||||||
highLine = NSProfile.fromMgdlToUnits(OverviewPlugin.bgTargetHigh, units);
|
highLine = NSProfile.fromMgdlToUnits(OverviewPlugin.bgTargetHigh, units);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -847,7 +915,7 @@ public class OverviewFragment extends Fragment {
|
||||||
}
|
}
|
||||||
maxBgValue = NSProfile.fromMgdlToUnits(maxBgValue, units);
|
maxBgValue = NSProfile.fromMgdlToUnits(maxBgValue, units);
|
||||||
maxBgValue = units.equals(Constants.MGDL) ? Round.roundTo(maxBgValue, 40d) + 80 : Round.roundTo(maxBgValue, 2d) + 4;
|
maxBgValue = units.equals(Constants.MGDL) ? Round.roundTo(maxBgValue, 40d) + 80 : Round.roundTo(maxBgValue, 2d) + 4;
|
||||||
if(highLine > maxBgValue) maxBgValue = highLine;
|
if (highLine > maxBgValue) maxBgValue = highLine;
|
||||||
Integer numOfHorizLines = units.equals(Constants.MGDL) ? (int) (maxBgValue / 40 + 1) : (int) (maxBgValue / 2 + 1);
|
Integer numOfHorizLines = units.equals(Constants.MGDL) ? (int) (maxBgValue / 40 + 1) : (int) (maxBgValue / 2 + 1);
|
||||||
|
|
||||||
BgReading[] inRange = new BgReading[inRangeArray.size()];
|
BgReading[] inRange = new BgReading[inRangeArray.size()];
|
||||||
|
@ -935,20 +1003,7 @@ public class OverviewFragment extends Fragment {
|
||||||
bgGraph.getGridLabelRenderer().setVerticalLabelsSecondScaleColor(ContextCompat.getColor(MainApp.instance(), R.color.background_material_dark)); // same color as backround = hide
|
bgGraph.getGridLabelRenderer().setVerticalLabelsSecondScaleColor(ContextCompat.getColor(MainApp.instance(), R.color.background_material_dark)); // same color as backround = hide
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pump not initialized message
|
updatePumpStatus(null);
|
||||||
if (!pump.isInitialized()) {
|
|
||||||
// disable all treatment buttons because we are not able to check constraints without profile
|
|
||||||
wizardButton.setVisibility(View.INVISIBLE);
|
|
||||||
treatmentButton.setVisibility(View.INVISIBLE);
|
|
||||||
quickWizardButton.setVisibility(View.INVISIBLE);
|
|
||||||
initializingView.setText(R.string.waitingforpump);
|
|
||||||
initializingView.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
|
||||||
wizardButton.setVisibility(View.VISIBLE);
|
|
||||||
treatmentButton.setVisibility(View.VISIBLE);
|
|
||||||
initializingView.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Notifications
|
//Notifications
|
||||||
|
@ -1040,5 +1095,4 @@ public class OverviewFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,7 @@ public class SimpleProfileFragment extends Fragment implements FragmentBase {
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!MainApp.getConfigBuilder().isInitialized() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
||||||
profileswitchButton.setVisibility(View.GONE);
|
profileswitchButton.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
profileswitchButton.setVisibility(View.VISIBLE);
|
profileswitchButton.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -124,6 +124,16 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSuspended() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBusy() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTempBasalInProgress() {
|
public boolean isTempBasalInProgress() {
|
||||||
return getTempBasal() != null;
|
return getTempBasal() != null;
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
t.start();
|
t.start();
|
||||||
} else if (isStatusOutdated) {
|
} else if (isStatusOutdated && !pump.isBusy()) {
|
||||||
Thread t = new Thread(new Runnable() {
|
Thread t = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -66,7 +66,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
t.start();
|
t.start();
|
||||||
} else if (isBasalOutdated) {
|
} else if (isBasalOutdated && !pump.isBusy()) {
|
||||||
Thread t = new Thread(new Runnable() {
|
Thread t = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -246,7 +246,7 @@
|
||||||
<string name="overview_bolusprogress_stoppressed">НАТИСНАТ СТОП</string>
|
<string name="overview_bolusprogress_stoppressed">НАТИСНАТ СТОП</string>
|
||||||
<string name="openapsma_target_bg">КЗ цел за изчисления</string>
|
<string name="openapsma_target_bg">КЗ цел за изчисления</string>
|
||||||
<string name="pumpbusy">Помпата е заета</string>
|
<string name="pumpbusy">Помпата е заета</string>
|
||||||
<string name="waitingforpump">Изчаква за помпа</string>
|
<string name="waitingforpump">Изчаква за помпа. Click to refresh.</string>
|
||||||
<string name="wrongpumppassword">Грешна парола за помпата!</string>
|
<string name="wrongpumppassword">Грешна парола за помпата!</string>
|
||||||
<string name="youareonallowedlimit">Достигнахте лимита</string>
|
<string name="youareonallowedlimit">Достигнахте лимита</string>
|
||||||
<string name="danar_alarm">аларма</string>
|
<string name="danar_alarm">аларма</string>
|
||||||
|
|
|
@ -249,7 +249,7 @@
|
||||||
<string name="danar_glucose">glykémie</string>
|
<string name="danar_glucose">glykémie</string>
|
||||||
<string name="danar_history">Historie</string>
|
<string name="danar_history">Historie</string>
|
||||||
<string name="danar_history_alarm">Alarmy</string>
|
<string name="danar_history_alarm">Alarmy</string>
|
||||||
<string name="danar_history_basalhours">Hodinvé bazály</string>
|
<string name="danar_history_basalhours">Hodinové bazály</string>
|
||||||
<string name="danar_history_bolus">Bolusy</string>
|
<string name="danar_history_bolus">Bolusy</string>
|
||||||
<string name="danar_history_carbohydrates">Sacharidy</string>
|
<string name="danar_history_carbohydrates">Sacharidy</string>
|
||||||
<string name="danar_history_connectingfor" formatted="false">Připojování %d sec</string>
|
<string name="danar_history_connectingfor" formatted="false">Připojování %d sec</string>
|
||||||
|
@ -271,7 +271,7 @@
|
||||||
<string name="overview_bolusprogress_stop">Stop</string>
|
<string name="overview_bolusprogress_stop">Stop</string>
|
||||||
<string name="overview_bolusprogress_stoped">Zastaveno</string>
|
<string name="overview_bolusprogress_stoped">Zastaveno</string>
|
||||||
<string name="overview_bolusprogress_stoppressed">STISKNUTO STOP</string>
|
<string name="overview_bolusprogress_stoppressed">STISKNUTO STOP</string>
|
||||||
<string name="waitingforpump">Čekání na pumpu</string>
|
<string name="waitingforpump">Čekání na pumpu. Klik pro připojení.</string>
|
||||||
<string name="overview_bolusprogress_goingtodeliver" formatted="false">Podávání %.2fU inzulínu</string>
|
<string name="overview_bolusprogress_goingtodeliver" formatted="false">Podávání %.2fU inzulínu</string>
|
||||||
<string name="objectives_0_gate">Zkontrolovat, zda jsou glykémie a údaje z pumpy viditelné v Nightscoutu</string>
|
<string name="objectives_0_gate">Zkontrolovat, zda jsou glykémie a údaje z pumpy viditelné v Nightscoutu</string>
|
||||||
<string name="objectives_0_objective">Nastavit vizualizaci a monitoring, analyzovat bazály a koeficienty</string>
|
<string name="objectives_0_objective">Nastavit vizualizaci a monitoring, analyzovat bazály a koeficienty</string>
|
||||||
|
@ -457,6 +457,6 @@
|
||||||
<string name="xdripnotinstalled">xDrip+ není nainstalován</string>
|
<string name="xdripnotinstalled">xDrip+ není nainstalován</string>
|
||||||
<string name="smscommunicator_calibrationfailed">xDrip nepřijímá kalibrace</string>
|
<string name="smscommunicator_calibrationfailed">xDrip nepřijímá kalibrace</string>
|
||||||
<string name="smscommunicator_calibrationreplywithcode" formatted="false">Odeslání kalibrace %.2f potvrďte kódem %s</string>
|
<string name="smscommunicator_calibrationreplywithcode" formatted="false">Odeslání kalibrace %.2f potvrďte kódem %s</string>
|
||||||
<string name="smscommunicator_calibrationsent">Kalibrace odeslána</string>
|
<string name="smscommunicator_calibrationsent">Kalibrace odeslána. Příjem musí být v xDripu povolený.</string>
|
||||||
<string name="smscommunicator_remotecalibrationnotallowed">Vzdálené kalibrace nejsou povoleny</string>
|
<string name="smscommunicator_remotecalibrationnotallowed">Vzdálené kalibrace nejsou povoleny</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -242,7 +242,7 @@
|
||||||
<string name="ko_lang">Korean</string>
|
<string name="ko_lang">Korean</string>
|
||||||
<string name="youareonallowedlimit">Limit erreicht</string>
|
<string name="youareonallowedlimit">Limit erreicht</string>
|
||||||
<string name="wrongpumppassword">Falsches Pumpen-Passwort!</string>
|
<string name="wrongpumppassword">Falsches Pumpen-Passwort!</string>
|
||||||
<string name="waitingforpump">Warte auf Pumpe</string>
|
<string name="waitingforpump">Warte auf Pumpe. Click to refresh.</string>
|
||||||
<string name="correctionbous">Korr</string>
|
<string name="correctionbous">Korr</string>
|
||||||
<string name="bolusdelivering">Abgabe %.2fU</string>
|
<string name="bolusdelivering">Abgabe %.2fU</string>
|
||||||
<string name="bolusdelivered">%.2fU Bolus erfolgreich abgegeben</string>
|
<string name="bolusdelivered">%.2fU Bolus erfolgreich abgegeben</string>
|
||||||
|
|
|
@ -283,7 +283,7 @@
|
||||||
<string name="occlusion">Oclusión</string>
|
<string name="occlusion">Oclusión</string>
|
||||||
<string name="overview_bolusprogress_stop">Detener</string>
|
<string name="overview_bolusprogress_stop">Detener</string>
|
||||||
<string name="overview_bolusprogress_stoppressed">Parar pulsado</string>
|
<string name="overview_bolusprogress_stoppressed">Parar pulsado</string>
|
||||||
<string name="waitingforpump">Esperando bomba</string>
|
<string name="waitingforpump">Esperando bomba. Click to refresh.</string>
|
||||||
<string formatted="false" name="overview_bolusprogress_goingtodeliver">Va a entregar% .2fU</string>
|
<string formatted="false" name="overview_bolusprogress_goingtodeliver">Va a entregar% .2fU</string>
|
||||||
<string name="objectives_0_objective">Configuración de visualización y monitoreo, y el análisis de los basales y ratios</string>
|
<string name="objectives_0_objective">Configuración de visualización y monitoreo, y el análisis de los basales y ratios</string>
|
||||||
<string name="objectives_0_gate">Comprobar que los datos de BG están disponibles en Nightscout, y que los datos de la bomba de insulina se están subiendo</string>
|
<string name="objectives_0_gate">Comprobar que los datos de BG están disponibles en Nightscout, y que los datos de la bomba de insulina se están subiendo</string>
|
||||||
|
|
|
@ -286,7 +286,7 @@
|
||||||
<string name="occlusion">막힘</string>
|
<string name="occlusion">막힘</string>
|
||||||
<string name="overview_bolusprogress_stop">정지</string>
|
<string name="overview_bolusprogress_stop">정지</string>
|
||||||
<string name="overview_bolusprogress_stoppressed">정지 누름</string>
|
<string name="overview_bolusprogress_stoppressed">정지 누름</string>
|
||||||
<string name="waitingforpump">펌프를 기다리고 있습니다.</string>
|
<string name="waitingforpump">펌프를 기다리고 있습니다. Click to refresh.</string>
|
||||||
<string name="overview_bolusprogress_goingtodeliver" formatted="false">%.2fU을 주입합니다</string>
|
<string name="overview_bolusprogress_goingtodeliver" formatted="false">%.2fU을 주입합니다</string>
|
||||||
<string name="objectives_0_objective">나이트스카우트를 세팅하고, 기초주입과 비율을 분석한다.</string>
|
<string name="objectives_0_objective">나이트스카우트를 세팅하고, 기초주입과 비율을 분석한다.</string>
|
||||||
<string name="objectives_0_gate">나이트스카우트에서 혈당 데이터가 잘 들어오는지, 펌프데이터가 업로드 되는지 확인한다.</string>
|
<string name="objectives_0_gate">나이트스카우트에서 혈당 데이터가 잘 들어오는지, 펌프데이터가 업로드 되는지 확인한다.</string>
|
||||||
|
|
|
@ -301,7 +301,7 @@
|
||||||
<string name="occlusion">Occlusion</string>
|
<string name="occlusion">Occlusion</string>
|
||||||
<string name="overview_bolusprogress_stop">Stop</string>
|
<string name="overview_bolusprogress_stop">Stop</string>
|
||||||
<string name="overview_bolusprogress_stoppressed">STOP PRESSED</string>
|
<string name="overview_bolusprogress_stoppressed">STOP PRESSED</string>
|
||||||
<string name="waitingforpump">Waiting for pump</string>
|
<string name="waitingforpump">Waiting for pump. Click to refresh.</string>
|
||||||
<string name="overview_bolusprogress_goingtodeliver" formatted="false">Going to deliver %.2fU</string>
|
<string name="overview_bolusprogress_goingtodeliver" formatted="false">Going to deliver %.2fU</string>
|
||||||
<string name="objectives_0_objective">Setting up visualization and monitoring, and analyzing basals and ratios</string>
|
<string name="objectives_0_objective">Setting up visualization and monitoring, and analyzing basals and ratios</string>
|
||||||
<string name="objectives_0_gate">Verify that BG is available in Nightscout, and pump insulin data is being uploaded</string>
|
<string name="objectives_0_gate">Verify that BG is available in Nightscout, and pump insulin data is being uploaded</string>
|
||||||
|
@ -486,7 +486,16 @@
|
||||||
<string name="xdripnotinstalled">xDrip+ not installed</string>
|
<string name="xdripnotinstalled">xDrip+ not installed</string>
|
||||||
<string name="calibrationsent">Calibration sent to xDrip</string>
|
<string name="calibrationsent">Calibration sent to xDrip</string>
|
||||||
<string name="smscommunicator_remotecalibrationnotallowed">Remote calibration not allowed</string>
|
<string name="smscommunicator_remotecalibrationnotallowed">Remote calibration not allowed</string>
|
||||||
<string name="smscommunicator_calibrationsent">Calibration sent</string>
|
<string name="smscommunicator_calibrationsent">Calibration sent. Receiving must be enabled in xDrip.</string>
|
||||||
<string name="smscommunicator_calibrationfailed">xDrip is not receiving calibrations</string>
|
<string name="smscommunicator_calibrationfailed">xDrip is not receiving calibrations</string>
|
||||||
<string name="dont_show_again">Don\'t show again</string>
|
<string name="dont_show_again">Don\'t show again</string>
|
||||||
|
<string name="pumpsuspendedclicktorefresh">Pump suspended. Click to refresh state</string>
|
||||||
|
<string name="pumpsuspended">Pump suspended</string>
|
||||||
|
<string name="gettingpumpstatus">Getting pump status</string>
|
||||||
|
<string name="settingtempbasal">Setting temp basal</string>
|
||||||
|
<string name="stoppingtempbasal">Stopping temp basal</string>
|
||||||
|
<string name="settingextendedbolus">Setting extended bolus</string>
|
||||||
|
<string name="stoppingextendedbolus">Stopping extended bolus</string>
|
||||||
|
<string name="updatingbasalrates">Updating basal rates</string>
|
||||||
|
<string name="disconnecting">Disconnecting</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue