From c3de5d7f5812b34f6d207616cf1eb2ad01f2ff9c Mon Sep 17 00:00:00 2001 From: Andy Rozman Date: Sun, 14 Jul 2019 22:24:41 +0100 Subject: [PATCH] Changed files with changes to PumpInterface and Profile --- .../info/nightscout/androidaps/MainApp.java | 2 +- .../pump/medtronic/MedtronicPumpPlugin.java | 19 +++++++++++++++-- .../pump/medtronic/util/MedtronicUtil.java | 21 +++++++++++-------- .../plugins/treatments/TreatmentsPlugin.java | 5 +---- 4 files changed, 31 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 87ddf8de1d..bdc21829dd 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -290,7 +290,7 @@ public class MainApp extends Application { break; case BluetoothAdapter.STATE_ON: { - if ("Medtronic".equals(activePump.deviceID())) { + if ("Medtronic".equals(activePump.manufacter())) { Log.v("MainApp", "Bluetooth on"); RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.BluetoothReconnected); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java index 1c0612d357..9a2a49ebf6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java @@ -6,9 +6,9 @@ import android.content.ServiceConnection; import android.os.Bundle; import android.os.IBinder; import android.os.SystemClock; + import androidx.annotation.NonNull; -import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity; import org.joda.time.LocalDateTime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,6 +42,7 @@ import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction; import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType; +import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract; @@ -633,7 +634,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter StringBuilder stringBuilder = new StringBuilder("Requested Basals (h): "); - for (Profile.BasalValue basalValue : profile.getBasalValues()) { + for (Profile.ProfileValue basalValue : profile.getBasalValues()) { double basalValueValue = pumpType.determineCorrectBasalSize(basalValue.value); @@ -1368,6 +1369,20 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter } } + @Override + public String manufacter() { + return "Medtronic"; + } + + @Override + public String model() { + return getMDTPumpStatus().medtronicDeviceType.getPumpModel(); + } + + @Override + public String serialNumber() { + return getMDTPumpStatus().serialNumber; + } @Override public PumpEnactResult setNewBasalProfile(Profile profile) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicUtil.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicUtil.java index 9833885b8c..79702492c6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicUtil.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicUtil.java @@ -1,8 +1,20 @@ package info.nightscout.androidaps.plugins.pump.medtronic.util; import android.content.Context; + import com.google.gson.Gson; import com.google.gson.GsonBuilder; + +import org.joda.time.LocalTime; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.interfaces.PluginType; @@ -27,15 +39,6 @@ import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpSta import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDeviceStatusChange; import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService; import info.nightscout.androidaps.utils.OKDialog; -import org.joda.time.LocalTime; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; /** * Created by andy on 5/9/18. diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java index fe555cdadc..b588a9ef42 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java @@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.treatments; import android.content.Intent; import android.os.Bundle; + import androidx.annotation.Nullable; import com.google.firebase.analytics.FirebaseAnalytics; @@ -579,10 +580,6 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface return newRecordCreated; } - private boolean isMedtronicPump() { - return ConfigBuilderPlugin.getPlugin().getActivePump().deviceID().equals("Medtronic"); - } - @Override public long oldestDataAvailable() { long oldestTime = System.currentTimeMillis();