pump manufacters etc

This commit is contained in:
Milos Kozak 2019-06-09 14:02:33 +02:00
parent c49da9a818
commit 243e6c5801
20 changed files with 116 additions and 57 deletions

View file

@ -15,7 +15,7 @@ import android.text.TextUtils;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; 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.EventPreferenceChange;
import info.nightscout.androidaps.events.EventRefreshGui; import info.nightscout.androidaps.events.EventRefreshGui;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginBase;
@ -209,7 +209,8 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
initSummary(getPreferenceScreen()); initSummary(getPreferenceScreen());
final Preference tidepoolTestLogin = findPreference("tidepool_test_login"); final Preference tidepoolTestLogin = findPreference(MainApp.gs(R.string.key_tidepool_test_login));
if (tidepoolTestLogin != null)
tidepoolTestLogin.setOnPreferenceClickListener(preference -> { tidepoolTestLogin.setOnPreferenceClickListener(preference -> {
TidepoolUploader.INSTANCE.testLogin(getActivity()); TidepoolUploader.INSTANCE.testLogin(getActivity());
return false; return false;

View file

@ -29,7 +29,7 @@ import java.util.concurrent.TimeUnit;
import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; 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.OverlappingIntervals;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.ProfileStore; import info.nightscout.androidaps.data.ProfileStore;

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps package info.nightscout.androidaps.plugins.bus
import io.reactivex.Observable import io.reactivex.Observable
import io.reactivex.subjects.PublishSubject import io.reactivex.subjects.PublishSubject

View file

@ -232,26 +232,32 @@ public class ConfigBuilderPlugin extends PluginBase {
return commandQueue; return commandQueue;
} }
@Nullable
public BgSourceInterface getActiveBgSource() { public BgSourceInterface getActiveBgSource() {
return activeBgSource; return activeBgSource;
} }
@Nullable
public ProfileInterface getActiveProfileInterface() { public ProfileInterface getActiveProfileInterface() {
return activeProfile; return activeProfile;
} }
@Nullable
public InsulinInterface getActiveInsulin() { public InsulinInterface getActiveInsulin() {
return activeInsulin; return activeInsulin;
} }
@Nullable
public APSInterface getActiveAPS() { public APSInterface getActiveAPS() {
return activeAPS; return activeAPS;
} }
@Nullable
public PumpInterface getActivePump() { public PumpInterface getActivePump() {
return activePump; return activePump;
} }
@Nullable
public SensitivityInterface getActiveSensitivity() { public SensitivityInterface getActiveSensitivity() {
return activeSensitivity; return activeSensitivity;
} }

View file

@ -22,7 +22,7 @@ import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; 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.EventAppExit;
import info.nightscout.androidaps.events.EventChargingState; import info.nightscout.androidaps.events.EventChargingState;
import info.nightscout.androidaps.events.EventNetworkChange; import info.nightscout.androidaps.events.EventNetworkChange;

View file

@ -10,7 +10,7 @@ import com.squareup.otto.Bus;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; 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.EventChargingState;
import info.nightscout.androidaps.events.EventNetworkChange; import info.nightscout.androidaps.events.EventNetworkChange;
import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.events.EventPreferenceChange;

View file

@ -12,7 +12,7 @@ import android.widget.TextView;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import info.nightscout.androidaps.R; 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.common.SubscriberFragment;
import info.nightscout.androidaps.plugins.general.tidepool.comm.TidepoolUploader; import info.nightscout.androidaps.plugins.general.tidepool.comm.TidepoolUploader;
import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolDoUpload; import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolDoUpload;

View file

@ -5,7 +5,7 @@ import android.text.Spanned
import info.nightscout.androidaps.Constants import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R 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.EventNetworkChange
import info.nightscout.androidaps.events.EventNewBG import info.nightscout.androidaps.events.EventNewBG
import info.nightscout.androidaps.events.EventPreferenceChange import info.nightscout.androidaps.events.EventPreferenceChange

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.general.tidepool.comm 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 info.nightscout.androidaps.logging.L
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import retrofit2.Call import retrofit2.Call

View file

@ -2,10 +2,11 @@ package info.nightscout.androidaps.plugins.general.tidepool.comm
import android.content.Context import android.content.Context
import android.os.PowerManager import android.os.PowerManager
import android.os.SystemClock
import info.nightscout.androidaps.BuildConfig import info.nightscout.androidaps.BuildConfig
import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.RxBus import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.logging.L import info.nightscout.androidaps.logging.L
import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolStatus import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolStatus
import info.nightscout.androidaps.plugins.general.tidepool.messages.* import info.nightscout.androidaps.plugins.general.tidepool.messages.*
@ -137,6 +138,7 @@ object TidepoolUploader {
connectionStatus = TidepoolUploader.ConnectionStatus.CONNECTED connectionStatus = TidepoolUploader.ConnectionStatus.CONNECTED
RxBus.send(EventTidepoolStatus(("New dataset OK"))) RxBus.send(EventTidepoolStatus(("New dataset OK")))
if (doUpload) doUpload() if (doUpload) doUpload()
else
releaseWakeLock() releaseWakeLock()
}, { }, {
RxBus.send(EventTidepoolStatus(("New dataset FAILED"))) RxBus.send(EventTidepoolStatus(("New dataset FAILED")))
@ -151,6 +153,7 @@ object TidepoolUploader {
connectionStatus = TidepoolUploader.ConnectionStatus.CONNECTED connectionStatus = TidepoolUploader.ConnectionStatus.CONNECTED
RxBus.send(EventTidepoolStatus(("Appending to existing dataset"))) RxBus.send(EventTidepoolStatus(("Appending to existing dataset")))
if (doUpload) doUpload() if (doUpload) doUpload()
else
releaseWakeLock() releaseWakeLock()
} }
}, { }, {
@ -170,6 +173,7 @@ object TidepoolUploader {
fun doUpload() { fun doUpload() {
if (session == null) { if (session == null) {
log.error("Session is null, cannot proceed") log.error("Session is null, cannot proceed")
releaseWakeLock()
return return
} }
extendWakeLock(60000) extendWakeLock(60000)
@ -184,6 +188,7 @@ object TidepoolUploader {
if (L.isEnabled(L.TIDEPOOL)) log.debug("Empty dataset - marking as succeeded") if (L.isEnabled(L.TIDEPOOL)) log.debug("Empty dataset - marking as succeeded")
RxBus.send(EventTidepoolStatus(("No data to upload"))) RxBus.send(EventTidepoolStatus(("No data to upload")))
releaseWakeLock() releaseWakeLock()
unploadNext()
} }
else -> { else -> {
val body = RequestBody.create(MediaType.parse("application/json"), chunk) val body = RequestBody.create(MediaType.parse("application/json"), chunk)
@ -194,13 +199,22 @@ object TidepoolUploader {
setLastEnd(session!!.end) setLastEnd(session!!.end)
RxBus.send(EventTidepoolStatus(("Upload completed OK"))) RxBus.send(EventTidepoolStatus(("Upload completed OK")))
releaseWakeLock() releaseWakeLock()
unploadNext()
}, { }, {
RxBus.send(EventTidepoolStatus(("Upload FAILED"))) RxBus.send(EventTidepoolStatus(("Upload FAILED")))
releaseWakeLock() 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() { fun deleteDataSet() {

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.general.tidepool.comm
import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R 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.logging.L
import info.nightscout.androidaps.plugins.general.tidepool.elements.* import info.nightscout.androidaps.plugins.general.tidepool.elements.*
import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolStatus import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolStatus

View file

@ -4,6 +4,7 @@ import com.google.gson.annotations.Expose
import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.db.ProfileSwitch import info.nightscout.androidaps.db.ProfileSwitch
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.utils.InstanceId
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
@ -23,7 +24,13 @@ class ProfileElement(ps: ProfileSwitch)
@Expose @Expose
internal var insulinSensitivities: IsfProfile = IsfProfile() internal var insulinSensitivities: IsfProfile = IsfProfile()
@Expose @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 { init {
type = "pumpSettings" type = "pumpSettings"

View file

@ -2,17 +2,18 @@ package info.nightscout.androidaps.plugins.general.tidepool.messages
import com.google.gson.annotations.Expose import com.google.gson.annotations.Expose
import info.nightscout.androidaps.BuildConfig 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.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.InstanceId
import info.nightscout.androidaps.utils.T import info.nightscout.androidaps.utils.T
import java.util.* import java.util.*
class OpenDatasetRequestMessage : BaseMessage() { class OpenDatasetRequestMessage : BaseMessage() {
@Expose @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 @Expose
var time = DateUtil.toISOAsUTC(DateUtil.now()) var time = DateUtil.toISOAsUTC(DateUtil.now())
@Expose @Expose
@ -27,9 +28,9 @@ class OpenDatasetRequestMessage : BaseMessage() {
@Expose @Expose
var dataSetType = "continuous" var dataSetType = "continuous"
@Expose @Expose
var deviceManufacturers = arrayOf("Dexcom", "Medtronic") var deviceManufacturers = arrayOf("Medtronic")
@Expose @Expose
var deviceModel = (ConfigBuilderPlugin.getPlugin().activePump?.model() ?: "Unknown") var deviceModel = (ConfigBuilderPlugin.getPlugin().activePump?.model() ?: "Medtronic")
@Expose @Expose
var deviceTags = arrayOf("bgm", "cgm", "insulin-pump") var deviceTags = arrayOf("bgm", "cgm", "insulin-pump")
@Expose @Expose

View file

@ -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.Treatment;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.InstanceId;
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.
@ -1323,7 +1324,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
@Override @Override
public String serialNumber() { public String serialNumber() {
return "Unknown"; return InstanceId.INSTANCE.instanceId(); // TODO replace by real serial
} }
@Override @Override

View file

@ -18,7 +18,7 @@ import info.nightscout.androidaps.plugins.pump.common.data.DoseSettings;
public enum PumpType { 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), // new DoseSettings(0.05d, 30, 8*60, 0.05d), //
PumpTempBasalType.Percent, // PumpTempBasalType.Percent, //
new DoseSettings(10,30, 24*60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, // new DoseSettings(10,30, 24*60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
@ -26,7 +26,7 @@ public enum PumpType {
// Cellnovo // Cellnovo
Cellnovo1("Cellnovo", 0.05d, null, // Cellnovo1("Cellnovo", "Cellnovo", "Cellnovo", 0.05d, null, //
new DoseSettings(0.05d, 30, 24*60, 1d, null), new DoseSettings(0.05d, 30, 24*60, 1d, null),
PumpTempBasalType.Percent, PumpTempBasalType.Percent,
new DoseSettings(5,30, 24*60, 0d, 200d), PumpCapability.BasalRate_Duration30minAllowed, // new DoseSettings(5,30, 24*60, 0d, 200d), PumpCapability.BasalRate_Duration30minAllowed, //
@ -34,105 +34,107 @@ public enum PumpType {
// Accu-Chek // 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), // new DoseSettings(0.1d, 15, 12*60, 0.1d), //
PumpTempBasalType.Percent, PumpTempBasalType.Percent,
new DoseSettings(10, 15, 12*60,0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, // new DoseSettings(10, 15, 12*60,0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
0.01d, 0.01d, DoseStepSize.ComboBasal, PumpCapability.ComboCapabilities), // 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), // new DoseSettings(0.1d, 15, 12*60, 0.1d), //
PumpTempBasalType.Percent, PumpTempBasalType.Percent,
new DoseSettings(10, 15, 12*60,0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, // new DoseSettings(10, 15, 12*60,0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
0.01d, 0.1d, null, PumpCapability.VirtualPumpCapabilities), // 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), // new DoseSettings(0.05d, 15, 24*60, 0.05d), //
PumpTempBasalType.Percent, PumpTempBasalType.Percent,
new DoseSettings(10, 15, 24*60,0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, // new DoseSettings(10, 15, 24*60,0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
0.02d, 0.01d, null, PumpCapability.InsightCapabilities), // 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), // new DoseSettings(0.01d, 15, 24*60, 0.05d), //
PumpTempBasalType.Percent, PumpTempBasalType.Percent,
new DoseSettings(10, 15, 24*60,0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, // new DoseSettings(10, 15, 24*60,0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
0.02d, 0.01d, DoseStepSize.InsightBolus, PumpCapability.InsightCapabilities), // 0.02d, 0.01d, DoseStepSize.InsightBolus, PumpCapability.InsightCapabilities), //
// Animas // 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), // new DoseSettings(0.05d, 30, 12*60, 0.05d), //
PumpTempBasalType.Percent, // PumpTempBasalType.Percent, //
new DoseSettings(10, 30, 24*60, 0d, 300d), PumpCapability.BasalRate_Duration30minAllowed, // new DoseSettings(10, 30, 24*60, 0d, 300d), PumpCapability.BasalRate_Duration30minAllowed, //
0.025d, 5d, 0d, null, PumpCapability.VirtualPumpCapabilities), // 0.025d, 5d, 0d, null, PumpCapability.VirtualPumpCapabilities), //
AnimasPing("Animas Ping", AnimasVibe), AnimasPing("Animas Ping", "Ping", AnimasVibe),
// Dana // Dana
DanaR("DanaR", 0.05d, null, // DanaR("DanaR", "SOOIL", "DanaR", 0.05d, null, //
new DoseSettings(0.05d, 30, 8*60, 0.05d), // new DoseSettings(0.05d, 30, 8*60, 0.05d), //
PumpTempBasalType.Percent, // PumpTempBasalType.Percent, //
new DoseSettings(10d, 60, 24*60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, // new DoseSettings(10d, 60, 24*60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, //
0.04d, 0.01d, null, PumpCapability.DanaCapabilities), 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), // new DoseSettings(0.05d, 30, 8*60, 0.05d), //
PumpTempBasalType.Percent, // PumpTempBasalType.Percent, //
new DoseSettings(10d, 60, 24*60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, // new DoseSettings(10d, 60, 24*60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, //
0.1d, 0.01d, null, PumpCapability.DanaCapabilities), 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), // new DoseSettings(0.05d, 30, 8*60, 0.05d), //
PumpTempBasalType.Percent, // PumpTempBasalType.Percent, //
new DoseSettings(10d, 60, 24*60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minAllowed, // new DoseSettings(10d, 60, 24*60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minAllowed, //
0.04d, 0.01d, null, PumpCapability.DanaWithHistoryCapabilities), 0.04d, 0.01d, null, PumpCapability.DanaWithHistoryCapabilities),
DanaRv2("DanaRv2", DanaRS), DanaRv2("DanaRv2", "DanaRv2", DanaRS),
// Insulet // 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), // new DoseSettings(0.05d, 30, 8*60, 0.05d), //
PumpTempBasalType.Absolute, // PumpTempBasalType.Absolute, //
new DoseSettings(0.05d, 30, 12*60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, // cannot exceed max basal rate 30u/hr 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), 0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities),
// Medtronic // 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), // new DoseSettings(0.05d, 30, 8*60, 0.05d), //
PumpTempBasalType.Absolute, // PumpTempBasalType.Absolute, //
new DoseSettings(0.05d, 30, 24*60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, // new DoseSettings(0.05d, 30, 24*60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities), // TODO 0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities), // TODO
Medtronic_515_715("Medtronic 515/715", Medtronic_512_712), Medtronic_515_715("Medtronic 515/715", "515/715", Medtronic_512_712),
Medtronic_522_722("Medtronic 522/722", 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), // new DoseSettings(0.05d, 30, 8*60, 0.05d), //
PumpTempBasalType.Absolute, // PumpTempBasalType.Absolute, //
new DoseSettings(0.05d, 30, 24*60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, // new DoseSettings(0.05d, 30, 24*60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.VirtualPumpCapabilities), // 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), // new DoseSettings(0.05d, 30, 8*60, 0.05d), //
PumpTempBasalType.Absolute, // PumpTempBasalType.Absolute, //
new DoseSettings(0.05d, 30, 24*60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, // new DoseSettings(0.05d, 30, 24*60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.VirtualPumpCapabilities), // 0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.VirtualPumpCapabilities), //
// Tandem // 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), new DoseSettings(0.01d,15, 8*60, 0.4d),
PumpTempBasalType.Percent, PumpTempBasalType.Percent,
new DoseSettings(1,15, 8*60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, // new DoseSettings(1,15, 8*60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
0.1d, 0.001d, null, PumpCapability.VirtualPumpCapabilities), 0.1d, 0.001d, null, PumpCapability.VirtualPumpCapabilities),
TandemTFlex("Tandem t:flex", TandemTSlim), // TandemTFlex("Tandem t:flex", "t:flex", TandemTSlim), //
TandemTSlimG4("Tandem t:slim G4", TandemTSlim), // TandemTSlimG4("Tandem t:slim G4", "t:slim G4", TandemTSlim), //
TandemTSlimX2("Tandem t:slim X2", TandemTSlim), // TandemTSlimX2("Tandem t:slim X2", "t:slim X2", TandemTSlim), //
; ;
private String description; private String description;
private String manufacter;
private String model;
private double bolusSize; private double bolusSize;
private DoseStepSize specialBolusSize; private DoseStepSize specialBolusSize;
private DoseSettings extendedBolusSettings; 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.description = description;
this.parent = parent; 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.description = description;
this.parent = parent; this.parent = parent;
this.pumpCapability = pumpCapability; 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, // DoseSettings extendedBolusSettings, //
PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, // PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, //
double baseBasalMinValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability) 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, // DoseSettings extendedBolusSettings, //
PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, // PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, //
double baseBasalMinValue, Double baseBasalMaxValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability) double baseBasalMinValue, Double baseBasalMaxValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability)
{ {
this.description = description; this.description = description;
this.manufacter = manufacter;
this.model = model;
this.bolusSize = bolusSize; this.bolusSize = bolusSize;
this.specialBolusSize = specialBolusSize; this.specialBolusSize = specialBolusSize;
this.extendedBolusSettings = extendedBolusSettings; this.extendedBolusSettings = extendedBolusSettings;
@ -203,6 +209,14 @@ public enum PumpType {
return description; return description;
} }
public String getManufacter() {
return isParentSet() ? parent.manufacter : manufacter;
}
public String getModel() {
return isParentSet() ? parent.model : model;
}
public PumpCapability getPumpCapability() { public PumpCapability getPumpCapability() {
if (isParentSet()) if (isParentSet())

View file

@ -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.general.actions.defs.CustomActionType;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.InstanceId;
/** /**
@ -247,7 +248,7 @@ public class MDIPlugin extends PluginBase implements PumpInterface {
@Override @Override
public String serialNumber() { public String serialNumber() {
return "Unknown"; return InstanceId.INSTANCE.instanceId();
} }
@Override @Override

View file

@ -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.pump.virtual.events.EventVirtualPumpUpdateGui;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.InstanceId;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.SP;
@ -438,17 +439,17 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
@Override @Override
public String manufacter() { public String manufacter() {
return "AndroidAPS"; return pumpDescription.pumpType.getManufacter();
} }
@Override @Override
public String model() { public String model() {
return "VirtualPump"; return pumpDescription.pumpType.getModel();
} }
@Override @Override
public String serialNumber() { public String serialNumber() {
return "Unknown"; return InstanceId.INSTANCE.instanceId();
} }
@Override @Override

View file

@ -12,7 +12,7 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import info.nightscout.androidaps.MainApp; 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.events.EventPreferenceChange;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.setupwizard.events.EventSWUpdate; import info.nightscout.androidaps.setupwizard.events.EventSWUpdate;

View file

@ -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
}
}

View file

@ -1373,6 +1373,7 @@
<string name="tidepool_upload_profile">Upload profile switches, temp targets</string> <string name="tidepool_upload_profile">Upload profile switches, temp targets</string>
<string name="key_tidepool_upload_bg" translatable="false">tidepool_upload_bg</string> <string name="key_tidepool_upload_bg" translatable="false">tidepool_upload_bg</string>
<string name="tidepool_upload_bg">Upload BG tests</string> <string name="tidepool_upload_bg">Upload BG tests</string>
<string name="key_instanceid" translatable="false">instanceid</string>
<plurals name="objective_days"> <plurals name="objective_days">
<item quantity="one">%1$d day</item> <item quantity="one">%1$d day</item>