Some compile fixes and translation problems.

This commit is contained in:
Andy Rozman 2019-03-30 23:31:02 +00:00
parent eb85cd2588
commit 4b144f282b
6 changed files with 211 additions and 134 deletions

View file

@ -1,12 +1,25 @@
package info.nightscout.androidaps; package info.nightscout.androidaps;
import java.io.File;
import java.util.ArrayList;
import net.danlew.android.joda.JodaTimeAndroid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import android.app.Application; import android.app.Application;
import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.annotation.PluralsRes; import android.support.annotation.PluralsRes;
import android.support.v4.content.LocalBroadcastManager; import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import com.crashlytics.android.Crashlytics; import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers; import com.crashlytics.android.answers.Answers;
@ -15,14 +28,6 @@ import com.squareup.otto.Bus;
import com.squareup.otto.LoggingBus; import com.squareup.otto.LoggingBus;
import com.squareup.otto.ThreadEnforcer; import com.squareup.otto.ThreadEnforcer;
import net.danlew.android.joda.JodaTimeAndroid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.ArrayList;
import info.nightscout.androidaps.data.ConstraintChecker; import info.nightscout.androidaps.data.ConstraintChecker;
import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginBase;
@ -93,8 +98,8 @@ import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.SP;
import io.fabric.sdk.android.Fabric; import io.fabric.sdk.android.Fabric;
public class MainApp extends Application { public class MainApp extends Application {
private static Logger log = LoggerFactory.getLogger(L.CORE); private static Logger log = LoggerFactory.getLogger(L.CORE);
private static KeepAliveReceiver keepAliveReceiver; private static KeepAliveReceiver keepAliveReceiver;
@ -117,6 +122,7 @@ public class MainApp extends Application {
public static boolean devBranch; public static boolean devBranch;
public static boolean engineeringMode; public static boolean engineeringMode;
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
@ -158,7 +164,8 @@ public class MainApp extends Application {
// Register all tabs in app here // Register all tabs in app here
pluginsList.add(OverviewPlugin.getPlugin()); pluginsList.add(OverviewPlugin.getPlugin());
pluginsList.add(IobCobCalculatorPlugin.getPlugin()); pluginsList.add(IobCobCalculatorPlugin.getPlugin());
if (Config.ACTION) pluginsList.add(ActionsFragment.getPlugin()); if (Config.ACTION)
pluginsList.add(ActionsFragment.getPlugin());
pluginsList.add(InsulinOrefRapidActingPlugin.getPlugin()); pluginsList.add(InsulinOrefRapidActingPlugin.getPlugin());
pluginsList.add(InsulinOrefUltraRapidActingPlugin.getPlugin()); pluginsList.add(InsulinOrefUltraRapidActingPlugin.getPlugin());
pluginsList.add(InsulinOrefFreePeakPlugin.getPlugin()); pluginsList.add(InsulinOrefFreePeakPlugin.getPlugin());
@ -166,29 +173,45 @@ public class MainApp extends Application {
pluginsList.add(SensitivityAAPSPlugin.getPlugin()); pluginsList.add(SensitivityAAPSPlugin.getPlugin());
pluginsList.add(SensitivityWeightedAveragePlugin.getPlugin()); pluginsList.add(SensitivityWeightedAveragePlugin.getPlugin());
pluginsList.add(SensitivityOref1Plugin.getPlugin()); pluginsList.add(SensitivityOref1Plugin.getPlugin());
if (Config.PUMPDRIVERS) pluginsList.add(DanaRPlugin.getPlugin()); if (Config.PUMPDRIVERS)
if (Config.PUMPDRIVERS) pluginsList.add(DanaRKoreanPlugin.getPlugin()); pluginsList.add(DanaRPlugin.getPlugin());
if (Config.PUMPDRIVERS) pluginsList.add(DanaRv2Plugin.getPlugin()); if (Config.PUMPDRIVERS)
if (Config.PUMPDRIVERS) pluginsList.add(DanaRSPlugin.getPlugin()); pluginsList.add(DanaRKoreanPlugin.getPlugin());
if (Config.PUMPDRIVERS) pluginsList.add(LocalInsightPlugin.getPlugin()); if (Config.PUMPDRIVERS)
pluginsList.add(DanaRv2Plugin.getPlugin());
if (Config.PUMPDRIVERS)
pluginsList.add(DanaRSPlugin.getPlugin());
if (Config.PUMPDRIVERS)
pluginsList.add(LocalInsightPlugin.getPlugin());
pluginsList.add(CareportalPlugin.getPlugin()); pluginsList.add(CareportalPlugin.getPlugin());
if (Config.PUMPDRIVERS) pluginsList.add(ComboPlugin.getPlugin()); if (Config.PUMPDRIVERS)
if (Config.MDI) pluginsList.add(MDIPlugin.getPlugin()); pluginsList.add(ComboPlugin.getPlugin());
if (Config.MDI)
pluginsList.add(MDIPlugin.getPlugin());
if (Config.PUMPDRIVERS && engineeringMode) { if (Config.PUMPDRIVERS && engineeringMode) {
pluginsList.add(MedtronicPumpPlugin.getPlugin()); pluginsList.add(MedtronicPumpPlugin.getPlugin());
} }
pluginsList.add(VirtualPumpPlugin.getPlugin()); pluginsList.add(VirtualPumpPlugin.getPlugin());
if (Config.APS) pluginsList.add(LoopPlugin.getPlugin()); if (Config.APS)
if (Config.APS) pluginsList.add(OpenAPSMAPlugin.getPlugin()); pluginsList.add(LoopPlugin.getPlugin());
if (Config.APS) pluginsList.add(OpenAPSAMAPlugin.getPlugin()); if (Config.APS)
if (Config.APS) pluginsList.add(OpenAPSSMBPlugin.getPlugin()); pluginsList.add(OpenAPSMAPlugin.getPlugin());
if (Config.APS)
pluginsList.add(OpenAPSAMAPlugin.getPlugin());
if (Config.APS)
pluginsList.add(OpenAPSSMBPlugin.getPlugin());
pluginsList.add(NSProfilePlugin.getPlugin()); pluginsList.add(NSProfilePlugin.getPlugin());
if (Config.OTHERPROFILES) pluginsList.add(SimpleProfilePlugin.getPlugin()); if (Config.OTHERPROFILES)
if (Config.OTHERPROFILES) pluginsList.add(LocalProfilePlugin.getPlugin()); pluginsList.add(SimpleProfilePlugin.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)
if (Config.SAFETY) pluginsList.add(StorageConstraintPlugin.getPlugin()); pluginsList.add(SafetyPlugin.getPlugin());
if (Config.APS) pluginsList.add(ObjectivesPlugin.getPlugin()); if (Config.SAFETY)
pluginsList.add(StorageConstraintPlugin.getPlugin());
if (Config.APS)
pluginsList.add(ObjectivesPlugin.getPlugin());
pluginsList.add(SourceXdripPlugin.getPlugin()); pluginsList.add(SourceXdripPlugin.getPlugin());
pluginsList.add(SourceNSClientPlugin.getPlugin()); pluginsList.add(SourceNSClientPlugin.getPlugin());
pluginsList.add(SourceMM640gPlugin.getPlugin()); pluginsList.add(SourceMM640gPlugin.getPlugin());
@ -198,7 +221,8 @@ public class MainApp extends Application {
pluginsList.add(SourcePoctechPlugin.getPlugin()); pluginsList.add(SourcePoctechPlugin.getPlugin());
pluginsList.add(SourceTomatoPlugin.getPlugin()); pluginsList.add(SourceTomatoPlugin.getPlugin());
pluginsList.add(SourceEversensePlugin.getPlugin()); pluginsList.add(SourceEversensePlugin.getPlugin());
if (Config.SMSCOMMUNICATORENABLED) pluginsList.add(SmsCommunicatorPlugin.getPlugin()); if (Config.SMSCOMMUNICATORENABLED)
pluginsList.add(SmsCommunicatorPlugin.getPlugin());
pluginsList.add(FoodPlugin.getPlugin()); pluginsList.add(FoodPlugin.getPlugin());
pluginsList.add(WearPlugin.initPlugin(this)); pluginsList.add(WearPlugin.initPlugin(this));
@ -211,7 +235,6 @@ public class MainApp extends Application {
pluginsList.add(DstHelperPlugin.getPlugin()); pluginsList.add(DstHelperPlugin.getPlugin());
ConfigBuilderPlugin.getPlugin().initialize(); ConfigBuilderPlugin.getPlugin().initialize();
} }
@ -227,6 +250,7 @@ public class MainApp extends Application {
} }
} }
private void registerLocalBroadcastReceiver() { private void registerLocalBroadcastReceiver() {
lbm = LocalBroadcastManager.getInstance(this); lbm = LocalBroadcastManager.getInstance(this);
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_TREATMENT)); lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_TREATMENT));
@ -242,16 +266,16 @@ public class MainApp extends Application {
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_DEVICESTATUS)); lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_DEVICESTATUS));
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_CAL)); lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_CAL));
//register alarms // register alarms
lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_ALARM)); lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_ALARM));
lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_ANNOUNCEMENT)); lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_ANNOUNCEMENT));
lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_CLEAR_ALARM)); lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_CLEAR_ALARM));
lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_URGENT_ALARM)); lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_URGENT_ALARM));
//register ack alarm // register ack alarm
lbm.registerReceiver(ackAlarmReciever, new IntentFilter(Intents.ACTION_ACK_ALARM)); lbm.registerReceiver(ackAlarmReciever, new IntentFilter(Intents.ACTION_ACK_ALARM));
//register dbaccess // register dbaccess
lbm.registerReceiver(dbAccessReciever, new IntentFilter(Intents.ACTION_DATABASE)); lbm.registerReceiver(dbAccessReciever, new IntentFilter(Intents.ACTION_DATABASE));
} }
@ -301,11 +325,13 @@ public class MainApp extends Application {
} }
} }
public void stopKeepAliveService() { public void stopKeepAliveService() {
if (keepAliveReceiver != null) if (keepAliveReceiver != null)
KeepAliveReceiver.cancelAlarm(this); KeepAliveReceiver.cancelAlarm(this);
} }
public static void subscribe(Object subscriber) { public static void subscribe(Object subscriber) {
try { try {
bus().register(subscriber); bus().register(subscriber);
@ -314,6 +340,7 @@ public class MainApp extends Application {
} }
} }
public static void unsubscribe(Object subscriber) { public static void unsubscribe(Object subscriber) {
try { try {
bus().unregister(subscriber); bus().unregister(subscriber);
@ -322,34 +349,42 @@ public class MainApp extends Application {
} }
} }
public static Bus bus() { public static Bus bus() {
return sBus; return sBus;
} }
public static String gs(int id) { public static String gs(int id) {
return sResources.getString(id); return sResources.getString(id);
} }
public static String gs(int id, Object... args) { public static String gs(int id, Object... args) {
return sResources.getString(id, args); return sResources.getString(id, args);
} }
public static String gq(@PluralsRes int id, int quantity, Object... args) { public static String gq(@PluralsRes int id, int quantity, Object... args) {
return sResources.getQuantityString(id, quantity, args); return sResources.getQuantityString(id, quantity, args);
} }
public static int gc(int id) { public static int gc(int id) {
return sResources.getColor(id); return sResources.getColor(id);
} }
public static MainApp instance() { public static MainApp instance() {
return sInstance; return sInstance;
} }
public static DatabaseHelper getDbHelper() { public static DatabaseHelper getDbHelper() {
return sDatabaseHelper; return sDatabaseHelper;
} }
public static void closeDbHelper() { public static void closeDbHelper() {
if (sDatabaseHelper != null) { if (sDatabaseHelper != null) {
sDatabaseHelper.close(); sDatabaseHelper.close();
@ -357,14 +392,17 @@ public class MainApp extends Application {
} }
} }
public static ConstraintChecker getConstraintChecker() { public static ConstraintChecker getConstraintChecker() {
return sConstraintsChecker; return sConstraintsChecker;
} }
public static ArrayList<PluginBase> getPluginsList() { public static ArrayList<PluginBase> getPluginsList() {
return pluginsList; return pluginsList;
} }
public static ArrayList<PluginBase> getSpecificPluginsList(PluginType type) { public static ArrayList<PluginBase> getSpecificPluginsList(PluginType type) {
ArrayList<PluginBase> newList = new ArrayList<>(); ArrayList<PluginBase> newList = new ArrayList<>();
@ -379,6 +417,7 @@ public class MainApp extends Application {
return newList; return newList;
} }
public static ArrayList<PluginBase> getSpecificPluginsVisibleInList(PluginType type) { public static ArrayList<PluginBase> getSpecificPluginsVisibleInList(PluginType type) {
ArrayList<PluginBase> newList = new ArrayList<>(); ArrayList<PluginBase> newList = new ArrayList<>();
@ -394,6 +433,7 @@ public class MainApp extends Application {
return newList; return newList;
} }
public static ArrayList<PluginBase> getSpecificPluginsListByInterface(Class interfaceClass) { public static ArrayList<PluginBase> getSpecificPluginsListByInterface(Class interfaceClass) {
ArrayList<PluginBase> newList = new ArrayList<>(); ArrayList<PluginBase> newList = new ArrayList<>();
@ -408,6 +448,7 @@ public class MainApp extends Application {
return newList; return newList;
} }
public static ArrayList<PluginBase> getSpecificPluginsVisibleInListByInterface(Class interfaceClass, PluginType type) { public static ArrayList<PluginBase> getSpecificPluginsVisibleInListByInterface(Class interfaceClass, PluginType type) {
ArrayList<PluginBase> newList = new ArrayList<>(); ArrayList<PluginBase> newList = new ArrayList<>();
@ -423,12 +464,13 @@ public class MainApp extends Application {
return newList; return newList;
} }
@Nullable @Nullable
public static <T extends PluginBase> T getSpecificPlugin(Class<T> pluginClass) { public static <T extends PluginBase> T getSpecificPlugin(Class<T> pluginClass) {
if (pluginsList != null) { if (pluginsList != null) {
for (PluginBase p : pluginsList) { for (PluginBase p : pluginsList) {
if (pluginClass.isAssignableFrom(p.getClass())) if (pluginClass.isAssignableFrom(p.getClass()))
return (T) p; return (T)p;
} }
} else { } else {
log.error("pluginsList=null"); log.error("pluginsList=null");
@ -450,10 +492,12 @@ public class MainApp extends Application {
return engineeringMode || !devBranch; return engineeringMode || !devBranch;
} }
public static boolean isDev() { public static boolean isDev() {
return devBranch; return devBranch;
} }
public static int getIcon() { public static int getIcon() {
if (Config.NSCLIENT) if (Config.NSCLIENT)
return R.mipmap.ic_yellowowl; return R.mipmap.ic_yellowowl;
@ -463,6 +507,7 @@ public class MainApp extends Application {
return R.mipmap.ic_launcher; return R.mipmap.ic_launcher;
} }
public static int getNotificationIcon() { public static int getNotificationIcon() {
if (Config.NSCLIENT) if (Config.NSCLIENT)
return R.drawable.ic_notif_nsclient; return R.drawable.ic_notif_nsclient;
@ -472,6 +517,7 @@ public class MainApp extends Application {
return R.drawable.ic_notif_aaps; return R.drawable.ic_notif_aaps;
} }
@Override @Override
public void onTerminate() { public void onTerminate() {
if (L.isEnabled(L.CORE)) if (L.isEnabled(L.CORE))

View file

@ -1,5 +1,9 @@
package info.nightscout.androidaps.plugins.general.actions; package info.nightscout.androidaps.plugins.general.actions;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
@ -15,18 +19,14 @@ 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.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.activities.HistoryBrowseActivity;
import info.nightscout.androidaps.activities.TDDStatsActivity; import info.nightscout.androidaps.activities.TDDStatsActivity;
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.events.EventCustomActionsChanged;
import info.nightscout.androidaps.events.EventExtendedBolusChange; import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventRefreshOverview; import info.nightscout.androidaps.events.EventRefreshOverview;
@ -35,19 +35,17 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.common.SubscriberFragment; import info.nightscout.androidaps.plugins.common.SubscriberFragment;
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.ActionsPlugin;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction; 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.OptionsToShow; import info.nightscout.androidaps.plugins.general.careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog;
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.
*/ */
@ -55,6 +53,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
static ActionsPlugin actionsPlugin = new ActionsPlugin(); static ActionsPlugin actionsPlugin = new ActionsPlugin();
static public ActionsPlugin getPlugin() { static public ActionsPlugin getPlugin() {
return actionsPlugin; return actionsPlugin;
} }
@ -70,27 +69,27 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
SingleClickButton tddStats; SingleClickButton tddStats;
SingleClickButton history; SingleClickButton history;
private Map<String,CustomAction> pumpCustomActions = new HashMap<>(); private Map<String, CustomAction> pumpCustomActions = new HashMap<>();
private List<SingleClickButton> pumpCustomButtons = new ArrayList<>(); private List<SingleClickButton> pumpCustomButtons = new ArrayList<>();
public ActionsFragment() { public ActionsFragment() {
super(); super();
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Bundle savedInstanceState) {
try { try {
View view = inflater.inflate(R.layout.actions_fragment, container, false); View view = inflater.inflate(R.layout.actions_fragment, container, false);
profileSwitch = (SingleClickButton) view.findViewById(R.id.actions_profileswitch); profileSwitch = (SingleClickButton)view.findViewById(R.id.actions_profileswitch);
tempTarget = (SingleClickButton) view.findViewById(R.id.actions_temptarget); tempTarget = (SingleClickButton)view.findViewById(R.id.actions_temptarget);
extendedBolus = (SingleClickButton) view.findViewById(R.id.actions_extendedbolus); extendedBolus = (SingleClickButton)view.findViewById(R.id.actions_extendedbolus);
extendedBolusCancel = (SingleClickButton) view.findViewById(R.id.actions_extendedbolus_cancel); extendedBolusCancel = (SingleClickButton)view.findViewById(R.id.actions_extendedbolus_cancel);
tempBasal = (SingleClickButton) view.findViewById(R.id.actions_settempbasal); tempBasal = (SingleClickButton)view.findViewById(R.id.actions_settempbasal);
tempBasalCancel = (SingleClickButton) view.findViewById(R.id.actions_canceltempbasal); tempBasalCancel = (SingleClickButton)view.findViewById(R.id.actions_canceltempbasal);
fill = (SingleClickButton) view.findViewById(R.id.actions_fill); fill = (SingleClickButton)view.findViewById(R.id.actions_fill);
tddStats = view.findViewById(R.id.actions_tddstats); tddStats = view.findViewById(R.id.actions_tddstats);
history = view.findViewById(R.id.actions_historybrowser); history = view.findViewById(R.id.actions_historybrowser);
@ -115,21 +114,25 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
return null; return null;
} }
@Subscribe @Subscribe
public void onStatusEvent(final EventInitializationChanged ev) { public void onStatusEvent(final EventInitializationChanged ev) {
updateGUI(); updateGUI();
} }
@Subscribe @Subscribe
public void onStatusEvent(final EventRefreshOverview ev) { public void onStatusEvent(final EventRefreshOverview ev) {
updateGUI(); updateGUI();
} }
@Subscribe @Subscribe
public void onStatusEvent(final EventExtendedBolusChange ev) { public void onStatusEvent(final EventExtendedBolusChange ev) {
updateGUI(); updateGUI();
} }
@Subscribe @Subscribe
public void onStatusEvent(final EventTempBasalChange ev) { public void onStatusEvent(final EventTempBasalChange ev) {
updateGUI(); updateGUI();
@ -147,9 +150,11 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if (ConfigBuilderPlugin.getPlugin().getActiveProfileInterface() != null && ConfigBuilderPlugin.getPlugin().getActiveProfileInterface().getProfile() != null) { if (ConfigBuilderPlugin.getPlugin().getActiveProfileInterface() != null
&& ConfigBuilderPlugin.getPlugin().getActiveProfileInterface().getProfile() != null) {
profileSwitch.setVisibility(View.VISIBLE); profileSwitch.setVisibility(View.VISIBLE);
} else { } else {
profileSwitch.setVisibility(View.GONE); profileSwitch.setVisibility(View.GONE);
@ -167,34 +172,37 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump(); final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
final boolean basalprofileEnabled = MainApp.isEngineeringModeOrRelease() final boolean basalprofileEnabled = MainApp.isEngineeringModeOrRelease()
&& pump.getPumpDescription().isSetBasalProfileCapable; && pump.getPumpDescription().isSetBasalProfileCapable;
if (!basalprofileEnabled || !pump.isInitialized() || pump.isSuspended()) if (!basalprofileEnabled || !pump.isInitialized() || pump.isSuspended())
profileSwitch.setVisibility(View.GONE); profileSwitch.setVisibility(View.GONE);
else else
profileSwitch.setVisibility(View.VISIBLE); profileSwitch.setVisibility(View.VISIBLE);
if (!pump.getPumpDescription().isExtendedBolusCapable || !pump.isInitialized() || pump.isSuspended() || pump.isFakingTempsByExtendedBoluses()) { if (!pump.getPumpDescription().isExtendedBolusCapable || !pump.isInitialized()
|| pump.isSuspended() || pump.isFakingTempsByExtendedBoluses()) {
extendedBolus.setVisibility(View.GONE); extendedBolus.setVisibility(View.GONE);
extendedBolusCancel.setVisibility(View.GONE); extendedBolusCancel.setVisibility(View.GONE);
} else { } else {
ExtendedBolus activeExtendedBolus = TreatmentsPlugin.getPlugin().getExtendedBolusFromHistory(System.currentTimeMillis()); ExtendedBolus activeExtendedBolus = TreatmentsPlugin.getPlugin().getExtendedBolusFromHistory(
System.currentTimeMillis());
if (activeExtendedBolus != null) { if (activeExtendedBolus != null) {
extendedBolus.setVisibility(View.GONE); extendedBolus.setVisibility(View.GONE);
extendedBolusCancel.setVisibility(View.VISIBLE); extendedBolusCancel.setVisibility(View.VISIBLE);
extendedBolusCancel.setText(MainApp.gs(R.string.cancel) + " " + activeExtendedBolus.toString()); extendedBolusCancel.setText(MainApp.gs(R.string.cancel) + " "
+ activeExtendedBolus.toString());
} else { } else {
extendedBolus.setVisibility(View.VISIBLE); extendedBolus.setVisibility(View.VISIBLE);
extendedBolusCancel.setVisibility(View.GONE); extendedBolusCancel.setVisibility(View.GONE);
} }
} }
if (!pump.getPumpDescription().isTempBasalCapable || !pump.isInitialized() || pump.isSuspended()) { if (!pump.getPumpDescription().isTempBasalCapable || !pump.isInitialized() || pump.isSuspended()) {
tempBasal.setVisibility(View.GONE); tempBasal.setVisibility(View.GONE);
tempBasalCancel.setVisibility(View.GONE); tempBasalCancel.setVisibility(View.GONE);
} else { } else {
final TemporaryBasal activeTemp = TreatmentsPlugin.getPlugin().getTempBasalFromHistory(System.currentTimeMillis()); final TemporaryBasal activeTemp = TreatmentsPlugin.getPlugin().getTempBasalFromHistory(
System.currentTimeMillis());
if (activeTemp != null) { if (activeTemp != null) {
tempBasal.setVisibility(View.GONE); tempBasal.setVisibility(View.GONE);
tempBasalCancel.setVisibility(View.VISIBLE); tempBasalCancel.setVisibility(View.VISIBLE);
@ -226,7 +234,6 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
}); });
} }
View.OnClickListener pumpCustomActionsListener = v -> { View.OnClickListener pumpCustomActionsListener = v -> {
SingleClickButton btn = (SingleClickButton)v; SingleClickButton btn = (SingleClickButton)v;
@ -248,9 +255,10 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
return; return;
} }
// add new actions
List<CustomAction> customActions = activePump.getCustomActions(); List<CustomAction> customActions = activePump.getCustomActions();
if (customActions != null && customActions.size()>0) { if (customActions != null && customActions.size() > 0) {
LinearLayout ll = actionsFragmentView.findViewById(R.id.action_buttons_layout); LinearLayout ll = actionsFragmentView.findViewById(R.id.action_buttons_layout);
@ -263,7 +271,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
btn.setText(MainApp.gs(customAction.getName())); btn.setText(MainApp.gs(customAction.getName()));
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 0.5f); LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 0.5f);
layoutParams.setMargins(20, 8, 20, 8); // 10,3,10,3 layoutParams.setMargins(20, 8, 20, 8); // 10,3,10,3
btn.setLayoutParams(layoutParams); btn.setLayoutParams(layoutParams);
@ -285,7 +293,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
private void removePumpCustomActions() { private void removePumpCustomActions() {
if (pumpCustomActions.size()==0) if (pumpCustomActions.size() == 0)
return; return;
LinearLayout ll = actionsFragmentView.findViewById(R.id.action_buttons_layout); LinearLayout ll = actionsFragmentView.findViewById(R.id.action_buttons_layout);

View file

@ -16,34 +16,29 @@ public class CustomAction {
public CustomAction(int nameResourceId, CustomActionType actionType) { public CustomAction(int nameResourceId, CustomActionType actionType) {
this.name = nameResourceId; this(nameResourceId, actionType, R.drawable.icon_actions_profileswitch, true);
this.customActionType = actionType;
this.iconResourceId = R.drawable.icon_actions_profileswitch;
} }
public CustomAction(int nameResourceId, CustomActionType actionType, int iconResourceId) { public CustomAction(int nameResourceId, CustomActionType actionType, int iconResourceId) {
this(nameResourceId, actionType, iconResourceId, true);
}
public CustomAction(int nameResourceId, CustomActionType actionType, int iconResourceId, boolean enabled) {
this.name = nameResourceId; this.name = nameResourceId;
this.customActionType = actionType; this.customActionType = actionType;
this.iconResourceId = iconResourceId; this.iconResourceId = iconResourceId;
}
public CustomAction(int nameResourceId, CustomActionType actionType, boolean enabled) {
this.name = nameResourceId;
this.customActionType = actionType;
this.enabled = enabled; this.enabled = enabled;
} }
public int getName() { public int getName() {
return name; return name;
} }
public CustomActionType getCustomActionType() { public CustomActionType getCustomActionType() {
return customActionType; return customActionType;
} }
@ -52,6 +47,7 @@ public class CustomAction {
return iconResourceId; return iconResourceId;
} }
public boolean isEnabled() { public boolean isEnabled() {
return enabled; return enabled;
} }

View file

@ -258,6 +258,12 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
} }
@Override
public boolean canHandleDST() {
return false;
}
// Pump Plugin // Pump Plugin
private boolean isServiceSet() { private boolean isServiceSet() {
@ -1377,13 +1383,13 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
// LOG.debug("MedtronicPumpPlugin::stopConnecting"); // LOG.debug("MedtronicPumpPlugin::stopConnecting");
// } // }
List<CustomAction> customActions = null; private List<CustomAction> customActions = null;
CustomAction customActionWakeUpAndTune = new CustomAction(R.string.medtronic_custom_action_wake_and_tune, private CustomAction customActionWakeUpAndTune = new CustomAction(R.string.medtronic_custom_action_wake_and_tune,
MedtronicCustomActionType.WakeUpAndTune); MedtronicCustomActionType.WakeUpAndTune);
CustomAction customActionClearBolusBlock = new CustomAction(R.string.medtronic_custom_action_clear_bolus_block, private CustomAction customActionClearBolusBlock = new CustomAction(
MedtronicCustomActionType.ClearBolusBlock); R.string.medtronic_custom_action_clear_bolus_block, MedtronicCustomActionType.ClearBolusBlock);
@Override @Override
@ -1398,7 +1404,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
@Override @Override
public PumpEnactResult executeCustomAction(CustomActionType customActionType) { public void executeCustomAction(CustomActionType customActionType) {
MedtronicCustomActionType mcat = (MedtronicCustomActionType)customActionType; MedtronicCustomActionType mcat = (MedtronicCustomActionType)customActionType;
@ -1419,7 +1425,6 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
break; break;
} }
return null;
} }

View file

@ -1,15 +1,15 @@
package info.nightscout.androidaps.plugins.pump.virtual; package info.nightscout.androidaps.plugins.pump.virtual;
import android.os.SystemClock; import java.util.List;
import com.squareup.otto.Subscribe;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; 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 android.os.SystemClock;
import com.squareup.otto.Subscribe;
import info.nightscout.androidaps.BuildConfig; import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
@ -41,11 +41,11 @@ 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.
*/ */
public class VirtualPumpPlugin extends PluginBase implements PumpInterface { public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
private Logger log = LoggerFactory.getLogger(L.PUMP); private Logger log = LoggerFactory.getLogger(L.PUMP);
Integer batteryPercent = 50; Integer batteryPercent = 50;
@ -56,16 +56,12 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
private long lastDataTime = 0; private long lastDataTime = 0;
private PumpDescription pumpDescription = new PumpDescription(); private PumpDescription pumpDescription = new PumpDescription();
public VirtualPumpPlugin() { public VirtualPumpPlugin() {
super(new PluginDescription() super(new PluginDescription().mainType(PluginType.PUMP).fragmentClass(VirtualPumpFragment.class.getName())
.mainType(PluginType.PUMP) .pluginName(R.string.virtualpump).shortName(R.string.virtualpump_shortname)
.fragmentClass(VirtualPumpFragment.class.getName()) .preferencesId(R.xml.pref_virtualpump).neverVisible(Config.NSCLIENT)
.pluginName(R.string.virtualpump) .description(R.string.description_pump_virtual));
.shortName(R.string.virtualpump_shortname)
.preferencesId(R.xml.pref_virtualpump)
.neverVisible(Config.NSCLIENT)
.description(R.string.description_pump_virtual)
);
pumpDescription.isBolusCapable = true; pumpDescription.isBolusCapable = true;
pumpDescription.bolusStep = 0.1d; pumpDescription.bolusStep = 0.1d;
@ -85,7 +81,6 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
pumpDescription.tempDurationStep30mAllowed = true; pumpDescription.tempDurationStep30mAllowed = true;
pumpDescription.tempMaxDuration = 24 * 60; pumpDescription.tempMaxDuration = 24 * 60;
pumpDescription.isSetBasalProfileCapable = true; pumpDescription.isSetBasalProfileCapable = true;
pumpDescription.basalStep = 0.01d; pumpDescription.basalStep = 0.01d;
pumpDescription.basalMinimumRate = 0.01d; pumpDescription.basalMinimumRate = 0.01d;
@ -96,6 +91,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
pumpDescription.is30minBasalRatesCapable = true; pumpDescription.is30minBasalRatesCapable = true;
} }
public static VirtualPumpPlugin getPlugin() { public static VirtualPumpPlugin getPlugin() {
if (plugin == null) if (plugin == null)
plugin = new VirtualPumpPlugin(); plugin = new VirtualPumpPlugin();
@ -103,19 +99,23 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
return plugin; return plugin;
} }
private void loadFakingStatus() { private void loadFakingStatus() {
fromNSAreCommingFakedExtendedBoluses = SP.getBoolean(R.string.key_fromNSAreCommingFakedExtendedBoluses, false); fromNSAreCommingFakedExtendedBoluses = SP.getBoolean(R.string.key_fromNSAreCommingFakedExtendedBoluses, false);
} }
public boolean getFakingStatus() { public boolean getFakingStatus() {
return fromNSAreCommingFakedExtendedBoluses; return fromNSAreCommingFakedExtendedBoluses;
} }
public void setFakingStatus(boolean newStatus) { public void setFakingStatus(boolean newStatus) {
fromNSAreCommingFakedExtendedBoluses = newStatus; fromNSAreCommingFakedExtendedBoluses = newStatus;
SP.putBoolean(R.string.key_fromNSAreCommingFakedExtendedBoluses, fromNSAreCommingFakedExtendedBoluses); SP.putBoolean(R.string.key_fromNSAreCommingFakedExtendedBoluses, fromNSAreCommingFakedExtendedBoluses);
} }
@Override @Override
protected void onStart() { protected void onStart() {
super.onStart(); super.onStart();
@ -123,72 +123,86 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
refreshConfiguration(); refreshConfiguration();
} }
@Override @Override
protected void onStop() { protected void onStop() {
MainApp.bus().unregister(this); MainApp.bus().unregister(this);
} }
@Subscribe @Subscribe
public void onStatusEvent(final EventPreferenceChange s) { public void onStatusEvent(final EventPreferenceChange s) {
if (s.isChanged(R.string.key_virtualpump_type)) if (s.isChanged(R.string.key_virtualpump_type))
refreshConfiguration(); refreshConfiguration();
} }
@Override @Override
public boolean isFakingTempsByExtendedBoluses() { public boolean isFakingTempsByExtendedBoluses() {
return (Config.NSCLIENT) && fromNSAreCommingFakedExtendedBoluses; return (Config.NSCLIENT) && fromNSAreCommingFakedExtendedBoluses;
} }
@Override @Override
public PumpEnactResult loadTDDs() { public PumpEnactResult loadTDDs() {
//no result, could read DB in the future? // no result, could read DB in the future?
return new PumpEnactResult(); return new PumpEnactResult();
} }
@Override @Override
public List<CustomAction> getCustomActions() { public List<CustomAction> getCustomActions() {
return null; return null;
} }
@Override @Override
public void executeCustomAction(CustomActionType customActionType) { public void executeCustomAction(CustomActionType customActionType) {
} }
@Override @Override
public boolean isInitialized() { public boolean isInitialized() {
return true; return true;
} }
@Override @Override
public boolean isSuspended() { public boolean isSuspended() {
return false; return false;
} }
@Override @Override
public boolean isBusy() { public boolean isBusy() {
return false; return false;
} }
@Override @Override
public boolean isConnected() { public boolean isConnected() {
return true; return true;
} }
@Override @Override
public boolean isConnecting() { public boolean isConnecting() {
return false; return false;
} }
@Override @Override
public boolean isHandshakeInProgress() { public boolean isHandshakeInProgress() {
return false; return false;
} }
@Override @Override
public void finishHandshaking() { public void finishHandshaking() {
} }
@Override @Override
public void connect(String reason) { public void connect(String reason) {
if (!Config.NSCLIENT) if (!Config.NSCLIENT)
@ -196,40 +210,48 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
lastDataTime = System.currentTimeMillis(); lastDataTime = System.currentTimeMillis();
} }
@Override @Override
public void disconnect(String reason) { public void disconnect(String reason) {
} }
@Override @Override
public void stopConnecting() { public void stopConnecting() {
} }
@Override @Override
public void getPumpStatus() { public void getPumpStatus() {
lastDataTime = System.currentTimeMillis(); lastDataTime = System.currentTimeMillis();
} }
@Override @Override
public PumpEnactResult setNewBasalProfile(Profile profile) { public PumpEnactResult setNewBasalProfile(Profile profile) {
lastDataTime = System.currentTimeMillis(); lastDataTime = System.currentTimeMillis();
// Do nothing here. we are using ConfigBuilderPlugin.getPlugin().getActiveProfile().getProfile(); // Do nothing here. we are using ConfigBuilderPlugin.getPlugin().getActiveProfile().getProfile();
PumpEnactResult result = new PumpEnactResult(); PumpEnactResult result = new PumpEnactResult();
result.success = true; result.success = true;
Notification notification = new Notification(Notification.PROFILE_SET_OK, MainApp.gs(R.string.profile_set_ok), Notification.INFO, 60); Notification notification = new Notification(Notification.PROFILE_SET_OK, MainApp.gs(R.string.profile_set_ok),
Notification.INFO, 60);
MainApp.bus().post(new EventNewNotification(notification)); MainApp.bus().post(new EventNewNotification(notification));
return result; return result;
} }
@Override @Override
public boolean isThisProfileSet(Profile profile) { public boolean isThisProfileSet(Profile profile) {
return true; return true;
} }
@Override @Override
public long lastDataTime() { public long lastDataTime() {
return lastDataTime; return lastDataTime;
} }
@Override @Override
public double getBaseBasalRate() { public double getBaseBasalRate() {
Profile profile = ProfileFunctions.getInstance().getProfile(); Profile profile = ProfileFunctions.getInstance().getProfile();
@ -241,10 +263,16 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
@Override @Override
public double getReservoirLevel() { return reservoirInUnits; } public double getReservoirLevel() {
return reservoirInUnits;
}
@Override @Override
public int getBatteryLevel() { return batteryPercent; } public int getBatteryLevel() {
return batteryPercent;
}
@Override @Override
public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) { public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
@ -262,7 +290,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
SystemClock.sleep(200); SystemClock.sleep(200);
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance(); EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
bolusingEvent.status = String.format(MainApp.gs(R.string.bolusdelivering), delivering); bolusingEvent.status = String.format(MainApp.gs(R.string.bolusdelivering), delivering);
bolusingEvent.percent = Math.min((int) (delivering / detailedBolusInfo.insulin * 100), 100); bolusingEvent.percent = Math.min((int)(delivering / detailedBolusInfo.insulin * 100), 100);
MainApp.bus().post(bolusingEvent); MainApp.bus().post(bolusingEvent);
delivering += 0.1d; delivering += 0.1d;
} }
@ -273,25 +301,26 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
MainApp.bus().post(bolusingEvent); MainApp.bus().post(bolusingEvent);
SystemClock.sleep(1000); SystemClock.sleep(1000);
if (L.isEnabled(L.PUMPCOMM)) if (L.isEnabled(L.PUMPCOMM))
log.debug("Delivering treatment insulin: " + detailedBolusInfo.insulin + "U carbs: " + detailedBolusInfo.carbs + "g " + result); log.debug("Delivering treatment insulin: " + detailedBolusInfo.insulin + "U carbs: "
+ detailedBolusInfo.carbs + "g " + result);
MainApp.bus().post(new EventVirtualPumpUpdateGui()); MainApp.bus().post(new EventVirtualPumpUpdateGui());
lastDataTime = System.currentTimeMillis(); lastDataTime = System.currentTimeMillis();
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false); TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false);
return result; return result;
} }
@Override @Override
public void stopBolusDelivering() { public void stopBolusDelivering() {
} }
@Override
public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, Profile profile, boolean enforceNew) {
TemporaryBasal tempBasal = new TemporaryBasal() @Override
.date(System.currentTimeMillis()) public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, Profile profile,
.absolute(absoluteRate) boolean enforceNew) {
.duration(durationInMinutes)
.source(Source.USER); TemporaryBasal tempBasal = new TemporaryBasal().date(System.currentTimeMillis()).absolute(absoluteRate)
.duration(durationInMinutes).source(Source.USER);
PumpEnactResult result = new PumpEnactResult(); PumpEnactResult result = new PumpEnactResult();
result.success = true; result.success = true;
result.enacted = true; result.enacted = true;
@ -307,13 +336,12 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
return result; return result;
} }
@Override @Override
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, Profile profile, boolean enforceNew) { public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, Profile profile,
TemporaryBasal tempBasal = new TemporaryBasal() boolean enforceNew) {
.date(System.currentTimeMillis()) TemporaryBasal tempBasal = new TemporaryBasal().date(System.currentTimeMillis()).percent(percent)
.percent(percent) .duration(durationInMinutes).source(Source.USER);
.duration(durationInMinutes)
.source(Source.USER);
PumpEnactResult result = new PumpEnactResult(); PumpEnactResult result = new PumpEnactResult();
result.success = true; result.success = true;
result.enacted = true; result.enacted = true;
@ -330,17 +358,15 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
return result; return result;
} }
@Override @Override
public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) { public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) {
PumpEnactResult result = cancelExtendedBolus(); PumpEnactResult result = cancelExtendedBolus();
if (!result.success) if (!result.success)
return result; return result;
ExtendedBolus extendedBolus = new ExtendedBolus() ExtendedBolus extendedBolus = new ExtendedBolus().date(System.currentTimeMillis()).insulin(insulin)
.date(System.currentTimeMillis()) .durationInMinutes(durationInMinutes).source(Source.USER);
.insulin(insulin)
.durationInMinutes(durationInMinutes)
.source(Source.USER);
result.success = true; result.success = true;
result.enacted = true; result.enacted = true;
result.bolusDelivered = insulin; result.bolusDelivered = insulin;
@ -355,6 +381,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
return result; return result;
} }
@Override @Override
public PumpEnactResult cancelTempBasal(boolean force) { public PumpEnactResult cancelTempBasal(boolean force) {
PumpEnactResult result = new PumpEnactResult(); PumpEnactResult result = new PumpEnactResult();
@ -365,7 +392,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
result.enacted = true; result.enacted = true;
TemporaryBasal tempStop = new TemporaryBasal().date(System.currentTimeMillis()).source(Source.USER); TemporaryBasal tempStop = new TemporaryBasal().date(System.currentTimeMillis()).source(Source.USER);
TreatmentsPlugin.getPlugin().addToHistoryTempBasal(tempStop); TreatmentsPlugin.getPlugin().addToHistoryTempBasal(tempStop);
//tempBasal = null; // tempBasal = null;
if (L.isEnabled(L.PUMPCOMM)) if (L.isEnabled(L.PUMPCOMM))
log.debug("Canceling temp basal: " + result); log.debug("Canceling temp basal: " + result);
MainApp.bus().post(new EventVirtualPumpUpdateGui()); MainApp.bus().post(new EventVirtualPumpUpdateGui());
@ -374,6 +401,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
return result; return result;
} }
@Override @Override
public PumpEnactResult cancelExtendedBolus() { public PumpEnactResult cancelExtendedBolus() {
PumpEnactResult result = new PumpEnactResult(); PumpEnactResult result = new PumpEnactResult();
@ -393,6 +421,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
return result; return result;
} }
@Override @Override
public JSONObject getJSONStatus(Profile profile, String profileName) { public JSONObject getJSONStatus(Profile profile, String profileName) {
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
@ -436,25 +465,30 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
return pump; return pump;
} }
@Override @Override
public String deviceID() { public String deviceID() {
return "VirtualPump"; return "VirtualPump";
} }
@Override @Override
public PumpDescription getPumpDescription() { public PumpDescription getPumpDescription() {
return pumpDescription; return pumpDescription;
} }
@Override @Override
public String shortStatus(boolean veryShort) { public String shortStatus(boolean veryShort) {
return "Virtual Pump"; return "Virtual Pump";
} }
public PumpType getPumpType() { public PumpType getPumpType() {
return pumpType; return pumpType;
} }
@Override @Override
public boolean canHandleDST() { public boolean canHandleDST() {
return true; return true;
@ -481,15 +515,4 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
} }
@Override
public List<CustomAction> getCustomActions() {
return null;
}
@Override
public void executeCustomAction(CustomActionType customActionType) {
return null;
}
} }

View file

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
<!--Generated by crowdin.com-->
<resources> <resources>
<string name="treatmentssafety_title">Sécurités des traitements</string> <string name="treatmentssafety_title">Sécurités des traitements</string>
<string name="treatmentssafety_maxbolus_title">Maximum Bolus autorisé [U]</string> <string name="treatmentssafety_maxbolus_title">Maximum Bolus autorisé [U]</string>
@ -344,7 +343,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
<string name="smscommunicator_basalreplywithcode">Pour démarrer Basal %1$.2fU/h pendant %2$d min, renvoyer le code %3$s</string> <string name="smscommunicator_basalreplywithcode">Pour démarrer Basal %1$.2fU/h pendant %2$d min, renvoyer le code %3$s</string>
<string name="smscommunicator_profilereplywithcode">Pour changer le profil vers %1$s %2$d%%, renvoyer le code %3$s</string> <string name="smscommunicator_profilereplywithcode">Pour changer le profil vers %1$s %2$d%%, renvoyer le code %3$s</string>
<string name="smscommunicator_extendedreplywithcode">Pour démarrer le Bolus étendu %1$.2fU pendant %2$d min, renvoyer le code %3$s</string> <string name="smscommunicator_extendedreplywithcode">Pour démarrer le Bolus étendu %1$.2fU pendant %2$d min, renvoyer le code %3$s</string>
<string name="smscommunicator_basalpctreplywithcode">Pour démarrer le Basal %1$d% pendant %2$d min, renvoyer le code %3$s</string> <string name="smscommunicator_basalpctreplywithcode">Pour démarrer le Basal %1$d%% pendant %2$d min, renvoyer le code %3$s</string>
<string name="smscommunicator_suspendreplywithcode">Envoyer le code %2$s pour suspendre la Boucle pour %1$d minutes</string> <string name="smscommunicator_suspendreplywithcode">Envoyer le code %2$s pour suspendre la Boucle pour %1$d minutes</string>
<string name="smscommunicator_tempbasalset">Démarrage réussi pour %1$.2fU/h de basal temporaire pour %2$d min</string> <string name="smscommunicator_tempbasalset">Démarrage réussi pour %1$.2fU/h de basal temporaire pour %2$d min</string>
<string name="smscommunicator_extendedset">Le Bolus étendu %1$.2fU pendant %2$d min a commencé avec succès</string> <string name="smscommunicator_extendedset">Le Bolus étendu %1$.2fU pendant %2$d min a commencé avec succès</string>