basal rates set

This commit is contained in:
Milos Kozak 2016-12-06 23:46:36 +01:00
parent f2928c3d39
commit 2dea4615c0
7 changed files with 58 additions and 26 deletions

View file

@ -33,7 +33,7 @@ public class MessageHashTable {
put(new MsgSetTempBasalStop()); // 0x0403 CMD_PUMPSET_EXERCISE_STOP
put(new MsgSetExtendedBolusStop()); // 0x0406 CMD_PUMPSET_EXPANS_INS_STOP
put(new MsgSetExtendedBolusStart()); // 0x0407 CMD_PUMPSET_EXPANS_INS_S
put(new MsgError()); // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS
put(new MsgError()); // 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
@ -56,6 +56,7 @@ public class MessageHashTable {
put(new MsgSettingUserOptions()); // 0x320B CMD_SETTING_V_USER_OPTIONS
put(new MsgSettingActiveProfile()); // 0x320C CMD_SETTING_V_PROFILE_NUMBER
put(new MsgSettingProfileRatiosAll()); // 0x320D CMD_SETTING_V_CIR_CF_VALUE
put(new MsgSetSingleBasalProfile()); // 0x3302 CMD_SETTING_BASAL_INS_S
put(new MsgSetBasalProfile()); // 0x3306 CMD_SETTING_BASAL_PROFILE_S
put(new MsgSetActivateBasalProfile()); // 0x330C CMD_SETTING_PROFILE_NUMBER_S
put(new MsgHistoryAllDone()); // 0x41F1 CMD_HISTORY_ALL_DONE

View file

@ -62,7 +62,7 @@ public class MessageOriginalNames {
messageNames.put(0x320d, "CMD_SETTING_V_CIR_CF_VALUE");
messageNames.put(0x3301, "CMD_SETTING_MEAL_INS_S");
messageNames.put(0x3302, "CMD_SETTING_Based_INS_S");
messageNames.put(0x3302, "CMD_SETTING_BASAL_INS_S");
messageNames.put(0x3303, "CMD_SETTING_MEAL_SETTING_S");
messageNames.put(0x3304, "CMD_SETTING_CCC_S");
messageNames.put(0x3305, "CMD_SETTING_MAX_VALUE_S");

View file

@ -0,0 +1,38 @@
package info.nightscout.androidaps.plugins.DanaR.comm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.Config;
public class MsgSetSingleBasalProfile extends MessageBase {
private static Logger log = LoggerFactory.getLogger(MsgSetSingleBasalProfile.class);
public MsgSetSingleBasalProfile() {
SetCommand(0x3302);
}
// index 0-3
public MsgSetSingleBasalProfile(double[] values) {
this();
for (Integer i = 0; i < 24; i++) {
AddParamInt((int) (values[i] * 100));
}
if (Config.logDanaMessageDetail)
log.debug("Set basal profile");
}
@Override
public void handleMessage(byte[] bytes) {
int result = intFromBuff(bytes, 0, 1);
if (result != 1) {
failed = true;
log.debug("Set basal profile result: " + result + " FAILED!!!");
} else {
if (Config.logDanaMessageDetail)
log.debug("Set basal profile result: " + result);
}
}
}

View file

@ -428,10 +428,8 @@ public class ExecutionService extends Service {
connect("updateBasalsInPump");
if (!isConnected()) return false;
double[] basal = buildDanaRProfileRecord(profile);
MsgSetBasalProfile msgSet = new MsgSetBasalProfile((byte) 0, basal);
MsgSetSingleBasalProfile msgSet = new MsgSetSingleBasalProfile(basal);
mSerialIOThread.sendMessage(msgSet);
//MsgSetActivateBasalProfile msgActivate = new MsgSetActivateBasalProfile((byte) 0);
//mSerialIOThread.sendMessage(msgActivate);
getPumpStatus();
return true;
}

View file

@ -34,7 +34,7 @@ public class MessageHashTable {
put(new MsgSetTempBasalStop()); // 0x0403 CMD_PUMPSET_EXERCISE_STOP
put(new MsgSetExtendedBolusStop()); // 0x0406 CMD_PUMPSET_EXPANS_INS_STOP
put(new MsgSetExtendedBolusStart()); // 0x0407 CMD_PUMPSET_EXPANS_INS_S
put(new MsgError()); // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS
put(new MsgError()); // 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
@ -54,7 +54,7 @@ public class MessageHashTable {
put(new MsgSettingShippingInfo()); // 0x3207 CMD_SETTING_V_SHIPPING_I
put(new MsgSettingGlucose()); // 0x3209 CMD_SETTING_V_GLUCOSEandEASY
put(new MsgSettingPumpTime()); // 0x320A CMD_SETTING_V_TIME_I
put(new MsgSetBasalProfile()); // 0x3306 CMD_SETTING_BASAL_PROFILE_S
put(new MsgSetSingleBasalProfile()); // 0x3302 CMD_SETTING_BASAL_INS_S
put(new MsgHistoryAll()); // 0x41F2 CMD_HISTORY_ALL
put(new MsgHistoryNewDone()); // 0x42F1 CMD_HISTORY_NEW_DONE
put(new MsgHistoryNew()); // 0x42F2 CMD_HISTORY_NEW

View file

@ -6,22 +6,21 @@ import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.plugins.DanaR.comm.MessageBase;
public class MsgSetBasalProfile extends MessageBase {
private static Logger log = LoggerFactory.getLogger(MsgSetBasalProfile.class);
public class MsgSetSingleBasalProfile extends MessageBase {
private static Logger log = LoggerFactory.getLogger(MsgSetSingleBasalProfile.class);
public MsgSetBasalProfile() {
SetCommand(0x3306);
public MsgSetSingleBasalProfile() {
SetCommand(0x3302);
}
// index 0-3
public MsgSetBasalProfile(byte index, double[] values) {
public MsgSetSingleBasalProfile(double[] values) {
this();
AddParamByte(index);
for (Integer i = 0; i < 24; i++) {
AddParamInt((int) (values[i] * 100));
}
if (Config.logDanaMessageDetail)
log.debug("Set basal profile: " + index);
log.debug("Set basal profile");
}
@Override

View file

@ -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/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" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<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" />
@ -122,9 +114,15 @@
<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" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<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" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<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" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/7.3.0/jars" />
@ -133,13 +131,11 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/me.denley.wearpreferenceactivity/wearpreferenceactivity/0.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/ustwo-clockwise-debug/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />