Merge pull request #1100 from MilosKozak/rsoption

Rsoption
This commit is contained in:
Milos Kozak 2018-06-15 00:19:08 +02:00 committed by GitHub
commit 21b598edfa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 901 additions and 18 deletions

View file

@ -49,6 +49,7 @@
android:theme="@style/Theme.AppCompat.Translucent" /> android:theme="@style/Theme.AppCompat.Translucent" />
<activity android:name=".AgreementActivity" /> <activity android:name=".AgreementActivity" />
<activity android:name=".plugins.PumpDanaR.activities.DanaRHistoryActivity" /> <activity android:name=".plugins.PumpDanaR.activities.DanaRHistoryActivity" />
<activity android:name=".plugins.PumpDanaR.activities.DanaRUserOptionsActivity" />
<activity android:name=".TDDStatsActivity" /> <activity android:name=".TDDStatsActivity" />
<activity android:name=".plugins.Overview.activities.QuickWizardListActivity"> <activity android:name=".plugins.Overview.activities.QuickWizardListActivity">
<intent-filter> <intent-filter>

View file

@ -103,12 +103,15 @@ public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
if(LocalProfilePlugin.LOCAL_PROFILE.equals(name)){ if(LocalProfilePlugin.LOCAL_PROFILE.equals(name)){
name = DecimalFormatter.to2Decimal(getProfileObject().percentageBasalSum()) + "U "; name = DecimalFormatter.to2Decimal(getProfileObject().percentageBasalSum()) + "U ";
} }
//Test if name is already containing percentage or timeshift
if (!name.endsWith("h)") || !name.endsWith("%)")) {
if (isCPP) { if (isCPP) {
name += "(" + percentage + "%"; name += "(" + percentage + "%";
if (timeshift != 0) if (timeshift != 0)
name += "," + timeshift + "h"; name += "," + timeshift + "h";
name += ")"; name += ")";
} }
}
return name; return name;
} }

View file

@ -9,4 +9,5 @@ import info.nightscout.androidaps.data.PumpEnactResult;
public interface DanaRInterface { public interface DanaRInterface {
PumpEnactResult loadHistory(byte type); // for history browser PumpEnactResult loadHistory(byte type); // for history browser
PumpEnactResult loadEvents(); // events history to build treatments from PumpEnactResult loadEvents(); // events history to build treatments from
PumpEnactResult setUserOptions(); // like AnyDana does
} }

View file

@ -11,6 +11,7 @@ import android.text.Spanned;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
@ -29,11 +30,14 @@ import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.events.EventExtendedBolusChange; import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.events.EventTempBasalChange; import info.nightscout.androidaps.events.EventTempBasalChange;
import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment; import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.PumpDanaR.Dialogs.ProfileViewDialog; import info.nightscout.androidaps.plugins.PumpDanaR.Dialogs.ProfileViewDialog;
import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRHistoryActivity; import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRHistoryActivity;
import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRUserOptionsActivity;
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus; import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.androidaps.queue.events.EventQueueChanged; import info.nightscout.androidaps.queue.events.EventQueueChanged;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
@ -88,6 +92,8 @@ public class DanaRFragment extends SubscriberFragment {
LinearLayout pumpStatusLayout; LinearLayout pumpStatusLayout;
@BindView(R.id.overview_pumpstatus) @BindView(R.id.overview_pumpstatus)
TextView pumpStatusView; TextView pumpStatusView;
@BindView(R.id.danar_user_options)
Button danar_user_options;
public DanaRFragment() { public DanaRFragment() {
} }
@ -138,6 +144,9 @@ public class DanaRFragment extends SubscriberFragment {
startActivity(new Intent(getContext(), TDDStatsActivity.class)); startActivity(new Intent(getContext(), TDDStatsActivity.class));
} }
@OnClick(R.id.danar_user_options)
void onUserOptionsClick() { startActivity(new Intent(getContext(), DanaRUserOptionsActivity.class)); }
@OnClick(R.id.danar_btconnection) @OnClick(R.id.danar_btconnection)
void onBtConnectionClick() { void onBtConnectionClick() {
log.debug("Clicked connect to pump"); log.debug("Clicked connect to pump");
@ -268,6 +277,11 @@ public class DanaRFragment extends SubscriberFragment {
queueView.setText(status); queueView.setText(status);
} }
} }
//hide user options button if not an RS pump
boolean isKorean = MainApp.getSpecificPlugin(DanaRKoreanPlugin.class) != null && MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).isEnabled(PluginType.PUMP);
if (isKorean ) {
danar_user_options.setVisibility(View.GONE);
}
} }
}); });
} }

View file

@ -379,4 +379,9 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
public PumpEnactResult loadEvents() { public PumpEnactResult loadEvents() {
return null; // no history, not needed return null; // no history, not needed
} }
@Override
public PumpEnactResult setUserOptions() {
return sExecutionService.setUserOptions();
}
} }

View file

@ -161,7 +161,7 @@ public class DanaRPump {
public int lowReservoirRate; public int lowReservoirRate;
public int cannulaVolume; public int cannulaVolume;
public int refillAmount; public int refillAmount;
public byte[] userOptionsFrompump;
public double initialBolusAmount; public double initialBolusAmount;
// Bolus settings // Bolus settings
public int bolusCalculationOption; public int bolusCalculationOption;

View file

@ -0,0 +1,196 @@
package info.nightscout.androidaps.plugins.PumpDanaR.activities;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Switch;
import com.squareup.otto.Subscribe;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.DecimalFormat;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.PumpDanaRS.DanaRSPlugin;
import info.nightscout.androidaps.plugins.PumpDanaRv2.DanaRv2Plugin;
import info.nightscout.utils.NumberPicker;
/**
* Created by Rumen Georgiev on 5/31/2018.
*/
public class DanaRUserOptionsActivity extends Activity {
private static Logger log = LoggerFactory.getLogger(DanaRUserOptionsActivity.class);
Switch timeFormat;
Switch buttonScroll;
Switch beep;
RadioGroup pumpAlarm;
RadioButton pumpAlarmSound;
RadioButton pumpAlarmVibrate;
RadioButton pumpAlarmBoth;
Switch pumpUnits;
NumberPicker screenTimeout;
NumberPicker backlightTimeout;
NumberPicker shutdown;
NumberPicker lowReservoir;
Button saveToPumpButton;
@Override
protected void onResume() {
super.onResume();
MainApp.bus().register(this);
}
@Override
protected void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.danar_user_options);
timeFormat = (Switch) findViewById(R.id.danar_timeformat);
buttonScroll = (Switch) findViewById(R.id.danar_buttonscroll);
beep = (Switch) findViewById(R.id.danar_beep);
pumpAlarm = (RadioGroup) findViewById(R.id.danar_pumpalarm);
pumpAlarmSound = (RadioButton) findViewById(R.id.danar_pumpalarm_sound);
pumpAlarmVibrate = (RadioButton) findViewById(R.id.danar_pumpalarm_vibrate);
pumpAlarmBoth = (RadioButton) findViewById(R.id.danar_pumpalarm_both);
screenTimeout = (NumberPicker) findViewById(R.id.danar_screentimeout);
backlightTimeout = (NumberPicker) findViewById(R.id.danar_backlight);
pumpUnits = (Switch) findViewById(R.id.danar_units);
shutdown = (NumberPicker) findViewById(R.id.danar_shutdown);
lowReservoir = (NumberPicker) findViewById(R.id.danar_lowreservoir);
saveToPumpButton = (Button) findViewById(R.id.save_user_options);
saveToPumpButton.setOnClickListener(v -> onSaveClick());
DanaRPump pump = DanaRPump.getInstance();
//used for debugging
log.debug("UserOptionsLoaded:" + (System.currentTimeMillis() - pump.lastConnection) / 1000 + " s ago"
+ "\ntimeDisplayType:" + pump.timeDisplayType
+ "\nbuttonScroll:" + pump.buttonScrollOnOff
+ "\ntimeDisplayType:" + pump.timeDisplayType
+ "\nlcdOnTimeSec:" + pump.lcdOnTimeSec
+ "\nbacklight:" + pump.backlightOnTimeSec
+ "\npumpUnits:" + pump.units
+ "\nlowReservoir:" + pump.lowReservoirRate);
screenTimeout.setParams((double) pump.lcdOnTimeSec, 5d, 240d, 5d, new DecimalFormat("1"), false);
backlightTimeout.setParams((double) pump.backlightOnTimeSec, 1d, 60d, 1d, new DecimalFormat("1"), false);
shutdown.setParams((double) pump.shutdownHour, 0d, 24d, 1d, new DecimalFormat("1"), true);
lowReservoir.setParams((double) pump.lowReservoirRate, 10d, 60d, 10d, new DecimalFormat("10"), false);
switch (pump.beepAndAlarm) {
case 1: pumpAlarmSound.setChecked(true);
break;
case 2: pumpAlarmVibrate.setChecked(true);
break;
case 3: pumpAlarmBoth.setChecked(true);
break;
case 5: pumpAlarmSound.setChecked(true);
beep.setChecked(true);
break;
case 6: pumpAlarmVibrate.setChecked(true);
beep.setChecked(true);
break;
case 7: pumpAlarmBoth.setChecked(true);
beep.setChecked(true);
break;
}
if (pump.lastSettingsRead == 0)
log.debug("No settings loaded from pump!");
else
setData();
}
public void setData() {
DanaRPump pump = DanaRPump.getInstance();
timeFormat.setChecked(pump.timeDisplayType != 0);
buttonScroll.setChecked(pump.buttonScrollOnOff != 0);
beep.setChecked(pump.beepAndAlarm > 4);
screenTimeout.setValue((double) pump.lcdOnTimeSec);
backlightTimeout.setValue((double) pump.backlightOnTimeSec);
pumpUnits.setChecked(pump.getUnits() != null && pump.getUnits().equals(Constants.MMOL));
shutdown.setValue((double) pump.shutdownHour);
lowReservoir.setValue((double) pump.lowReservoirRate);
}
@Subscribe
public void onEventInitializationChanged(EventInitializationChanged ignored) {
runOnUiThread(this::setData);
}
public void onSaveClick() {
boolean isRS = MainApp.getSpecificPlugin(DanaRSPlugin.class) != null && MainApp.getSpecificPlugin(DanaRSPlugin.class).isEnabled(PluginType.PUMP);
boolean isDanaR = MainApp.getSpecificPlugin(DanaRPlugin.class) != null && MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginType.PUMP);
boolean isDanaRv2 = MainApp.getSpecificPlugin(DanaRv2Plugin.class) != null && MainApp.getSpecificPlugin(DanaRv2Plugin.class).isEnabled(PluginType.PUMP);
if (!isRS && !isDanaR && !isDanaRv2) {
//exit if pump is not DanaRS, Dana!, or DanaR with upgraded firmware
return;
}
DanaRPump pump = DanaRPump.getInstance();
if (timeFormat.isChecked())
pump.timeDisplayType = 1;
else
pump.timeDisplayType = 0;
if (buttonScroll.isChecked())
pump.buttonScrollOnOff = 1;
else
pump.buttonScrollOnOff = 0;
pump.beepAndAlarm = 1; // default
if (pumpAlarmSound.isChecked()) pump.beepAndAlarm = 1;
else if (pumpAlarmVibrate.isChecked()) pump.beepAndAlarm = 2;
else if (pumpAlarmBoth.isChecked()) pump.beepAndAlarm = 3;
if (beep.isChecked()) pump.beepAndAlarm += 4;
// step is 5 seconds
int screenTimeoutValue = !screenTimeout.getText().isEmpty() ? (Integer.parseInt(screenTimeout.getText().toString()) / 5) * 5: 5;
if (screenTimeoutValue > 4 && screenTimeoutValue < 241) {
pump.lcdOnTimeSec = screenTimeoutValue;
} else {
pump.lcdOnTimeSec = 5;
}
int backlightTimeoutValue = !backlightTimeout.getText().isEmpty() ? Integer.parseInt(backlightTimeout.getText().toString()): 1;
if (backlightTimeoutValue > 0 && backlightTimeoutValue < 61) {
pump.backlightOnTimeSec = backlightTimeoutValue;
}
if (pumpUnits.isChecked()) {
pump.units = 1;
} else {
pump.units = 0;
}
int shutDownValue = !shutdown.getText().isEmpty() ? Integer.parseInt(shutdown.getText().toString()) : 0;
if (shutDownValue > -1 && shutDownValue < 25) {
pump.shutdownHour = shutDownValue;
} else {
pump.shutdownHour = 0;
}
int lowReservoirValue = !lowReservoir.getText().isEmpty() ? (Integer.parseInt(lowReservoir.getText().toString()) * 10) / 10 : 10;
if (lowReservoirValue > 9 && lowReservoirValue < 51) {
pump.lowReservoirRate = lowReservoirValue;
} else
pump.lowReservoirRate = 10;
MainApp.getConfigBuilder().getCommandQueue().setUserOptions(null);
finish();
}
}

View file

@ -60,6 +60,7 @@ public class MessageHashTable {
put(new MsgSettingProfileRatiosAll()); // 0x320D CMD_SETTING_V_CIR_CF_VALUE put(new MsgSettingProfileRatiosAll()); // 0x320D CMD_SETTING_V_CIR_CF_VALUE
put(new MsgSetSingleBasalProfile()); // 0x3302 CMD_SETTING_BASAL_INS_S put(new MsgSetSingleBasalProfile()); // 0x3302 CMD_SETTING_BASAL_INS_S
put(new MsgSetBasalProfile()); // 0x3306 CMD_SETTING_BASAL_PROFILE_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 MsgSetActivateBasalProfile()); // 0x330C CMD_SETTING_PROFILE_NUMBER_S
put(new MsgHistoryAllDone()); // 0x41F1 CMD_HISTORY_ALL_DONE put(new MsgHistoryAllDone()); // 0x41F1 CMD_HISTORY_ALL_DONE
put(new MsgHistoryAll()); // 0x41F2 CMD_HISTORY_ALL put(new MsgHistoryAll()); // 0x41F2 CMD_HISTORY_ALL

View file

@ -0,0 +1,52 @@
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.Config;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
/**
* Created by mike on 05.07.2016.
*/
public class MsgSetUserOptions extends MessageBase {
private static Logger log = LoggerFactory.getLogger(MsgSetUserOptions.class);
public boolean done;
public MsgSetUserOptions() {
SetCommand(0x330B);
DanaRPump pump = DanaRPump.getInstance();
if (pump.userOptionsFrompump == null) {
// No options set -> Exitting
log.debug("NO USER OPTIONS LOADED EXITTING!");
return;
}
pump.userOptionsFrompump[0] = (byte) (pump.timeDisplayType == 1 ? 0 : 1);
pump.userOptionsFrompump[1] = (byte) pump.buttonScrollOnOff;
pump.userOptionsFrompump[2] = (byte) pump.beepAndAlarm;
pump.userOptionsFrompump[3] = (byte) pump.lcdOnTimeSec;
pump.userOptionsFrompump[4] = (byte) pump.backlightOnTimeSec;
pump.userOptionsFrompump[5] = (byte) pump.selectedLanguage;
pump.userOptionsFrompump[8] = (byte) pump.units;
pump.userOptionsFrompump[9] = (byte) pump.shutdownHour;
pump.userOptionsFrompump[27] = (byte) pump.lowReservoirRate;
for(int i=0; i<pump.userOptionsFrompump.length; i++){
AddParamByte(pump.userOptionsFrompump[i]);
}
}
public void handleMessage(byte[] bytes) {
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);
}
}
}

View file

@ -3,18 +3,66 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.Arrays;
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 { public class MsgSettingUserOptions extends MessageBase {
private static Logger log = LoggerFactory.getLogger(MsgSettingShippingInfo.class);
private static Logger log = LoggerFactory.getLogger(MsgSettingUserOptions.class);
public MsgSettingUserOptions() { public MsgSettingUserOptions() {
SetCommand(0x320B); SetCommand(0x320B);
} }
public void handleMessage(byte[] bytes) { public void handleMessage(byte[] packet) {
DanaRPump pump = DanaRPump.getInstance();
byte[] bytes = getDataBytes(packet, 0, packet.length - 10);
pump.userOptionsFrompump = Arrays.copyOf(bytes, bytes.length);// saving pumpDataBytes to use it in MsgSetUserOptions
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;
}
} }

View file

@ -92,6 +92,7 @@ public abstract class AbstractDanaRExecutionService extends Service {
public abstract boolean extendedBolusStop(); public abstract boolean extendedBolusStop();
public abstract PumpEnactResult setUserOptions();
protected BroadcastReceiver receiver = new BroadcastReceiver() { protected BroadcastReceiver receiver = new BroadcastReceiver() {
@Override @Override

View file

@ -18,6 +18,8 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingUserOptions;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetUserOptions;
import info.nightscout.androidaps.plugins.Treatments.Treatment; import info.nightscout.androidaps.plugins.Treatments.Treatment;
import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventInitializationChanged;
@ -62,7 +64,6 @@ import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.NSUpload; import info.nightscout.utils.NSUpload;
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
import info.nightscout.utils.ToastUtils;
public class DanaRExecutionService extends AbstractDanaRExecutionService{ public class DanaRExecutionService extends AbstractDanaRExecutionService{
@ -177,6 +178,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
mSerialIOThread.sendMessage(new MsgSettingActiveProfile()); mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
mSerialIOThread.sendMessage(new MsgSettingProfileRatios()); mSerialIOThread.sendMessage(new MsgSettingProfileRatios());
mSerialIOThread.sendMessage(new MsgSettingProfileRatiosAll()); mSerialIOThread.sendMessage(new MsgSettingProfileRatiosAll());
mSerialIOThread.sendMessage(new MsgSettingUserOptions());
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime))); MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime)));
mSerialIOThread.sendMessage(new MsgSettingPumpTime()); mSerialIOThread.sendMessage(new MsgSettingPumpTime());
long timeDiff = (mDanaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L; long timeDiff = (mDanaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
@ -397,4 +399,13 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
log.debug("EventAppExit finished"); log.debug("EventAppExit finished");
} }
public PumpEnactResult setUserOptions() {
if (!isConnected())
return new PumpEnactResult().success(false);
SystemClock.sleep(300);
MsgSetUserOptions msg = new MsgSetUserOptions();
mSerialIOThread.sendMessage(msg);
SystemClock.sleep(200);
return new PumpEnactResult().success(!msg.failed);
}
} }

View file

@ -380,4 +380,9 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin {
public PumpEnactResult loadEvents() { public PumpEnactResult loadEvents() {
return null; // no history, not needed return null; // no history, not needed
} }
@Override
public PumpEnactResult setUserOptions() {
return null;
}
} }

View file

@ -327,4 +327,9 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
return true; return true;
} }
@Override
public PumpEnactResult setUserOptions() {
return null;
}
} }

View file

@ -26,8 +26,6 @@ import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.db.ExtendedBolus; import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Bolus_Set_Step_Bolus_Start;
import info.nightscout.androidaps.plugins.Treatments.Treatment;
import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.Constraint;
import info.nightscout.androidaps.interfaces.ConstraintsInterface; import info.nightscout.androidaps.interfaces.ConstraintsInterface;
@ -46,8 +44,10 @@ import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRFragment; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRFragment;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes; import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes;
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Bolus_Set_Step_Bolus_Start;
import info.nightscout.androidaps.plugins.PumpDanaRS.events.EventDanaRSDeviceChange; import info.nightscout.androidaps.plugins.PumpDanaRS.events.EventDanaRSDeviceChange;
import info.nightscout.androidaps.plugins.PumpDanaRS.services.DanaRSService; import info.nightscout.androidaps.plugins.PumpDanaRS.services.DanaRSService;
import info.nightscout.androidaps.plugins.Treatments.Treatment;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
@ -224,6 +224,11 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
return danaRSService.loadEvents(); return danaRSService.loadEvents();
} }
@Override
public PumpEnactResult setUserOptions() {
return danaRSService.setUserSettings();
}
// Constraints interface // Constraints interface
@Override @Override
@ -759,4 +764,5 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
public PumpEnactResult loadTDDs() { public PumpEnactResult loadTDDs() {
return loadHistory(RecordTypes.RECORD_TYPE_DAILY); return loadHistory(RecordTypes.RECORD_TYPE_DAILY);
} }
} }

View file

@ -23,7 +23,14 @@ public class DanaRS_Packet_Option_Set_User_Option extends DanaRS_Packet {
@Override @Override
public byte[] getRequestParams() { public byte[] getRequestParams() {
DanaRPump pump = DanaRPump.getInstance(); DanaRPump pump = DanaRPump.getInstance();
log.debug("UserOptions:"+(System.currentTimeMillis() - pump.lastConnection)/1000+" s ago"
+"\ntimeDisplayType:"+pump.timeDisplayType
+"\nbuttonScroll:"+pump.buttonScrollOnOff
+"\ntimeDisplayType:"+pump.timeDisplayType
+"\nlcdOnTimeSec:"+pump.lcdOnTimeSec
+"\nbacklight:"+pump.backlightOnTimeSec
+"\npumpUnits:"+pump.units
+"\nlowReservoir:"+pump.lowReservoirRate);
byte[] request = new byte[13]; byte[] request = new byte[13];
request[0] = (byte) (pump.timeDisplayType & 0xff); request[0] = (byte) (pump.timeDisplayType & 0xff);
request[1] = (byte) (pump.buttonScrollOnOff & 0xff); request[1] = (byte) (pump.buttonScrollOnOff & 0xff);

View file

@ -19,6 +19,7 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Get_User_Option;
import info.nightscout.androidaps.plugins.Treatments.Treatment; import info.nightscout.androidaps.plugins.Treatments.Treatment;
import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventInitializationChanged;
@ -70,6 +71,7 @@ import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Notify_D
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Notify_Delivery_Rate_Display; import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Notify_Delivery_Rate_Display;
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Get_Pump_Time; import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Get_Pump_Time;
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Set_Pump_Time; import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Set_Pump_Time;
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Set_User_Option;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.NSUpload; import info.nightscout.utils.NSUpload;
@ -146,6 +148,7 @@ public class DanaRSService extends Service {
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_CIR_CF_Array()); bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_CIR_CF_Array());
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime))); MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime)));
bleComm.sendMessage(new DanaRS_Packet_Option_Get_Pump_Time()); bleComm.sendMessage(new DanaRS_Packet_Option_Get_Pump_Time());
bleComm.sendMessage(new DanaRS_Packet_Option_Get_User_Option()); // Getting user options
long timeDiff = (danaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L; long timeDiff = (danaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
log.debug("Pump time difference: " + timeDiff + " seconds"); log.debug("Pump time difference: " + timeDiff + " seconds");
if (Math.abs(timeDiff) > 3) { if (Math.abs(timeDiff) > 3) {
@ -202,6 +205,13 @@ public class DanaRSService extends Service {
} }
public PumpEnactResult setUserSettings() {
bleComm.sendMessage(new DanaRS_Packet_Option_Set_User_Option());
bleComm.sendMessage(new DanaRS_Packet_Option_Get_User_Option());
return new PumpEnactResult().success(true);
}
public boolean bolus(final double insulin, int carbs, long carbtime, Treatment t) { public boolean bolus(final double insulin, int carbs, long carbtime, Treatment t) {
if (!isConnected()) return false; if (!isConnected()) return false;
if (BolusProgressDialog.stopPressed) return false; if (BolusProgressDialog.stopPressed) return false;

View file

@ -389,4 +389,8 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
return sExecutionService.loadEvents(); return sExecutionService.loadEvents();
} }
@Override
public PumpEnactResult setUserOptions() {
return sExecutionService.setUserOptions();
}
} }

View file

@ -66,6 +66,7 @@ public class MessageHashTable_v2 {
put(new MsgSettingProfileRatiosAll()); // 0x320D CMD_SETTING_V_CIR_CF_VALUE put(new MsgSettingProfileRatiosAll()); // 0x320D CMD_SETTING_V_CIR_CF_VALUE
put(new MsgSetSingleBasalProfile()); // 0x3302 CMD_SETTING_BASAL_INS_S put(new MsgSetSingleBasalProfile()); // 0x3302 CMD_SETTING_BASAL_INS_S
put(new MsgSetBasalProfile()); // 0x3306 CMD_SETTING_BASAL_PROFILE_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 MsgSetActivateBasalProfile()); // 0x330C CMD_SETTING_PROFILE_NUMBER_S
put(new MsgHistoryAllDone()); // 0x41F1 CMD_HISTORY_ALL_DONE put(new MsgHistoryAllDone()); // 0x41F1 CMD_HISTORY_ALL_DONE
put(new MsgHistoryAll()); // 0x41F2 CMD_HISTORY_ALL put(new MsgHistoryAll()); // 0x41F2 CMD_HISTORY_ALL

View file

@ -18,6 +18,8 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingUserOptions;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetUserOptions;
import info.nightscout.androidaps.plugins.Treatments.Treatment; import info.nightscout.androidaps.plugins.Treatments.Treatment;
import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventInitializationChanged;
@ -68,7 +70,6 @@ import info.nightscout.utils.DateUtil;
import info.nightscout.utils.NSUpload; import info.nightscout.utils.NSUpload;
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
import info.nightscout.utils.T; import info.nightscout.utils.T;
import info.nightscout.utils.ToastUtils;
public class DanaRv2ExecutionService extends AbstractDanaRExecutionService { public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
@ -199,6 +200,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
mSerialIOThread.sendMessage(new MsgSettingGlucose()); mSerialIOThread.sendMessage(new MsgSettingGlucose());
mSerialIOThread.sendMessage(new MsgSettingActiveProfile()); mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
mSerialIOThread.sendMessage(new MsgSettingProfileRatios()); mSerialIOThread.sendMessage(new MsgSettingProfileRatios());
mSerialIOThread.sendMessage(new MsgSettingUserOptions());
mSerialIOThread.sendMessage(new MsgSettingProfileRatiosAll()); mSerialIOThread.sendMessage(new MsgSettingProfileRatiosAll());
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime))); MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime)));
mSerialIOThread.sendMessage(new MsgSettingPumpTime()); mSerialIOThread.sendMessage(new MsgSettingPumpTime());
@ -471,4 +473,15 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
SystemClock.sleep(Math.min(timeToWholeMinute, 100)); SystemClock.sleep(Math.min(timeToWholeMinute, 100));
} }
} }
public PumpEnactResult setUserOptions() {
if (!isConnected())
return new PumpEnactResult().success(false);
SystemClock.sleep(300);
MsgSetUserOptions msg = new MsgSetUserOptions();
mSerialIOThread.sendMessage(msg);
SystemClock.sleep(200);
return new PumpEnactResult().success(!msg.failed);
}
} }

View file

@ -37,6 +37,7 @@ import info.nightscout.androidaps.queue.commands.CommandLoadTDDs;
import info.nightscout.androidaps.queue.commands.CommandReadStatus; import info.nightscout.androidaps.queue.commands.CommandReadStatus;
import info.nightscout.androidaps.queue.commands.CommandSMBBolus; import info.nightscout.androidaps.queue.commands.CommandSMBBolus;
import info.nightscout.androidaps.queue.commands.CommandSetProfile; import info.nightscout.androidaps.queue.commands.CommandSetProfile;
import info.nightscout.androidaps.queue.commands.CommandSetUserSettings;
import info.nightscout.androidaps.queue.commands.CommandTempBasalAbsolute; import info.nightscout.androidaps.queue.commands.CommandTempBasalAbsolute;
import info.nightscout.androidaps.queue.commands.CommandTempBasalPercent; import info.nightscout.androidaps.queue.commands.CommandTempBasalPercent;
@ -403,6 +404,25 @@ public class CommandQueue {
return true; return true;
} }
// returns true if command is queued
public boolean setUserOptions(Callback callback) {
if (isRunning(Command.CommandType.SETUSERSETTINGS)) {
if (callback != null)
callback.result(executingNowError()).run();
return false;
}
// remove all unfinished
removeAll(Command.CommandType.SETUSERSETTINGS);
// add new command to queue
add(new CommandSetUserSettings(callback));
notifyAboutNewCommand();
return true;
}
// returns true if command is queued // returns true if command is queued
public boolean loadTDDs(Callback callback) { public boolean loadTDDs(Callback callback) {
if (isRunning(Command.CommandType.LOADHISTORY)) { if (isRunning(Command.CommandType.LOADHISTORY)) {

View file

@ -18,7 +18,8 @@ public abstract class Command {
BASALPROFILE, BASALPROFILE,
READSTATUS, READSTATUS,
LOADHISTORY, // TDDs and so far only Dana specific LOADHISTORY, // TDDs and so far only Dana specific
LOADEVENTS // so far only Dana specific LOADEVENTS, // so far only Dana specific
SETUSERSETTINGS // so far only Dana specific
} }
public CommandType commandType; public CommandType commandType;

View file

@ -0,0 +1,45 @@
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;
import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.PumpDanaRv2.DanaRv2Plugin;
import info.nightscout.androidaps.queue.Callback;
/**
* Created by mike on 10.11.2017.
*/
public class CommandSetUserSettings extends Command {
private static Logger log = LoggerFactory.getLogger(CommandSetUserSettings.class);
public CommandSetUserSettings(Callback callback) {
commandType = CommandType.SETUSERSETTINGS;
this.callback = callback;
}
@Override
public void execute() {
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
if (pump instanceof DanaRInterface) {
DanaRInterface danaPump = (DanaRInterface) pump;
boolean isDanaRv2 = MainApp.getSpecificPlugin(DanaRv2Plugin.class) != null && MainApp.getSpecificPlugin(DanaRv2Plugin.class).isEnabled(PluginType.PUMP);
if(isDanaRv2){
log.debug("MsgSetUserOptions detected for DanaRv2");
}
PumpEnactResult r = danaPump.setUserOptions();
if (callback != null)
callback.result(r).run();
}
}
@Override
public String status() {
return "SETUSERSETTINGS";
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 963 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 974 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 881 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 974 B

View file

@ -702,7 +702,7 @@
android:id="@+id/danar_viewprofile" android:id="@+id/danar_viewprofile"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:drawableTop="@drawable/icon_danarprofile" android:drawableTop="@drawable/icon_danarprofile"
android:paddingLeft="0dp" android:paddingLeft="0dp"
@ -714,7 +714,7 @@
android:id="@+id/danar_history" android:id="@+id/danar_history"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:drawableTop="@drawable/icon_danarhistory" android:drawableTop="@drawable/icon_danarhistory"
android:paddingLeft="0dp" android:paddingLeft="0dp"
@ -725,13 +725,24 @@
android:id="@+id/danar_stats" android:id="@+id/danar_stats"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:drawableTop="@drawable/icon_danarstats" android:drawableTop="@drawable/icon_danarstats"
android:paddingLeft="0dp" android:paddingLeft="0dp"
android:paddingRight="0dp" android:paddingRight="0dp"
android:text="@string/danar_stats" /> android:text="@string/danar_stats" />
<Button
android:id="@+id/danar_user_options"
style="@style/ButtonSmallFontStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawableTop="@drawable/icon_danar_useropt"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/danar_useroptions" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -0,0 +1,406 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
tools:context="info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRUserOptionsActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="@+id/danar_user_options_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/danar_buttons"
android:fillViewport="true">
<LinearLayout
android:id="@+id/danar_user_options_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:text="@string/danar_pump_settings"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<LinearLayout
android:id="@+id/overview_pumpstatuslayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingTop="2dp"
android:visibility="gone">
<TextView
android:id="@+id/overview_pumpstatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:gravity="center_vertical|center_horizontal"
android:text="@string/initializing"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginEnd="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="5dp"
android:layout_marginStart="20dp"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<Switch
android:id="@+id/danar_timeformat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:showText="true"
android:text="@string/danar_timedisplay"
android:textOff="12h"
android:textOn="24h" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginEnd="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="5dp"
android:layout_marginStart="20dp"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<Switch
android:id="@+id/danar_buttonscroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/danar_buttonscroll"
android:textOff="@string/option_off"
android:textOn="@string/option_on" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginEnd="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="5dp"
android:layout_marginStart="20dp"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<Switch
android:id="@+id/danar_beep"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/danar_beep"
android:textOff="@string/option_off"
android:textOn="@string/option_on" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginEnd="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="5dp"
android:layout_marginStart="20dp"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:paddingRight="5dp"
android:text="@string/danar_pumpalarm"
android:textSize="14sp" />
<RadioGroup
android:id="@+id/danar_pumpalarm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checkedButton="@+id/danar_pumpalarm_sound">
<RadioButton
android:id="@+id/danar_pumpalarm_sound"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/danar_pumpalarm_sound" />
<RadioButton
android:id="@+id/danar_pumpalarm_vibrate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/danar_pumpalarm_vibrate" />
<RadioButton
android:id="@+id/danar_pumpalarm_both"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/danar_pumpalarm_both" />
</RadioGroup>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginEnd="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="5dp"
android:layout_marginStart="20dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="top"
android:paddingRight="5dp"
android:text="@string/danar_screentimeout"
android:textSize="14sp" />
<info.nightscout.utils.NumberPicker
android:id="@+id/danar_screentimeout"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="end"
android:paddingLeft="5dp"
android:paddingRight="5dp" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginEnd="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="5dp"
android:layout_marginStart="20dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="top"
android:paddingRight="5dp"
android:text="@string/danar_backlight"
android:textSize="14sp" />
<info.nightscout.utils.NumberPicker
android:id="@+id/danar_backlight"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="end"
android:paddingLeft="5dp"
android:paddingRight="5dp" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginEnd="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="5dp"
android:layout_marginStart="20dp"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<Switch
android:id="@+id/danar_units"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:showText="true"
android:splitTrack="false"
android:text="@string/danar_glucoseunits"
android:textOff="@string/mgdl"
android:textOn="@string/mmol" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginEnd="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="5dp"
android:layout_marginStart="20dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:paddingRight="5dp"
android:text="@string/danar_shutdown"
android:textSize="14sp" />
<info.nightscout.utils.NumberPicker
android:id="@+id/danar_shutdown"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="end"
android:paddingLeft="5dp"
android:paddingRight="5dp" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginEnd="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="5dp"
android:layout_marginStart="20dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:paddingRight="5dp"
android:text="@string/danar_lowreservoir"
android:textSize="14sp" />
<info.nightscout.utils.NumberPicker
android:id="@+id/danar_lowreservoir"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="end"
android:paddingLeft="5dp"
android:paddingRight="5dp" />
</LinearLayout>
<Button
android:id="@+id/save_user_options"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/danar_saveuseroptions" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
</FrameLayout>

View file

@ -1137,6 +1137,22 @@
<string name="request">Request</string> <string name="request">Request</string>
<string name="insulinsourcesetup">Configure Insulin plugin</string> <string name="insulinsourcesetup">Configure Insulin plugin</string>
<string name="exit">Exit</string> <string name="exit">Exit</string>
<string name="danar_useroptions">User options</string>
<string name="danar_timedisplay">Display time format</string>
<string name="danar_buttonscroll">Button scroll</string>
<string name="danar_beep">Beep on button press</string>
<string name="danar_pumpalarm">Alarm</string>
<string name="danar_pumpalarm_sound">Sound</string>
<string name="danar_pumpalarm_vibrate">Vibrate</string>
<string name="danar_pumpalarm_both">Both</string>
<string name="danar_screentimeout">LCD on time(seconds)</string>
<string name="danar_backlight">Backlight on time(seconds)</string>
<string name="danar_glucoseunits">Glucose units</string>
<string name="danar_shutdown">Shutdown(hours)</string>
<string name="danar_lowreservoir">Low reservoir (Units)</string>
<string name="danar_saveuseroptions">Save options to pump</string>
<string name="option_on">On</string>
<string name="option_off">Off</string>
<string name="open_navigation">Open navigation</string> <string name="open_navigation">Open navigation</string>
<string name="close_navigation">Close navigation</string> <string name="close_navigation">Close navigation</string>
<string name="nav_plugin_preferences">Plugin preferences</string> <string name="nav_plugin_preferences">Plugin preferences</string>