diff --git a/app/src/main/java/info/nightscout/androidaps/Config.java b/app/src/main/java/info/nightscout/androidaps/Config.java
index e6c06583c9..7f3aad2f93 100644
--- a/app/src/main/java/info/nightscout/androidaps/Config.java
+++ b/app/src/main/java/info/nightscout/androidaps/Config.java
@@ -15,6 +15,7 @@ public class Config {
public static final boolean NSCLIENT = BuildConfig.NSCLIENTOLNY;
+ public static final boolean COMBO = true && BuildConfig.PUMPDRIVERS;
public static final boolean DANAR = true && BuildConfig.PUMPDRIVERS;
public static final boolean DANARv2 = true && BuildConfig.PUMPDRIVERS;
diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java
index 9dff7b0b5a..17bf5ebb4c 100644
--- a/app/src/main/java/info/nightscout/androidaps/MainApp.java
+++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java
@@ -40,6 +40,7 @@ import info.nightscout.androidaps.plugins.ProfileCircadianPercentage.CircadianPe
import info.nightscout.androidaps.plugins.ProfileLocal.LocalProfileFragment;
import info.nightscout.androidaps.plugins.ProfileNS.NSProfileFragment;
import info.nightscout.androidaps.plugins.ProfileSimple.SimpleProfileFragment;
+import info.nightscout.androidaps.plugins.PumpCombo.ComboFragment;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRFragment;
import info.nightscout.androidaps.plugins.PumpDanaR.services.DanaRExecutionService;
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanFragment;
@@ -106,6 +107,7 @@ public class MainApp extends Application {
if (Config.DANAR) pluginsList.add(DanaRFragment.getPlugin());
if (Config.DANAR) pluginsList.add(DanaRKoreanFragment.getPlugin());
if (Config.DANARv2) pluginsList.add(DanaRv2Fragment.getPlugin());
+ if (Config.COMBO) pluginsList.add(ComboFragment.getPlugin());
pluginsList.add(CareportalFragment.getPlugin());
if (Config.MDI) pluginsList.add(MDIPlugin.getPlugin());
if (Config.VIRTUALPUMP) pluginsList.add(VirtualPumpPlugin.getInstance());
diff --git a/app/src/main/java/info/nightscout/androidaps/PreferencesActivity.java b/app/src/main/java/info/nightscout/androidaps/PreferencesActivity.java
index c5d8769639..71c1445298 100644
--- a/app/src/main/java/info/nightscout/androidaps/PreferencesActivity.java
+++ b/app/src/main/java/info/nightscout/androidaps/PreferencesActivity.java
@@ -14,6 +14,7 @@ import android.preference.PreferenceManager;
import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventRefreshGui;
import info.nightscout.androidaps.interfaces.PluginBase;
+import info.nightscout.androidaps.plugins.PumpCombo.ComboPlugin;
import info.nightscout.androidaps.plugins.PumpDanaR.BluetoothDevicePreference;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
@@ -135,6 +136,12 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
addPreferencesFromResource(R.xml.pref_danarprofile);
}
}
+ if (Config.COMBO) {
+ ComboPlugin comboPlugin = (ComboPlugin) MainApp.getSpecificPlugin(ComboPlugin.class);
+ if (comboPlugin.isEnabled(PluginBase.PUMP)) {
+ addPreferencesFromResource(R.xml.pref_combo);
+ }
+ }
VirtualPumpPlugin virtualPumpPlugin = (VirtualPumpPlugin) MainApp.getSpecificPlugin(VirtualPumpPlugin.class);
if (virtualPumpPlugin != null && virtualPumpPlugin.isEnabled(PluginBase.PUMP)) {
addPreferencesFromResource(R.xml.pref_virtualpump);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java
new file mode 100644
index 0000000000..49fc90c6ae
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java
@@ -0,0 +1,74 @@
+package info.nightscout.androidaps.plugins.PumpCombo;
+
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.os.Handler;
+import android.support.annotation.Nullable;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import com.squareup.otto.Subscribe;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+
+import info.nightscout.androidaps.MainApp;
+import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.plugins.PumpCombo.events.EventComboPumpUpdateGUI;
+import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
+import info.nightscout.androidaps.plugins.PumpVirtual.events.EventVirtualPumpUpdateGui;
+
+public class ComboFragment extends Fragment {
+ private static Logger log = LoggerFactory.getLogger(ComboFragment.class);
+
+ private static ComboPlugin comboPlugin = new ComboPlugin();
+
+ public static ComboPlugin getPlugin() {
+ return comboPlugin;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View view = inflater.inflate(R.layout.combopump_fragment, container, false);
+
+ updateGUI();
+ return view;
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ MainApp.bus().unregister(this);
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ MainApp.bus().register(this);
+ }
+
+ @Subscribe
+ public void onStatusEvent(final EventComboPumpUpdateGUI ev) {
+ updateGUI();
+ }
+
+ public void updateGUI() {
+ Activity activity = getActivity();
+ if (activity != null)
+ activity.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+
+// your rendering code here
+
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java
new file mode 100644
index 0000000000..8f9bc20561
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java
@@ -0,0 +1,252 @@
+package info.nightscout.androidaps.plugins.PumpCombo;
+
+import android.content.Context;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+
+import info.nightscout.androidaps.BuildConfig;
+import info.nightscout.androidaps.Config;
+import info.nightscout.androidaps.MainApp;
+import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.data.PumpEnactResult;
+import info.nightscout.androidaps.interfaces.InsulinInterface;
+import info.nightscout.androidaps.interfaces.PluginBase;
+import info.nightscout.androidaps.interfaces.PumpDescription;
+import info.nightscout.androidaps.interfaces.PumpInterface;
+import info.nightscout.androidaps.plugins.NSClientInternal.data.NSProfile;
+import info.nightscout.androidaps.plugins.PumpCombo.events.EventComboPumpUpdateGUI;
+import info.nightscout.androidaps.plugins.PumpMDI.MDIFragment;
+import info.nightscout.androidaps.plugins.TreatmentsFromHistory.TreatmentsFromHistoryPlugin;
+import info.nightscout.utils.DateUtil;
+
+/**
+ * Created by mike on 05.08.2016.
+ */
+public class ComboPlugin implements PluginBase, PumpInterface {
+ private static Logger log = LoggerFactory.getLogger(ComboPlugin.class);
+
+ boolean fragmentEnabled = false;
+ boolean fragmentVisible = false;
+
+ PumpDescription pumpDescription = new PumpDescription();
+
+ public ComboPlugin() {
+ pumpDescription.isBolusCapable = true;
+ pumpDescription.bolusStep = 0.5d;
+
+ pumpDescription.isExtendedBolusCapable = false;
+ pumpDescription.extendedBolusStep = 0d;
+
+ pumpDescription.isTempBasalCapable = false;
+ pumpDescription.lowTempBasalStyle = PumpDescription.NONE;
+ pumpDescription.highTempBasalStyle = PumpDescription.NONE;
+ pumpDescription.maxHighTempPercent = 0;
+ pumpDescription.maxHighTempAbsolute = 0;
+ pumpDescription.lowTempPercentStep = 0;
+ pumpDescription.lowTempAbsoluteStep = 0;
+ pumpDescription.lowTempPercentDuration = 0;
+ pumpDescription.lowTempAbsoluteDuration = 0;
+ pumpDescription.highTempPercentStep = 0;
+ pumpDescription.highTempAbsoluteStep = 0d;
+ pumpDescription.highTempPercentDuration = 0;
+ pumpDescription.highTempAbsoluteDuration = 0;
+
+ pumpDescription.isSetBasalProfileCapable = false;
+ pumpDescription.basalStep = 0d;
+ pumpDescription.basalMinimumRate = 0d;
+
+ pumpDescription.isRefillingCapable = false;
+ }
+
+ @Override
+ public String getFragmentClass() {
+ return ComboFragment.class.getName();
+ }
+
+ @Override
+ public String getName() {
+ return MainApp.instance().getString(R.string.combopump);
+ }
+
+ @Override
+ public String getNameShort() {
+ // use long name as fallback (not visible in tabs)
+ return getName();
+ }
+
+ @Override
+ public boolean isEnabled(int type) {
+ return type == PUMP && fragmentEnabled;
+ }
+
+ @Override
+ public boolean isVisibleInTabs(int type) {
+ return type == PUMP && fragmentVisible;
+ }
+
+ @Override
+ public boolean canBeHidden(int type) {
+ return true;
+ }
+
+ @Override
+ public boolean hasFragment() {
+ return true;
+ }
+
+ @Override
+ public boolean showInList(int type) {
+ return true;
+ }
+
+ @Override
+ public void setFragmentEnabled(int type, boolean fragmentEnabled) {
+ if (type == PUMP) this.fragmentEnabled = fragmentEnabled;
+ }
+
+ @Override
+ public void setFragmentVisible(int type, boolean fragmentVisible) {
+ if (type == PUMP) this.fragmentVisible = fragmentVisible;
+ }
+
+ @Override
+ public int getType() {
+ return PluginBase.PUMP;
+ }
+
+ @Override
+ public String treatmentPlugin() {
+ return TreatmentsFromHistoryPlugin.class.getName();
+ }
+
+ @Override
+ public boolean isInitialized() {
+ return true;
+ }
+
+ @Override
+ public boolean isSuspended() {
+ return false;
+ }
+
+ @Override
+ public boolean isBusy() {
+ return false;
+ }
+
+ @Override
+ public int setNewBasalProfile(NSProfile profile) {
+ return FAILED;
+ }
+
+ @Override
+ public boolean isThisProfileSet(NSProfile profile) {
+ return false;
+ }
+
+ @Override
+ public Date lastDataTime() {
+ return new Date();
+ }
+
+ @Override
+ public void refreshDataFromPump(String reason) {
+// this is called regulary from keepalive
+ }
+
+ @Override
+ public double getBaseBasalRate() {
+ return 0d;
+ }
+
+ @Override
+ public PumpEnactResult deliverTreatment(InsulinInterface insulinType, Double insulin, Integer carbs, Context context) {
+ PumpEnactResult result = new PumpEnactResult();
+ return result;
+ }
+
+ @Override
+ public void stopBolusDelivering() {
+ }
+
+ @Override
+ public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes) {
+ PumpEnactResult result = new PumpEnactResult();
+ return result;
+ }
+
+ @Override
+ public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) {
+ PumpEnactResult result = new PumpEnactResult();
+ return result;
+ }
+
+ @Override
+ public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) {
+ PumpEnactResult result = new PumpEnactResult();
+ return result;
+ }
+
+ @Override
+ public PumpEnactResult cancelTempBasal() {
+ PumpEnactResult result = new PumpEnactResult();
+ return result;
+ }
+
+ @Override
+ public PumpEnactResult cancelExtendedBolus() {
+ PumpEnactResult result = new PumpEnactResult();
+ return result;
+ }
+
+ @Override
+ public JSONObject getJSONStatus() {
+ JSONObject pump = new JSONObject();
+ JSONObject status = new JSONObject();
+ JSONObject extended = new JSONObject();
+ try {
+ status.put("status", "normal");
+ extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION);
+ try {
+ extended.put("ActiveProfile", MainApp.getConfigBuilder().getActiveProfile().getProfile().getActiveProfile());
+ } catch (Exception e) {
+ }
+ status.put("timestamp", DateUtil.toISOString(new Date()));
+
+// more info here .... look at dana plugin
+
+ pump.put("status", status);
+ pump.put("extended", extended);
+ pump.put("clock", DateUtil.toISOString(new Date()));
+ } catch (JSONException e) {
+ }
+ return pump;
+ }
+
+ @Override
+ public String deviceID() {
+// Serial number here
+ return "Combo";
+ }
+
+ @Override
+ public PumpDescription getPumpDescription() {
+ return pumpDescription;
+ }
+
+ @Override
+ public String shortStatus(boolean veryShort) {
+ return deviceID();
+ }
+
+}
+
+
+// If you want update fragment call
+// MainApp.bus().post(new EventComboPumpUpdateGUI());
+// fragment should fetch data from plugin and display status, buttons etc ...
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/events/EventComboPumpUpdateGUI.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/events/EventComboPumpUpdateGUI.java
new file mode 100644
index 0000000000..e9bf3f8415
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/events/EventComboPumpUpdateGUI.java
@@ -0,0 +1,8 @@
+package info.nightscout.androidaps.plugins.PumpCombo.events;
+
+/**
+ * Created by mike on 24.05.2017.
+ */
+
+public class EventComboPumpUpdateGUI {
+}
diff --git a/app/src/main/res/layout/combopump_fragment.xml b/app/src/main/res/layout/combopump_fragment.xml
new file mode 100644
index 0000000000..dd0948ef4c
--- /dev/null
+++ b/app/src/main/res/layout/combopump_fragment.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a44e5ef758..959aceb127 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -685,4 +685,6 @@
Values not stored!
Overview Notifications
Pass the Overview Notifications through as wear confirmation messages.
+ Accu-Chek Combo
+ Accu-Chek Combo settings
diff --git a/app/src/main/res/xml/pref_combo.xml b/app/src/main/res/xml/pref_combo.xml
new file mode 100644
index 0000000000..3f2a8800b7
--- /dev/null
+++ b/app/src/main/res/xml/pref_combo.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
\ No newline at end of file