Merge branch 'dev' into wear_upgrade

This commit is contained in:
Andy Rozman 2019-03-12 22:46:38 +00:00
commit f7c4db35b5
40 changed files with 1860 additions and 119 deletions

View file

@ -63,7 +63,7 @@ android {
targetSdkVersion 25 targetSdkVersion 25
multiDexEnabled true multiDexEnabled true
versionCode 1500 versionCode 1500
version "2.1.1" version "2.1.3-dev"
buildConfigField "String", "VERSION", '"' + version + '"' buildConfigField "String", "VERSION", '"' + version + '"'
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"' buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"' buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"'
@ -110,7 +110,7 @@ android {
applicationId "info.nightscout.aapspumpcontrol" applicationId "info.nightscout.aapspumpcontrol"
dimension "standard" dimension "standard"
resValue "string", "app_name", "Pumpcontrol" resValue "string", "app_name", "Pumpcontrol"
versionName version versionName version + "-pumpcontrol"
manifestPlaceholders = [ manifestPlaceholders = [
appIcon: "@mipmap/ic_pumpcontrol", appIcon: "@mipmap/ic_pumpcontrol",
appIconRound: "@null" appIconRound: "@null"

View file

@ -68,4 +68,7 @@ public class Constants {
//SMS Communicator //SMS Communicator
public static final long SMS_CONFIRM_TIMEOUT = T.mins(5).msecs(); public static final long SMS_CONFIRM_TIMEOUT = T.mins(5).msecs();
//Storage [MB]
public static final long MINIMUM_FREE_SPACE = 200;
} }

View file

@ -37,6 +37,7 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.constraints.dstHelper.DstHelperPlugin; import info.nightscout.androidaps.plugins.constraints.dstHelper.DstHelperPlugin;
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin; import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin;
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin; import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin;
import info.nightscout.androidaps.plugins.constraints.storage.StorageConstraintPlugin;
import info.nightscout.androidaps.plugins.general.actions.ActionsFragment; import info.nightscout.androidaps.plugins.general.actions.ActionsFragment;
import info.nightscout.androidaps.plugins.general.careportal.CareportalPlugin; import info.nightscout.androidaps.plugins.general.careportal.CareportalPlugin;
import info.nightscout.androidaps.plugins.general.food.FoodPlugin; import info.nightscout.androidaps.plugins.general.food.FoodPlugin;
@ -175,6 +176,7 @@ public class MainApp extends Application {
if (Config.OTHERPROFILES) pluginsList.add(LocalProfilePlugin.getPlugin()); if (Config.OTHERPROFILES) pluginsList.add(LocalProfilePlugin.getPlugin());
pluginsList.add(TreatmentsPlugin.getPlugin()); pluginsList.add(TreatmentsPlugin.getPlugin());
if (Config.SAFETY) pluginsList.add(SafetyPlugin.getPlugin()); if (Config.SAFETY) pluginsList.add(SafetyPlugin.getPlugin());
if (Config.SAFETY) pluginsList.add(StorageConstraintPlugin.getPlugin());
if (Config.APS) pluginsList.add(ObjectivesPlugin.getPlugin()); if (Config.APS) pluginsList.add(ObjectivesPlugin.getPlugin());
pluginsList.add(SourceXdripPlugin.getPlugin()); pluginsList.add(SourceXdripPlugin.getPlugin());
pluginsList.add(SourceNSClientPlugin.getPlugin()); pluginsList.add(SourceNSClientPlugin.getPlugin());
@ -198,6 +200,7 @@ public class MainApp extends Application {
pluginsList.add(DstHelperPlugin.getPlugin()); pluginsList.add(DstHelperPlugin.getPlugin());
ConfigBuilderPlugin.getPlugin().initialize(); ConfigBuilderPlugin.getPlugin().initialize();
} }

View file

@ -2,9 +2,13 @@ package info.nightscout.androidaps.interfaces;
import org.json.JSONObject; import org.json.JSONObject;
import java.util.List;
import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.DetailedBolusInfo;
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.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
/** /**
* Created by mike on 04.06.2016. * Created by mike on 04.06.2016.
@ -61,4 +65,9 @@ public interface PumpInterface {
PumpEnactResult loadTDDs(); 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.Source;
import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.events.EventNewBG; import info.nightscout.androidaps.events.EventNewBG;
import info.nightscout.androidaps.events.EventTempTargetChange;
import info.nightscout.androidaps.interfaces.APSInterface; import info.nightscout.androidaps.interfaces.APSInterface;
import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.Constraint;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginBase;
@ -175,6 +176,14 @@ public class LoopPlugin extends PluginBase {
return loopSuspendedTill; 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) { public void suspendTo(long endTime) {
loopSuspendedTill = endTime; loopSuspendedTill = endTime;
isSuperBolus = false; 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.common.SubscriberFragment;
import info.nightscout.androidaps.plugins.insulin.InsulinOrefRapidActingPlugin; import info.nightscout.androidaps.plugins.insulin.InsulinOrefRapidActingPlugin;
import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin; import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin;
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin; import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref0Plugin; import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref0Plugin;
import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.FabricPrivacy;

View file

@ -0,0 +1,76 @@
package info.nightscout.androidaps.plugins.constraints.storage;
import android.os.Environment;
import android.os.StatFs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.Constraint;
import info.nightscout.androidaps.interfaces.ConstraintsInterface;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.logging.L;
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;
/**
* Created by Rumen on 06.03.2019.
*/
public class StorageConstraintPlugin extends PluginBase implements ConstraintsInterface {
private static Logger log = LoggerFactory.getLogger(L.CONSTRAINTS);
static StorageConstraintPlugin plugin = null;
public static StorageConstraintPlugin getPlugin() {
if (plugin == null)
plugin = new StorageConstraintPlugin();
return plugin;
}
public StorageConstraintPlugin() {
super(new PluginDescription()
.mainType(PluginType.CONSTRAINTS)
.neverVisible(true)
.alwaysEnabled(true)
.showInList(false)
.pluginName(R.string.storage)
);
}
/**
* Constraints interface
**/
@Override
public Constraint<Boolean> isClosedLoopAllowed(Constraint<Boolean> value) {
long diskfree = getAvailableInternalMemorySize();
if (L.isEnabled(L.CONSTRAINTS))
log.debug("Internal storage free (Mb):" + diskfree);
if (diskfree < Constants.MINIMUM_FREE_SPACE) {
value.set(false, MainApp.gs(R.string.diskfull, Constants.MINIMUM_FREE_SPACE), this);
Notification notification = new Notification(Notification.DISKFULL, MainApp.gs(R.string.diskfull, Constants.MINIMUM_FREE_SPACE), Notification.NORMAL);
MainApp.bus().post(new EventNewNotification(notification));
} else {
MainApp.bus().post(new EventDismissNotification(Notification.DISKFULL));
}
return value;
}
public static long getAvailableInternalMemorySize() {
File path = Environment.getDataDirectory();
StatFs stat = new StatFs(path.getPath());
long blockSize = stat.getBlockSizeLong();
long blocksAvailable = stat.getAvailableBlocksLong();
int size = 1048576; // blocksize of 1 Mb
return ((blocksAvailable * blockSize) / size);
}
}

View file

@ -3,16 +3,23 @@ package info.nightscout.androidaps.plugins.general.actions;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; 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.Config;
import info.nightscout.androidaps.activities.HistoryBrowseActivity; import info.nightscout.androidaps.activities.HistoryBrowseActivity;
import info.nightscout.androidaps.MainApp; 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.EventRefreshOverview;
import info.nightscout.androidaps.events.EventTempBasalChange; import info.nightscout.androidaps.events.EventTempBasalChange;
import info.nightscout.androidaps.interfaces.PumpInterface; 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.FillDialog;
import info.nightscout.androidaps.plugins.general.actions.dialogs.NewExtendedBolusDialog; import info.nightscout.androidaps.plugins.general.actions.dialogs.NewExtendedBolusDialog;
import info.nightscout.androidaps.plugins.general.actions.dialogs.NewTempBasalDialog; import info.nightscout.androidaps.plugins.general.actions.dialogs.NewTempBasalDialog;
import info.nightscout.androidaps.plugins.general.careportal.CareportalFragment; import info.nightscout.androidaps.plugins.general.careportal.CareportalFragment;
import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog; import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog;
import info.nightscout.androidaps.plugins.general.careportal.OptionsToShow; 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.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.SingleClickButton; import info.nightscout.androidaps.utils.SingleClickButton;
/** /**
* A simple {@link Fragment} subclass. * A simple {@link Fragment} subclass.
*/ */
@ -49,6 +59,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
return actionsPlugin; return actionsPlugin;
} }
View actionsFragmentView;
SingleClickButton profileSwitch; SingleClickButton profileSwitch;
SingleClickButton tempTarget; SingleClickButton tempTarget;
SingleClickButton extendedBolus; SingleClickButton extendedBolus;
@ -59,6 +70,9 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
SingleClickButton tddStats; SingleClickButton tddStats;
SingleClickButton history; SingleClickButton history;
private Map<String,CustomAction> pumpCustomActions = new HashMap<>();
private List<SingleClickButton> pumpCustomButtons = new ArrayList<>();
public ActionsFragment() { public ActionsFragment() {
super(); super();
} }
@ -90,6 +104,8 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
history.setOnClickListener(this); history.setOnClickListener(this);
tddStats.setOnClickListener(this); tddStats.setOnClickListener(this);
actionsFragmentView = view;
updateGUI(); updateGUI();
return view; return view;
} catch (Exception e) { } catch (Exception e) {
@ -192,13 +208,87 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
else else
tempTarget.setVisibility(View.VISIBLE); tempTarget.setVisibility(View.VISIBLE);
if (!ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().supportsTDDs) tddStats.setVisibility(View.GONE); if (!pump.getPumpDescription().supportsTDDs)
else tddStats.setVisibility(View.VISIBLE); 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 @Override
public void onClick(View view) { public void onClick(View view) {
FragmentManager manager = getFragmentManager(); 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

@ -48,9 +48,7 @@ class NsClientReceiverDelegate {
bus.post(event); bus.post(event);
context.registerReceiver(chargingStateReceiver, context.registerReceiver(chargingStateReceiver,
new IntentFilter(Intent.ACTION_POWER_CONNECTED)); new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
context.registerReceiver(chargingStateReceiver,
new IntentFilter(Intent.ACTION_POWER_DISCONNECTED));
EventChargingState eventChargingState = chargingStateReceiver.grabChargingState(context); EventChargingState eventChargingState = chargingStateReceiver.grabChargingState(context);
if (eventChargingState != null) if (eventChargingState != null)
@ -97,7 +95,7 @@ class NsClientReceiverDelegate {
} }
void processStateChange() { void processStateChange() {
boolean newAllowedState = allowedChargingState && allowedNetworkState; boolean newAllowedState = allowedChargingState && allowedNetworkState;
if (newAllowedState != allowed) { if (newAllowedState != allowed) {
allowed = newAllowedState; allowed = newAllowedState;
bus.post(new EventPreferenceChange(R.string.key_nsclientinternal_paused)); bus.post(new EventPreferenceChange(R.string.key_nsclientinternal_paused));
@ -109,7 +107,9 @@ class NsClientReceiverDelegate {
boolean newAllowedState = true; boolean newAllowedState = true;
if (!ev.isCharging && chargingOnly) newAllowedState = false; if (!ev.isCharging && chargingOnly) {
newAllowedState = false;
}
return newAllowedState; return newAllowedState;
} }

View file

@ -73,6 +73,7 @@ public class Notification {
public static final int INSIGHT_TIMEOUT_DURING_HANDSHAKE = 48; public static final int INSIGHT_TIMEOUT_DURING_HANDSHAKE = 48;
public static final int DST_LOOP_DISABLED = 49; public static final int DST_LOOP_DISABLED = 49;
public static final int DST_IN_24H = 50; public static final int DST_IN_24H = 50;
public static final int DISKFULL = 51;
public int id; public int id;

View file

@ -41,6 +41,7 @@ import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.MidnightTime; import info.nightscout.androidaps.utils.MidnightTime;
import info.nightscout.androidaps.utils.Profiler; import info.nightscout.androidaps.utils.Profiler;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.SP;
import info.nightscout.androidaps.utils.T;
import static info.nightscout.androidaps.utils.DateUtil.now; import static info.nightscout.androidaps.utils.DateUtil.now;
import static java.util.Calendar.MINUTE; import static java.util.Calendar.MINUTE;
@ -61,7 +62,7 @@ public class IobCobOref1Thread extends Thread {
private PowerManager.WakeLock mWakeLock; 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(); super();
this.iobCobCalculatorPlugin = plugin; this.iobCobCalculatorPlugin = plugin;
@ -72,13 +73,15 @@ public class IobCobOref1Thread extends Thread {
this.end = end; this.end = end;
PowerManager powerManager = (PowerManager) MainApp.instance().getApplicationContext().getSystemService(Context.POWER_SERVICE); 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 @Override
public final void run() { public final void run() {
long start = DateUtil.now(); long start = DateUtil.now();
mWakeLock.acquire(); if (mWakeLock != null)
mWakeLock.acquire(T.mins(10).msecs());
try { try {
if (L.isEnabled(L.AUTOSENS)) if (L.isEnabled(L.AUTOSENS))
log.debug("AUTOSENSDATA thread started: " + from); log.debug("AUTOSENSDATA thread started: " + from);
@ -173,7 +176,7 @@ public class IobCobOref1Thread extends Thread {
double bgi = -iob.activity * sens * 5; double bgi = -iob.activity * sens * 5;
double deviation = delta - bgi; double deviation = delta - bgi;
double avgDeviation = Math.round((avgDelta - bgi) * 1000) / 1000; double avgDeviation = Math.round((avgDelta - bgi) * 1000) / 1000d;
double slopeFromMaxDeviation = 0; double slopeFromMaxDeviation = 0;
double slopeFromMinDeviation = 999; double slopeFromMinDeviation = 999;
@ -394,7 +397,8 @@ public class IobCobOref1Thread extends Thread {
MainApp.bus().post(new EventAutosensCalculationFinished(cause)); MainApp.bus().post(new EventAutosensCalculationFinished(cause));
}).start(); }).start();
} finally { } finally {
mWakeLock.release(); if (mWakeLock != null)
mWakeLock.release();
MainApp.bus().post(new EventIobCalculationProgress("")); MainApp.bus().post(new EventIobCalculationProgress(""));
if (L.isEnabled(L.AUTOSENS)) { if (L.isEnabled(L.AUTOSENS)) {
log.debug("AUTOSENSDATA thread ended: " + from); 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.MidnightTime;
import info.nightscout.androidaps.utils.Profiler; import info.nightscout.androidaps.utils.Profiler;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.SP;
import info.nightscout.androidaps.utils.T;
import static info.nightscout.androidaps.utils.DateUtil.now; import static info.nightscout.androidaps.utils.DateUtil.now;
@ -60,7 +61,7 @@ public class IobCobThread extends Thread {
private PowerManager.WakeLock mWakeLock; 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(); super();
this.iobCobCalculatorPlugin = plugin; this.iobCobCalculatorPlugin = plugin;
@ -71,13 +72,15 @@ public class IobCobThread extends Thread {
this.end = end; this.end = end;
PowerManager powerManager = (PowerManager) MainApp.instance().getApplicationContext().getSystemService(Context.POWER_SERVICE); 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 @Override
public final void run() { public final void run() {
long start = DateUtil.now(); long start = DateUtil.now();
mWakeLock.acquire(); if (mWakeLock != null)
mWakeLock.acquire(T.mins(10).msecs());
try { try {
if (L.isEnabled(L.AUTOSENS)) if (L.isEnabled(L.AUTOSENS))
log.debug("AUTOSENSDATA thread started: " + from); log.debug("AUTOSENSDATA thread started: " + from);
@ -172,7 +175,7 @@ public class IobCobThread extends Thread {
double bgi = -iob.activity * sens * 5; double bgi = -iob.activity * sens * 5;
double deviation = delta - bgi; double deviation = delta - bgi;
double avgDeviation = Math.round((avgDelta - bgi) * 1000) / 1000; double avgDeviation = Math.round((avgDelta - bgi) * 1000) / 1000d;
double slopeFromMaxDeviation = 0; double slopeFromMaxDeviation = 0;
double slopeFromMinDeviation = 999; double slopeFromMinDeviation = 999;
@ -321,7 +324,8 @@ public class IobCobThread extends Thread {
MainApp.bus().post(new EventAutosensCalculationFinished(cause)); MainApp.bus().post(new EventAutosensCalculationFinished(cause));
}).start(); }).start();
} finally { } finally {
mWakeLock.release(); if (mWakeLock != null)
mWakeLock.release();
MainApp.bus().post(new EventIobCalculationProgress("")); MainApp.bus().post(new EventIobCalculationProgress(""));
if (L.isEnabled(L.AUTOSENS)) { if (L.isEnabled(L.AUTOSENS)) {
log.debug("AUTOSENSDATA thread ended: " + from); 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.ConfigBuilderFragment;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions; 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.EventDismissNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress; 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.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.SP;
/** /**
* Created by mike on 05.08.2016. * 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); maxIob.setIfSmaller(0d, String.format(MainApp.gs(R.string.limitingmaxiob), 0d, MainApp.gs(R.string.unsafeusage)), this);
return maxIob; 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 org.slf4j.LoggerFactory;
import java.util.Date; import java.util.Date;
import java.util.List;
import info.nightscout.androidaps.BuildConfig; import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.MainApp; 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.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.L; 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.EventDismissNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; 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 // 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.List;
import info.nightscout.androidaps.BuildConfig; import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; 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.ConfigBuilderFragment;
import info.nightscout.androidaps.plugins.configBuilder.DetailedBolusInfoStorage; import info.nightscout.androidaps.plugins.configBuilder.DetailedBolusInfoStorage;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions; 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.EventDismissNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; 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); 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.events.EventAppExit;
import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.Constraint;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderFragment; import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderFragment;
import info.nightscout.androidaps.plugins.configBuilder.DetailedBolusInfoStorage; import info.nightscout.androidaps.plugins.configBuilder.DetailedBolusInfoStorage;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.danaR.AbstractDanaRPlugin; import info.nightscout.androidaps.plugins.pump.danaR.AbstractDanaRPlugin;
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump; import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgBolusStartWithSpeed; import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgBolusStartWithSpeed;

View file

@ -8,6 +8,10 @@ import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.Looper; 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.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.slf4j.Logger; 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.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.TotalDailyDoseEvent;
import info.nightscout.androidaps.plugins.pump.insight.app_layer.history.history_events.TubeFilledEvent; 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.CancelBolusMessage;
import info.nightscout.androidaps.plugins.pump.insight.app_layer.remote_control.CancelTBRMessage; import info.nightscout.androidaps.plugins.pump.insight.app_layer.remote_control.CancelTBRMessage;
import info.nightscout.androidaps.plugins.pump.insight.app_layer.remote_control.ChangeTBRMessage; 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.InsightBolusID;
import info.nightscout.androidaps.plugins.pump.insight.database.InsightHistoryOffset; 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.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.InsightException;
import info.nightscout.androidaps.plugins.pump.insight.exceptions.app_layer_errors.AppLayerErrorException; import info.nightscout.androidaps.plugins.pump.insight.exceptions.app_layer_errors.AppLayerErrorException;
import info.nightscout.androidaps.plugins.pump.insight.exceptions.app_layer_errors.NoActiveTBRToCanceLException; 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 final Object $bolusLock = new Object[0];
private int bolusID; private int bolusID;
private boolean bolusCancelled; private boolean bolusCancelled;
private BasalProfile activeBasalProfile;
private List<BasalProfileBlock> profileBlocks; private List<BasalProfileBlock> profileBlocks;
private boolean limitsFetched; private boolean limitsFetched;
private double maximumBolusAmount; private double maximumBolusAmount;
@ -345,6 +332,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
} }
private void fetchBasalProfile() throws Exception { private void fetchBasalProfile() throws Exception {
activeBasalProfile = ParameterBlockUtil.readParameterBlock(connectionService, Service.CONFIGURATION, ActiveBRProfileBlock.class).getActiveBasalProfile();
profileBlocks = ParameterBlockUtil.readParameterBlock(connectionService, Service.CONFIGURATION, BRProfile1Block.class).getProfileBlocks(); profileBlocks = ParameterBlockUtil.readParameterBlock(connectionService, Service.CONFIGURATION, BRProfile1Block.class).getProfileBlocks();
} }
@ -438,6 +426,10 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
profileBlocks.add(profileBlock); profileBlocks.add(profileBlock);
} }
try { try {
ActiveBRProfileBlock activeBRProfileBlock = new ActiveBRProfileBlock();
activeBRProfileBlock.setActiveBasalProfile(BasalProfile.PROFILE_1);
ParameterBlockUtil.writeConfigurationBlock(connectionService, activeBRProfileBlock);
activeBasalProfile = BasalProfile.PROFILE_1;
BRProfileBlock profileBlock = new BRProfile1Block(); BRProfileBlock profileBlock = new BRProfile1Block();
profileBlock.setProfileBlocks(profileBlocks); profileBlock.setProfileBlocks(profileBlocks);
ParameterBlockUtil.writeConfigurationBlock(connectionService, profileBlock); ParameterBlockUtil.writeConfigurationBlock(connectionService, profileBlock);
@ -475,6 +467,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
public boolean isThisProfileSet(Profile profile) { public boolean isThisProfileSet(Profile profile) {
if (!isInitialized() || profileBlocks == null) return true; if (!isInitialized() || profileBlocks == null) return true;
if (profile.getBasalValues().length != profileBlocks.size()) return false; if (profile.getBasalValues().length != profileBlocks.size()) return false;
if (activeBasalProfile != BasalProfile.PROFILE_1) return false;
for (int i = 0; i < profileBlocks.size(); i++) { for (int i = 0; i < profileBlocks.size(); i++) {
BasalProfileBlock profileBlock = profileBlocks.get(i); BasalProfileBlock profileBlock = profileBlocks.get(i);
Profile.BasalValue basalValue = profile.getBasalValues()[i]; Profile.BasalValue basalValue = profile.getBasalValues()[i];
@ -715,6 +708,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
@Override @Override
public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) { public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) {
PumpEnactResult result = cancelExtendedBolusOnly(); PumpEnactResult result = cancelExtendedBolusOnly();
if (result.success) result = setExtendedBolusOnly(insulin, durationInMinutes);
try { try {
fetchStatus(); fetchStatus();
readHistory(); readHistory();
@ -1067,6 +1061,16 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
return new PumpEnactResult().success(true); return new PumpEnactResult().success(true);
} }
@Override
public List<CustomAction> getCustomActions() {
return null;
}
@Override
public void executeCustomAction(CustomActionType customActionType) {
}
private void readHistory() { private void readHistory() {
try { try {
PumpTime pumpTime = connectionService.requestMessage(new GetDateTimeMessage()).await().getPumpTime(); PumpTime pumpTime = connectionService.requestMessage(new GetDateTimeMessage()).await().getPumpTime();

View file

@ -5,6 +5,8 @@ import org.json.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.List;
import info.nightscout.androidaps.BuildConfig; import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; 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.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.L; 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.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
/** /**
* Created by mike on 05.08.2016. * Created by mike on 05.08.2016.
*/ */
@ -137,14 +142,10 @@ public class MDIPlugin extends PluginBase implements PumpInterface {
} }
@Override @Override
public double getReservoirLevel() { public double getReservoirLevel() { return -1; }
return -1;
}
@Override @Override
public int getBatteryLevel() { public int getBatteryLevel() { return -1; }
return -1;
}
@Override @Override
public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) { public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
@ -249,4 +250,14 @@ public class MDIPlugin extends PluginBase implements PumpInterface {
return deviceID(); 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.ExtendedBolus;
import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.plugins.common.SubscriberFragment; 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.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.virtual.events.EventVirtualPumpUpdateGui; import info.nightscout.androidaps.plugins.pump.virtual.events.EventVirtualPumpUpdateGui;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.FabricPrivacy;
public class VirtualPumpFragment extends SubscriberFragment { public class VirtualPumpFragment extends SubscriberFragment {
private static Logger log = LoggerFactory.getLogger(VirtualPumpFragment.class); 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.List;
import info.nightscout.androidaps.BuildConfig; import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp; 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.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions; 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.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress; 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.DateUtil;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.SP;
/** /**
* Created by mike on 05.08.2016. * Created by mike on 05.08.2016.
*/ */
@ -140,6 +145,16 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
return new PumpEnactResult(); return new PumpEnactResult();
} }
@Override
public List<CustomAction> getCustomActions() {
return null;
}
@Override
public void executeCustomAction(CustomActionType customActionType) {
}
@Override @Override
public boolean isInitialized() { public boolean isInitialized() {
return true; return true;

View file

@ -5,7 +5,7 @@ import android.util.LongSparseArray;
import java.util.Calendar; import java.util.Calendar;
public class MidnightTime { public class MidnightTime {
private static LongSparseArray times = new LongSparseArray(); private static final LongSparseArray<Long> times = new LongSparseArray<>();
private static long hits = 0; private static long hits = 0;
private static long misses = 0; private static long misses = 0;
@ -20,20 +20,23 @@ public class MidnightTime {
} }
public static long calc(long time) { public static long calc(long time) {
Long m = (Long) times.get(time); Long m;
if (m != null) { synchronized (times) {
++hits; m = times.get(time);
return m; if (m != null) {
++hits;
return m;
}
Calendar c = Calendar.getInstance();
c.setTimeInMillis(time);
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
c.set(Calendar.MILLISECOND, 0);
m = c.getTimeInMillis();
times.append(time, m);
++misses;
} }
Calendar c = Calendar.getInstance();
c.setTimeInMillis(time);
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
c.set(Calendar.MILLISECOND, 0);
m = c.getTimeInMillis();
times.append(time, m);
++misses;
return m; return m;
} }

View file

@ -43,7 +43,6 @@ public class VersionChecker {
if (inputStream != null) { if (inputStream != null) {
String result = findLine(inputStream); String result = findLine(inputStream);
if (result != null) { if (result != null) {
result = result.replace("version", "").replace("\"", "").replace("\\s+", "").trim();
int compare = result.compareTo(BuildConfig.VERSION_NAME.replace("\"", "")); int compare = result.compareTo(BuildConfig.VERSION_NAME.replace("\"", ""));
if (compare == 0) { if (compare == 0) {
log.debug("Version equal to master"); log.debug("Version equal to master");
@ -75,14 +74,14 @@ public class VersionChecker {
private static String findLine(InputStream inputStream) throws IOException { private static String findLine(InputStream inputStream) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
String line; String line;
String regex = "(.*)version(.*)\"(\\d+)\\.(\\d+)\"(.*)"; String regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)";
Pattern p = Pattern.compile(regex); Pattern p = Pattern.compile(regex);
while ((line = bufferedReader.readLine()) != null) { while ((line = bufferedReader.readLine()) != null) {
Matcher m = p.matcher(line); Matcher m = p.matcher(line);
if (m.matches()) { if (m.matches()) {
log.debug("+++ " + line); log.debug("+++ " + line);
return line; return m.group(3);
} else { } else {
log.debug("--- " + line); log.debug("--- " + line);
} }

View file

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

View file

@ -1139,6 +1139,8 @@
<string name="dexcom_lognssensorchange_summary">Vytvořit událost \"Výměna senzoru\" v NS automaticky po spuštění senzoru</string> <string name="dexcom_lognssensorchange_summary">Vytvořit událost \"Výměna senzoru\" v NS automaticky po spuštění senzoru</string>
<string name="tomato">Tomato (MiaoMiao)</string> <string name="tomato">Tomato (MiaoMiao)</string>
<string name="tomato_short">Tomato</string> <string name="tomato_short">Tomato</string>
<string name="dst_in_24h_warning">Změna letního času za méně než 24 hodin</string>
<string name="dst_loop_disabled_warning">Změna letního času za méně než 3 hodiny - Uzavřená smyčka zastavena</string>
<plurals name="objective_days"> <plurals name="objective_days">
<item quantity="one">%1$d den</item> <item quantity="one">%1$d den</item>
<item quantity="few">%1$d dnů</item> <item quantity="few">%1$d dnů</item>

View file

@ -1140,6 +1140,8 @@ Stel in en gebruik tijdelijk en standaard tijdelijke streefdoelen (bv. bij sport
<string name="dexcom_lognssensorchange_summary">Noteer automatisch \"Sensor Wissel\" in NS bij starten van sensor</string> <string name="dexcom_lognssensorchange_summary">Noteer automatisch \"Sensor Wissel\" in NS bij starten van sensor</string>
<string name="tomato">Tomato (MiaoMiao)</string> <string name="tomato">Tomato (MiaoMiao)</string>
<string name="tomato_short">Tomato</string> <string name="tomato_short">Tomato</string>
<string name="dst_in_24h_warning">Zomer/wintertijd omschakeling binnen 24 uur</string>
<string name="dst_loop_disabled_warning">Zomer/wintertijd omschakeling in minder dan 3 uur - Closed loop gedeactiveerd</string>
<plurals name="objective_days"> <plurals name="objective_days">
<item quantity="one">%1$d dag</item> <item quantity="one">%1$d dag</item>
<item quantity="other">%1$d dag</item> <item quantity="other">%1$d dag</item>

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,30 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources></resources> <resources>
<string name="alert_r1_code">Reamintire R1</string>
<string name="alert_r2_code">Reamintire R2</string>
<string name="alert_r3_code">Reamintire R3</string>
<string name="alert_r4_code">Reamintire R4</string>
<string name="alert_r7_code">Reamintire R7</string>
<string name="alert_w31_code">Avertizare W31</string>
<string name="alert_w32_code">Avertizare W32</string>
<string name="alert_w33_code">Avertizare W33</string>
<string name="alert_w34_code">Avertizare W34</string>
<string name="alert_w36_code">Avertizare W36</string>
<string name="alert_w38_code">Avertizare W38</string>
<string name="alert_w39_code">Avertizare W39</string>
<string name="alert_m20_code">Mentenanță M20</string>
<string name="alert_m21_code">Mentenanță M21</string>
<string name="alert_m22_code">Mentenanță M22</string>
<string name="alert_m23_code">Mentenanță M23</string>
<string name="alert_m24_code">Mentenanță M24</string>
<string name="alert_m25_code">Mentenanță M25</string>
<string name="alert_m26_code">Mentenanță M26</string>
<string name="alert_m27_code">Mentenanță M27</string>
<string name="alert_m28_code">Mentenanță M28</string>
<string name="alert_m29_code">Mentenanță M29</string>
<string name="alert_m30_code">Mentenanță M30</string>
<string name="alert_e6_code">Eroare E6</string>
<string name="alert_e10_code">Eroare E10</string>
<string name="alert_e13_code">Eroare E13</string>
</resources>

View file

@ -1,3 +1,25 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources></resources> <resources>
<string name="alert_r7_description"><![CDATA[Cantitate: <b>%1$d%%</b>\nDurata: <b>%2$s h</b>]]></string>
<string name="alert_w31_description"><![CDATA[Conţinut rezervor: <b>%1$s U</b>]]></string>
<string name="alert_w32_description">Schimbați bateria.</string>
<string name="alert_w33_description">Setați ora/data.</string>
<string name="alert_w34_description">Contactați departamentul de suport Accu-Chek.</string>
<string name="alert_w36_description"><![CDATA[Cantitate: <b>%1$d%%</b><br/>Durată: <b>%2$s h</b>]]></string>
<string name="alert_w38_description"><![CDATA[Stabilit: <b>%1$s U</b><br/>Livrat: <b>%2$s U</b>]]></string>
<string name="alert_m20_description">Introduceți cartușul.</string>
<string name="alert_m21_description">Schimbați cartușul.</string>
<string name="alert_m22_description">Schimbați bateria.</string>
<string name="alert_m23_description">Verificați starea pompei pe ecranul acesteia.</string>
<string name="alert_m24_description">Schimbați setul de infuzie.</string>
<string name="alert_m25_description">Contactați departamentul de suport Accu-Chek.</string>
<string name="alert_m26_description">Schimbați cartușul.</string>
<string name="alert_m27_description">Reporniţi descărcarea datelor.</string>
<string name="alert_m28_description">Verificați starea pompei pe ecranul acesteia.</string>
<string name="alert_m29_description">Setaţi tipul de baterie.</string>
<string name="alert_m30_description">Setaţi tipul de rezervor.</string>
<string name="alert_e6_description">Schimbați bateria și rezervorul.</string>
<string name="alert_e10_description">Schimbați rezervorul.</string>
<string name="alert_e13_description">Schimbați limba.</string>
</resources>

View file

@ -1,3 +1,30 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources></resources> <resources>
<string name="alert_r1_title">Livrează bolus</string>
<string name="alert_r2_title">Bolus ratat</string>
<string name="alert_r3_title">Ceas alarmă</string>
<string name="alert_r4_title">Schimbă setul de infuzie</string>
<string name="alert_r7_title">RBT compet</string>
<string name="alert_w31_title">Rezervor aproape golit</string>
<string name="alert_w32_title">Baterie aproape golită</string>
<string name="alert_w33_title">Timp/dată incorecte</string>
<string name="alert_w34_title">Perioada de garanție a expirat</string>
<string name="alert_w36_title">RBT anulat</string>
<string name="alert_w38_title">Bolus anulat</string>
<string name="alert_w39_title">Perioada de închiriere se apropie de sfârșit</string>
<string name="alert_m20_title">Rezervorul nu a fost instalat</string>
<string name="alert_m21_title">Rezervor gol</string>
<string name="alert_m22_title">Baterie epuizată</string>
<string name="alert_m23_title">Oprire automată - pompa stopată</string>
<string name="alert_m24_title">Ocluzie</string>
<string name="alert_m25_title">Perioada de închiriere epuizată - nu se mai execută operațiuni</string>
<string name="alert_m26_title">Schimbarea rezervorului nu este completă</string>
<string name="alert_m27_title">Descărcarea datelor a eșuat</string>
<string name="alert_m28_title">Modul de pauză a expirat</string>
<string name="alert_m29_title">Tipul de baterie nu a fost stabilit</string>
<string name="alert_m30_title">Tipul de rezervor nu a fost stabilit</string>
<string name="alert_e6_title">Eroare mecanică</string>
<string name="alert_e10_title">Eroare de derulare</string>
<string name="alert_e13_title">Eroare de limbaj</string>
</resources>

View file

@ -1,3 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources></resources> <resources>
<string name="connection_failed">Conexiune eșuată</string>
<string name="connection_lost">Conexiune pierdută</string>
<string name="pairing_rejected">Asociere respinsă</string>
<string name="socket_creation_failed">Crearea asocierii a eșuat</string>
<string name="timeout">Timpul a expirat</string>
<string name="maximum_number_of_bolus_type_already_running">Numărul maxim de bolusuri care sunt livrate în același timp</string>
<string name="no_active_tbr_to_cancel">Nu există RBT activă de anulat</string>
<string name="no_active_tbr_to_change">Nu există RBT activă de schimbat</string>
<string name="no_such_bolus_to_cancel">Nu există un bolus care să fie anulat</string>
<string name="pump_already_in_that_state_exception">Pompa este deja în starea solicitată</string>
<string name="run_mode_not_allowed">Mod de folosire nepermis</string>
</resources>

View file

@ -44,6 +44,8 @@
<string name="description_sensitivity_oref1">Sensibilitatea este calculată folosind datele din ultimele 8 ore, iar cabohidrații (când nu sunt absorbiți) sunt ignorați după timpul specificat în preferințe. Se calculează, de asemenea, UAM.</string> <string name="description_sensitivity_oref1">Sensibilitatea este calculată folosind datele din ultimele 8 ore, iar cabohidrații (când nu sunt absorbiți) sunt ignorați după timpul specificat în preferințe. Se calculează, de asemenea, UAM.</string>
<string name="description_sensitivity_weighted_average">Sensibilitatea este calculată ca o medie ponderată a deviațiilor. Deviațiile noi au o importanță mai mare. Absorbția minimă de carbohidrați este calculată în funcție de parametrul absorbție maximă de carbohidrați, stabilit în preferințe. Acest algoritm este cel mai rapid atunci când sensibilitatea la insulină este fluctuantă.</string> <string name="description_sensitivity_weighted_average">Sensibilitatea este calculată ca o medie ponderată a deviațiilor. Deviațiile noi au o importanță mai mare. Absorbția minimă de carbohidrați este calculată în funcție de parametrul absorbție maximă de carbohidrați, stabilit în preferințe. Acest algoritm este cel mai rapid atunci când sensibilitatea la insulină este fluctuantă.</string>
<string name="description_source_dexcom_g5">Primește valorile glicemiei din aplicația Dexcom G5 modificată.</string> <string name="description_source_dexcom_g5">Primește valorile glicemiei din aplicația Dexcom G5 modificată.</string>
<string name="description_source_dexcom_g6">Primește valorile glicemiei din aplicația Dexcom G6 modificată.</string>
<string name="description_source_eversense">Primește valorile glicemiei din aplicația Eversense modificată.</string>
<string name="description_source_glimp">Primește valorile glicemiei din aplicația Glimp.</string> <string name="description_source_glimp">Primește valorile glicemiei din aplicația Glimp.</string>
<string name="description_source_mm640g">Primește valorile glicemiei din aplicația 600SeriesAndroidUploader (Medtronic).</string> <string name="description_source_mm640g">Primește valorile glicemiei din aplicația 600SeriesAndroidUploader (Medtronic).</string>
<string name="description_source_ns_client">Descarcă datele despre glicemii din Nightscout</string> <string name="description_source_ns_client">Descarcă datele despre glicemii din Nightscout</string>
@ -408,6 +410,7 @@
<string name="array_of_elements">Matrice de %1$d elemente.\nValoarea curentă:</string> <string name="array_of_elements">Matrice de %1$d elemente.\nValoarea curentă:</string>
<string name="openapsma_autosensdata_label">Date Autosens</string> <string name="openapsma_autosensdata_label">Date Autosens</string>
<string name="openapsma_scriptdebugdata_label">Depanare script</string> <string name="openapsma_scriptdebugdata_label">Depanare script</string>
<string name="openapsama_useautosens">Folosește opțiunea de autosensibilitate</string>
<string name="refresheventsfromnightscout">Sincronizează cu NS</string> <string name="refresheventsfromnightscout">Sincronizează cu NS</string>
<string name="deletefuturetreatments">Ștergerea tratamentelor înregistrate în viitor</string> <string name="deletefuturetreatments">Ștergerea tratamentelor înregistrate în viitor</string>
<string name="eatingsoon">Masă în curând</string> <string name="eatingsoon">Masă în curând</string>
@ -531,6 +534,7 @@
<string name="disconnectpumpfor2h">Deconectează pompa pentru 2h</string> <string name="disconnectpumpfor2h">Deconectează pompa pentru 2h</string>
<string name="disconnectpumpfor3h">Deconectează pompa pentru 3h</string> <string name="disconnectpumpfor3h">Deconectează pompa pentru 3h</string>
<string name="resume">Restabilește</string> <string name="resume">Restabilește</string>
<string name="reconnect">Reconectaţi pompa</string>
<string name="smscommunicator_wrongduration">Durată greșită</string> <string name="smscommunicator_wrongduration">Durată greșită</string>
<string name="smscommunicator_loopsuspended">Buclă suspendată</string> <string name="smscommunicator_loopsuspended">Buclă suspendată</string>
<string name="smscommunicator_loopresumed">Buclă restabilită</string> <string name="smscommunicator_loopresumed">Buclă restabilită</string>
@ -548,6 +552,12 @@
<string name="insulin_shortname">INS</string> <string name="insulin_shortname">INS</string>
<string name="enablesuperbolus">Activează superbolus în asistent</string> <string name="enablesuperbolus">Activează superbolus în asistent</string>
<string name="enablesuperbolus_summary">Activează funcționalitatea de superbolus în asistentul de buclă. Nu activați până nu înțelegeți ce face cu adevărat. DACĂ ESTE FOLOSIT ÎN NECUNOȘTINȚĂ DE CAUZĂ POATE DUCE LA SUPRADOZĂ DE INSULINĂ!</string> <string name="enablesuperbolus_summary">Activează funcționalitatea de superbolus în asistentul de buclă. Nu activați până nu înțelegeți ce face cu adevărat. DACĂ ESTE FOLOSIT ÎN NECUNOȘTINȚĂ DE CAUZĂ POATE DUCE LA SUPRADOZĂ DE INSULINĂ!</string>
<string name="show_statuslights">Afișați indicatorii luminoși ai pompei pe ecranul de start</string>
<string name="show_statuslights_summary">Activați indicatori pentru CAGE, IAGE, SAGE, nivel baterie și rezervor pe ecranul principal.</string>
<string name="statuslights_res_warning">Pragul de avertisment pentru insulina din rezervor [U]</string>
<string name="statuslights_res_critical">Pragul critic al nivelului insulinei în rezervor [U]</string>
<string name="statuslights_bat_warning">Pragul de avertizare nivel baterie [%]</string>
<string name="statuslights_bat_critical">Pragul critic al nivelului baterie [%]</string>
<string name="iob">IOB</string> <string name="iob">IOB</string>
<string name="cob">COB</string> <string name="cob">COB</string>
<string name="virtualpump_firmware_label">Firmware</string> <string name="virtualpump_firmware_label">Firmware</string>
@ -702,7 +712,10 @@
<string name="btwatchdog_title">BT Watchdog</string> <string name="btwatchdog_title">BT Watchdog</string>
<string name="btwatchdog_summary">Oprește bluetooth-ul telefonului pentru o secundă dacă nu se poate conecta la pompă. Aceasta poate ajuta în cazul telefoanelor cu bluetooth incompatitibil.</string> <string name="btwatchdog_summary">Oprește bluetooth-ul telefonului pentru o secundă dacă nu se poate conecta la pompă. Aceasta poate ajuta în cazul telefoanelor cu bluetooth incompatitibil.</string>
<string name="DexcomG5">App DexcomG5 (cu patch)</string> <string name="DexcomG5">App DexcomG5 (cu patch)</string>
<string name="DexcomG6">Aplicația G6 (modificată)</string>
<string name="eversense">Aplicația Eversense (modificată)</string>
<string name="dexcomg5_nsupload_title">Încarcă date glicemie în NS</string> <string name="dexcomg5_nsupload_title">Încarcă date glicemie în NS</string>
<string name="bgsource_upload">Setări înregistrare glicemie</string>
<string name="wear_detailed_delta_title">Arată variație detaliată</string> <string name="wear_detailed_delta_title">Arată variație detaliată</string>
<string name="wear_detailed_delta_summary">Arată variație cu încă o zecimală</string> <string name="wear_detailed_delta_summary">Arată variație cu încă o zecimală</string>
<string name="smbmaxminutes_summary">Max minute de bazală la care să se limiteze SMB</string> <string name="smbmaxminutes_summary">Max minute de bazală la care să se limiteze SMB</string>
@ -768,6 +781,7 @@
<string name="combo_error_bolus_verification_failed">Nu s-a reușit livrarea bolusului și citirea istoricului pompei, verificați pompa. Dacă a fost totuși livrat un bolus, acesta va fi adăugat în lista tratamentelor în timpul următoarei conexiuni cu pompa.</string> <string name="combo_error_bolus_verification_failed">Nu s-a reușit livrarea bolusului și citirea istoricului pompei, verificați pompa. Dacă a fost totuși livrat un bolus, acesta va fi adăugat în lista tratamentelor în timpul următoarei conexiuni cu pompa.</string>
<string name="combo_reservoir_level_insufficient_for_bolus">Nu este suficientă insulină în rezervor</string> <string name="combo_reservoir_level_insufficient_for_bolus">Nu este suficientă insulină în rezervor</string>
<string name="extendedbolusdeliveryerror">Eroare de livrare a bolusului extins</string> <string name="extendedbolusdeliveryerror">Eroare de livrare a bolusului extins</string>
<string name="insightpump_shortname">Obiectiv</string>
<string name="insightpump">Pompă Insight</string> <string name="insightpump">Pompă Insight</string>
<string name="status_no_colon">Stare</string> <string name="status_no_colon">Stare</string>
<string name="changed">Schimbat</string> <string name="changed">Schimbat</string>
@ -842,6 +856,7 @@
<string name="data_choices">Alegeri date</string> <string name="data_choices">Alegeri date</string>
<string name="fabric_upload">Încărcare \"fabric\"</string> <string name="fabric_upload">Încărcare \"fabric\"</string>
<string name="allow_automated_crash_reporting">Permite trimiterea de rapoarte automate de eroare și de date despre folosire către dezvoltatori prin serviciul fabric.io.</string> <string name="allow_automated_crash_reporting">Permite trimiterea de rapoarte automate de eroare și de date despre folosire către dezvoltatori prin serviciul fabric.io.</string>
<string name="g5appnotdetected">Actualizați aplicația Dexcom la o versiune acceptată</string>
<string name="start_activity_tt">Start TT activitate</string> <string name="start_activity_tt">Start TT activitate</string>
<string name="start_eating_soon_tt">Start TT mănânc-în-curând</string> <string name="start_eating_soon_tt">Start TT mănânc-în-curând</string>
<string name="temptargetshort">TT</string> <string name="temptargetshort">TT</string>
@ -1007,6 +1022,7 @@
<string name="nth_objective">Obiectiv %1$d</string> <string name="nth_objective">Obiectiv %1$d</string>
<string name="poctech">Poctech</string> <string name="poctech">Poctech</string>
<string name="description_source_poctech">Citire a valorii glicemiei din aplicația Poctech</string> <string name="description_source_poctech">Citire a valorii glicemiei din aplicația Poctech</string>
<string name="description_source_tomato">Înregistrează valorile glicemiei din aplicația Tomato (dispozitiv MiaoMIao)</string>
<string name="high_temptarget_raises_sensitivity_title">Ținte temporare mai mari cresc sensibilitatea</string> <string name="high_temptarget_raises_sensitivity_title">Ținte temporare mai mari cresc sensibilitatea</string>
<string name="high_temptarget_raises_sensitivity_summary"><![CDATA[Creșterea sensibilității pentru ținte temporare >= 100]]></string> <string name="high_temptarget_raises_sensitivity_summary"><![CDATA[Creșterea sensibilității pentru ținte temporare >= 100]]></string>
<string name="low_temptarget_lowers_sensitivity_title">Țintele temporare joase scad sensibilitatea</string> <string name="low_temptarget_lowers_sensitivity_title">Țintele temporare joase scad sensibilitatea</string>
@ -1049,6 +1065,40 @@
<string name="loop_openmode_min_change">Cerere de schimbare minimală [%]</string> <string name="loop_openmode_min_change">Cerere de schimbare minimală [%]</string>
<string name="loop_openmode_min_change_summary">Bucla va afişa o nouă cerere de schimbare doar dacă schimbarea are o valoare decât aceasta. Valoarea implicită este 20%</string> <string name="loop_openmode_min_change_summary">Bucla va afişa o nouă cerere de schimbare doar dacă schimbarea are o valoare decât aceasta. Valoarea implicită este 20%</string>
<string name="pairfirst">Vă rog să conectați pompa cu telefonul!</string> <string name="pairfirst">Vă rog să conectați pompa cu telefonul!</string>
<string name="searching_for_devices">Căutare dispozitive…</string>
<string name="please_wait">Așteptați…</string>
<string name="pairing_completed">Asociere reușită</string>
<string name="code_compare">Sunt identice codurile afișate aici și cele de pe pompă?</string>
<string name="insight_pairing">Asociere Insight</string>
<string name="insight_local">Accu-Chek Insight</string>
<string name="insight_delivered">Livrat %1$.2fU / %2$.2fU</string>
<string name="insight_alert_formatter">%1$s:%2$s</string>
<string name="tube_changed">Canulă schimbată</string>
<string name="pump_time_updated">Timpul din pompă a fost actualizat</string>
<string name="confirm">Confirmă</string>
<string name="mute_alert">Liniște</string>
<string name="pump_alert">Alertă a pompei</string>
<string name="log_site_changes">Înregistrează schimbările locului de inserție</string>
<string name="log_tube_changes">Înregistrează schimbările canulei</string>
<string name="log_battery_changes">Înregistrează schimbările bateriei</string>
<string name="log_operating_mode_changes">Înregistrează schimbările modului de operare</string>
<string name="log_alerts">Înregistrează alertele</string>
<string name="enable_tbr_emulation">Activează emularea RBT</string>
<string name="enable_tbr_emulation_summary">Folosește bolus extins în locul RBT pentru a trece de limita de 250%</string>
<string name="disconnect_delay">Întârziere a deconectării [s]</string>
<string name="serial_number">Număr de serie</string>
<string name="release_software_version">Versiunea de software</string>
<string name="ui_processor_software_version">Versiunea softwareului procesor UI</string>
<string name="pc_processor_software_version">Versiunea software procesor PC</string>
<string name="md_tel_processor_software_version">Versiunea software procesor MD tel</string>
<string name="safety_processor_software_version">Versiunea software procesor siguranță</string>
<string name="bt_info_page_version">Versiunea BT info</string>
<string name="bluetooth_address">Adresa Bluetooth</string>
<string name="system_id_appendix">Indexul sistem ID</string>
<string name="manufacturing_date">Data fabricării</string>
<string name="delete_pairing">Șterge asocierea</string>
<string name="pairing_information">Informații despre asociere</string>
<string name="refreh_status">Reîmprospătare stare</string>
<plurals name="objective_days"> <plurals name="objective_days">
<item quantity="one">%1$d zi</item> <item quantity="one">%1$d zi</item>
<item quantity="few">%1$d zi</item> <item quantity="few">%1$d zi</item>

View file

@ -1141,4 +1141,6 @@ Context | Edit Context</string>
<string name="dexcom_lognssensorchange_summary">Автоматически создать событие \"Замена сенсора\" в NS при запуске сенсора</string> <string name="dexcom_lognssensorchange_summary">Автоматически создать событие \"Замена сенсора\" в NS при запуске сенсора</string>
<string name="tomato">Томато (MiaoMiao)</string> <string name="tomato">Томато (MiaoMiao)</string>
<string name="tomato_short">Томато</string> <string name="tomato_short">Томато</string>
<string name="dst_in_24h_warning">Переход на летнее/зимнее время через 24 часа или менее</string>
<string name="dst_loop_disabled_warning">Переход на летнее/зимнее время менее чем через 3 часа - замкнутый цикл отключен</string>
</resources> </resources>

View file

@ -1312,7 +1312,8 @@
<string name="dst_plugin_name" translatable="false">Dayligh Saving time</string> <string name="dst_plugin_name" translatable="false">Dayligh Saving time</string>
<string name="dst_in_24h_warning">Dayligh Saving time change in 24h or less</string> <string name="dst_in_24h_warning">Dayligh Saving time change in 24h or less</string>
<string name="dst_loop_disabled_warning">Dayligh Saving time change in less than 3 hours - Closed loop diabled</string> <string name="dst_loop_disabled_warning">Dayligh Saving time change in less than 3 hours - Closed loop diabled</string>
<string name="storage">internal storage constraint</string>
<string name="diskfull">Free at least %1$d MB from internal storage! Loop disabled!</string>
<plurals name="objective_days"> <plurals name="objective_days">
<item quantity="one">%1$d day</item> <item quantity="one">%1$d day</item>
<item quantity="other">%1$d days</item> <item quantity="other">%1$d days</item>

View file

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

View file

@ -0,0 +1,80 @@
package info.nightscout.androidaps.plugins.constraints.storage;
import android.os.Environment;
import android.os.StatFs;
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.io.File;
import info.AAPSMocker;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.Constraint;
import static org.mockito.Mockito.when;
import static org.mockito.Mockito.mock;
import static org.powermock.api.mockito.PowerMockito.whenNew;
import static org.mockito.ArgumentMatchers.any;
/**
* Created by Rumen on 06.03.2019.
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({MainApp.class, StorageConstraintPlugin.class, StatFs.class, Environment.class})
public class StorageConstraintPluginTest extends StorageConstraintPlugin{
StorageConstraintPlugin storageConstraintPlugin;
private File mockedFile;
private static final String path = "/data";
private StatFs mockedStatFs;
@Test
public void isLoopInvocationAllowedTest(){
PowerMockito.mockStatic(StorageConstraintPlugin.class);
// Set free space under 200(Mb) to disable loop
when(StorageConstraintPlugin.getAvailableInternalMemorySize()).thenReturn(150L);
Constraint<Boolean> c = new Constraint<>(true);
c = storageConstraintPlugin.isClosedLoopAllowed(c);
Assert.assertEquals(Boolean.FALSE, c.value());
// Set free space over 200(Mb) to enable loop
when(StorageConstraintPlugin.getAvailableInternalMemorySize()).thenReturn(300L);
Constraint<Boolean> c2 = new Constraint<>(true);
c2 = storageConstraintPlugin.isClosedLoopAllowed(c2);
Assert.assertEquals(Boolean.TRUE, c2.value());
}
@Test
public void getAvailableInternalMemorySizeTest() throws Exception {
PowerMockito.mockStatic(Environment.class);
PowerMockito.when(Environment.getDataDirectory()).thenReturn(mockedFile);
when(mockedFile.getPath()).thenReturn(path);
when(mockedFile.exists()).thenReturn(true);
whenNew(StatFs.class).withArguments(any()).thenReturn(mockedStatFs);
when(mockedStatFs.getBlockSizeLong()).thenReturn(1024L);
when(mockedStatFs.getAvailableBlocksLong()).thenReturn(150l*1024);
long freeSpaceInMb = storageConstraintPlugin.getAvailableInternalMemorySize();
Assert.assertEquals(150L, freeSpaceInMb);
}
@Before
public void prepareMock() {
AAPSMocker.mockMainApp();
AAPSMocker.mockStrings();
AAPSMocker.mockBus();
mockedFile = mock(File.class);
mockedStatFs = mock(StatFs.class);
storageConstraintPlugin = StorageConstraintPlugin.getPlugin();
}
}

View file

@ -0,0 +1,62 @@
package info.nightscout.androidaps.utils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.util.Calendar;
import java.util.Date;
import info.AAPSMocker;
import info.nightscout.androidaps.MainApp;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* Created by mike on 20.11.2017.
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({Calendar.class})
public class MidnightTimeTest {
@Test
public void calc() {
// We get real midnight
long now = DateUtil.now();
Assert.assertTrue(now >= MidnightTime.calc());
Calendar c = Calendar.getInstance();
c.setTimeInMillis(MidnightTime.calc());
Assert.assertEquals(c.get(Calendar.HOUR_OF_DAY), 0);
Assert.assertEquals(c.get(Calendar.MINUTE), 0);
Assert.assertEquals(c.get(Calendar.SECOND), 0);
Assert.assertEquals(c.get(Calendar.MILLISECOND), 0);
}
@Test
public void calc_time() {
// We get real midnight
long now = DateUtil.now();
long midnight = MidnightTime.calc(now);
Assert.assertTrue(now >= midnight);
Calendar c = Calendar.getInstance();
c.setTimeInMillis(MidnightTime.calc(now));
Assert.assertEquals(c.get(Calendar.HOUR_OF_DAY), 0);
Assert.assertEquals(c.get(Calendar.MINUTE), 0);
Assert.assertEquals(c.get(Calendar.SECOND), 0);
Assert.assertEquals(c.get(Calendar.MILLISECOND), 0);
// Assure we get the same time from cache
Assert.assertEquals(midnight, MidnightTime.calc(now));
}
@Test
public void log() {
long now = DateUtil.now();
MidnightTime.calc(now);
Assert.assertTrue(MidnightTime.log().startsWith("Hits:"));
}
}

View file

@ -57,9 +57,9 @@ android {
versionName version versionName version
} }
pumpcontrol { pumpcontrol {
applicationId "info.nightscout.androidaps" applicationId "info.nightscout.aapspumpcontrol"
dimension "standard" dimension "standard"
versionName version versionName version + "-pumpcontrol"
} }
nsclient { nsclient {
applicationId "info.nightscout.nsclient" applicationId "info.nightscout.nsclient"