Revert "more debugging output"

This reverts commit f1f8bae2d1.
This commit is contained in:
PoweRGbg 2018-06-13 09:34:57 +03:00
parent 233fb33659
commit 209fb79396
4 changed files with 45 additions and 24 deletions

View file

@ -11,9 +11,25 @@ import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
*/
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);
private byte[] optionsInPump;
public MsgGetUserOptions() {
SetCommand(0x320B);
}
@ -21,9 +37,8 @@ public class MsgGetUserOptions extends MessageBase {
public void handleMessage(byte[] packet) {
DanaRPump pump = DanaRPump.getInstance();
byte[] bytes = getDataBytes(packet, 0, packet.length - 10);
this.optionsInPump = getDataBytes(packet, 0, packet.length - 10);
for(int pos=0; pos < packet.length; pos++) {
log.debug("[" + pos + "]" + packet[pos]);
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
@ -54,7 +69,6 @@ public class MsgGetUserOptions extends MessageBase {
log.debug("Low reservoir: " + pump.lowReservoirRate);
// }
}
public static byte[] getDataBytes(byte[] bytes, int start, int len) {
if (bytes == null) {
return null;
@ -63,6 +77,4 @@ public class MsgGetUserOptions extends MessageBase {
System.arraycopy(bytes, start + 6, ret, 0, len);
return ret;
}
}

View file

@ -2,7 +2,6 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import android.support.v4.internal.view.SupportMenu;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
@ -24,7 +23,7 @@ public class MsgSettingUserOptions extends MessageBase {
private int selectedLanguage;
private int shutdownHour;
private int timeDisplayType;
byte[] newOptions;
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) {
@ -50,19 +49,17 @@ public class MsgSettingUserOptions extends MessageBase {
this.lowReservoirRate = lowReservoirRate;
this.cannulaVolume = cannulaVolume;
this.refillRate = refillRate;
newOptions[0] = (byte) (timeDisplayType == 1 ? 0 : 1);
newOptions[1] = (byte) buttonScrollOnOff;
newOptions[2] = (byte) beepAndAlarm;
newOptions[3] = (byte) lcdOnTimeSec;
newOptions[4] = (byte) backlightOnTimeSec;
newOptions[5] = (byte) selectedLanguage;
newOptions[8] = (byte) glucoseUnit;
newOptions[9] = (byte) shutdownHour;
newOptions[27] = (byte) lowReservoirRate;
// need to organize here
// glucoseunit is at pos 8 and lowReservoirRate is at pos 27
// 6 extended bolus on/off
// 10 missed bolus
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);
}
=======
@ -78,7 +75,6 @@ public class MsgSettingUserOptions extends MessageBase {
<<<<<<< HEAD
public void handleMessage(byte[] bytes) {
log.debug("Entering handleMessage ");
newOptions = new byte[]{bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], bytes[8], bytes[9], bytes[15], bytes[16], bytes[17], bytes[18], bytes[19], bytes[20], bytes[21], bytes[22], bytes[23], bytes[24], bytes[25], bytes[26], bytes[27], bytes[28], bytes[29], bytes[30], bytes[31], bytes[32]};
int result = intFromBuff(bytes, 0, 1);
if (result != 1) {
failed = true;
@ -133,6 +129,7 @@ public class MsgSettingUserOptions extends MessageBase {
}
<<<<<<< HEAD
<<<<<<< HEAD
public byte[] getCommByte(int cmd, byte[] data) {
int len = (data == null ? 0 : data.length) + 3;
byte[] btSendData = new byte[(len + 7)];
@ -180,4 +177,6 @@ public class MsgSettingUserOptions extends MessageBase {
=======
>>>>>>> upstream/rsoption
=======
>>>>>>> parent of f1f8bae2d... more debugging output
}

View file

@ -393,6 +393,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
public PumpEnactResult setUserOptions() {
<<<<<<< HEAD
DanaRv2ExecutionService service = new DanaRv2ExecutionService();
log.debug("MsgSetUserOptions executed!");
return service.setUserOptions();
=======
return sExecutionService.setUserOptions();

View file

@ -200,8 +200,12 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
mSerialIOThread.sendMessage(new MsgSettingGlucose());
mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
mSerialIOThread.sendMessage(new MsgSettingProfileRatios());
<<<<<<< HEAD
<<<<<<< HEAD
//added by Roumen for testing and
=======
//added by Roumen for testing
>>>>>>> parent of f1f8bae2d... more debugging output
mSerialIOThread.sendMessage(new MsgGetUserOptions());
=======
mSerialIOThread.sendMessage(new MsgSettingUserOptions());
@ -482,7 +486,9 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
public PumpEnactResult setUserOptions() {
<<<<<<< HEAD
if (!isConnected()) {
return new PumpEnactResult().success(false);
log.debug("MsgSetUserOptions - service is not connected");
// return new PumpEnactResult().success(false);
connect();
}
=======
if (!isConnected())
@ -498,11 +504,14 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
<<<<<<< HEAD
public PumpEnactResult getUserOptions() {
if (!isConnected()) {
return new PumpEnactResult().success(false);
log.debug("MsgGetUserOptions fails - disconnected!");
connect();
// return new PumpEnactResult().success(false);
}
MsgGetUserOptions msg = new MsgGetUserOptions();
mSerialIOThread.sendMessage(msg);
// mSerialIOThread.sendMessage(msg); // == null
mDanaRPump.lastConnection = System.currentTimeMillis();
log.debug("MsgGetUserOptions executed!");
return new PumpEnactResult().success(true);
}
=======