From 1a90746bed51e30df60c4bfb6172ee08a037eaae Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 20 Jul 2016 23:12:25 +0200 Subject: [PATCH] added danar history messages --- .../plugins/DanaR/comm/MessageHashTable.java | 14 +++++++++- .../DanaR/comm/MessageOriginalNames.java | 2 +- .../plugins/DanaR/comm/MsgHistoryAlarm.java | 15 +++++++++++ .../plugins/DanaR/comm/MsgHistoryAllDone.java | 12 ++++++++- .../DanaR/comm/MsgHistoryBasalHour.java | 15 +++++++++++ .../plugins/DanaR/comm/MsgHistoryBolus.java | 15 +++++++++++ .../plugins/DanaR/comm/MsgHistoryCarbo.java | 15 +++++++++++ .../DanaR/comm/MsgHistoryDailyInsulin.java | 15 +++++++++++ .../plugins/DanaR/comm/MsgHistoryDone.java | 27 +++++++++++++++++++ .../plugins/DanaR/comm/MsgHistoryError.java | 15 +++++++++++ .../plugins/DanaR/comm/MsgHistoryGlucose.java | 15 +++++++++++ .../plugins/DanaR/comm/MsgHistoryNew.java | 15 +++++++++++ .../plugins/DanaR/comm/MsgHistoryNewDone.java | 26 ++++++++++++++++++ .../plugins/DanaR/comm/MsgHistoryRefill.java | 15 +++++++++++ .../plugins/DanaR/comm/MsgHistorySuspend.java | 15 +++++++++++ 15 files changed, 228 insertions(+), 3 deletions(-) create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryAlarm.java create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryBasalHour.java create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryBolus.java create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryCarbo.java create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryDailyInsulin.java create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryDone.java create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryError.java create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryGlucose.java create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryNew.java create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryNewDone.java create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryRefill.java create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistorySuspend.java diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MessageHashTable.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MessageHashTable.java index 6f63ee88ef..c9079c1898 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MessageHashTable.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MessageHashTable.java @@ -36,6 +36,16 @@ public class MessageHashTable { put(new MsgOcclusion()); // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS put(new MsgPCCommStart()); // 0x3001 CMD_CONNECT put(new MsgPCCommStop()); // 0x3002 CMD_DISCONNECT + put(new MsgHistoryBolus()); // 0x3101 CMD_HISTORY_MEAL_INS + put(new MsgHistoryDailyInsulin()); // 0x3102 CMD_HISTORY_DAY_INS + put(new MsgHistoryGlucose()); // 0x3104 CMD_HISTORY_GLUCOSE + put(new MsgHistoryAlarm()); // 0x3105 CMD_HISTORY_ALARM + put(new MsgHistoryError()); // 0x3106 CMD_HISTORY_ERROR + put(new MsgHistoryCarbo()); // 0x3107 CMD_HISTORY_CARBOHY + put(new MsgHistoryRefill()); // 0x3108 CMD_HISTORY_REFILL + put(new MsgHistorySuspend()); // 0x3109 CMD_HISTORY_SUSPEND + put(new MsgHistoryBasalHour()); // 0x310A CMD_HISTORY_BASAL_HOUR + put(new MsgHistoryDone()); // 0x31F1 CMD_HISTORY_DONT_USED put(new MsgSettingBasal()); // 0x3202 CMD_SETTING_V_BASAL_INS_I put(new MsgSettingProfileRatios()); // 0x3204 CMD_SETTING_V_CCC_I put(new MsgSettingMaxValues()); // 0x3205 CMD_SETTING_V_MAX_VALUE_I @@ -48,8 +58,10 @@ public class MessageHashTable { put(new MsgSettingProfileRatiosAll()); // 0x320D CMD_SETTING_V_CIR_CF_VALUE put(new MsgSetBasalProfile()); // 0x3306 CMD_SETTING_BASAL_PROFILE_S put(new MsgSetActivateBasalProfile()); // 0x330C CMD_SETTING_PROFILE_NUMBER_S - put(new MsgHistoryAll()); // 0x41F2 CMD_HISTORY_ALL put(new MsgHistoryAllDone()); // 0x41F1 CMD_HISTORY_ALL_DONE + put(new MsgHistoryAll()); // 0x41F2 CMD_HISTORY_ALL + put(new MsgHistoryNewDone()); // 0x42F1 CMD_HISTORY_NEW_DONE + put(new MsgHistoryNew()); // 0x42F2 CMD_HISTORY_NEW put(new MsgCheckValue()); // 0xF0F1 CMD_PUMP_CHECK_VALUE } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MessageOriginalNames.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MessageOriginalNames.java index 7200489c6a..2b4da9c6db 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MessageOriginalNames.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MessageOriginalNames.java @@ -48,7 +48,7 @@ public class MessageOriginalNames { messageNames.put(0x050d, "CMD_HISPAGE_TB"); messageNames.put(0x3201, "CMD_SETTING_V_MEAL_INS_I"); - messageNames.put(0x3202, "CMD_SETTING_V_Based_INS_I"); + messageNames.put(0x3202, "CMD_SETTING_V_BASAL_INS_I"); messageNames.put(0x3203, "CMD_SETTING_V_MEAL_SETTING_I"); messageNames.put(0x3204, "CMD_SETTING_V_CCC_I"); messageNames.put(0x3205, "CMD_SETTING_V_MAX_VALUE_I"); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryAlarm.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryAlarm.java new file mode 100644 index 0000000000..1964a58fc9 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryAlarm.java @@ -0,0 +1,15 @@ +package info.nightscout.androidaps.plugins.DanaR.comm; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by mike on 20.07.2016. + */ +public class MsgHistoryAlarm extends MsgHistoryAll { + private static Logger log = LoggerFactory.getLogger(MsgHistoryAlarm.class); + public MsgHistoryAlarm() { + SetCommand(0x3105); + } + // Handle message taken from MsgHistoryAll +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryAllDone.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryAllDone.java index 330f897919..1a839f5553 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryAllDone.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryAllDone.java @@ -1,13 +1,23 @@ package info.nightscout.androidaps.plugins.DanaR.comm; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import info.nightscout.androidaps.Config; + public class MsgHistoryAllDone extends MessageBase { + private static Logger log = LoggerFactory.getLogger(MsgHistoryAllDone.class); + public static boolean received = false; public MsgHistoryAllDone() { SetCommand(0x41F1); + received = false; } @Override public void handleMessage(byte[] bytes) { + received = true; + if (Config.logDanaMessageDetail) + log.debug("History all done received"); } - } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryBasalHour.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryBasalHour.java new file mode 100644 index 0000000000..dee4de6a39 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryBasalHour.java @@ -0,0 +1,15 @@ +package info.nightscout.androidaps.plugins.DanaR.comm; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by mike on 20.07.2016. + */ +public class MsgHistoryBasalHour extends MsgHistoryAll { + private static Logger log = LoggerFactory.getLogger(MsgHistoryBasalHour.class); + public MsgHistoryBasalHour() { + SetCommand(0x310A); + } + // Handle message taken from MsgHistoryAll +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryBolus.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryBolus.java new file mode 100644 index 0000000000..97963955dd --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryBolus.java @@ -0,0 +1,15 @@ +package info.nightscout.androidaps.plugins.DanaR.comm; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by mike on 20.07.2016. + */ +public class MsgHistoryBolus extends MsgHistoryAll { + private static Logger log = LoggerFactory.getLogger(MsgHistoryBolus.class); + public MsgHistoryBolus() { + SetCommand(0x3101); + } + // Handle message taken from MsgHistoryAll +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryCarbo.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryCarbo.java new file mode 100644 index 0000000000..26fe30c89f --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryCarbo.java @@ -0,0 +1,15 @@ +package info.nightscout.androidaps.plugins.DanaR.comm; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by mike on 20.07.2016. + */ +public class MsgHistoryCarbo extends MsgHistoryAll { + private static Logger log = LoggerFactory.getLogger(MsgHistoryCarbo.class); + public MsgHistoryCarbo() { + SetCommand(0x3107); + } + // Handle message taken from MsgHistoryAll +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryDailyInsulin.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryDailyInsulin.java new file mode 100644 index 0000000000..2d0e6969ea --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryDailyInsulin.java @@ -0,0 +1,15 @@ +package info.nightscout.androidaps.plugins.DanaR.comm; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by mike on 20.07.2016. + */ +public class MsgHistoryDailyInsulin extends MsgHistoryAll { + private static Logger log = LoggerFactory.getLogger(MsgHistoryDailyInsulin.class); + public MsgHistoryDailyInsulin() { + SetCommand(0x3102); + } + // Handle message taken from MsgHistoryAll +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryDone.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryDone.java new file mode 100644 index 0000000000..773101ab85 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryDone.java @@ -0,0 +1,27 @@ +package info.nightscout.androidaps.plugins.DanaR.comm; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import info.nightscout.androidaps.Config; + +/** + * Created by mike on 20.07.2016. + */ +public class MsgHistoryDone extends MessageBase { + private static Logger log = LoggerFactory.getLogger(MsgHistoryDone.class); + public static boolean received = false; + + MsgHistoryDone() { + SetCommand(0x31F1); + received = false; + } + + @Override + public void handleMessage(byte[] bytes) { + received = true; + if (Config.logDanaMessageDetail) + log.debug("History done received"); + + } +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryError.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryError.java new file mode 100644 index 0000000000..85443a271e --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryError.java @@ -0,0 +1,15 @@ +package info.nightscout.androidaps.plugins.DanaR.comm; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by mike on 20.07.2016. + */ +public class MsgHistoryError extends MsgHistoryAll { + private static Logger log = LoggerFactory.getLogger(MsgHistoryError.class); + public MsgHistoryError() { + SetCommand(0x3106); + } + // Handle message taken from MsgHistoryAll +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryGlucose.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryGlucose.java new file mode 100644 index 0000000000..903a402810 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryGlucose.java @@ -0,0 +1,15 @@ +package info.nightscout.androidaps.plugins.DanaR.comm; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by mike on 20.07.2016. + */ +public class MsgHistoryGlucose extends MsgHistoryAll { + private static Logger log = LoggerFactory.getLogger(MsgHistoryGlucose.class); + public MsgHistoryGlucose() { + SetCommand(0x3104); + } + // Handle message taken from MsgHistoryAll +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryNew.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryNew.java new file mode 100644 index 0000000000..0bfe82fd30 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryNew.java @@ -0,0 +1,15 @@ +package info.nightscout.androidaps.plugins.DanaR.comm; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by mike on 20.07.2016. + */ +public class MsgHistoryNew extends MsgHistoryAll { + private static Logger log = LoggerFactory.getLogger(MsgHistoryNew.class); + public MsgHistoryNew() { + SetCommand(0x42F2); + } + // Handle message taken from MsgHistoryAll +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryNewDone.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryNewDone.java new file mode 100644 index 0000000000..fb5de7515e --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryNewDone.java @@ -0,0 +1,26 @@ +package info.nightscout.androidaps.plugins.DanaR.comm; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import info.nightscout.androidaps.Config; + +/** + * Created by mike on 20.07.2016. + */ +public class MsgHistoryNewDone extends MessageBase { + private static Logger log = LoggerFactory.getLogger(MsgHistoryNewDone.class); + public static boolean received = false; + + public MsgHistoryNewDone() { + SetCommand(0x42F1); + received = false; + } + + @Override + public void handleMessage(byte[] bytes) { + received = true; + if (Config.logDanaMessageDetail) + log.debug("History new done received"); + } +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryRefill.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryRefill.java new file mode 100644 index 0000000000..6db3e972ff --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryRefill.java @@ -0,0 +1,15 @@ +package info.nightscout.androidaps.plugins.DanaR.comm; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by mike on 20.07.2016. + */ +public class MsgHistoryRefill extends MsgHistoryAll { + private static Logger log = LoggerFactory.getLogger(MsgHistoryRefill.class); + public MsgHistoryRefill() { + SetCommand(0x3108); + } + // Handle message taken from MsgHistoryAll +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistorySuspend.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistorySuspend.java new file mode 100644 index 0000000000..a7a6c5ee04 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistorySuspend.java @@ -0,0 +1,15 @@ +package info.nightscout.androidaps.plugins.DanaR.comm; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by mike on 20.07.2016. + */ +public class MsgHistorySuspend extends MsgHistoryAll { + private static Logger log = LoggerFactory.getLogger(MsgHistorySuspend.class); + public MsgHistorySuspend() { + SetCommand(0x3109); + } + // Handle message taken from MsgHistoryAll +}