diff --git a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.java b/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.java
index b6ebed9b5b..59c53ba0b6 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.java
+++ b/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.java
@@ -15,7 +15,7 @@ import android.text.TextUtils;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.RxBus;
+import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventRefreshGui;
import info.nightscout.androidaps.interfaces.PluginBase;
@@ -209,11 +209,12 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
initSummary(getPreferenceScreen());
- final Preference tidepoolTestLogin = findPreference("tidepool_test_login");
- tidepoolTestLogin.setOnPreferenceClickListener(preference -> {
- TidepoolUploader.INSTANCE.testLogin(getActivity());
- return false;
- });
+ final Preference tidepoolTestLogin = findPreference(MainApp.gs(R.string.key_tidepool_test_login));
+ if (tidepoolTestLogin != null)
+ tidepoolTestLogin.setOnPreferenceClickListener(preference -> {
+ TidepoolUploader.INSTANCE.testLogin(getActivity());
+ return false;
+ });
}
@Override
diff --git a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java
index 46bf2764c2..9770f12510 100644
--- a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java
+++ b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java
@@ -29,7 +29,7 @@ import java.util.concurrent.TimeUnit;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.RxBus;
+import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.data.OverlappingIntervals;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.ProfileStore;
diff --git a/app/src/main/java/info/nightscout/androidaps/RxBus.kt b/app/src/main/java/info/nightscout/androidaps/plugins/bus/RxBus.kt
similarity index 91%
rename from app/src/main/java/info/nightscout/androidaps/RxBus.kt
rename to app/src/main/java/info/nightscout/androidaps/plugins/bus/RxBus.kt
index 489f349ef8..724790df07 100644
--- a/app/src/main/java/info/nightscout/androidaps/RxBus.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/bus/RxBus.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps
+package info.nightscout.androidaps.plugins.bus
import io.reactivex.Observable
import io.reactivex.subjects.PublishSubject
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.java
index 3c3531da86..77398a1cae 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.java
@@ -232,26 +232,32 @@ public class ConfigBuilderPlugin extends PluginBase {
return commandQueue;
}
+ @Nullable
public BgSourceInterface getActiveBgSource() {
return activeBgSource;
}
+ @Nullable
public ProfileInterface getActiveProfileInterface() {
return activeProfile;
}
+ @Nullable
public InsulinInterface getActiveInsulin() {
return activeInsulin;
}
+ @Nullable
public APSInterface getActiveAPS() {
return activeAPS;
}
+ @Nullable
public PumpInterface getActivePump() {
return activePump;
}
+ @Nullable
public SensitivityInterface getActiveSensitivity() {
return activeSensitivity;
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.java
index 142c106953..b5ff92ee0e 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.java
@@ -22,7 +22,7 @@ import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.RxBus;
+import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventChargingState;
import info.nightscout.androidaps.events.EventNetworkChange;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NsClientReceiverDelegate.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NsClientReceiverDelegate.java
index e3d8874ea9..00d8d933ec 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NsClientReceiverDelegate.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NsClientReceiverDelegate.java
@@ -10,7 +10,7 @@ import com.squareup.otto.Bus;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.RxBus;
+import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.events.EventChargingState;
import info.nightscout.androidaps.events.EventNetworkChange;
import info.nightscout.androidaps.events.EventPreferenceChange;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/TidepoolJavaFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/TidepoolJavaFragment.java
index 9dd6b9b9c6..492667cb4d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/TidepoolJavaFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/TidepoolJavaFragment.java
@@ -12,7 +12,7 @@ import android.widget.TextView;
import com.squareup.otto.Subscribe;
import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.RxBus;
+import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
import info.nightscout.androidaps.plugins.general.tidepool.comm.TidepoolUploader;
import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolDoUpload;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/TidepoolPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/TidepoolPlugin.kt
index 84013ab033..022a0bc75b 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/TidepoolPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/TidepoolPlugin.kt
@@ -5,7 +5,7 @@ import android.text.Spanned
import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.RxBus
+import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.events.EventNetworkChange
import info.nightscout.androidaps.events.EventNewBG
import info.nightscout.androidaps.events.EventPreferenceChange
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/TidepoolCallback.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/TidepoolCallback.kt
index 893d4c5ce8..f6ae47dbc7 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/TidepoolCallback.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/TidepoolCallback.kt
@@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.general.tidepool.comm
-import info.nightscout.androidaps.RxBus
+import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.logging.L
import org.slf4j.LoggerFactory
import retrofit2.Call
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/TidepoolUploader.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/TidepoolUploader.kt
index 19b75b7c59..afec069623 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/TidepoolUploader.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/TidepoolUploader.kt
@@ -2,10 +2,11 @@ package info.nightscout.androidaps.plugins.general.tidepool.comm
import android.content.Context
import android.os.PowerManager
+import android.os.SystemClock
import info.nightscout.androidaps.BuildConfig
import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.RxBus
+import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.logging.L
import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolStatus
import info.nightscout.androidaps.plugins.general.tidepool.messages.*
@@ -137,7 +138,8 @@ object TidepoolUploader {
connectionStatus = TidepoolUploader.ConnectionStatus.CONNECTED
RxBus.send(EventTidepoolStatus(("New dataset OK")))
if (doUpload) doUpload()
- releaseWakeLock()
+ else
+ releaseWakeLock()
}, {
RxBus.send(EventTidepoolStatus(("New dataset FAILED")))
connectionStatus = TidepoolUploader.ConnectionStatus.FAILED
@@ -151,7 +153,8 @@ object TidepoolUploader {
connectionStatus = TidepoolUploader.ConnectionStatus.CONNECTED
RxBus.send(EventTidepoolStatus(("Appending to existing dataset")))
if (doUpload) doUpload()
- releaseWakeLock()
+ else
+ releaseWakeLock()
}
}, {
connectionStatus = TidepoolUploader.ConnectionStatus.FAILED
@@ -170,6 +173,7 @@ object TidepoolUploader {
fun doUpload() {
if (session == null) {
log.error("Session is null, cannot proceed")
+ releaseWakeLock()
return
}
extendWakeLock(60000)
@@ -184,6 +188,7 @@ object TidepoolUploader {
if (L.isEnabled(L.TIDEPOOL)) log.debug("Empty dataset - marking as succeeded")
RxBus.send(EventTidepoolStatus(("No data to upload")))
releaseWakeLock()
+ unploadNext()
}
else -> {
val body = RequestBody.create(MediaType.parse("application/json"), chunk)
@@ -194,13 +199,22 @@ object TidepoolUploader {
setLastEnd(session!!.end)
RxBus.send(EventTidepoolStatus(("Upload completed OK")))
releaseWakeLock()
+ unploadNext()
}, {
RxBus.send(EventTidepoolStatus(("Upload FAILED")))
releaseWakeLock()
}))
}
}
+ }
+ private fun unploadNext() {
+ if (getLastEnd() < DateUtil.now() - T.mins(1).msecs()) {
+ SystemClock.sleep(3000)
+ if (L.isEnabled(L.TIDEPOOL))
+ log.debug("Restarting doUpload. Last: " + DateUtil.dateAndTimeString(getLastEnd()))
+ doUpload()
+ }
}
fun deleteDataSet() {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/UploadChunk.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/UploadChunk.kt
index a972242a36..93d2bf20a0 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/UploadChunk.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/UploadChunk.kt
@@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.general.tidepool.comm
import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.RxBus
+import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.logging.L
import info.nightscout.androidaps.plugins.general.tidepool.elements.*
import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolStatus
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/elements/ProfileElement.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/elements/ProfileElement.kt
index 97da4e9a76..71ff8bd618 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/elements/ProfileElement.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/elements/ProfileElement.kt
@@ -4,6 +4,7 @@ import com.google.gson.annotations.Expose
import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.db.ProfileSwitch
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
+import info.nightscout.androidaps.utils.InstanceId
import java.util.*
import kotlin.collections.ArrayList
@@ -23,7 +24,13 @@ class ProfileElement(ps: ProfileSwitch)
@Expose
internal var insulinSensitivities: IsfProfile = IsfProfile()
@Expose
- internal var deviceId: String = (ConfigBuilderPlugin.getPlugin().activePump?.model() ?: "Unknown") + ":" + (ConfigBuilderPlugin.getPlugin().activePump?.model() ?: "Unknown")
+ internal var deviceId: String = (ConfigBuilderPlugin.getPlugin().activePump?.model() ?: "Medtronic") + ":" + (ConfigBuilderPlugin.getPlugin().activePump?.serialNumber() ?: InstanceId.instanceId())
+ @Expose
+ internal var deviceSerialNumber: String = ConfigBuilderPlugin.getPlugin().activePump?.serialNumber() ?: InstanceId.instanceId()
+ @Expose
+ internal var clockDriftOffset: Long = 0
+ @Expose
+ internal var conversionOffset: Long = 0
init {
type = "pumpSettings"
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/messages/OpenDatasetRequestMessage.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/messages/OpenDatasetRequestMessage.kt
index 63aeb03795..4300b2d46b 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/messages/OpenDatasetRequestMessage.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/messages/OpenDatasetRequestMessage.kt
@@ -2,17 +2,18 @@ package info.nightscout.androidaps.plugins.general.tidepool.messages
import com.google.gson.annotations.Expose
import info.nightscout.androidaps.BuildConfig
-import info.nightscout.androidaps.MainApp
-import info.nightscout.androidaps.R
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.androidaps.utils.InstanceId
import info.nightscout.androidaps.utils.T
import java.util.*
class OpenDatasetRequestMessage : BaseMessage() {
@Expose
- var deviceId: String = (ConfigBuilderPlugin.getPlugin().activePump?.model() ?: "Unknown") + ":" + (ConfigBuilderPlugin.getPlugin().activePump?.model() ?: "Unknown")
+ var deviceId: String = (ConfigBuilderPlugin.getPlugin().activePump?.model()
+ ?: "Medtronic") + ":" + (ConfigBuilderPlugin.getPlugin().activePump?.serialNumber()
+ ?: InstanceId.instanceId())
@Expose
var time = DateUtil.toISOAsUTC(DateUtil.now())
@Expose
@@ -27,9 +28,9 @@ class OpenDatasetRequestMessage : BaseMessage() {
@Expose
var dataSetType = "continuous"
@Expose
- var deviceManufacturers = arrayOf("Dexcom", "Medtronic")
+ var deviceManufacturers = arrayOf("Medtronic")
@Expose
- var deviceModel = (ConfigBuilderPlugin.getPlugin().activePump?.model() ?: "Unknown")
+ var deviceModel = (ConfigBuilderPlugin.getPlugin().activePump?.model() ?: "Medtronic")
@Expose
var deviceTags = arrayOf("bgm", "cgm", "insulin-pump")
@Expose
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java
index a70f0c1f72..20a1d08e6d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java
@@ -65,6 +65,7 @@ import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.treatments.Treatment;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil;
+import info.nightscout.androidaps.utils.InstanceId;
import info.nightscout.androidaps.utils.SP;
/**
* Created by mike on 05.08.2016.
@@ -1323,7 +1324,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
@Override
public String serialNumber() {
- return "Unknown";
+ return InstanceId.INSTANCE.instanceId(); // TODO replace by real serial
}
@Override
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.java
index 9a7e351bf1..876419a0c1 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.java
@@ -18,7 +18,7 @@ import info.nightscout.androidaps.plugins.pump.common.data.DoseSettings;
public enum PumpType {
- GenericAAPS("Generic AAPS", 0.1d, null, //
+ GenericAAPS("Generic AAPS", "AndroidAPS", "VirutalPump", 0.1d, null, //
new DoseSettings(0.05d, 30, 8*60, 0.05d), //
PumpTempBasalType.Percent, //
new DoseSettings(10,30, 24*60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
@@ -26,7 +26,7 @@ public enum PumpType {
// Cellnovo
- Cellnovo1("Cellnovo", 0.05d, null, //
+ Cellnovo1("Cellnovo", "Cellnovo", "Cellnovo", 0.05d, null, //
new DoseSettings(0.05d, 30, 24*60, 1d, null),
PumpTempBasalType.Percent,
new DoseSettings(5,30, 24*60, 0d, 200d), PumpCapability.BasalRate_Duration30minAllowed, //
@@ -34,105 +34,107 @@ public enum PumpType {
// Accu-Chek
- AccuChekCombo("Accu-Chek Combo", 0.1d, null, //
+ AccuChekCombo("Accu-Chek Combo", "Roche", "Combo", 0.1d, null, //
new DoseSettings(0.1d, 15, 12*60, 0.1d), //
PumpTempBasalType.Percent,
new DoseSettings(10, 15, 12*60,0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
0.01d, 0.01d, DoseStepSize.ComboBasal, PumpCapability.ComboCapabilities), //
- AccuChekSpirit("Accu-Chek Spirit", 0.1d, null, //
+ AccuChekSpirit("Accu-Chek Spirit", "Roche", "Spirit", 0.1d, null, //
new DoseSettings(0.1d, 15, 12*60, 0.1d), //
PumpTempBasalType.Percent,
new DoseSettings(10, 15, 12*60,0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
0.01d, 0.1d, null, PumpCapability.VirtualPumpCapabilities), //
- AccuChekInsight("Accu-Chek Insight", 0.05d, DoseStepSize.InsightBolus, //
+ AccuChekInsight("Accu-Chek Insight", "Roche", "Insight", 0.05d, DoseStepSize.InsightBolus, //
new DoseSettings(0.05d, 15, 24*60, 0.05d), //
PumpTempBasalType.Percent,
new DoseSettings(10, 15, 24*60,0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
0.02d, 0.01d, null, PumpCapability.InsightCapabilities), //
- AccuChekInsightBluetooth("Accu-Chek Insight", 0.01d, null, //
+ AccuChekInsightBluetooth("Accu-Chek Insight", "Roche", "Insight", 0.01d, null, //
new DoseSettings(0.01d, 15, 24*60, 0.05d), //
PumpTempBasalType.Percent,
new DoseSettings(10, 15, 24*60,0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
0.02d, 0.01d, DoseStepSize.InsightBolus, PumpCapability.InsightCapabilities), //
// Animas
- AnimasVibe("Animas Vibe", 0.05d, null, // AnimasBolus?
+ AnimasVibe("Animas Vibe","Animas", "Vibe", 0.05d, null, // AnimasBolus?
new DoseSettings(0.05d, 30, 12*60, 0.05d), //
PumpTempBasalType.Percent, //
new DoseSettings(10, 30, 24*60, 0d, 300d), PumpCapability.BasalRate_Duration30minAllowed, //
0.025d, 5d, 0d, null, PumpCapability.VirtualPumpCapabilities), //
- AnimasPing("Animas Ping", AnimasVibe),
+ AnimasPing("Animas Ping", "Ping", AnimasVibe),
// Dana
- DanaR("DanaR", 0.05d, null, //
+ DanaR("DanaR", "SOOIL", "DanaR", 0.05d, null, //
new DoseSettings(0.05d, 30, 8*60, 0.05d), //
PumpTempBasalType.Percent, //
new DoseSettings(10d, 60, 24*60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, //
0.04d, 0.01d, null, PumpCapability.DanaCapabilities),
- DanaRKorean("DanaR Korean", 0.05d, null, //
+ DanaRKorean("DanaR Korean", "SOOIL", "DanaRKorean", 0.05d, null, //
new DoseSettings(0.05d, 30, 8*60, 0.05d), //
PumpTempBasalType.Percent, //
new DoseSettings(10d, 60, 24*60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, //
0.1d, 0.01d, null, PumpCapability.DanaCapabilities),
- DanaRS("DanaRS", 0.05d, null, //
+ DanaRS("DanaRS", "SOOIL", "DanaRS", 0.05d, null, //
new DoseSettings(0.05d, 30, 8*60, 0.05d), //
PumpTempBasalType.Percent, //
new DoseSettings(10d, 60, 24*60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minAllowed, //
0.04d, 0.01d, null, PumpCapability.DanaWithHistoryCapabilities),
- DanaRv2("DanaRv2", DanaRS),
+ DanaRv2("DanaRv2", "DanaRv2", DanaRS),
// Insulet
- Insulet_Omnipod("Insulet Omnipod", 0.05d, null, //
+ Insulet_Omnipod("Insulet Omnipod", "Insulet", "Omnipod", 0.05d, null, //
new DoseSettings(0.05d, 30, 8*60, 0.05d), //
PumpTempBasalType.Absolute, //
new DoseSettings(0.05d, 30, 12*60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, // cannot exceed max basal rate 30u/hr
0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities),
// Medtronic
- Medtronic_512_712("Medtronic 512/712", 0.05d, null, //
+ Medtronic_512_712("Medtronic 512/712", "Medtronic", "512/712", 0.05d, null, //
new DoseSettings(0.05d, 30, 8*60, 0.05d), //
PumpTempBasalType.Absolute, //
new DoseSettings(0.05d, 30, 24*60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities), // TODO
- Medtronic_515_715("Medtronic 515/715", Medtronic_512_712),
- Medtronic_522_722("Medtronic 522/722", Medtronic_512_712),
+ Medtronic_515_715("Medtronic 515/715", "515/715", Medtronic_512_712),
+ Medtronic_522_722("Medtronic 522/722", "522/722", Medtronic_512_712),
- Medtronic_523_723_Revel("Medtronic 523/723 (Revel)", 0.05d, null, //
+ Medtronic_523_723_Revel("Medtronic 523/723 (Revel)", "Medtronic", "523/723 (Revel)", 0.05d, null, //
new DoseSettings(0.05d, 30, 8*60, 0.05d), //
PumpTempBasalType.Absolute, //
new DoseSettings(0.05d, 30, 24*60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.VirtualPumpCapabilities), //
- Medtronic_554_754_Veo("Medtronic 554/754 (Veo)", Medtronic_523_723_Revel), // TODO
+ Medtronic_554_754_Veo("Medtronic 554/754 (Veo)", "554/754 (Veo)", Medtronic_523_723_Revel), // TODO
- Medtronic_640G("Medtronic 640G", 0.025d, null, //
+ Medtronic_640G("Medtronic 640G", "Medtronic", "640G", 0.025d, null, //
new DoseSettings(0.05d, 30, 8*60, 0.05d), //
PumpTempBasalType.Absolute, //
new DoseSettings(0.05d, 30, 24*60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.VirtualPumpCapabilities), //
// Tandem
- TandemTSlim("Tandem t:slim", 0.01d, null, //
+ TandemTSlim("Tandem t:slim", "Tandem", "t:slim", 0.01d, null, //
new DoseSettings(0.01d,15, 8*60, 0.4d),
PumpTempBasalType.Percent,
new DoseSettings(1,15, 8*60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
0.1d, 0.001d, null, PumpCapability.VirtualPumpCapabilities),
- TandemTFlex("Tandem t:flex", TandemTSlim), //
- TandemTSlimG4("Tandem t:slim G4", TandemTSlim), //
- TandemTSlimX2("Tandem t:slim X2", TandemTSlim), //
+ TandemTFlex("Tandem t:flex", "t:flex", TandemTSlim), //
+ TandemTSlimG4("Tandem t:slim G4", "t:slim G4", TandemTSlim), //
+ TandemTSlimX2("Tandem t:slim X2", "t:slim X2", TandemTSlim), //
;
private String description;
+ private String manufacter;
+ private String model;
private double bolusSize;
private DoseStepSize specialBolusSize;
private DoseSettings extendedBolusSettings;
@@ -158,33 +160,37 @@ public enum PumpType {
}
- PumpType(String description, PumpType parent)
+ PumpType(String description, String model, PumpType parent)
{
this.description = description;
this.parent = parent;
+ parent.model = model;
}
- PumpType(String description, PumpType parent, PumpCapability pumpCapability)
+ PumpType(String description, String model, PumpType parent, PumpCapability pumpCapability)
{
this.description = description;
this.parent = parent;
this.pumpCapability = pumpCapability;
+ parent.model = model;
}
- PumpType(String description, double bolusSize, DoseStepSize specialBolusSize, //
+ PumpType(String description, String manufacter, String model, double bolusSize, DoseStepSize specialBolusSize, //
DoseSettings extendedBolusSettings, //
PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, //
double baseBasalMinValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability)
{
- this(description, bolusSize, specialBolusSize, extendedBolusSettings, pumpTempBasalType, tbrSettings, specialBasalDurations, baseBasalMinValue, null, baseBasalStep, baseBasalSpecialSteps, pumpCapability);
+ this(description, manufacter, model, bolusSize, specialBolusSize, extendedBolusSettings, pumpTempBasalType, tbrSettings, specialBasalDurations, baseBasalMinValue, null, baseBasalStep, baseBasalSpecialSteps, pumpCapability);
}
- PumpType(String description, double bolusSize, DoseStepSize specialBolusSize, //
+ PumpType(String description, String manufacter, String model, double bolusSize, DoseStepSize specialBolusSize, //
DoseSettings extendedBolusSettings, //
PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, //
double baseBasalMinValue, Double baseBasalMaxValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability)
{
this.description = description;
+ this.manufacter = manufacter;
+ this.model = model;
this.bolusSize = bolusSize;
this.specialBolusSize = specialBolusSize;
this.extendedBolusSettings = extendedBolusSettings;
@@ -203,6 +209,14 @@ public enum PumpType {
return description;
}
+ public String getManufacter() {
+ return isParentSet() ? parent.manufacter : manufacter;
+ }
+
+ public String getModel() {
+ return isParentSet() ? parent.model : model;
+ }
+
public PumpCapability getPumpCapability() {
if (isParentSet())
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/mdi/MDIPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/mdi/MDIPlugin.java
index d607dad4cb..13c2853ac7 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/mdi/MDIPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/mdi/MDIPlugin.java
@@ -23,6 +23,7 @@ import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil;
+import info.nightscout.androidaps.utils.InstanceId;
/**
@@ -247,7 +248,7 @@ public class MDIPlugin extends PluginBase implements PumpInterface {
@Override
public String serialNumber() {
- return "Unknown";
+ return InstanceId.INSTANCE.instanceId();
}
@Override
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.java
index 5317120b58..31b0e5456f 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.java
@@ -39,6 +39,7 @@ import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.virtual.events.EventVirtualPumpUpdateGui;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil;
+import info.nightscout.androidaps.utils.InstanceId;
import info.nightscout.androidaps.utils.SP;
@@ -438,17 +439,17 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
@Override
public String manufacter() {
- return "AndroidAPS";
+ return pumpDescription.pumpType.getManufacter();
}
@Override
public String model() {
- return "VirtualPump";
+ return pumpDescription.pumpType.getModel();
}
@Override
public String serialNumber() {
- return "Unknown";
+ return InstanceId.INSTANCE.instanceId();
}
@Override
diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWItem.java b/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWItem.java
index 6c5c0703c4..6206cb0d9a 100644
--- a/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWItem.java
+++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWItem.java
@@ -12,7 +12,7 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.RxBus;
+import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.setupwizard.events.EventSWUpdate;
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/InstanceId.kt b/app/src/main/java/info/nightscout/androidaps/utils/InstanceId.kt
new file mode 100644
index 0000000000..702d13d989
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/utils/InstanceId.kt
@@ -0,0 +1,12 @@
+package info.nightscout.androidaps.utils
+
+import android.provider.Settings
+import com.google.firebase.iid.FirebaseInstanceId
+import info.nightscout.androidaps.R
+
+object InstanceId {
+ fun instanceId(): String {
+ var id = FirebaseInstanceId.getInstance().id
+ return id
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a7646fa9e7..a43733f56a 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1373,6 +1373,7 @@
Upload profile switches, temp targets
tidepool_upload_bg
Upload BG tests
+ instanceid
- %1$d day