Merge branch 'omnipod_eros' of https://github.com/AAPS-Omnipod/AndroidAPS into omnipod_eros

This commit is contained in:
Andy Rozman 2019-12-29 22:15:58 +01:00
commit 9dee52cd0f
13 changed files with 82 additions and 57 deletions

View file

@ -116,6 +116,21 @@ public class ByteUtil {
return rval;
}
public static String shortHexStringWithoutSpaces(byte[] byteArray) {
String hexString = "";
if (byteArray == null) {
return hexString;
}
if (byteArray.length == 0) {
return hexString;
}
for (byte b : byteArray) {
hexString = hexString + HEX_DIGITS[(b & 0xF0) >> 4];
hexString = hexString + HEX_DIGITS[(b & 0x0F)];
}
return hexString;
}
public static String shortHexString(List<Byte> list) {
byte[] abyte0 = getByteArrayFromList(list);

View file

@ -48,7 +48,7 @@ import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentHighFlashLogDump;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionType;
@ -67,7 +67,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.SP;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
@ -377,7 +376,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
if (omnipodStatusRequest==OmnipodStatusRequest.GetPodPulseLog) {
OmnipodUITask omnipodUITask = omnipodUIComm.executeCommand(omnipodStatusRequest.getCommandType());
PodInfoRecentHighFlashLogDump result = (PodInfoRecentHighFlashLogDump)omnipodUITask.returnDataObject;
PodInfoRecentPulseLog result = (PodInfoRecentPulseLog)omnipodUITask.returnDataObject;
if (result==null) {
LOG.warn("Result was null.");

View file

@ -28,7 +28,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.service.Inser
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.service.PrimeService;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.CancelDeliveryCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentHighFlashLogDump;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.BeepType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.DeliveryStatus;
@ -408,8 +408,8 @@ public class OmnipodManager {
// FIXME replace by storing to file
if (isLoggingEnabled()) {
try {
PodInfoResponse podInfoResponse = communicationService.executeAction(new GetPodInfoAction(podState, PodInfoType.RECENT_HIGH_FLASH_LOG_DUMP));
PodInfoRecentHighFlashLogDump pulseLogInfo = podInfoResponse.getPodInfo();
PodInfoResponse podInfoResponse = communicationService.executeAction(new GetPodInfoAction(podState, PodInfoType.RECENT_PULSE_LOG));
PodInfoRecentPulseLog pulseLogInfo = podInfoResponse.getPodInfo();
LOG.info("Retrieved pulse log from the pod: {}", pulseLogInfo.toString());
} catch (Exception ex) {
LOG.warn("Failed to retrieve pulse log from the pod", ex);

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo;
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -7,12 +9,12 @@ import java.util.List;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
public class PodInfoOlderHighFlashLogDump extends PodInfo {
public class PodInfoOlderPulseLog extends PodInfo {
private static final int MINIMUM_MESSAGE_LENGTH = 3;
private final ArrayList<byte[]> dwords;
public PodInfoOlderHighFlashLogDump(byte[] encodedData) {
public PodInfoOlderPulseLog(byte[] encodedData) {
super(encodedData);
if (encodedData.length < MINIMUM_MESSAGE_LENGTH) {
@ -30,7 +32,7 @@ public class PodInfoOlderHighFlashLogDump extends PodInfo {
@Override
public PodInfoType getType() {
return PodInfoType.OLDER_HIGH_FLASH_LOG_DUMP;
return PodInfoType.OLDER_PULSE_LOG;
}
public List<byte[]> getDwords() {
@ -39,8 +41,16 @@ public class PodInfoOlderHighFlashLogDump extends PodInfo {
@Override
public String toString() {
return "PodInfoOlderHighFlashLogDump{" +
"dwords=" + dwords +
'}';
String out = "PodInfoOlderPulseLog{" +
"dwords=[";
List<String> hexDwords = new ArrayList<>();
for (byte[] dword : dwords) {
hexDwords.add(ByteUtil.shortHexStringWithoutSpaces(dword));
}
out += TextUtils.join(", ", hexDwords);
out += "]}";
return out;
}
}

View file

@ -9,14 +9,14 @@ import java.util.List;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
public class PodInfoRecentHighFlashLogDump extends PodInfo {
public class PodInfoRecentPulseLog extends PodInfo {
private static final int MINIMUM_MESSAGE_LENGTH = 3;
private final ArrayList<byte[]> dwords;
private final int lastEntryIndex;
public PodInfoRecentHighFlashLogDump(byte[] encodedData, int bodyLength) {
public PodInfoRecentPulseLog(byte[] encodedData, int bodyLength) {
super(encodedData);
if (encodedData.length < MINIMUM_MESSAGE_LENGTH) {
@ -36,7 +36,7 @@ public class PodInfoRecentHighFlashLogDump extends PodInfo {
@Override
public PodInfoType getType() {
return PodInfoType.RECENT_HIGH_FLASH_LOG_DUMP;
return PodInfoType.RECENT_PULSE_LOG;
}
public List<byte[]> getDwords() {
@ -49,14 +49,15 @@ public class PodInfoRecentHighFlashLogDump extends PodInfo {
@Override
public String toString() {
String out = "PodInfoRecentHighFlashLogDump{" +
String out = "PodInfoRecentPulseLog{" +
"lastEntryIndex=" + lastEntryIndex +
",dwords=[";
List<String> hexDwords = new ArrayList<>();
for (byte[] dword : dwords) {
hexDwords.add(ByteUtil.shortHexString(dword));
hexDwords.add(ByteUtil.shortHexStringWithoutSpaces(dword));
}
out += TextUtils.join(",", hexDwords);
out += TextUtils.join(", ", hexDwords);
out += "]}";
return out;
}

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.defs;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentHighFlashLogDump;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
public interface OmnipodCommunicationManagerInterface {
@ -74,5 +74,5 @@ public interface OmnipodCommunicationManagerInterface {
void setPumpStatus(OmnipodPumpStatus pumpStatusLocal);
PodInfoRecentHighFlashLogDump readPulseLog();
PodInfoRecentPulseLog readPulseLog();
}

View file

@ -6,8 +6,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.pod
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoFaultAndInitializationTime;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoFaultEvent;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoLowFlashLogDump;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoOlderHighFlashLogDump;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentHighFlashLogDump;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoOlderPulseLog;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoTestValues;
public enum PodInfoType {
@ -18,8 +18,8 @@ public enum PodInfoType {
FAULT_AND_INITIALIZATION_TIME((byte) 0x05),
HARDCODED_TEST_VALUES((byte) 0x06),
LOW_FLASH_DUMP_LOG((byte) 0x46), // Starting at $4000
RECENT_HIGH_FLASH_LOG_DUMP((byte) 0x50), // Starting at $4200
OLDER_HIGH_FLASH_LOG_DUMP((byte) 0x51); // Starting at $4200 but dumps entries before the last 50
RECENT_PULSE_LOG((byte) 0x50), // Starting at $4200
OLDER_PULSE_LOG((byte) 0x51); // Starting at $4200 but dumps entries before the last 50
private final byte value;
@ -58,10 +58,10 @@ public enum PodInfoType {
return new PodInfoTestValues(encodedData);
case LOW_FLASH_DUMP_LOG:
return new PodInfoLowFlashLogDump(encodedData);
case RECENT_HIGH_FLASH_LOG_DUMP:
return new PodInfoRecentHighFlashLogDump(encodedData, bodyLength);
case OLDER_HIGH_FLASH_LOG_DUMP:
return new PodInfoOlderHighFlashLogDump(encodedData);
case RECENT_PULSE_LOG:
return new PodInfoRecentPulseLog(encodedData, bodyLength);
case OLDER_PULSE_LOG:
return new PodInfoOlderPulseLog(encodedData);
default:
throw new IllegalArgumentException("Cannot decode " + this.name());
}

View file

@ -35,7 +35,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunication
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodManager;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.SetupActionResult;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentHighFlashLogDump;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertSlot;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertType;
@ -443,8 +443,8 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
return new PumpEnactResult().success(true).enacted(true);
}
public PodInfoRecentHighFlashLogDump readPulseLog() {
PodInfoResponse response = delegate.getPodInfo(PodInfoType.RECENT_HIGH_FLASH_LOG_DUMP);
public PodInfoRecentPulseLog readPulseLog() {
PodInfoResponse response = delegate.getPodInfo(PodInfoType.RECENT_PULSE_LOG);
return response.getPodInfo();
}

View file

@ -11,7 +11,7 @@ import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentHighFlashLogDump;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
@ -118,7 +118,7 @@ public class OmnipodDashCommunicationManager implements OmnipodCommunicationMana
}
@Override
public PodInfoRecentHighFlashLogDump readPulseLog() {
public PodInfoRecentPulseLog readPulseLog() {
return null;
}

View file

@ -1723,11 +1723,11 @@
<string name="omnipod_init_pod_wizard_step1_title">Fill the Pod</string>
<string name="omnipod_init_pod_wizard_step1_desc">\nFill the new Pod with insulin.\n\nListen for two beeps from the Pod during the filling process. Be sure to completely empty the fill syringe, even after hearing the two beeps.\n\nAfter filling the Pod, please press <b>Next</b>.\n\n<b>Note:</b> do not remove the Pod\'s needle cap at this time.</string>
<string name="omnipod_init_pod_wizard_step1_desc">\nFill the new Pod with enough insulin for 3 days.\n\nListen for two beeps from the Pod during the filling process. These indicate that the minimum amount of 85U has been inserted. Be sure to completely empty the fill syringe, even after hearing the two beeps.\n\nAfter filling the Pod, please press <b>Next</b>.\n\n<b>Note:</b> do not remove the Pod\'s needle cap at this time.</string>
<string name="omnipod_init_pod_wizard_step2_title">Priming</string>
<string name="omnipod_init_pod_wizard_step2_action_header">Trying to pair with and prime the new Pod.\n\nWhen all items are checked, you can press <b>Next</b>.\n\n<b>Note:</b> please keep the Pod very close to the RileyLink at this time.</string>
<string name="omnipod_init_pod_wizard_step2_action_header">Trying to pair with the new Pod and prime it.\n\nWhen all items are checked, you can press <b>Next</b>.\n\n<b>Note:</b> please keep the Pod very close to the RileyLink at this time.</string>
<string name="omnipod_init_pod_wizard_step3_title">Attach the Pod</string>
<string name="omnipod_init_pod_wizard_step3_desc">\nPrepare the infusion site. Remove the Pod\'s needle cap and adhesive backing and attach the pod to the infusion site.\n\nIf the cannula sticks out, please press <b>Cancel</b> and discard your Pod.\n\nPress <b>Next</b> to insert the cannula and begin basal delivery.</string>
<string name="omnipod_init_pod_wizard_step3_desc">\nPrepare the infusion site. Remove the Pod\'s needle cap and adhesive backing and attach the Pod to the infusion site.\n\nIf the cannula sticks out, please press <b>Cancel</b> and discard your Pod.\n\nPress <b>Next</b> to insert the cannula and begin basal delivery.</string>
<string name="omnipod_init_pod_wizard_step4_title">Inserting cannula</string>
<string name="omnipod_init_pod_wizard_pod_info_title">Pod Info</string>
<string name="omnipod_init_pod_wizard_pod_info_init_pod_description">\nThe Pod is now active.\n\nYour basal schedule has been programmed and the cannula has been inserted.\n\nPlease verify that the cannula has been inserted correctly and replace your Pod if you feel hasn\'t.</string>
@ -1735,7 +1735,7 @@
<string name="omnipod_remove_pod_wizard_step1_title">Deactivate Pod</string>
<string name="omnipod_remove_pod_wizard_step1_desc">\nPress <b>Next</b> to deactivate the Pod.\n\n<b>Note:</b> This will suspend all insulin delivery and deactivate the Pod.</string>
<string name="omnipod_remove_pod_wizard_step2_title">Deactivating the Pod</string>
<string name="omnipod_remove_pod_wizard_step2_action_header">Deactivating the Pod.\n\nWhen all items are checked, you can press <b>Next</b>.\n\n<b>Note:</b> If deactivating continuously fails, please press <b>Cancel</b> and use the <b>Reset Pod</b> option to forcibly reset the pod state.</string>
<string name="omnipod_remove_pod_wizard_step2_action_header">Deactivating the Pod.\n\nWhen all items are checked, you can press <b>Next</b>.\n\n<b>Note:</b> If deactivating continuously fails, please press <b>Cancel</b> and use the <b>Reset Pod</b> option to forcibly reset the Pod state.</string>
<string name="omnipod_init_pod_wizard_pod_info_remove_pod_description">Pod deactivated.\n\nPlease remove the Pod from your body and discard it.</string>
@ -1760,9 +1760,9 @@
<string name="omnipod_alert_shutdown_imminent">Shutdown is imminent</string>
<string name="omnipod_alert_low_reservoir">Low reservoir</string>
<string name="omnipod_alert_unknown_alert">Unknown alert</string>
<string name="omnipod_error_set_basal_failed_uncertain">Setting basal profile might have failed. Delivery might be suspended! Please refresh pod status.</string>
<string name="omnipod_error_set_time_failed_uncertain">Setting time might have failed. Delivery might be suspended! Please refresh pod status.</string>
<string name="omnipod_bolus_failed_uncertain">Unable to verify whether the bolus succeeded. Please verify that your pod is bolusing or cancel the bolus.</string>
<string name="omnipod_error_set_basal_failed_uncertain">Setting basal profile might have failed. Delivery might be suspended! Please refresh Pod status.</string>
<string name="omnipod_error_set_time_failed_uncertain">Setting time might have failed. Delivery might be suspended! Please refresh Pod status.</string>
<string name="omnipod_bolus_failed_uncertain">Unable to verify whether the bolus succeeded. Please verify that your Pod is bolusing or cancel the bolus.</string>
<string name="omnipod_rl_stats">RL Stats</string>
<string name="omnipod_read_pulse_log_short">Pulse Log</string>

View file

@ -1,5 +1,5 @@
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo;
public class PodInfoOlderHighFlashLogDumpTest {
public class PodInfoOlderPulseLogTest {
// TODO
}

View file

@ -1,16 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo;
import org.junit.Test;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import static org.junit.Assert.assertEquals;
public class PodInfoRecentHighFlashLogDumpTest {
@Test
public void testDecoding() {
PodInfoRecentHighFlashLogDump podInfoRecentHighFlashLogDump = new PodInfoRecentHighFlashLogDump(ByteUtil.fromHexString("3d313b004030350045303a00483033004d313a005031310054313f00583038805d302d806030368001313b800c3033801130388014313480193138801c313280213039802431360029313d002c31390031303f0034313900393140003c31390041313e00443137004905723a80087335800d733a801073358015733a80187235801d7338802073338025733a00287235002d723b003072360035703b00383134"), 160);
assertEquals(39, podInfoRecentHighFlashLogDump.getDwords().size());
}
}

View file

@ -0,0 +1,16 @@
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo;
import org.junit.Test;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import static org.junit.Assert.assertEquals;
public class PodInfoRecentPulseLogTest {
@Test
public void testDecoding() {
PodInfoRecentPulseLog podInfoRecentPulseLog = new PodInfoRecentPulseLog(ByteUtil.fromHexString("3d313b004030350045303a00483033004d313a005031310054313f00583038805d302d806030368001313b800c3033801130388014313480193138801c313280213039802431360029313d002c31390031303f0034313900393140003c31390041313e00443137004905723a80087335800d733a801073358015733a80187235801d7338802073338025733a00287235002d723b003072360035703b00383134"), 160);
assertEquals(39, podInfoRecentPulseLog.getDwords().size());
}
}