detect if extended bolus is enabled, detect easy ui mode

This commit is contained in:
Milos Kozak 2016-12-13 21:35:49 +01:00
parent 9454e7e6e2
commit 407ea423cb
11 changed files with 124 additions and 43 deletions

View file

@ -46,6 +46,9 @@ public class DanaRPump {
public int protocol;
public int productCode;
public boolean isConfigUD;
public boolean isExtendedBolusEnabled;
// Status
public boolean pumpSuspended;
@ -54,6 +57,7 @@ public class DanaRPump {
public int maxDailyTotalUnits;
public double bolusStep;
public double basalStep;
public double iob;

View file

@ -61,6 +61,7 @@ import info.nightscout.androidaps.plugins.DanaR.comm.MsgSetTempBasalStop;
import info.nightscout.androidaps.plugins.DanaR.comm.MsgSetTime;
import info.nightscout.androidaps.plugins.DanaR.comm.MsgSettingActiveProfile;
import info.nightscout.androidaps.plugins.DanaR.comm.MsgSettingBasal;
import info.nightscout.androidaps.plugins.DanaR.comm.MsgSettingMeal;
import info.nightscout.androidaps.plugins.DanaR.comm.MsgSettingGlucose;
import info.nightscout.androidaps.plugins.DanaR.comm.MsgSettingMaxValues;
import info.nightscout.androidaps.plugins.DanaR.comm.MsgSettingProfileRatios;
@ -312,7 +313,7 @@ public class ExecutionService extends Service {
if (danaRPump.lastSettingsRead.getTime() + 60 * 60 * 1000L < now.getTime()) {
mSerialIOThread.sendMessage(new MsgSettingShippingInfo());
mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
//0x3203
mSerialIOThread.sendMessage(new MsgSettingMeal());
mSerialIOThread.sendMessage(new MsgSettingBasal());
//0x3201
mSerialIOThread.sendMessage(new MsgSettingMaxValues());

View file

@ -47,6 +47,7 @@ public class MessageHashTable {
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 MsgSettingMeal()); // 0x3203 CMD_SETTING_V_MEAL_SETTING_I
put(new MsgSettingProfileRatios()); // 0x3204 CMD_SETTING_V_CCC_I
put(new MsgSettingMaxValues()); // 0x3205 CMD_SETTING_V_MAX_VALUE_I
put(new MsgSettingBasalProfileAll()); // 0x3206 CMD_SETTING_V_BASAL_PROFILE_ALL

View file

@ -24,20 +24,14 @@ public class MsgInitConnStatusBolus extends MessageBase {
}
DanaRPump pump = DanaRPlugin.getDanaRPump();
int bolusConfig = intFromBuff(bytes, 0, 1);
boolean deliveryPrime = (bolusConfig & DanaRPump.DELIVERY_PRIME) != 0;
boolean deliveryStepBolus = (bolusConfig & DanaRPump.DELIVERY_STEP_BOLUS) != 0;
boolean deliveryBasal = (bolusConfig & DanaRPump.DELIVERY_BASAL) != 0;
boolean deliveryExtBolus = (bolusConfig & DanaRPump.DELIVERY_EXT_BOLUS) != 0;
pump.isExtendedBolusEnabled = (bolusConfig & 0x01) != 0;
pump.bolusStep = intFromBuff(bytes, 1, 1) / 100d;
pump.maxBolus = intFromBuff(bytes, 2, 2) / 100d;
//int bolusRate = intFromBuff(bytes, 4, 8);
if (Config.logDanaMessageDetail) {
log.debug("Delivery prime: " + deliveryPrime);
log.debug("Delivery step bolus: " + deliveryStepBolus);
log.debug("Delivery basal: " + deliveryBasal);
log.debug("Delivery ext bolus: " + deliveryExtBolus);
log.debug("Is Extended bolus enabled: " + pump.isExtendedBolusEnabled);
log.debug("Bolus increment: " + pump.bolusStep);
log.debug("Bolus max: " + pump.maxBolus);
}

View file

@ -0,0 +1,40 @@
package info.nightscout.androidaps.plugins.DanaR.comm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
import info.nightscout.androidaps.plugins.DanaR.DanaRPump;
/**
* Created by mike on 13.12.2016.
*/
public class MsgSettingMeal extends MessageBase {
private static Logger log = LoggerFactory.getLogger(MsgSettingMeal.class);
public MsgSettingMeal() {
SetCommand(0x3203);
}
public void handleMessage(byte[] bytes) {
DanaRPump pump = DanaRPlugin.getDanaRPump();
pump.basalStep = intFromBuff(bytes, 0, 1) / 100d;
pump.bolusStep = intFromBuff(bytes, 1, 1) / 100d;
boolean bolusEnabled = intFromBuff(bytes, 2, 1) == 1;
int melodyTime = intFromBuff(bytes, 3, 1);
int blockTime = intFromBuff(bytes, 4, 1);
pump.isConfigUD = intFromBuff(bytes, 5, 1) == 1;
if (Config.logDanaMessageDetail) {
log.debug("Basal step: " + pump.basalStep);
log.debug("Bolus step: " + pump.bolusStep);
log.debug("Bolus enabled: " + bolusEnabled);
log.debug("Melody time: " + melodyTime);
log.debug("Block time: " + blockTime);
log.debug("Is Config U/d: " + pump.isConfigUD);
}
}
}

View file

@ -46,11 +46,15 @@ public class DanaRKoreanPump {
public int protocol;
public int productCode;
public boolean isConfigUD;
public boolean isExtendedBolusEnabled;
// Status
public double dailyTotalUnits;
public int maxDailyTotalUnits;
public double bolusStep;
public double basalStep;
public double iob;

View file

@ -32,7 +32,6 @@ import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.plugins.DanaR.comm.*;
import info.nightscout.androidaps.plugins.DanaR.comm.MsgSetTime;
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRBolusStart;
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRConnectionStatus;
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRNewStatus;
@ -62,9 +61,11 @@ import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgSetExtendedBolusSt
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgSetSingleBasalProfile;
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgSetTempBasalStart;
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgSetTempBasalStop;
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgSetTime;
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgSettingBasal;
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgSettingGlucose;
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgSettingMaxValues;
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgSettingMeal;
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgSettingProfileRatios;
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgSettingPumpTime;
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgSettingShippingInfo;
@ -305,7 +306,7 @@ public class ExecutionService extends Service {
Date now = new Date();
if (danaRKoreanPump.lastSettingsRead.getTime() + 60 * 60 * 1000L < now.getTime()) {
mSerialIOThread.sendMessage(new MsgSettingShippingInfo());
//0x3203
mSerialIOThread.sendMessage(new MsgSettingMeal());
mSerialIOThread.sendMessage(new MsgSettingBasal());
//0x3201
mSerialIOThread.sendMessage(new MsgSettingMaxValues());

View file

@ -5,7 +5,7 @@ import org.slf4j.LoggerFactory;
import java.util.HashMap;
import info.nightscout.androidaps.plugins.DanaR.comm.MessageBase;
import info.nightscout.androidaps.plugins.DanaR.comm.*;
/**
* Created by mike on 28.05.2016.
@ -48,6 +48,7 @@ public class MessageHashTable {
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 MsgSettingMeal()); // 0x3203 CMD_SETTING_V_MEAL_SETTING_I
put(new MsgSettingProfileRatios()); // 0x3204 CMD_SETTING_V_CCC_I
put(new MsgSettingMaxValues()); // 0x3205 CMD_SETTING_V_MAX_VALUE_I
put(new MsgSettingBasalProfileAll()); // 0x3206 CMD_SETTING_V_BASAL_PROFILE_ALL

View file

@ -25,10 +25,7 @@ public class MsgInitConnStatusBolus extends MessageBase {
}
DanaRKoreanPump pump = DanaRKoreanPlugin.getDanaRPump();
int bolusConfig = intFromBuff(bytes, 0, 1);
boolean deliveryPrime = (bolusConfig & DanaRKoreanPump.DELIVERY_PRIME) != 0;
boolean deliveryStepBolus = (bolusConfig & DanaRKoreanPump.DELIVERY_STEP_BOLUS) != 0;
boolean deliveryBasal = (bolusConfig & DanaRKoreanPump.DELIVERY_BASAL) != 0;
boolean deliveryExtBolus = (bolusConfig & DanaRKoreanPump.DELIVERY_EXT_BOLUS) != 0;
pump.isExtendedBolusEnabled = (bolusConfig & 0x01) != 0;
pump.bolusStep = intFromBuff(bytes, 1, 1) / 100d;
pump.maxBolus = intFromBuff(bytes, 2, 2) / 100d;
@ -36,10 +33,7 @@ public class MsgInitConnStatusBolus extends MessageBase {
int deliveryStatus = intFromBuff(bytes, 12, 1);
if (Config.logDanaMessageDetail) {
log.debug("Delivery prime: " + deliveryPrime);
log.debug("Delivery step bolus: " + deliveryStepBolus);
log.debug("Delivery basal: " + deliveryBasal);
log.debug("Delivery ext bolus: " + deliveryExtBolus);
log.debug("Is Extended bolus enabled: " + pump.isExtendedBolusEnabled);
log.debug("Bolus increment: " + pump.bolusStep);
log.debug("Bolus max: " + pump.maxBolus);
log.debug("Delivery status: " + deliveryStatus);

View file

@ -0,0 +1,41 @@
package info.nightscout.androidaps.plugins.DanaRKorean.comm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
import info.nightscout.androidaps.plugins.DanaR.DanaRPump;
import info.nightscout.androidaps.plugins.DanaR.comm.MessageBase;
/**
* Created by mike on 13.12.2016.
*/
public class MsgSettingMeal extends MessageBase {
private static Logger log = LoggerFactory.getLogger(MsgSettingMeal.class);
public MsgSettingMeal() {
SetCommand(0x3203);
}
public void handleMessage(byte[] bytes) {
DanaRPump pump = DanaRPlugin.getDanaRPump();
pump.basalStep = intFromBuff(bytes, 0, 1) / 100d;
pump.bolusStep = intFromBuff(bytes, 1, 1) / 100d;
boolean bolusEnabled = intFromBuff(bytes, 2, 1) == 1;
int melodyTime = intFromBuff(bytes, 3, 1);
int blockTime = intFromBuff(bytes, 4, 1);
pump.isConfigUD = intFromBuff(bytes, 5, 1) == 1;
if (Config.logDanaMessageDetail) {
log.debug("Basal step: " + pump.basalStep);
log.debug("Bolus step: " + pump.bolusStep);
log.debug("Bolus enabled: " + bolusEnabled);
log.debug("Melody time: " + melodyTime);
log.debug("Block time: " + blockTime);
log.debug("Is Config U/d: " + pump.isConfigUD);
}
}
}

View file

@ -43,13 +43,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/fullDebug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/fullDebug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/fullDebug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/full/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/full/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/assets" type="java-test-resource" />
@ -58,6 +51,13 @@
<sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/full/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/full/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/full/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/full/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/full/assets" type="java-resource" />
@ -66,14 +66,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/full/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/full/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/full/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testFull/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testFull/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testFull/assets" type="java-test-resource" />
@ -82,6 +74,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/testFull/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testFull/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testFull/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
@ -106,14 +106,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
@ -122,6 +114,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" />