Merge branch 'dev' into dev
2302
AndroidAPS Icon.ai
Normal file
BIN
AndroidAPS Icon.png
Normal file
After Width: | Height: | Size: 21 KiB |
|
@ -99,7 +99,8 @@ android {
|
|||
resValue "string", "app_name", "AndroidAPS"
|
||||
versionName version
|
||||
manifestPlaceholders = [
|
||||
appIcon: "@mipmap/blueowl"
|
||||
appIcon: "@mipmap/ic_launcher",
|
||||
appIconRound: "@mipmap/ic_launcher_round"
|
||||
]
|
||||
buildConfigField "boolean", "APS", "true"
|
||||
buildConfigField "boolean", "PUMPDRIVERS", "true"
|
||||
|
@ -112,7 +113,8 @@ android {
|
|||
resValue "string", "app_name", "AndroidAPS"
|
||||
versionName version
|
||||
manifestPlaceholders = [
|
||||
appIcon: "@mipmap/blueowl"
|
||||
appIcon: "@mipmap/blueowl",
|
||||
appIconRound: "@null"
|
||||
]
|
||||
buildConfigField "boolean", "APS", "false"
|
||||
buildConfigField "boolean", "PUMPDRIVERS", "true"
|
||||
|
@ -125,7 +127,8 @@ android {
|
|||
resValue "string", "app_name", "NSClient"
|
||||
versionName version + "-nsclient"
|
||||
manifestPlaceholders = [
|
||||
appIcon: "@mipmap/yellowowl"
|
||||
appIcon: "@mipmap/yellowowl",
|
||||
appIconRound: "@null"
|
||||
]
|
||||
buildConfigField "boolean", "APS", "false"
|
||||
buildConfigField "boolean", "PUMPDRIVERS", "false"
|
||||
|
@ -138,7 +141,8 @@ android {
|
|||
resValue "string", "app_name", "NSClient"
|
||||
versionName version + "-nsclient"
|
||||
manifestPlaceholders = [
|
||||
appIcon: "@mipmap/yellowowl"
|
||||
appIcon: "@mipmap/yellowowl",
|
||||
appIconRound: "@null"
|
||||
]
|
||||
buildConfigField "boolean", "APS", "false"
|
||||
buildConfigField "boolean", "PUMPDRIVERS", "false"
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
android:name=".MainApp"
|
||||
android:allowBackup="true"
|
||||
android:icon="${appIcon}"
|
||||
android:roundIcon="${appIconRound}"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
|
@ -48,6 +49,7 @@
|
|||
android:theme="@style/Theme.AppCompat.Translucent" />
|
||||
<activity android:name=".AgreementActivity" />
|
||||
<activity android:name=".plugins.PumpDanaR.activities.DanaRHistoryActivity" />
|
||||
<activity android:name=".plugins.PumpDanaR.activities.DanaRUserOptionsActivity" />
|
||||
<activity android:name=".TDDStatsActivity" />
|
||||
<activity android:name=".plugins.Overview.activities.QuickWizardListActivity">
|
||||
<intent-filter>
|
||||
|
@ -82,6 +84,8 @@
|
|||
<action android:name="it.ct.glicemia.ACTION_GLUCOSE_MEASURED" />
|
||||
<!-- Receiver from DexcomG5 -->
|
||||
<action android:name="com.dexcom.cgm.DATA" />
|
||||
<!-- Receiver from Poctech -->
|
||||
<action android:name="com.china.poctech.data" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<!-- Receiver keepalive, scheduled every 30 min -->
|
||||
|
|
|
@ -70,6 +70,7 @@ import info.nightscout.androidaps.plugins.Source.SourceDexcomG5Plugin;
|
|||
import info.nightscout.androidaps.plugins.Source.SourceGlimpPlugin;
|
||||
import info.nightscout.androidaps.plugins.Source.SourceMM640gPlugin;
|
||||
import info.nightscout.androidaps.plugins.Source.SourceNSClientPlugin;
|
||||
import info.nightscout.androidaps.plugins.Source.SourcePoctechPlugin;
|
||||
import info.nightscout.androidaps.plugins.Source.SourceXdripPlugin;
|
||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||
import info.nightscout.androidaps.plugins.Wear.WearPlugin;
|
||||
|
@ -179,6 +180,8 @@ public class MainApp extends Application {
|
|||
pluginsList.add(SourceGlimpPlugin.getPlugin());
|
||||
if (!Config.NSCLIENT)
|
||||
pluginsList.add(SourceDexcomG5Plugin.getPlugin());
|
||||
if (!Config.NSCLIENT)
|
||||
pluginsList.add(SourcePoctechPlugin.getPlugin());
|
||||
if (Config.SMSCOMMUNICATORENABLED) pluginsList.add(SmsCommunicatorPlugin.getPlugin());
|
||||
pluginsList.add(FoodPlugin.getPlugin());
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.ProfileStore;
|
||||
|
@ -38,6 +39,7 @@ import info.nightscout.androidaps.plugins.Source.SourceDexcomG5Plugin;
|
|||
import info.nightscout.androidaps.plugins.Source.SourceGlimpPlugin;
|
||||
import info.nightscout.androidaps.plugins.Source.SourceMM640gPlugin;
|
||||
import info.nightscout.androidaps.plugins.Source.SourceNSClientPlugin;
|
||||
import info.nightscout.androidaps.plugins.Source.SourcePoctechPlugin;
|
||||
import info.nightscout.androidaps.plugins.Source.SourceXdripPlugin;
|
||||
import info.nightscout.androidaps.receivers.DataReceiver;
|
||||
import info.nightscout.utils.BundleLogger;
|
||||
|
@ -54,6 +56,7 @@ public class DataService extends IntentService {
|
|||
boolean mm640gEnabled = false;
|
||||
boolean glimpEnabled = false;
|
||||
boolean dexcomG5Enabled = false;
|
||||
boolean poctechEnabled = false;
|
||||
|
||||
public DataService() {
|
||||
super("DataService");
|
||||
|
@ -70,36 +73,49 @@ public class DataService extends IntentService {
|
|||
mm640gEnabled = false;
|
||||
glimpEnabled = false;
|
||||
dexcomG5Enabled = false;
|
||||
poctechEnabled = false;
|
||||
} else if (ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().equals(SourceXdripPlugin.class)) {
|
||||
xDripEnabled = true;
|
||||
nsClientEnabled = false;
|
||||
mm640gEnabled = false;
|
||||
glimpEnabled = false;
|
||||
dexcomG5Enabled = false;
|
||||
poctechEnabled = false;
|
||||
} else if (ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().equals(SourceNSClientPlugin.class)) {
|
||||
xDripEnabled = false;
|
||||
nsClientEnabled = true;
|
||||
mm640gEnabled = false;
|
||||
glimpEnabled = false;
|
||||
dexcomG5Enabled = false;
|
||||
poctechEnabled = false;
|
||||
} else if (ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().equals(SourceMM640gPlugin.class)) {
|
||||
xDripEnabled = false;
|
||||
nsClientEnabled = false;
|
||||
mm640gEnabled = true;
|
||||
glimpEnabled = false;
|
||||
dexcomG5Enabled = false;
|
||||
poctechEnabled = false;
|
||||
} else if (ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().equals(SourceGlimpPlugin.class)) {
|
||||
xDripEnabled = false;
|
||||
nsClientEnabled = false;
|
||||
mm640gEnabled = false;
|
||||
glimpEnabled = true;
|
||||
dexcomG5Enabled = false;
|
||||
poctechEnabled = false;
|
||||
} else if (ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().equals(SourceDexcomG5Plugin.class)) {
|
||||
xDripEnabled = false;
|
||||
nsClientEnabled = false;
|
||||
mm640gEnabled = false;
|
||||
glimpEnabled = false;
|
||||
dexcomG5Enabled = true;
|
||||
poctechEnabled = false;
|
||||
} else if (ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().equals(SourcePoctechPlugin.class)) {
|
||||
xDripEnabled = false;
|
||||
nsClientEnabled = false;
|
||||
mm640gEnabled = false;
|
||||
glimpEnabled = false;
|
||||
dexcomG5Enabled = false;
|
||||
poctechEnabled = true;
|
||||
}
|
||||
|
||||
boolean isNSProfile = MainApp.getConfigBuilder().getActiveProfileInterface() != null && MainApp.getConfigBuilder().getActiveProfileInterface().getClass().equals(NSProfilePlugin.class);
|
||||
|
@ -129,6 +145,10 @@ public class DataService extends IntentService {
|
|||
if (dexcomG5Enabled) {
|
||||
handleNewDataFromDexcomG5(intent);
|
||||
}
|
||||
} else if (Intents.POCTECH_BG.equals(action)) {
|
||||
if (poctechEnabled) {
|
||||
handleNewDataFromPoctech(intent);
|
||||
}
|
||||
} else if (Intents.ACTION_NEW_SGV.equals(action)) {
|
||||
if (nsClientEnabled || SP.getBoolean(R.string.key_ns_autobackfill, true))
|
||||
handleNewDataFromNSClient(intent);
|
||||
|
@ -250,6 +270,41 @@ public class DataService extends IntentService {
|
|||
}
|
||||
}
|
||||
|
||||
private void handleNewDataFromPoctech(Intent intent) {
|
||||
|
||||
Bundle bundle = intent.getExtras();
|
||||
if (bundle == null) return;
|
||||
|
||||
BgReading bgReading = new BgReading();
|
||||
|
||||
String data = bundle.getString("data");
|
||||
log.debug("Received Poctech Data", data);
|
||||
|
||||
try {
|
||||
JSONArray jsonArray = new JSONArray(data);
|
||||
log.debug("Received Poctech Data size:" + jsonArray.length());
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject json = jsonArray.getJSONObject(i);
|
||||
bgReading.value = json.getDouble("current");
|
||||
bgReading.direction = json.getString("direction");
|
||||
bgReading.date = json.getLong("date");
|
||||
bgReading.raw = json.getDouble("raw");
|
||||
if (JsonHelper.safeGetString(json, "utils", Constants.MGDL).equals("mmol/L"))
|
||||
bgReading.value = bgReading.value * Constants.MMOLL_TO_MGDL;
|
||||
boolean isNew = MainApp.getDbHelper().createIfNotExists(bgReading, "Poctech");
|
||||
if (isNew && SP.getBoolean(R.string.key_dexcomg5_nsupload, false)) {
|
||||
NSUpload.uploadBg(bgReading);
|
||||
}
|
||||
if (isNew && SP.getBoolean(R.string.key_dexcomg5_xdripupload, false)) {
|
||||
NSUpload.sendToXdrip(bgReading);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleNewDataFromMM640g(Intent intent) {
|
||||
Bundle bundle = intent.getExtras();
|
||||
if (bundle == null) return;
|
||||
|
|
|
@ -49,4 +49,6 @@ public interface Intents {
|
|||
String GLIMP_BG = "it.ct.glicemia.ACTION_GLUCOSE_MEASURED";
|
||||
|
||||
String DEXCOMG5_BG = "com.dexcom.cgm.DATA";
|
||||
|
||||
String POCTECH_BG = "com.china.poctech.data";
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public class CareportalEvent implements DataPointWithLabelInterface {
|
|||
}
|
||||
|
||||
public long getHoursFromStart() {
|
||||
return (System.currentTimeMillis() - date) / (60 * 1000);
|
||||
return (System.currentTimeMillis() - date) / (60 * 60 * 1000);
|
||||
}
|
||||
|
||||
public String age() {
|
||||
|
@ -98,13 +98,7 @@ public class CareportalEvent implements DataPointWithLabelInterface {
|
|||
return diff.get(TimeUnit.DAYS) + " " + MainApp.gs(R.string.days) + " " + diff.get(TimeUnit.HOURS) + " " + MainApp.gs(R.string.hours);
|
||||
}
|
||||
|
||||
public boolean isOlderThan(double hours) {
|
||||
Map<TimeUnit, Long> diff = computeDiff(date, System.currentTimeMillis());
|
||||
if(diff.get(TimeUnit.DAYS)*24 + diff.get(TimeUnit.HOURS) > hours)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
public boolean isOlderThan(double hours) { return getHoursFromStart() > hours; }
|
||||
|
||||
public String log() {
|
||||
return "CareportalEvent{" +
|
||||
|
|
|
@ -103,12 +103,15 @@ public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
|
|||
if(LocalProfilePlugin.LOCAL_PROFILE.equals(name)){
|
||||
name = DecimalFormatter.to2Decimal(getProfileObject().percentageBasalSum()) + "U ";
|
||||
}
|
||||
//Test if name is already containing percentage or timeshift
|
||||
if (!name.endsWith("h)") || !name.endsWith("%)")) {
|
||||
if (isCPP) {
|
||||
name += "(" + percentage + "%";
|
||||
if (timeshift != 0)
|
||||
name += "," + timeshift + "h";
|
||||
name += ")";
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,4 +9,5 @@ import info.nightscout.androidaps.data.PumpEnactResult;
|
|||
public interface DanaRInterface {
|
||||
PumpEnactResult loadHistory(byte type); // for history browser
|
||||
PumpEnactResult loadEvents(); // events history to build treatments from
|
||||
PumpEnactResult setUserOptions(); // like AnyDana does
|
||||
}
|
||||
|
|
|
@ -590,6 +590,10 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
String units = MainApp.getConfigBuilder().getProfileUnits();
|
||||
|
||||
FragmentManager manager = getFragmentManager();
|
||||
// try to fix https://fabric.io/nightscout3/android/apps/info.nightscout.androidaps/issues/5aca7a1536c7b23527eb4be7?time=last-seven-days
|
||||
// https://stackoverflow.com/questions/14860239/checking-if-state-is-saved-before-committing-a-fragmenttransaction
|
||||
if (manager.isStateSaved())
|
||||
return;
|
||||
switch (v.getId()) {
|
||||
case R.id.overview_accepttempbutton:
|
||||
onClickAcceptTemp();
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.text.Spanned;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
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.EventPumpStatusChanged;
|
||||
import info.nightscout.androidaps.events.EventTempBasalChange;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.Dialogs.ProfileViewDialog;
|
||||
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.PumpDanaRKorean.DanaRKoreanPlugin;
|
||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||
import info.nightscout.androidaps.queue.events.EventQueueChanged;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
|
@ -88,6 +92,8 @@ public class DanaRFragment extends SubscriberFragment {
|
|||
LinearLayout pumpStatusLayout;
|
||||
@BindView(R.id.overview_pumpstatus)
|
||||
TextView pumpStatusView;
|
||||
@BindView(R.id.danar_user_options)
|
||||
Button danar_user_options;
|
||||
|
||||
public DanaRFragment() {
|
||||
}
|
||||
|
@ -138,6 +144,9 @@ public class DanaRFragment extends SubscriberFragment {
|
|||
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)
|
||||
void onBtConnectionClick() {
|
||||
log.debug("Clicked connect to pump");
|
||||
|
@ -268,6 +277,11 @@ public class DanaRFragment extends SubscriberFragment {
|
|||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -379,4 +379,9 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
public PumpEnactResult loadEvents() {
|
||||
return null; // no history, not needed
|
||||
}
|
||||
|
||||
@Override
|
||||
public PumpEnactResult setUserOptions() {
|
||||
return sExecutionService.setUserOptions();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ public class DanaRPump {
|
|||
public int lowReservoirRate;
|
||||
public int cannulaVolume;
|
||||
public int refillAmount;
|
||||
|
||||
public byte[] userOptionsFrompump;
|
||||
public double initialBolusAmount;
|
||||
// Bolus settings
|
||||
public int bolusCalculationOption;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
|
@ -60,6 +60,7 @@ public class MessageHashTable {
|
|||
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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -3,18 +3,66 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
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 {
|
||||
private static Logger log = LoggerFactory.getLogger(MsgSettingShippingInfo.class);
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(MsgSettingUserOptions.class);
|
||||
|
||||
public MsgSettingUserOptions() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,6 +92,7 @@ public abstract class AbstractDanaRExecutionService extends Service {
|
|||
|
||||
public abstract boolean extendedBolusStop();
|
||||
|
||||
public abstract PumpEnactResult setUserOptions();
|
||||
|
||||
protected BroadcastReceiver receiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
|
|
|
@ -18,6 +18,8 @@ import info.nightscout.androidaps.MainApp;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
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.events.EventAppExit;
|
||||
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.utils.NSUpload;
|
||||
import info.nightscout.utils.SP;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
||||
|
||||
|
@ -177,6 +178,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
|||
mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
|
||||
mSerialIOThread.sendMessage(new MsgSettingProfileRatios());
|
||||
mSerialIOThread.sendMessage(new MsgSettingProfileRatiosAll());
|
||||
mSerialIOThread.sendMessage(new MsgSettingUserOptions());
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime)));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime());
|
||||
long timeDiff = (mDanaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
|
||||
|
@ -397,4 +399,13 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -380,4 +380,9 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin {
|
|||
public PumpEnactResult loadEvents() {
|
||||
return null; // no history, not needed
|
||||
}
|
||||
|
||||
@Override
|
||||
public PumpEnactResult setUserOptions() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -327,4 +327,9 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PumpEnactResult setUserOptions() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,8 +26,6 @@ import info.nightscout.androidaps.data.ProfileStore;
|
|||
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||
import info.nightscout.androidaps.db.ExtendedBolus;
|
||||
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.interfaces.Constraint;
|
||||
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.DanaRPump;
|
||||
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.services.DanaRSService;
|
||||
import info.nightscout.androidaps.plugins.Treatments.Treatment;
|
||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
|
@ -224,6 +224,11 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
|
|||
return danaRSService.loadEvents();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PumpEnactResult setUserOptions() {
|
||||
return danaRSService.setUserSettings();
|
||||
}
|
||||
|
||||
// Constraints interface
|
||||
|
||||
@Override
|
||||
|
@ -759,4 +764,5 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
|
|||
public PumpEnactResult loadTDDs() {
|
||||
return loadHistory(RecordTypes.RECORD_TYPE_DAILY);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,14 @@ public class DanaRS_Packet_Option_Set_User_Option extends DanaRS_Packet {
|
|||
@Override
|
||||
public byte[] getRequestParams() {
|
||||
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];
|
||||
request[0] = (byte) (pump.timeDisplayType & 0xff);
|
||||
request[1] = (byte) (pump.buttonScrollOnOff & 0xff);
|
||||
|
|
|
@ -19,6 +19,7 @@ import info.nightscout.androidaps.MainApp;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
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.events.EventAppExit;
|
||||
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_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_User_Option;
|
||||
import info.nightscout.androidaps.queue.Callback;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.NSUpload;
|
||||
|
@ -146,6 +148,7 @@ public class DanaRSService extends Service {
|
|||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_CIR_CF_Array());
|
||||
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_User_Option()); // Getting user options
|
||||
long timeDiff = (danaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
|
||||
log.debug("Pump time difference: " + timeDiff + " seconds");
|
||||
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) {
|
||||
if (!isConnected()) return false;
|
||||
if (BolusProgressDialog.stopPressed) return false;
|
||||
|
|
|
@ -389,4 +389,8 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
|
|||
return sExecutionService.loadEvents();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PumpEnactResult setUserOptions() {
|
||||
return sExecutionService.setUserOptions();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ public class MessageHashTable_v2 {
|
|||
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
|
||||
|
|
|
@ -18,6 +18,8 @@ import info.nightscout.androidaps.MainApp;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
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.events.EventAppExit;
|
||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||
|
@ -68,7 +70,6 @@ import info.nightscout.utils.DateUtil;
|
|||
import info.nightscout.utils.NSUpload;
|
||||
import info.nightscout.utils.SP;
|
||||
import info.nightscout.utils.T;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
||||
|
||||
|
@ -199,6 +200,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
mSerialIOThread.sendMessage(new MsgSettingGlucose());
|
||||
mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
|
||||
mSerialIOThread.sendMessage(new MsgSettingProfileRatios());
|
||||
mSerialIOThread.sendMessage(new MsgSettingUserOptions());
|
||||
mSerialIOThread.sendMessage(new MsgSettingProfileRatiosAll());
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime)));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime());
|
||||
|
@ -471,4 +473,15 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package info.nightscout.androidaps.plugins.Source;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interfaces.BgSourceInterface;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
|
||||
/**
|
||||
* Created by mike on 05.08.2016.
|
||||
*/
|
||||
public class SourcePoctechPlugin extends PluginBase implements BgSourceInterface {
|
||||
|
||||
private static SourcePoctechPlugin plugin = null;
|
||||
|
||||
public static SourcePoctechPlugin getPlugin() {
|
||||
if (plugin == null)
|
||||
plugin = new SourcePoctechPlugin();
|
||||
return plugin;
|
||||
}
|
||||
|
||||
private SourcePoctechPlugin() {
|
||||
super(new PluginDescription()
|
||||
.mainType(PluginType.BGSOURCE)
|
||||
.fragmentClass(BGSourceFragment.class.getName())
|
||||
.pluginName(R.string.poctech)
|
||||
.showInList(!Config.NSCLIENT)
|
||||
.preferencesId(R.xml.pref_poctech)
|
||||
.description(R.string.description_source_poctech)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean advancedFilteringSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -37,6 +37,7 @@ import info.nightscout.androidaps.queue.commands.CommandLoadTDDs;
|
|||
import info.nightscout.androidaps.queue.commands.CommandReadStatus;
|
||||
import info.nightscout.androidaps.queue.commands.CommandSMBBolus;
|
||||
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.CommandTempBasalPercent;
|
||||
|
||||
|
@ -403,6 +404,25 @@ public class CommandQueue {
|
|||
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
|
||||
public boolean loadTDDs(Callback callback) {
|
||||
if (isRunning(Command.CommandType.LOADHISTORY)) {
|
||||
|
|
|
@ -18,7 +18,8 @@ public abstract class Command {
|
|||
BASALPROFILE,
|
||||
READSTATUS,
|
||||
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;
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
}
|
BIN
app/src/main/res/drawable-hdpi/icon_danar_useropthdpi.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_local_activatehdpi.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_local_resethdpi.png
Normal file
After Width: | Height: | Size: 963 B |
BIN
app/src/main/res/drawable-hdpi/icon_local_savehdpi.png
Normal file
After Width: | Height: | Size: 912 B |
BIN
app/src/main/res/drawable-mdpi/icon_danar_useroptmdpi.png
Normal file
After Width: | Height: | Size: 974 B |
BIN
app/src/main/res/drawable-mdpi/icon_local_activatemdpi.png
Normal file
After Width: | Height: | Size: 881 B |
BIN
app/src/main/res/drawable-mdpi/icon_local_resetmdpi.png
Normal file
After Width: | Height: | Size: 692 B |
BIN
app/src/main/res/drawable-mdpi/icon_local_savemdpi.png
Normal file
After Width: | Height: | Size: 619 B |
BIN
app/src/main/res/drawable-xhdpi/icon_danar_useroptxhdpi.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/drawable-xhdpi/icon_local_activatexhdpi.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/drawable-xhdpi/icon_local_resetxhdpi.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable-xhdpi/icon_local_savexhdpi.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable-xxhdpi/icon_danar_useroptxxhdpi.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable-xxhdpi/icon_local_activatexxhdpi.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
app/src/main/res/drawable-xxhdpi/icon_local_resetxxhdpi.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
app/src/main/res/drawable-xxhdpi/icon_local_savexxhdpi.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/icon_danar_useroptxxxhdpi.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/icon_local_activatexxxhdpi.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/icon_local_resetxxxhdpi.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/icon_local_savexxxhdpi.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
app/src/main/res/drawable/icon_danar_useropt.png
Normal file
After Width: | Height: | Size: 974 B |
|
@ -702,7 +702,7 @@
|
|||
android:id="@+id/danar_viewprofile"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:drawableTop="@drawable/icon_danarprofile"
|
||||
android:paddingLeft="0dp"
|
||||
|
@ -714,7 +714,7 @@
|
|||
android:id="@+id/danar_history"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:drawableTop="@drawable/icon_danarhistory"
|
||||
android:paddingLeft="0dp"
|
||||
|
@ -725,13 +725,24 @@
|
|||
android:id="@+id/danar_stats"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:drawableTop="@drawable/icon_danarstats"
|
||||
android:paddingLeft="0dp"
|
||||
android:paddingRight="0dp"
|
||||
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>
|
||||
|
|
406
app/src/main/res/layout/danar_user_options.xml
Normal 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>
|
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
Normal file
After Width: | Height: | Size: 8.5 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 8.3 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 12 KiB |
|
@ -75,4 +75,5 @@
|
|||
<color name="deviationred">#72FF0000</color>
|
||||
<color name="deviationblack">#72000000</color>
|
||||
|
||||
<color name="ic_launcher_background">#424242</color>
|
||||
</resources>
|
||||
|
|
|
@ -803,6 +803,7 @@
|
|||
<string name="dexcomg5_nsupload_title">Upload BG data to NS</string>
|
||||
<string name="key_dexcomg5_nsupload" translatable="false">dexcomg5_nsupload</string>
|
||||
<string name="dexcomg5_upload">G5 upload settings</string>
|
||||
<string name="poctech_upload">Poctech upload settings</string>
|
||||
<string name="wear_detailed_delta_title">Show detailed delta</string>
|
||||
<string name="wear_detailed_delta_summary">Show delta with one more decimal place</string>
|
||||
<string name="smbmaxminutes" translatable="false">45 60 75 90 105 120</string>
|
||||
|
@ -1136,6 +1137,22 @@
|
|||
<string name="request">Request</string>
|
||||
<string name="insulinsourcesetup">Configure Insulin plugin</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="close_navigation">Close navigation</string>
|
||||
<string name="nav_plugin_preferences">Plugin preferences</string>
|
||||
|
@ -1143,17 +1160,17 @@
|
|||
<string name="not_completed_yet">Not completed yet</string>
|
||||
<string name="time_elapsed">Time elapsed</string>
|
||||
<string name="nth_objective">%1$d. Objective</string>
|
||||
<string name="poctech">Poctech</string>
|
||||
<string name="description_source_poctech">Receive BG values from Poctech app</string>
|
||||
|
||||
<plurals name="objective_days">
|
||||
<item quantity="one">%d day</item>
|
||||
<item quantity="other">%d days</item>
|
||||
</plurals>
|
||||
|
||||
<plurals name="objective_hours">
|
||||
<item quantity="one">%d hour</item>
|
||||
<item quantity="other">%d hours</item>
|
||||
</plurals>
|
||||
|
||||
<plurals name="objective_minutes">
|
||||
<item quantity="one">%d minute</item>
|
||||
<item quantity="other">%d minutes</item>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceCategory
|
||||
android:key="danar"
|
||||
android:title="@string/dexcomg5_upload">
|
||||
|
||||
<SwitchPreference
|
||||
|
|
19
app/src/main/res/xml/pref_poctech.xml
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceCategory
|
||||
android:title="@string/poctech_upload">
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/key_dexcomg5_nsupload"
|
||||
android:title="@string/dexcomg5_nsupload_title" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/key_dexcomg5_xdripupload"
|
||||
android:summary="@string/dexcomg5_xdripupload_summary"
|
||||
android:title="@string/dexcomg5_xdripupload_title" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
|
@ -7,7 +7,7 @@ buildscript {
|
|||
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.1.2'
|
||||
classpath 'com.android.tools.build:gradle:3.1.3'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
|