Merge branch 'dev' into smsrefactor

This commit is contained in:
Milos Kozak 2019-03-13 19:22:02 +01:00
commit 11ee9f54c3
19 changed files with 343 additions and 87 deletions

View file

@ -2,9 +2,13 @@ package info.nightscout.androidaps.interfaces;
import org.json.JSONObject;
import java.util.List;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
/**
* Created by mike on 04.06.2016.
@ -61,4 +65,9 @@ public interface PumpInterface {
PumpEnactResult loadTDDs();
List<CustomAction> getCustomActions();
void executeCustomAction(CustomActionType customActionType);
}

View file

@ -34,6 +34,7 @@ import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.events.EventNewBG;
import info.nightscout.androidaps.events.EventTempTargetChange;
import info.nightscout.androidaps.interfaces.APSInterface;
import info.nightscout.androidaps.interfaces.Constraint;
import info.nightscout.androidaps.interfaces.PluginBase;
@ -175,6 +176,14 @@ public class LoopPlugin extends PluginBase {
return loopSuspendedTill;
}
@Subscribe
public void onStatusEvent(final EventTempTargetChange ev) {
new Thread(() -> invoke("EventTempTargetChange", true)).start();
FabricPrivacy.getInstance().logCustom(new CustomEvent("TT_Loop_Run"));
}
public void suspendTo(long endTime) {
loopSuspendedTill = endTime;
isSuperBolus = false;

View file

@ -42,6 +42,7 @@ import info.nightscout.androidaps.interfaces.SensitivityInterface;
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
import info.nightscout.androidaps.plugins.insulin.InsulinOrefRapidActingPlugin;
import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin;
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref0Plugin;
import info.nightscout.androidaps.utils.FabricPrivacy;

View file

@ -3,16 +3,23 @@ package info.nightscout.androidaps.plugins.general.actions;
import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.activities.HistoryBrowseActivity;
import info.nightscout.androidaps.MainApp;
@ -25,19 +32,22 @@ import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventRefreshOverview;
import info.nightscout.androidaps.events.EventTempBasalChange;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.actions.ActionsPlugin;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.dialogs.FillDialog;
import info.nightscout.androidaps.plugins.general.actions.dialogs.NewExtendedBolusDialog;
import info.nightscout.androidaps.plugins.general.actions.dialogs.NewTempBasalDialog;
import info.nightscout.androidaps.plugins.general.careportal.CareportalFragment;
import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog;
import info.nightscout.androidaps.plugins.general.careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.SingleClickButton;
/**
* A simple {@link Fragment} subclass.
*/
@ -49,6 +59,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
return actionsPlugin;
}
View actionsFragmentView;
SingleClickButton profileSwitch;
SingleClickButton tempTarget;
SingleClickButton extendedBolus;
@ -59,6 +70,9 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
SingleClickButton tddStats;
SingleClickButton history;
private Map<String,CustomAction> pumpCustomActions = new HashMap<>();
private List<SingleClickButton> pumpCustomButtons = new ArrayList<>();
public ActionsFragment() {
super();
}
@ -90,6 +104,8 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
history.setOnClickListener(this);
tddStats.setOnClickListener(this);
actionsFragmentView = view;
updateGUI();
return view;
} catch (Exception e) {
@ -192,13 +208,87 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
else
tempTarget.setVisibility(View.VISIBLE);
if (!ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().supportsTDDs) tddStats.setVisibility(View.GONE);
else tddStats.setVisibility(View.VISIBLE);
if (!pump.getPumpDescription().supportsTDDs)
tddStats.setVisibility(View.GONE);
else
tddStats.setVisibility(View.VISIBLE);
checkPumpCustomActions();
}
});
}
View.OnClickListener pumpCustomActionsListener = v -> {
SingleClickButton btn = (SingleClickButton)v;
CustomAction customAction = this.pumpCustomActions.get(btn.getText().toString());
ConfigBuilderPlugin.getPlugin().getActivePump().executeCustomAction(customAction.getCustomActionType());
};
private void checkPumpCustomActions() {
PumpInterface activePump = ConfigBuilderPlugin.getPlugin().getActivePump();
removePumpCustomActions();
if (activePump == null) {
return;
}
List<CustomAction> customActions = activePump.getCustomActions();
if (customActions != null && customActions.size()>0) {
LinearLayout ll = actionsFragmentView.findViewById(R.id.action_buttons_layout);
for (CustomAction customAction : customActions) {
SingleClickButton btn = new SingleClickButton(getContext(), null, android.R.attr.buttonStyle);
btn.setText(MainApp.gs(customAction.getName()));
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 0.5f);
layoutParams.setMargins(20, 8, 20, 8); // 10,3,10,3
btn.setLayoutParams(layoutParams);
btn.setOnClickListener(pumpCustomActionsListener);
Drawable top = getResources().getDrawable(customAction.getIconResourceId());
btn.setCompoundDrawablesWithIntrinsicBounds(null, top, null, null);
ll.addView(btn);
this.pumpCustomActions.put(MainApp.gs(customAction.getName()), customAction);
this.pumpCustomButtons.add(btn);
}
}
}
private void removePumpCustomActions() {
if (pumpCustomActions.size()==0)
return;
LinearLayout ll = actionsFragmentView.findViewById(R.id.action_buttons_layout);
for (SingleClickButton customButton : pumpCustomButtons) {
ll.removeView(customButton);
}
pumpCustomButtons.clear();
pumpCustomActions.clear();
}
@Override
public void onClick(View view) {
FragmentManager manager = getFragmentManager();

View file

@ -0,0 +1,47 @@
package info.nightscout.androidaps.plugins.general.actions.defs;
import info.nightscout.androidaps.R;
/**
* Created by andy on 9/20/18.
*/
public class CustomAction {
private int name;
private String iconName;
private CustomActionType customActionType;
private int iconResourceId;
public CustomAction(int nameResourceId, CustomActionType actionType) {
this.name = nameResourceId;
this.customActionType = actionType;
this.iconResourceId = R.drawable.icon_actions_profileswitch;
}
public CustomAction(int nameResourceId, CustomActionType actionType, int iconResourceId) {
this.name = nameResourceId;
this.customActionType = actionType;
this.iconResourceId = iconResourceId;
}
public int getName() {
return name;
}
public CustomActionType getCustomActionType() {
return customActionType;
}
public int getIconResourceId() {
return iconResourceId;
}
}

View file

@ -0,0 +1,11 @@
package info.nightscout.androidaps.plugins.general.actions.defs;
/**
* Created by andy on 9/20/18.
*/
public interface CustomActionType {
String getKey();
}

View file

@ -41,6 +41,7 @@ import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.MidnightTime;
import info.nightscout.androidaps.utils.Profiler;
import info.nightscout.androidaps.utils.SP;
import info.nightscout.androidaps.utils.T;
import static info.nightscout.androidaps.utils.DateUtil.now;
import static java.util.Calendar.MINUTE;
@ -61,7 +62,7 @@ public class IobCobOref1Thread extends Thread {
private PowerManager.WakeLock mWakeLock;
public IobCobOref1Thread(IobCobCalculatorPlugin plugin, String from, long end, boolean bgDataReload, boolean limitDataToOldestAvailable, Event cause) {
IobCobOref1Thread(IobCobCalculatorPlugin plugin, String from, long end, boolean bgDataReload, boolean limitDataToOldestAvailable, Event cause) {
super();
this.iobCobCalculatorPlugin = plugin;
@ -72,13 +73,15 @@ public class IobCobOref1Thread extends Thread {
this.end = end;
PowerManager powerManager = (PowerManager) MainApp.instance().getApplicationContext().getSystemService(Context.POWER_SERVICE);
mWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "iobCobThread");
if (powerManager != null)
mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, MainApp.gs(R.string.app_name) + ":iobCobThread");
}
@Override
public final void run() {
long start = DateUtil.now();
mWakeLock.acquire();
if (mWakeLock != null)
mWakeLock.acquire(T.mins(10).msecs());
try {
if (L.isEnabled(L.AUTOSENS))
log.debug("AUTOSENSDATA thread started: " + from);
@ -173,7 +176,7 @@ public class IobCobOref1Thread extends Thread {
double bgi = -iob.activity * sens * 5;
double deviation = delta - bgi;
double avgDeviation = Math.round((avgDelta - bgi) * 1000) / 1000;
double avgDeviation = Math.round((avgDelta - bgi) * 1000) / 1000d;
double slopeFromMaxDeviation = 0;
double slopeFromMinDeviation = 999;
@ -394,7 +397,8 @@ public class IobCobOref1Thread extends Thread {
MainApp.bus().post(new EventAutosensCalculationFinished(cause));
}).start();
} finally {
mWakeLock.release();
if (mWakeLock != null)
mWakeLock.release();
MainApp.bus().post(new EventIobCalculationProgress(""));
if (L.isEnabled(L.AUTOSENS)) {
log.debug("AUTOSENSDATA thread ended: " + from);

View file

@ -41,6 +41,7 @@ import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.MidnightTime;
import info.nightscout.androidaps.utils.Profiler;
import info.nightscout.androidaps.utils.SP;
import info.nightscout.androidaps.utils.T;
import static info.nightscout.androidaps.utils.DateUtil.now;
@ -60,7 +61,7 @@ public class IobCobThread extends Thread {
private PowerManager.WakeLock mWakeLock;
public IobCobThread(IobCobCalculatorPlugin plugin, String from, long end, boolean bgDataReload, boolean limitDataToOldestAvailable, Event cause) {
IobCobThread(IobCobCalculatorPlugin plugin, String from, long end, boolean bgDataReload, boolean limitDataToOldestAvailable, Event cause) {
super();
this.iobCobCalculatorPlugin = plugin;
@ -71,13 +72,15 @@ public class IobCobThread extends Thread {
this.end = end;
PowerManager powerManager = (PowerManager) MainApp.instance().getApplicationContext().getSystemService(Context.POWER_SERVICE);
mWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "iobCobThread");
if (powerManager != null)
mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, MainApp.gs(R.string.app_name) + ":iobCobThread");
}
@Override
public final void run() {
long start = DateUtil.now();
mWakeLock.acquire();
if (mWakeLock != null)
mWakeLock.acquire(T.mins(10).msecs());
try {
if (L.isEnabled(L.AUTOSENS))
log.debug("AUTOSENSDATA thread started: " + from);
@ -172,7 +175,7 @@ public class IobCobThread extends Thread {
double bgi = -iob.activity * sens * 5;
double deviation = delta - bgi;
double avgDeviation = Math.round((avgDelta - bgi) * 1000) / 1000;
double avgDeviation = Math.round((avgDelta - bgi) * 1000) / 1000d;
double slopeFromMaxDeviation = 0;
double slopeFromMinDeviation = 999;
@ -321,7 +324,8 @@ public class IobCobThread extends Thread {
MainApp.bus().post(new EventAutosensCalculationFinished(cause));
}).start();
} finally {
mWakeLock.release();
if (mWakeLock != null)
mWakeLock.release();
MainApp.bus().post(new EventIobCalculationProgress(""));
if (L.isEnabled(L.AUTOSENS)) {
log.debug("AUTOSENSDATA thread ended: " + from);

View file

@ -42,6 +42,8 @@ import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderFragment;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
@ -64,7 +66,6 @@ import info.nightscout.androidaps.plugins.treatments.Treatment;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.SP;
/**
* Created by mike on 05.08.2016.
*/
@ -1379,4 +1380,15 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
maxIob.setIfSmaller(0d, String.format(MainApp.gs(R.string.limitingmaxiob), 0d, MainApp.gs(R.string.unsafeusage)), this);
return maxIob;
}
@Override
public List<CustomAction> getCustomActions() {
return null;
}
@Override
public void executeCustomAction(CustomActionType customActionType) {
}
}

View file

@ -8,6 +8,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
import java.util.List;
import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.MainApp;
@ -27,6 +28,8 @@ import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
@ -473,4 +476,16 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
}
// TODO: daily total constraint
@Override
public List<CustomAction> getCustomActions() {
return null;
}
@Override
public void executeCustomAction(CustomActionType customActionType) {
}
}

View file

@ -16,6 +16,8 @@ import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
@ -39,6 +41,8 @@ import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderFragment;
import info.nightscout.androidaps.plugins.configBuilder.DetailedBolusInfoStorage;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
@ -813,4 +817,14 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
return loadHistory(RecordTypes.RECORD_TYPE_DAILY);
}
@Override
public List<CustomAction> getCustomActions() {
return null;
}
@Override
public void executeCustomAction(CustomActionType customActionType) {
}
}

View file

@ -19,9 +19,11 @@ import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.interfaces.Constraint;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderFragment;
import info.nightscout.androidaps.plugins.configBuilder.DetailedBolusInfoStorage;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.danaR.AbstractDanaRPlugin;
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgBolusStartWithSpeed;

View file

@ -298,4 +298,4 @@ public class LocalInsightFragment extends SubscriberFragment implements View.OnC
statusItems.add(getStatusItem(label, MainApp.gs(R.string.eb_formatter, activeBolus.getRemainingAmount(), activeBolus.getInitialAmount(), activeBolus.getRemainingDuration())));
}
}
}
}

View file

@ -8,6 +8,10 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
import info.nightscout.androidaps.plugins.pump.insight.app_layer.parameter_blocks.*;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.*;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
@ -69,12 +73,6 @@ import info.nightscout.androidaps.plugins.pump.insight.app_layer.history.history
import info.nightscout.androidaps.plugins.pump.insight.app_layer.history.history_events.StartOfTBREvent;
import info.nightscout.androidaps.plugins.pump.insight.app_layer.history.history_events.TotalDailyDoseEvent;
import info.nightscout.androidaps.plugins.pump.insight.app_layer.history.history_events.TubeFilledEvent;
import info.nightscout.androidaps.plugins.pump.insight.app_layer.parameter_blocks.BRProfile1Block;
import info.nightscout.androidaps.plugins.pump.insight.app_layer.parameter_blocks.BRProfileBlock;
import info.nightscout.androidaps.plugins.pump.insight.app_layer.parameter_blocks.FactoryMinBolusAmountBlock;
import info.nightscout.androidaps.plugins.pump.insight.app_layer.parameter_blocks.MaxBasalAmountBlock;
import info.nightscout.androidaps.plugins.pump.insight.app_layer.parameter_blocks.MaxBolusAmountBlock;
import info.nightscout.androidaps.plugins.pump.insight.app_layer.parameter_blocks.TBROverNotificationBlock;
import info.nightscout.androidaps.plugins.pump.insight.app_layer.remote_control.CancelBolusMessage;
import info.nightscout.androidaps.plugins.pump.insight.app_layer.remote_control.CancelTBRMessage;
import info.nightscout.androidaps.plugins.pump.insight.app_layer.remote_control.ChangeTBRMessage;
@ -98,18 +96,6 @@ import info.nightscout.androidaps.plugins.pump.insight.connection_service.Insigh
import info.nightscout.androidaps.plugins.pump.insight.database.InsightBolusID;
import info.nightscout.androidaps.plugins.pump.insight.database.InsightHistoryOffset;
import info.nightscout.androidaps.plugins.pump.insight.database.InsightPumpID;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.ActiveBasalRate;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.ActiveBolus;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.ActiveTBR;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.AlertType;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.BasalProfileBlock;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.BatteryStatus;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.BolusType;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.CartridgeStatus;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.InsightState;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.OperatingMode;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.PumpTime;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.TotalDailyDose;
import info.nightscout.androidaps.plugins.pump.insight.exceptions.InsightException;
import info.nightscout.androidaps.plugins.pump.insight.exceptions.app_layer_errors.AppLayerErrorException;
import info.nightscout.androidaps.plugins.pump.insight.exceptions.app_layer_errors.NoActiveTBRToCanceLException;
@ -152,6 +138,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
private final Object $bolusLock = new Object[0];
private int bolusID;
private boolean bolusCancelled;
private BasalProfile activeBasalProfile;
private List<BasalProfileBlock> profileBlocks;
private boolean limitsFetched;
private double maximumBolusAmount;
@ -345,6 +332,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
}
private void fetchBasalProfile() throws Exception {
activeBasalProfile = ParameterBlockUtil.readParameterBlock(connectionService, Service.CONFIGURATION, ActiveBRProfileBlock.class).getActiveBasalProfile();
profileBlocks = ParameterBlockUtil.readParameterBlock(connectionService, Service.CONFIGURATION, BRProfile1Block.class).getProfileBlocks();
}
@ -438,6 +426,10 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
profileBlocks.add(profileBlock);
}
try {
ActiveBRProfileBlock activeBRProfileBlock = new ActiveBRProfileBlock();
activeBRProfileBlock.setActiveBasalProfile(BasalProfile.PROFILE_1);
ParameterBlockUtil.writeConfigurationBlock(connectionService, activeBRProfileBlock);
activeBasalProfile = BasalProfile.PROFILE_1;
BRProfileBlock profileBlock = new BRProfile1Block();
profileBlock.setProfileBlocks(profileBlocks);
ParameterBlockUtil.writeConfigurationBlock(connectionService, profileBlock);
@ -475,6 +467,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
public boolean isThisProfileSet(Profile profile) {
if (!isInitialized() || profileBlocks == null) return true;
if (profile.getBasalValues().length != profileBlocks.size()) return false;
if (activeBasalProfile != BasalProfile.PROFILE_1) return false;
for (int i = 0; i < profileBlocks.size(); i++) {
BasalProfileBlock profileBlock = profileBlocks.get(i);
Profile.BasalValue basalValue = profile.getBasalValues()[i];
@ -1068,6 +1061,16 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
return new PumpEnactResult().success(true);
}
@Override
public List<CustomAction> getCustomActions() {
return null;
}
@Override
public void executeCustomAction(CustomActionType customActionType) {
}
private void readHistory() {
try {
PumpTime pumpTime = connectionService.requestMessage(new GetDateTimeMessage()).await().getPumpTime();
@ -1566,4 +1569,4 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
Notification notification = new Notification(Notification.INSIGHT_TIMEOUT_DURING_HANDSHAKE, MainApp.gs(R.string.timeout_during_handshake), Notification.URGENT);
new Handler(Looper.getMainLooper()).post(() -> MainApp.bus().post(new EventNewNotification(notification)));
}
}
}

View file

@ -5,6 +5,8 @@ import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
@ -17,9 +19,12 @@ import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil;
/**
* Created by mike on 05.08.2016.
*/
@ -137,14 +142,10 @@ public class MDIPlugin extends PluginBase implements PumpInterface {
}
@Override
public double getReservoirLevel() {
return -1;
}
public double getReservoirLevel() { return -1; }
@Override
public int getBatteryLevel() {
return -1;
}
public int getBatteryLevel() { return -1; }
@Override
public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
@ -249,4 +250,14 @@ public class MDIPlugin extends PluginBase implements PumpInterface {
return deviceID();
}
@Override
public List<CustomAction> getCustomActions() {
return null;
}
@Override
public void executeCustomAction(CustomActionType customActionType) {
}
}

View file

@ -20,11 +20,14 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.virtual.events.EventVirtualPumpUpdateGui;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.FabricPrivacy;
public class VirtualPumpFragment extends SubscriberFragment {
private static Logger log = LoggerFactory.getLogger(VirtualPumpFragment.class);
@ -119,4 +122,6 @@ public class VirtualPumpFragment extends SubscriberFragment {
}
});
}
}

View file

@ -9,6 +9,8 @@ import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp;
@ -27,6 +29,8 @@ import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
@ -37,6 +41,7 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.SP;
/**
* Created by mike on 05.08.2016.
*/
@ -140,6 +145,16 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
return new PumpEnactResult();
}
@Override
public List<CustomAction> getCustomActions() {
return null;
}
@Override
public void executeCustomAction(CustomActionType customActionType) {
}
@Override
public boolean isInitialized() {
return true;

View file

@ -9,6 +9,7 @@
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/action_buttons_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

View file

@ -1,57 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<Preference android:title="@string/insight_pairing">
<intent
android:targetClass="info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingInformationActivity"
android:targetPackage="info.nightscout.androidaps" />
</Preference>
<PreferenceCategory android:title="@string/insight_local">
<SwitchPreference
android:defaultValue="false"
android:key="insight_log_site_changes"
android:title="@string/log_site_changes" />
<Preference android:title="@string/insight_pairing">
<intent
android:targetClass="info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingInformationActivity"
android:targetPackage="info.nightscout.androidaps" />
</Preference>
<SwitchPreference
android:defaultValue="false"
android:key="insight_log_tube_changes"
android:title="@string/log_tube_changes" />
<SwitchPreference
android:defaultValue="false"
android:key="insight_log_site_changes"
android:title="@string/log_site_changes" />
<SwitchPreference
android:defaultValue="false"
android:key="insight_log_battery_changes"
android:title="@string/log_battery_changes" />
<SwitchPreference
android:defaultValue="false"
android:key="insight_log_tube_changes"
android:title="@string/log_tube_changes" />
<SwitchPreference
android:defaultValue="false"
android:key="insight_log_operating_mode_changes"
android:title="@string/log_operating_mode_changes" />
<SwitchPreference
android:defaultValue="false"
android:key="insight_log_battery_changes"
android:title="@string/log_battery_changes" />
<SwitchPreference
android:defaultValue="false"
android:key="insight_log_alerts"
android:title="@string/log_alerts" />
<SwitchPreference
android:defaultValue="false"
android:key="insight_log_operating_mode_changes"
android:title="@string/log_operating_mode_changes" />
<SwitchPreference
android:defaultValue="false"
android:key="insight_enable_tbr_emulation"
android:summary="@string/enable_tbr_emulation_summary"
android:title="@string/enable_tbr_emulation" />
<SwitchPreference
android:defaultValue="false"
android:key="insight_log_alerts"
android:title="@string/log_alerts" />
<EditTextPreference
android:defaultValue="5"
android:inputType="number"
android:key="insight_min_recovery_duration"
android:title="@string/min_recovery_duration" />
<SwitchPreference
android:defaultValue="false"
android:key="insight_enable_tbr_emulation"
android:summary="@string/enable_tbr_emulation_summary"
android:title="@string/enable_tbr_emulation" />
<EditTextPreference
android:defaultValue="20"
android:inputType="number"
android:key="insight_max_recovery_duration"
android:title="@string/max_recovery_duration" />
<EditTextPreference
android:defaultValue="5"
android:inputType="number"
android:key="insight_min_recovery_duration"
android:title="@string/min_recovery_duration" />
<EditTextPreference
android:defaultValue="5"
android:inputType="number"
android:key="insight_disconnect_delay"
android:title="@string/disconnect_delay" />
<EditTextPreference
android:defaultValue="20"
android:inputType="number"
android:key="insight_max_recovery_duration"
android:title="@string/max_recovery_duration" />
<EditTextPreference
android:defaultValue="5"
android:inputType="number"
android:key="insight_disconnect_delay"
android:title="@string/disconnect_delay" />
</PreferenceCategory>
</PreferenceScreen>