reverting changes
This commit is contained in:
parent
87bc6ed798
commit
434db333b1
4 changed files with 103 additions and 131 deletions
|
@ -56,11 +56,11 @@ public class MessageHashTable {
|
|||
put(new MsgSettingGlucose()); // 0x3209 CMD_SETTING_V_GLUCOSEandEASY
|
||||
put(new MsgSettingPumpTime()); // 0x320A CMD_SETTING_V_TIME_I
|
||||
put(new MsgSettingUserOptions()); // 0x320B CMD_SETTING_V_USER_OPTIONS
|
||||
put(new MsgGetUserOptions()); // 0x320B CMD_SETTING_V_USER_OPTIONS - trying to get uptions
|
||||
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 MsgSetUserOptions()); // 0x330B CMD_SETTING_USER_OPTIONS_S
|
||||
put(new MsgSetActivateBasalProfile()); // 0x330C CMD_SETTING_PROFILE_NUMBER_S
|
||||
put(new MsgHistoryAllDone()); // 0x41F1 CMD_HISTORY_ALL_DONE
|
||||
put(new MsgHistoryAll()); // 0x41F2 CMD_HISTORY_ALL
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||
|
||||
/**
|
||||
* Created by Rumen Georgiev on 6/11/2018.
|
||||
*/
|
||||
|
||||
public class MsgGetUserOptions extends MessageBase {
|
||||
private int backlightOnTimeSec;
|
||||
private int beepAndAlarm;
|
||||
private int buttonScrollOnOff;
|
||||
private int cannulaVolume;
|
||||
private int glucoseUnit;
|
||||
private int lcdOnTimeSec;
|
||||
private int lowReservoirRate;
|
||||
private int refillRate;
|
||||
private int selectableLanguage1;
|
||||
private int selectableLanguage2;
|
||||
private int selectableLanguage3;
|
||||
private int selectableLanguage4;
|
||||
private int selectableLanguage5;
|
||||
private int selectedLanguage;
|
||||
private int shutdownHour;
|
||||
private int timeDisplayType;
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(MsgGetUserOptions.class);
|
||||
|
||||
public MsgGetUserOptions() {
|
||||
SetCommand(0x320B);
|
||||
}
|
||||
|
||||
public void handleMessage(byte[] packet) {
|
||||
DanaRPump pump = DanaRPump.getInstance();
|
||||
byte[] bytes = getDataBytes(packet, 0, packet.length - 10);
|
||||
pump.timeDisplayType = bytes[0] == (byte) 1 ? 0 : 1; // 1 -> 24h 0 -> 12h
|
||||
pump.buttonScrollOnOff = bytes[1] == (byte) 1 ? 1 : 0; // 1 -> ON, 0-> OFF
|
||||
pump.beepAndAlarm = bytes[2]; // 1 -> Sound on alarm 2-> Vibrate on alarm 3-> Both on alarm 5-> Sound + beep 6-> vibrate + beep 7-> both + beep Beep adds 4
|
||||
pump.lcdOnTimeSec = bytes[3] & 255;
|
||||
pump.backlightOnTimeSec = bytes[4] & 255;
|
||||
pump.selectedLanguage = bytes[5]; // on DanaRv2 is that needed ?
|
||||
pump.units = bytes[8];
|
||||
pump.shutdownHour = bytes[9];
|
||||
pump.lowReservoirRate = bytes[32] & 255;
|
||||
/* int selectableLanguage1 = bytes[10];
|
||||
int selectableLanguage2 = bytes[11];
|
||||
int selectableLanguage3 = bytes[12];
|
||||
int selectableLanguage4 = bytes[13];
|
||||
int selectableLanguage5 = bytes[14];
|
||||
*/
|
||||
|
||||
// if (Config.logDanaMessageDetail) {
|
||||
|
||||
log.debug("timeDisplayType: " + pump.timeDisplayType);
|
||||
log.debug("Button scroll: " + pump.buttonScrollOnOff);
|
||||
log.debug("BeepAndAlarm: " + pump.beepAndAlarm);
|
||||
log.debug("screen timeout: " + pump.lcdOnTimeSec);
|
||||
log.debug("Backlight: " + pump.backlightOnTimeSec);
|
||||
log.debug("Selected language: " + pump.selectedLanguage);
|
||||
log.debug("Units: " + pump.getUnits());
|
||||
log.debug("Shutdown: " + pump.shutdownHour);
|
||||
log.debug("Low reservoir: " + pump.lowReservoirRate);
|
||||
// }
|
||||
}
|
||||
public static byte[] getDataBytes(byte[] bytes, int start, int len) {
|
||||
if (bytes == null) {
|
||||
return null;
|
||||
}
|
||||
byte[] ret = new byte[len];
|
||||
System.arraycopy(bytes, start + 6, ret, 0, len);
|
||||
return ret;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||
|
||||
/**
|
||||
* Created by mike on 05.07.2016.
|
||||
*/
|
||||
public class MsgSetUserOptions extends MessageBase {
|
||||
|
||||
public boolean done;
|
||||
|
||||
public MsgSetUserOptions() {
|
||||
SetCommand(0x330B);
|
||||
|
||||
DanaRPump pump = DanaRPump.getInstance();
|
||||
|
||||
log.debug(" initializing MsgSetUserOptions");
|
||||
log.debug("timeDisplayType: " + (byte) pump.timeDisplayType);
|
||||
log.debug("Button scroll: " + (byte) pump.buttonScrollOnOff);
|
||||
log.debug("BeepAndAlarm: " + (byte) pump.beepAndAlarm);
|
||||
log.debug("screen timeout: " + (byte) pump.lcdOnTimeSec);
|
||||
log.debug("Backlight: " + (byte) pump.backlightOnTimeSec);
|
||||
log.debug("Selected language: " + (byte) pump.selectedLanguage);
|
||||
log.debug("Units: " + (byte) pump.units);
|
||||
log.debug("Shutdown: " + (byte) pump.shutdownHour);
|
||||
log.debug("Low reservoir: " + (byte) pump.lowReservoirRate);
|
||||
// need to organize here
|
||||
// glucoseunit is at pos 8 and lowReservoirRate is at pos 27
|
||||
AddParamByte((byte) pump.timeDisplayType);
|
||||
AddParamByte((byte) pump.buttonScrollOnOff);
|
||||
AddParamByte((byte) pump.beepAndAlarm);
|
||||
AddParamByte((byte) pump.lcdOnTimeSec);
|
||||
AddParamByte((byte) pump.backlightOnTimeSec);
|
||||
AddParamByte((byte) pump.selectedLanguage);
|
||||
AddParamByte((byte) pump.units);
|
||||
AddParamByte((byte) pump.shutdownHour);
|
||||
AddParamByte((byte) pump.lowReservoirRate);
|
||||
}
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(MsgSetUserOptions.class);
|
||||
|
||||
public void handleMessage(byte[] bytes) {
|
||||
log.debug("Entering handleMessage ");
|
||||
int result = intFromBuff(bytes, 0, 1);
|
||||
if (result != 1) {
|
||||
failed = true;
|
||||
log.debug("Setting user options: " + result + " FAILED!!!");
|
||||
} else {
|
||||
if (Config.logDanaMessageDetail)
|
||||
log.debug("Setting user options: " + result);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -3,70 +3,61 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||
|
||||
/**
|
||||
* Created by mike on 05.07.2016.
|
||||
* Created by Rumen Georgiev on 6/11/2018.
|
||||
*/
|
||||
|
||||
public class MsgSettingUserOptions extends MessageBase {
|
||||
|
||||
private int backlightOnTimeSec;
|
||||
private int beepAndAlarm;
|
||||
private int buttonScrollOnOff;
|
||||
private int cannulaVolume;
|
||||
private int error;
|
||||
private int glucoseUnit;
|
||||
private int lcdOnTimeSec;
|
||||
private int lowReservoirRate;
|
||||
private int refillRate;
|
||||
private int selectedLanguage;
|
||||
private int shutdownHour;
|
||||
private int timeDisplayType;
|
||||
|
||||
public boolean done;
|
||||
|
||||
public MsgSettingUserOptions(int timeDisplayType, int buttonScrollOnOff, int beepAndAlarm, int lcdOnTimeSec, int backlightOnTimeSec, int selectedLanguage, int glucoseUnit, int shutdownHour, int lowReservoirRate, int cannulaVolume, int refillRate) {
|
||||
this();
|
||||
log.debug(" initializing MsgSetUserOptions");
|
||||
this.timeDisplayType = timeDisplayType;
|
||||
this.buttonScrollOnOff = buttonScrollOnOff;
|
||||
this.beepAndAlarm = beepAndAlarm;
|
||||
this.lcdOnTimeSec = lcdOnTimeSec;
|
||||
this.backlightOnTimeSec = backlightOnTimeSec;
|
||||
this.selectedLanguage = selectedLanguage;
|
||||
this.glucoseUnit = glucoseUnit;
|
||||
this.shutdownHour = shutdownHour;
|
||||
this.lowReservoirRate = lowReservoirRate;
|
||||
this.cannulaVolume = cannulaVolume;
|
||||
this.refillRate = refillRate;
|
||||
|
||||
AddParamByte((byte) timeDisplayType);
|
||||
AddParamByte((byte) buttonScrollOnOff);
|
||||
AddParamByte((byte) beepAndAlarm);
|
||||
AddParamByte((byte) lcdOnTimeSec);
|
||||
AddParamByte((byte) backlightOnTimeSec);
|
||||
AddParamByte((byte) selectedLanguage);
|
||||
AddParamByte((byte) glucoseUnit);
|
||||
AddParamByte((byte) shutdownHour);
|
||||
AddParamByte((byte) lowReservoirRate);
|
||||
}
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(MsgSettingUserOptions.class);
|
||||
|
||||
public MsgSettingUserOptions() {
|
||||
SetCommand(0x320B);
|
||||
}
|
||||
|
||||
public void handleMessage(byte[] bytes) {
|
||||
log.debug("Entering handleMessage ");
|
||||
int result = intFromBuff(bytes, 0, 1);
|
||||
if (result != 1) {
|
||||
failed = true;
|
||||
log.debug("Setting user options: " + result + " FAILED!!!");
|
||||
} else {
|
||||
if (Config.logDanaMessageDetail)
|
||||
log.debug("Setting user options: " + result);
|
||||
public void handleMessage(byte[] packet) {
|
||||
DanaRPump pump = DanaRPump.getInstance();
|
||||
byte[] bytes = getDataBytes(packet, 0, packet.length - 10);
|
||||
for(int pos=0; pos < bytes.length; pos++) {
|
||||
log.debug("[" + pos + "]" + bytes[pos]);
|
||||
}
|
||||
}
|
||||
pump.timeDisplayType = bytes[0] == (byte) 1 ? 0 : 1; // 1 -> 24h 0 -> 12h
|
||||
pump.buttonScrollOnOff = bytes[1] == (byte) 1 ? 1 : 0; // 1 -> ON, 0-> OFF
|
||||
pump.beepAndAlarm = bytes[2]; // 1 -> Sound on alarm 2-> Vibrate on alarm 3-> Both on alarm 5-> Sound + beep 6-> vibrate + beep 7-> both + beep Beep adds 4
|
||||
pump.lcdOnTimeSec = bytes[3] & 255;
|
||||
pump.backlightOnTimeSec = bytes[4] & 255;
|
||||
pump.selectedLanguage = bytes[5]; // on DanaRv2 is that needed ?
|
||||
pump.units = bytes[8];
|
||||
pump.shutdownHour = bytes[9];
|
||||
pump.lowReservoirRate = bytes[32] & 255;
|
||||
/* int selectableLanguage1 = bytes[10];
|
||||
int selectableLanguage2 = bytes[11];
|
||||
int selectableLanguage3 = bytes[12];
|
||||
int selectableLanguage4 = bytes[13];
|
||||
int selectableLanguage5 = bytes[14];
|
||||
*/
|
||||
|
||||
// if (Config.logDanaMessageDetail) {
|
||||
|
||||
log.debug("timeDisplayType: " + pump.timeDisplayType);
|
||||
log.debug("Button scroll: " + pump.buttonScrollOnOff);
|
||||
log.debug("BeepAndAlarm: " + pump.beepAndAlarm);
|
||||
log.debug("screen timeout: " + pump.lcdOnTimeSec);
|
||||
log.debug("Backlight: " + pump.backlightOnTimeSec);
|
||||
log.debug("Selected language: " + pump.selectedLanguage);
|
||||
log.debug("Units: " + pump.getUnits());
|
||||
log.debug("Shutdown: " + pump.shutdownHour);
|
||||
log.debug("Low reservoir: " + pump.lowReservoirRate);
|
||||
// }
|
||||
}
|
||||
public static byte[] getDataBytes(byte[] bytes, int start, int len) {
|
||||
if (bytes == null) {
|
||||
return null;
|
||||
}
|
||||
byte[] ret = new byte[len];
|
||||
System.arraycopy(bytes, start + 6, ret, 0, len);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue