update method names

This commit is contained in:
Roumen Georgiev 2018-06-12 12:41:40 +03:00
parent 978d94499f
commit 06507bab2c
6 changed files with 29 additions and 23 deletions

View file

@ -381,7 +381,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
}
@Override
public PumpEnactResult setUserSettings() {
public PumpEnactResult setUserOptions() {
return null;
}
}

View file

@ -4,11 +4,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
/**
* Created by mike on 05.07.2016.
@ -32,6 +27,7 @@ public class MsgSettingUserOptions extends MessageBase {
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;
@ -44,15 +40,15 @@ public class MsgSettingUserOptions extends MessageBase {
this.cannulaVolume = cannulaVolume;
this.refillRate = refillRate;
AddParamInt(timeDisplayType);
AddParamInt(buttonScrollOnOff);
AddParamInt(beepAndAlarm);
AddParamInt(lcdOnTimeSec);
AddParamInt(backlightOnTimeSec);
AddParamInt(selectedLanguage);
AddParamInt(glucoseUnit);
AddParamInt(shutdownHour);
AddParamInt(lowReservoirRate);
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);
@ -62,6 +58,7 @@ public class MsgSettingUserOptions extends MessageBase {
}
public void handleMessage(byte[] bytes) {
log.debug("Entering handleMessage ");
int result = intFromBuff(bytes, 0, 1);
if (result != 1) {
failed = true;

View file

@ -382,7 +382,7 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin {
}
@Override
public PumpEnactResult setUserSettings() {
public PumpEnactResult setUserOptions() {
return null;
}
}

View file

@ -392,7 +392,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
@Override
public PumpEnactResult setUserOptions() {
DanaRv2ExecutionService service = new DanaRv2ExecutionService();
log.debug("MsgSetingUserOptions executed!");
log.debug("MsgSetUserOptions executed!");
return service.setUserOptions();
}

View file

@ -477,12 +477,19 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
}
public PumpEnactResult setUserOptions() {
if (!isConnected())
return new PumpEnactResult().success(false);
if (!isConnected()) {
log.debug("MsgSetUserOptions - service is not connected");
// return new PumpEnactResult().success(false);
connect();
}
SystemClock.sleep(300);
DanaRPump pump = DanaRPump.getInstance();
MsgSettingUserOptions msg = new MsgSettingUserOptions(pump.timeDisplayType, pump.buttonScrollOnOff, pump.beepAndAlarm, pump.lcdOnTimeSec, pump.backlightOnTimeSec, pump.selectedLanguage, pump.units, pump.shutdownHour, pump.lowReservoirRate, 0, 0);
if (mSerialIOThread != null) {
mSerialIOThread.disconnect("MsgSetUserOptions - Recreate SerialIOThread");
}
mSerialIOThread = new SerialIOThread(mRfcommSocket);
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.CONNECTED, 0));
mSerialIOThread.sendMessage(msg);
while (!msg.done && mRfcommSocket.isConnected()) {
SystemClock.sleep(100);

View file

@ -1,5 +1,8 @@
package info.nightscout.androidaps.queue.commands;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.interfaces.DanaRInterface;
@ -14,7 +17,7 @@ import info.nightscout.androidaps.queue.Callback;
*/
public class CommandSetUserSettings extends Command {
private static Logger log = LoggerFactory.getLogger(CommandSetUserSettings.class);
public CommandSetUserSettings(Callback callback) {
commandType = CommandType.SETUSERSETTINGS;
this.callback = callback;
@ -27,8 +30,7 @@ public class CommandSetUserSettings extends Command {
DanaRInterface danaPump = (DanaRInterface) pump;
boolean isDanaRv2 = MainApp.getSpecificPlugin(DanaRv2Plugin.class) != null && MainApp.getSpecificPlugin(DanaRv2Plugin.class).isEnabled(PluginType.PUMP);
if(isDanaRv2){
pump.getPumpStatus();
danaPump.setUserOptions();
log.debug("MsgSetUserOptions detected for DanaRv2");
}
PumpEnactResult r = danaPump.setUserOptions();
if (callback != null)