Merge remote-tracking branch 'milosremote/dev' into wear-bolus5

This commit is contained in:
AdrianLxM 2017-02-15 16:28:15 +01:00
commit d74ea13937
41 changed files with 784 additions and 297 deletions

View file

@ -44,7 +44,7 @@ android {
minSdkVersion 21
targetSdkVersion 23
versionCode 1100
versionName "1.1e"
versionName "1.1g"
buildConfigField "String", "BUILDVERSION", generateGitBuild()
}
lintOptions {

View file

@ -49,4 +49,7 @@ public class Constants {
public static final int[] VERY_HARD_LIMIT_TEMP_MIN_BG = {72,180};
public static final int[] VERY_HARD_LIMIT_TEMP_MAX_BG = {72,270};
public static final int[] VERY_HARD_LIMIT_TEMP_TARGET_BG = {72,200};
//DanaR
public static final double dailyLimitWarning = 0.95d;
}

View file

@ -39,6 +39,7 @@ import info.nightscout.androidaps.tabs.TabPageAdapter;
import info.nightscout.utils.LogDialog;
import info.nightscout.utils.ImportExportPrefs;
import info.nightscout.utils.LocaleHelper;
import info.nightscout.utils.PasswordProtection;
public class MainActivity extends AppCompatActivity {
private static Logger log = LoggerFactory.getLogger(MainActivity.class);
@ -125,8 +126,13 @@ public class MainActivity extends AppCompatActivity {
int id = item.getItemId();
switch (id) {
case R.id.nav_preferences:
PasswordProtection.QueryPassword(this, R.string.settings_password, "settings_password", new Runnable() {
@Override
public void run() {
Intent i = new Intent(getApplicationContext(), PreferencesActivity.class);
startActivity(i);
}
}, null);
break;
case R.id.nav_resetdb:
new AlertDialog.Builder(this)

View file

@ -19,6 +19,7 @@ import info.nightscout.androidaps.plugins.DanaR.BluetoothDevicePreference;
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin;
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
import info.nightscout.androidaps.plugins.VirtualPump.VirtualPumpPlugin;
import info.nightscout.utils.LocaleHelper;
public class PreferencesActivity extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
@ -54,7 +55,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
}
if (pref instanceof EditTextPreference) {
EditTextPreference editTextPref = (EditTextPreference) pref;
if (pref.getKey().contains("danar_password")) {
if (pref.getKey().contains("password")) {
pref.setSummary("******");
} else if (editTextPref.getText() != null && !editTextPref.getText().equals("")) {
((EditTextPreference) pref).setDialogMessage(editTextPref.getDialogMessage());
@ -82,6 +83,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_password);
addPreferencesFromResource(R.xml.pref_quickwizard);
addPreferencesFromResource(R.xml.pref_language);
if (Config.CAREPORTALENABLED)
@ -104,6 +106,10 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
addPreferencesFromResource(R.xml.pref_danarprofile);
}
}
VirtualPumpPlugin virtualPumpPlugin = (VirtualPumpPlugin) MainApp.getSpecificPlugin(VirtualPumpPlugin.class);
if (virtualPumpPlugin != null && virtualPumpPlugin.isEnabled(PluginBase.PUMP)) {
addPreferencesFromResource(R.xml.pref_virtualpump);
}
if (Config.SMSCOMMUNICATORENABLED)
addPreferencesFromResource(R.xml.pref_smscommunicator);
addPreferencesFromResource(R.xml.pref_others);

View file

@ -28,7 +28,7 @@ public class MealData {
List<BgReading> bgReadings = MainApp.getDbHelper().getBgreadingsDataFromTime((long) (new Date().getTime() - 60 * 60 * 1000L * profile.getDia() * 2), false);
long now = new Date().getTime();
long dia_ago = now - (new Double(profile.getDia() * 60 * 60 * 1000l)).longValue();
long dia_ago = now - (new Double(1.5d * profile.getDia() * 60 * 60 * 1000l)).longValue();
long t = treatment.created_at.getTime();
if (t > dia_ago && t <= now) {
if (treatment.carbs >= 1) {

View file

@ -230,6 +230,16 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
scheduleTreatmentChange();
}
public void delete(Treatment treatment) {
try {
getDaoTreatments().delete(treatment);
latestTreatmentChange = treatment.getTimeIndex();
} catch (SQLException e) {
e.printStackTrace();
}
scheduleTreatmentChange();
}
public int delete(String _id) {
Treatment stored = findTreatmentById(_id);
int removed = 0;

View file

@ -17,6 +17,8 @@ import info.nightscout.client.data.NSProfile;
public interface PumpInterface {
boolean isInitialized();
boolean isSuspended();
boolean isBusy();
boolean isTempBasalInProgress();
boolean isExtendedBoluslInProgress();

View file

@ -94,19 +94,19 @@ public class ActionsFragment extends Fragment implements FragmentBase, View.OnCl
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable || !MainApp.getConfigBuilder().isInitialized())
if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended())
profileSwitch.setVisibility(View.GONE);
else
profileSwitch.setVisibility(View.VISIBLE);
if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized())
if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended())
extendedBolus.setVisibility(View.GONE);
else
extendedBolus.setVisibility(View.VISIBLE);
if (!MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable || !MainApp.getConfigBuilder().isInitialized())
if (!MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended())
tempBasal.setVisibility(View.GONE);
else
tempBasal.setVisibility(View.VISIBLE);
if (!MainApp.getConfigBuilder().getPumpDescription().isRefillingCapable || !MainApp.getConfigBuilder().isInitialized())
if (!MainApp.getConfigBuilder().getPumpDescription().isRefillingCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended())
fill.setVisibility(View.GONE);
else
fill.setVisibility(View.VISIBLE);

View file

@ -13,11 +13,13 @@ import android.support.v4.app.FragmentActivity;
import android.support.v7.app.AlertDialog;
import android.text.Editable;
import android.text.TextWatcher;
import android.text.format.DateFormat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioButton;
@ -44,6 +46,7 @@ import java.util.Date;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.GlucoseStatus;
import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.events.EventNewBasalProfile;
import info.nightscout.androidaps.interfaces.PumpInterface;
@ -264,10 +267,32 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
// meterRadioButton.setChecked(true);
// }
if (units.equals(Constants.MMOL))
editBg = new PlusMinusEditText(view, R.id.careportal_newnstreatment_bginput, R.id.careportal_newnstreatment_bg_plus, R.id.careportal_newnstreatment_bg_minus, 0d, 0d, 40d, 0.1d, new DecimalFormat("0.0"), false);
Double bg = NSProfile.fromMgdlToUnits(GlucoseStatus.getGlucoseStatusData() != null ? GlucoseStatus.getGlucoseStatusData().glucose : 0d, profile != null ? profile.getUnits() : Constants.MGDL);
if (profile == null)
editBg = new PlusMinusEditText(view, R.id.careportal_newnstreatment_bginput, R.id.careportal_newnstreatment_bg_plus, R.id.careportal_newnstreatment_bg_minus, bg, 0d, 500d, 0.1d, new DecimalFormat("0.0"), false);
else if (profile.getUnits().equals(Constants.MMOL))
editBg = new PlusMinusEditText(view, R.id.careportal_newnstreatment_bginput, R.id.careportal_newnstreatment_bg_plus, R.id.careportal_newnstreatment_bg_minus, bg, 0d, 30d, 0.1d, new DecimalFormat("0.0"), false);
else
editBg = new PlusMinusEditText(view, R.id.careportal_newnstreatment_bginput, R.id.careportal_newnstreatment_bg_plus, R.id.careportal_newnstreatment_bg_minus, 0d, 0d, 500d, 1d, new DecimalFormat("0"), false);
editBg = new PlusMinusEditText(view, R.id.careportal_newnstreatment_bginput, R.id.careportal_newnstreatment_bg_plus, R.id.careportal_newnstreatment_bg_minus, bg, 0d, 500d, 1d, new DecimalFormat("0"), false);
bgInputEdit.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (sensorRadioButton.isChecked()) meterRadioButton.setChecked(true);
}
});
sensorRadioButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
NSProfile profile = ConfigBuilderPlugin.getActiveProfile().getProfile();
if (profile == null) return;
Double bg = NSProfile.fromMgdlToUnits(GlucoseStatus.getGlucoseStatusData() != null ? GlucoseStatus.getGlucoseStatusData().glucose : 0d, profile.getUnits());
editBg.setValue(bg);
}
});
Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
editCarbs = new PlusMinusEditText(view, R.id.careportal_newnstreatment_carbsinput, R.id.careportal_newnstreatment_carbs_plus, R.id.careportal_newnstreatment_carbs_minus, 0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false);
@ -330,7 +355,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
this,
calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE),
df.is24HourFormat(context)
DateFormat.is24HourFormat(context)
);
tpd.setThemeDark(true);
tpd.dismissOnPause(true);
@ -588,7 +613,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
public void run() {
try {
String profile = data.getString("profile");
NSProfile nsProfile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
NSProfile nsProfile = ConfigBuilderPlugin.getActiveProfile().getProfile();
nsProfile.setActiveProfile(profile);
PumpInterface pump = MainApp.getConfigBuilder();
if (pump != null) {
@ -598,8 +623,8 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
} else {
log.error("No active pump selected");
}
if (MainApp.getConfigBuilder().getActiveProfile() instanceof CircadianPercentageProfilePlugin) {
CircadianPercentageProfilePlugin cpp = (CircadianPercentageProfilePlugin) MainApp.getConfigBuilder().getActiveProfile();
if (ConfigBuilderPlugin.getActiveProfile() instanceof CircadianPercentageProfilePlugin) {
CircadianPercentageProfilePlugin cpp = (CircadianPercentageProfilePlugin) ConfigBuilderPlugin.getActiveProfile();
data.put("CircadianPercentageProfile", true);
data.put("timeshift", cpp.timeshift);
data.put("percentage", cpp.percentage);
@ -623,8 +648,8 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
tempTarget.duration = data.getInt("duration");
tempTarget.reason = data.getString("reason");
if(tempTarget.duration != 0) {
tempTarget.low = NSProfile.toMgdl(data.getDouble("targetBottom"), MainApp.getConfigBuilder().getActiveProfile().getProfile().getUnits());
tempTarget.high = NSProfile.toMgdl(data.getDouble("targetTop"), MainApp.getConfigBuilder().getActiveProfile().getProfile().getUnits());
tempTarget.low = NSProfile.toMgdl(data.getDouble("targetBottom"), ConfigBuilderPlugin.getActiveProfile().getProfile().getUnits());
tempTarget.high = NSProfile.toMgdl(data.getDouble("targetTop"), ConfigBuilderPlugin.getActiveProfile().getProfile().getUnits());
} else {
tempTarget.low = 0;
tempTarget.high = 0;
@ -635,9 +660,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
dao.createIfNotExists(tempTarget);
MainApp.bus().post(new EventTempTargetRangeChange());
ConfigBuilderPlugin.uploadCareportalEntryToNS(data);
} catch (JSONException e) {
e.printStackTrace();
} catch (SQLException e) {
} catch (JSONException | SQLException e) {
e.printStackTrace();
}
}

View file

@ -7,6 +7,7 @@ import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.text.Editable;
import android.text.Html;
import android.text.TextWatcher;
@ -68,7 +69,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
ImageView iceditIcon;
ImageView isfeditIcon;
BasalEditDialog basalEditDialog;
LinearLayout ll;
FrameLayout fl;
Snackbar mSnackBar;
static Boolean percentageViewHint = true;
@ -78,8 +79,8 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View layout = inflater.inflate(R.layout.circadianpercentageprofile_fragment, container, false);
ll = (LinearLayout) layout.findViewById(R.id.circadianpercentageprofile_linearlayout);
ll.requestFocusFromTouch();
fl = (FrameLayout) layout.findViewById(R.id.circadianpercentageprofile_framelayout);
fl.requestFocusFromTouch();
diaView = (FormEditText) layout.findViewById(R.id.circadianpercentageprofile_dia);
mgdlView = (RadioButton) layout.findViewById(R.id.circadianpercentageprofile_mgdl);
mmolView = (RadioButton) layout.findViewById(R.id.circadianpercentageprofile_mmol);
@ -203,7 +204,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
mSnackBar.dismiss();
}
timeshiftView.clearFocus();
ll.requestFocusFromTouch();
fl.requestFocusFromTouch();
}
else {
if (timeshiftViewHint) {
@ -222,7 +223,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
mSnackBar.dismiss();
}
percentageView.clearFocus();
ll.requestFocusFromTouch();
fl.requestFocusFromTouch();
}
else {
if (percentageViewHint) {
@ -238,7 +239,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
public void onFocusChange(View view, boolean hasFocus) {
if (!hasFocus) {
diaView.clearFocus();
ll.requestFocusFromTouch();
fl.requestFocusFromTouch();
}
}
});
@ -249,7 +250,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
public void onFocusChange(View view, boolean hasFocus) {
if (!hasFocus) {
targethighView.clearFocus();
ll.requestFocusFromTouch();
fl.requestFocusFromTouch();
}
}
});
@ -260,7 +261,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
public void onFocusChange(View view, boolean hasFocus) {
if (!hasFocus) {
targetlowView.clearFocus();
ll.requestFocusFromTouch();
fl.requestFocusFromTouch();
}
}
});
@ -325,11 +326,9 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
this.snackbarCaller = snackbarCaller;
if (timeshiftViewHint || percentageViewHint) {
mSnackBar = Snackbar.make(view,
Msg,
Snackbar.LENGTH_LONG)
.setDuration(Snackbar.LENGTH_LONG)
.setActionTextColor(getResources().getColor(R.color.notificationInfo))
//noinspection WrongConstant
mSnackBar = Snackbar.make(view, Msg, 7000)
.setActionTextColor(ContextCompat.getColor(MainApp.instance(), R.color.notificationInfo))
.setAction(getString(R.string.dont_show_again), new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -344,9 +343,9 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) view.getLayoutParams();
params.gravity = Gravity.CENTER_HORIZONTAL | Gravity.TOP;
view.setLayoutParams(params);
view.setBackgroundColor(getResources().getColor(R.color.cardview_dark_background));
view.setBackgroundColor(ContextCompat.getColor(MainApp.instance(), R.color.cardview_dark_background));
TextView mainTextView = (TextView) (view).findViewById(android.support.design.R.id.snackbar_text);
mainTextView.setTextColor(getResources().getColor(R.color.mdtp_white));
mainTextView.setTextColor(ContextCompat.getColor(MainApp.instance(), R.color.mdtp_white));
mSnackBar.show();
}
}
@ -383,7 +382,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
basalEditDialog.dismiss();
}
basalEditDialog = null;
ll.requestFocusFromTouch();
fl.requestFocusFromTouch();
}
public static class BasalEditDialog extends DialogFragment {
@ -464,7 +463,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
basalEditDialog = null;
MainApp.bus().unregister(this);
ll.requestFocusFromTouch();
fl.requestFocusFromTouch();
}
@Override
@ -472,7 +471,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
super.onResume();
MainApp.bus().register(this);
onStatusEvent(null);
ll.requestFocusFromTouch();
fl.requestFocusFromTouch();
}
@Subscribe
@ -482,7 +481,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (!MainApp.getConfigBuilder().isInitialized() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
profileswitchButton.setVisibility(View.GONE);
} else {
profileswitchButton.setVisibility(View.VISIBLE);

View file

@ -9,7 +9,9 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
@ -28,6 +30,7 @@ import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.NSProfile.NSProfilePlugin;
import info.nightscout.androidaps.plugins.VirtualPump.VirtualPumpPlugin;
import info.nightscout.utils.PasswordProtection;
public class ConfigBuilderFragment extends Fragment implements FragmentBase {
@ -62,6 +65,8 @@ public class ConfigBuilderFragment extends Fragment implements FragmentBase {
PluginCustomAdapter constraintsDataAdapter = null;
PluginCustomAdapter generalDataAdapter = null;
LinearLayout mainLayout;
Button unlock;
// TODO: sorting
@ -89,6 +94,25 @@ public class ConfigBuilderFragment extends Fragment implements FragmentBase {
if (ConfigBuilderPlugin.nightscoutVersionCode < 900)
nightscoutVerView.setTextColor(Color.RED);
setViews();
unlock = (Button) view.findViewById(R.id.configbuilder_unlock);
mainLayout = (LinearLayout) view.findViewById(R.id.configbuilder_mainlayout);
if (PasswordProtection.isLocked("settings_password")) {
mainLayout.setVisibility(View.GONE);
unlock.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PasswordProtection.QueryPassword(getContext(), R.string.settings_password, "settings_password", new Runnable() {
@Override
public void run() {
mainLayout.setVisibility(View.VISIBLE);
unlock.setVisibility(View.GONE);
}
}, null);
}
});
}
return view;
}

View file

@ -18,6 +18,10 @@ import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Date;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp;
@ -75,7 +79,8 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
static ArrayList<PluginBase> pluginList;
static Date lastDeviceStatusUpload = new Date(0);
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
private static ScheduledFuture<?> scheduledPost = null;
PowerManager.WakeLock mWakeLock;
@ -336,6 +341,16 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
return activePump.isInitialized();
}
@Override
public boolean isSuspended() {
return activePump.isSuspended();
}
@Override
public boolean isBusy() {
return activePump.isBusy();
}
@Override
public boolean isTempBasalInProgress() {
return activePump.isTempBasalInProgress();
@ -608,6 +623,17 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
result.comment = MainApp.sResources.getString(R.string.pumpNotInitialized);
result.enacted = false;
result.success = false;
log.debug("applyAPSRequest: " + MainApp.sResources.getString(R.string.pumpNotInitialized));
return result;
}
if (isSuspended()) {
result = new PumpEnactResult();
result.comment = MainApp.sResources.getString(R.string.pumpsuspended);
result.enacted = false;
result.success = false;
log.debug("applyAPSRequest: " + MainApp.sResources.getString(R.string.pumpsuspended));
return result;
}
if (Config.logCongigBuilderActions)
@ -801,22 +827,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
@Subscribe
public void onStatusEvent(final EventNewBG ev) {
Thread t = new Thread(new Runnable() {
@Override
public void run() {
// Give some time to Loop
try {
Thread.sleep(120 * 1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
// if status not uploaded, upload pump status only
if (new Date().getTime() - lastDeviceStatusUpload.getTime() > 120 * 1000L) {
uploadDeviceStatus();
}
}
});
t.start();
uploadDeviceStatus(120);
}
public void uploadTempBasalStartAbsolute(Double absolute, double durationInMinutes) {
@ -922,11 +933,11 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
}
}
public void uploadDeviceStatus() {
public void doUploadDeviceStatus() {
DeviceStatus deviceStatus = new DeviceStatus();
try {
LoopPlugin.LastRun lastRun = LoopPlugin.lastRun;
if (lastRun != null && lastRun.lastAPSRun.getTime() > new Date().getTime() - 60 * 1000L) {
if (lastRun != null && lastRun.lastAPSRun.getTime() > new Date().getTime() - 300 * 1000L) {
// do not send if result is older than 1 min
APSResult apsResult = lastRun.request;
apsResult.json().put("timestamp", DateUtil.toISOString(lastRun.lastAPSRun));
@ -958,18 +969,36 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
}
if (activePump != null) {
deviceStatus.device = "openaps://" + deviceID();
JSONObject pumpstatus = getJSONStatus();
if (pumpstatus != null) {
deviceStatus.pump = getJSONStatus();
}
deviceStatus.created_at = DateUtil.toISOString(new Date());
deviceStatus.sendToNSClient();
lastDeviceStatusUpload = new Date();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
static public void uploadDeviceStatus(int sec) {
class PostRunnable implements Runnable {
public void run() {
MainApp.getConfigBuilder().doUploadDeviceStatus();
scheduledPost = null;
}
}
// prepare task for execution
// cancel waiting task to prevent sending multiple posts
if (scheduledPost != null)
scheduledPost.cancel(false);
Runnable task = new PostRunnable();
scheduledPost = worker.schedule(task, sec, TimeUnit.SECONDS);
log.debug("Scheduling devicestatus upload in " + sec + " sec");
}
public void uploadBolusWizardRecord(Treatment t, double glucose, String glucoseType, int carbTime, JSONObject boluscalc) {
JSONObject data = new JSONObject();
try {

View file

@ -211,6 +211,17 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
return getDanaRPump().lastConnection.getTime() > 0 && getDanaRPump().isExtendedBolusEnabled;
}
@Override
public boolean isSuspended() {
return getDanaRPump().pumpSuspended;
}
@Override
public boolean isBusy() {
if (sExecutionService == null) return false;
return sExecutionService.isConnected() || sExecutionService.isConnecting();
}
// Pump interface
@Override
public boolean isTempBasalInProgress() {
@ -705,7 +716,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
JSONObject extended = new JSONObject();
try {
battery.put("percent", getDanaRPump().batteryRemaining);
status.put("status", "normal");
status.put("status", getDanaRPump().pumpSuspended ? "suspended" : "normal");
status.put("timestamp", DateUtil.toISOString(getDanaRPump().lastConnection));
extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION);
extended.put("PumpIOB", getDanaRPump().iob);

View file

@ -26,6 +26,7 @@ import java.util.Set;
import java.util.UUID;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.db.Treatment;
@ -33,6 +34,7 @@ import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
import info.nightscout.androidaps.plugins.DanaR.DanaRPump;
import info.nightscout.androidaps.plugins.DanaR.SerialIOThread;
@ -78,6 +80,8 @@ import info.nightscout.androidaps.plugins.DanaR.comm.RecordTypes;
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRBolusStart;
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRConnectionStatus;
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRNewStatus;
import info.nightscout.androidaps.plugins.Overview.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.client.data.NSProfile;
import info.nightscout.utils.SafeParse;
import info.nightscout.utils.ToastUtils;
@ -276,6 +280,7 @@ public class ExecutionService extends Service {
private boolean getPumpStatus() {
try {
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.gettingpumpstatus)));
MsgStatus statusMsg = new MsgStatus();
MsgStatusBasic statusBasicMsg = new MsgStatusBasic();
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal();
@ -336,6 +341,13 @@ public class ExecutionService extends Service {
danaRPump.lastConnection = now;
MainApp.bus().post(new EventDanaRNewStatus());
MainApp.bus().post(new EventInitializationChanged());
MainApp.getConfigBuilder().uploadDeviceStatus(60);
if (danaRPump.dailyTotalUnits > danaRPump.maxDailyTotalUnits * Constants.dailyLimitWarning ) {
log.debug("Approaching daily limit: " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits);
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.sResources.getString(R.string.approachingdailylimit), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(reportFail));
MainApp.getConfigBuilder().uploadError(MainApp.sResources.getString(R.string.approachingdailylimit) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
}
} catch (Exception e) {
e.printStackTrace();
}
@ -345,30 +357,37 @@ public class ExecutionService extends Service {
public boolean tempBasal(int percent, int durationInHours) {
connect("tempBasal");
if (!isConnected()) return false;
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.settingtempbasal)));
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(percent, durationInHours));
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
return true;
}
public boolean tempBasalStop() {
connect("tempBasalStop");
if (!isConnected()) return false;
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.stoppingtempbasal)));
mSerialIOThread.sendMessage(new MsgSetTempBasalStop());
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
return true;
}
public boolean extendedBolus(double insulin, int durationInHalfHours) {
connect("extendedBolus");
if (!isConnected()) return false;
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.settingextendedbolus)));
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(insulin, (byte) (durationInHalfHours & 0xFF)));
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
return true;
}
public boolean extendedBolusStop() {
connect("extendedBolusStop");
if (!isConnected()) return false;
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.stoppingextendedbolus)));
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop());
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
return true;
@ -482,6 +501,7 @@ public class ExecutionService extends Service {
public boolean updateBasalsInPump(final NSProfile profile) {
connect("updateBasalsInPump");
if (!isConnected()) return false;
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.updatingbasalrates)));
double[] basal = buildDanaRProfileRecord(profile);
MsgSetBasalProfile msgSet = new MsgSetBasalProfile((byte) 0, basal);
mSerialIOThread.sendMessage(msgSet);
@ -489,6 +509,7 @@ public class ExecutionService extends Service {
mSerialIOThread.sendMessage(msgActivate);
danaRPump.lastSettingsRead = new Date(0); // force read full settings
getPumpStatus();
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
return true;
}

View file

@ -4,12 +4,20 @@ public class EventDanaRConnectionStatus {
public static final int CONNECTING = 0;
public static final int CONNECTED = 1;
public static final int DISCONNECTED = 2;
public static final int PERFORMING = 3;
public int sStatus = DISCONNECTED;
public int sSecondsElapsed = 0;
public String sAction = "";
public EventDanaRConnectionStatus(int status, int secondsElapsed) {
sStatus = status;
sSecondsElapsed = secondsElapsed;
}
public EventDanaRConnectionStatus(int status, int secondsElapsed, String action) {
sStatus = status;
sSecondsElapsed = secondsElapsed;
sAction = action;
}
}

View file

@ -211,6 +211,17 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
return getDanaRPump().lastConnection.getTime() > 0 && !getDanaRPump().isConfigUD && !getDanaRPump().isEasyModeEnabled && getDanaRPump().isExtendedBolusEnabled;
}
@Override
public boolean isSuspended() {
return false;
}
@Override
public boolean isBusy() {
if (sExecutionService == null) return false;
return sExecutionService.isConnected() || sExecutionService.isConnecting();
}
// Pump interface
@Override
public boolean isTempBasalInProgress() {

View file

@ -26,6 +26,7 @@ import java.util.Set;
import java.util.UUID;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.db.Treatment;
@ -74,6 +75,8 @@ import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgSettingShippingInf
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgStatusBasic;
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgStatusBolusExtended;
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MsgStatusTempBasal;
import info.nightscout.androidaps.plugins.Overview.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.client.data.NSProfile;
import info.nightscout.utils.SafeParse;
import info.nightscout.utils.ToastUtils;
@ -272,6 +275,7 @@ public class ExecutionService extends Service {
private boolean getPumpStatus() {
try {
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.gettingpumpstatus)));
//MsgStatus statusMsg = new MsgStatus();
MsgStatusBasic statusBasicMsg = new MsgStatusBasic();
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal();
@ -330,6 +334,13 @@ public class ExecutionService extends Service {
danaRKoreanPump.lastConnection = now;
MainApp.bus().post(new EventDanaRNewStatus());
MainApp.bus().post(new EventInitializationChanged());
MainApp.getConfigBuilder().uploadDeviceStatus(60);
if (danaRKoreanPump.dailyTotalUnits > danaRKoreanPump.maxDailyTotalUnits * Constants.dailyLimitWarning ) {
log.debug("Approaching daily limit: " + danaRKoreanPump.dailyTotalUnits + "/" + danaRKoreanPump.maxDailyTotalUnits);
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.sResources.getString(R.string.approachingdailylimit), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(reportFail));
MainApp.getConfigBuilder().uploadError(MainApp.sResources.getString(R.string.approachingdailylimit) + ": " + danaRKoreanPump.dailyTotalUnits + "/" + danaRKoreanPump.maxDailyTotalUnits + "U");
}
} catch (Exception e) {
e.printStackTrace();
}
@ -339,32 +350,40 @@ public class ExecutionService extends Service {
public boolean tempBasal(int percent, int durationInHours) {
connect("tempBasal");
if (!isConnected()) return false;
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.settingtempbasal)));
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(percent, durationInHours));
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
return true;
}
public boolean tempBasalStop() {
connect("tempBasalStop");
if (!isConnected()) return false;
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.stoppingtempbasal)));
mSerialIOThread.sendMessage(new MsgSetTempBasalStop());
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
return true;
}
public boolean extendedBolus(double insulin, int durationInHalfHours) {
connect("extendedBolus");
if (!isConnected()) return false;
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.settingextendedbolus)));
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(insulin, (byte) (durationInHalfHours & 0xFF)));
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
return true;
}
public boolean extendedBolusStop() {
connect("extendedBolusStop");
if (!isConnected()) return false;
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.stoppingextendedbolus)));
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop());
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
return true;
}
@ -476,11 +495,13 @@ public class ExecutionService extends Service {
public boolean updateBasalsInPump(final NSProfile profile) {
connect("updateBasalsInPump");
if (!isConnected()) return false;
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.updatingbasalrates)));
double[] basal = buildDanaRProfileRecord(profile);
MsgSetSingleBasalProfile msgSet = new MsgSetSingleBasalProfile(basal);
mSerialIOThread.sendMessage(msgSet);
danaRKoreanPump.lastSettingsRead = new Date(0); // force read full settings
getPumpStatus();
MainApp.bus().post(new EventDanaRConnectionStatus(EventDanaRConnectionStatus.PERFORMING, 0, MainApp.sResources.getString(R.string.disconnecting)));
return true;
}

View file

@ -156,7 +156,7 @@ public class LocalProfileFragment extends Fragment implements FragmentBase {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (!MainApp.getConfigBuilder().isInitialized() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
profileswitchButton.setVisibility(View.GONE);
} else {
profileswitchButton.setVisibility(View.VISIBLE);

View file

@ -76,7 +76,14 @@ public class LoopFragment extends Fragment implements View.OnClickListener, Frag
public void onClick(View view) {
switch (view.getId()) {
case R.id.loop_run:
lastRunView.setText(MainApp.sResources.getString(R.string.executing));
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
getPlugin().invoke("Loop button", true);
}
});
thread.start();
break;
}

View file

@ -228,7 +228,7 @@ public class LoopPlugin implements PluginBase {
}
MainApp.bus().post(new EventLoopUpdateGui());
MainApp.getConfigBuilder().uploadDeviceStatus();
MainApp.getConfigBuilder().uploadDeviceStatus(120);
} finally {
if (Config.logFunctionCalls)
log.debug("invoke end");

View file

@ -115,6 +115,16 @@ public class MDIPlugin implements PluginBase, PumpInterface {
return true;
}
@Override
public boolean isSuspended() {
return false;
}
@Override
public boolean isBusy() {
return false;
}
@Override
public boolean isTempBasalInProgress() {
return false;

View file

@ -22,6 +22,7 @@ public class Notification {
public static final int BASAL_VALUE_BELOW_MINIMUM = 7;
public static final int OLD_NSCLIENT = 8;
public static final int INVALID_PHONE_NUMBER = 9;
public static final int APPROACHING_DAILY_LIMIT = 10;
public int id;
public Date date;

View file

@ -71,6 +71,7 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRConnectionStatus;
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
import info.nightscout.androidaps.plugins.Loop.events.EventNewOpenLoopNotification;
import info.nightscout.androidaps.plugins.Objectives.ObjectivesPlugin;
@ -116,7 +117,7 @@ public class OverviewFragment extends Fragment {
TextView iobView;
TextView apsModeView;
TextView tempTargetView;
TextView initializingView;
TextView pumpStatusView;
GraphView bgGraph;
CheckBox showPredictionView;
@ -162,7 +163,7 @@ public class OverviewFragment extends Fragment {
baseBasalView = (TextView) view.findViewById(R.id.overview_basebasal);
basalLayout = (LinearLayout) view.findViewById(R.id.overview_basallayout);
activeProfileView = (TextView) view.findViewById(R.id.overview_activeprofile);
initializingView = (TextView) view.findViewById(R.id.overview_initializing);
pumpStatusView = (TextView) view.findViewById(R.id.overview_initializing);
iobView = (TextView) view.findViewById(R.id.overview_iob);
apsModeView = (TextView) view.findViewById(R.id.overview_apsmode);
@ -268,7 +269,7 @@ public class OverviewFragment extends Fragment {
finalLastRun.setByPump = applyResult;
finalLastRun.lastEnact = new Date();
finalLastRun.lastOpenModeAccept = new Date();
MainApp.getConfigBuilder().uploadDeviceStatus();
MainApp.getConfigBuilder().uploadDeviceStatus(15);
ObjectivesPlugin objectivesPlugin = (ObjectivesPlugin) MainApp.getSpecificPlugin(ObjectivesPlugin.class);
if (objectivesPlugin != null) {
objectivesPlugin.manualEnacts++;
@ -287,22 +288,35 @@ public class OverviewFragment extends Fragment {
}
});
pumpStatusView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().isInitialized())
sHandler.post(new Runnable() {
@Override
public void run() {
MainApp.getConfigBuilder().updateStatus("RefreshClicked");
}
});
}
});
updateGUI();
return view;
}
void processQuickWizard() {
final BgReading lastBG = GlucoseStatus.lastBg();
final BgReading actualBg = GlucoseStatus.actualBg();
if (MainApp.getConfigBuilder() == null || ConfigBuilderPlugin.getActiveProfile() == null) // app not initialized yet
return;
final NSProfile profile = ConfigBuilderPlugin.getActiveProfile().getProfile();
QuickWizard.QuickWizardEntry quickWizardEntry = getPlugin().quickWizard.getActive();
if (quickWizardEntry != null && lastBG != null) {
if (quickWizardEntry != null && actualBg != null) {
quickWizardButton.setVisibility(View.VISIBLE);
String text = MainApp.sResources.getString(R.string.bolus) + ": " + quickWizardEntry.buttonText();
BolusWizard wizard = new BolusWizard();
wizard.doCalc(profile.getDefaultProfile(), quickWizardEntry.carbs(), lastBG.valueToUnits(profile.getUnits()), 0d, true, true);
wizard.doCalc(profile.getDefaultProfile(), quickWizardEntry.carbs(), actualBg.valueToUnits(profile.getUnits()), 0d, true, true);
final JSONObject boluscalcJSON = new JSONObject();
try {
@ -314,7 +328,7 @@ public class OverviewFragment extends Fragment {
boluscalcJSON.put("iob", -(wizard.insulingFromBolusIOB + wizard.insulingFromBasalsIOB));
boluscalcJSON.put("bolusiobused", true);
boluscalcJSON.put("basaliobused", true);
boluscalcJSON.put("bg", lastBG.valueToUnits(profile.getUnits()));
boluscalcJSON.put("bg", actualBg.valueToUnits(profile.getUnits()));
boluscalcJSON.put("insulinbg", wizard.insulinFromBG);
boluscalcJSON.put("insulinbgused", true);
boluscalcJSON.put("bgdiff", wizard.bgDiff);
@ -361,7 +375,7 @@ public class OverviewFragment extends Fragment {
getContext(),
finalInsulinAfterConstraints,
finalCarbsAfterConstraints,
lastBG.valueToUnits(profile.getUnits()),
actualBg.valueToUnits(profile.getUnits()),
"Manual",
0,
boluscalcJSON
@ -443,16 +457,41 @@ public class OverviewFragment extends Fragment {
}
@Subscribe
public void onStatusEvent(final EventNewBasalProfile ev) { updateGUIIfVisible(); }
public void onStatusEvent(final EventNewBasalProfile ev) {
updateGUIIfVisible();
}
@Subscribe
public void onStatusEvent(final EventTempTargetRangeChange ev) {updateGUIIfVisible();}
public void onStatusEvent(final EventTempTargetRangeChange ev) {
updateGUIIfVisible();
}
@Subscribe
public void onStatusEvent(final EventNewNotification n) { updateNotifications(); }
public void onStatusEvent(final EventNewNotification n) {
updateNotifications();
}
@Subscribe
public void onStatusEvent(final EventDismissNotification n) { updateNotifications(); }
public void onStatusEvent(final EventDismissNotification n) {
updateNotifications();
}
@Subscribe
public void onStatusEvent(final EventDanaRConnectionStatus s) {
Activity activity = getActivity();
if (activity != null)
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (s.sStatus == EventDanaRConnectionStatus.CONNECTING)
updatePumpStatus(String.format(getString(R.string.danar_history_connectingfor), s.sSecondsElapsed));
else if (s.sStatus == EventDanaRConnectionStatus.PERFORMING)
updatePumpStatus(s.sAction);
else if (s.sStatus == EventDanaRConnectionStatus.DISCONNECTED)
updatePumpStatus(null);
}
});
}
private void hideTempRecommendation() {
Activity activity = getActivity();
@ -476,6 +515,35 @@ public class OverviewFragment extends Fragment {
});
}
private void updatePumpStatus(String status) {
PumpInterface pump = MainApp.getConfigBuilder();
if (status != null) {
pumpStatusView.setText(status);
pumpStatusView.setVisibility(View.VISIBLE);
} else if (pump.isBusy()) {
pumpStatusView.setText(R.string.pumpbusy);
pumpStatusView.setVisibility(View.VISIBLE);
} else if (pump.isSuspended()) {
// disable all treatment buttons because we are not able to check constraints without profile
wizardButton.setVisibility(View.INVISIBLE);
treatmentButton.setVisibility(View.INVISIBLE);
quickWizardButton.setVisibility(View.INVISIBLE);
pumpStatusView.setText(R.string.pumpsuspendedclicktorefresh);
pumpStatusView.setVisibility(View.VISIBLE);
} else if (!pump.isInitialized()) {
// disable all treatment buttons because we are not able to check constraints without profile
wizardButton.setVisibility(View.INVISIBLE);
treatmentButton.setVisibility(View.INVISIBLE);
quickWizardButton.setVisibility(View.INVISIBLE);
pumpStatusView.setText(R.string.waitingforpumpclicktorefresh);
pumpStatusView.setVisibility(View.VISIBLE);
} else {
wizardButton.setVisibility(View.VISIBLE);
treatmentButton.setVisibility(View.VISIBLE);
pumpStatusView.setVisibility(View.GONE);
}
}
@SuppressLint("SetTextI18n")
public void updateGUI() {
updateNotifications();
@ -483,11 +551,11 @@ public class OverviewFragment extends Fragment {
BgReading lastBG = GlucoseStatus.lastBg();
if (MainApp.getConfigBuilder() == null || MainApp.getConfigBuilder().getActiveProfile() == null || MainApp.getConfigBuilder().getActiveProfile().getProfile() == null) {// app not initialized yet
initializingView.setText(R.string.noprofileset);
initializingView.setVisibility(View.VISIBLE);
pumpStatusView.setText(R.string.noprofileset);
pumpStatusView.setVisibility(View.VISIBLE);
return;
} else {
initializingView.setVisibility(View.GONE);
pumpStatusView.setVisibility(View.GONE);
}
// Skip if not initialized yet
@ -504,7 +572,7 @@ public class OverviewFragment extends Fragment {
apsModeView.setBackgroundResource(R.drawable.loopmodeborder);
apsModeView.setTextColor(Color.BLACK);
final LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
if(activeloop != null && activeloop.isEnabled(activeloop.getType())) {
if (activeloop != null && activeloop.isEnabled(activeloop.getType())) {
if (MainApp.getConfigBuilder().isClosedModeEnabled()) {
apsModeView.setText(MainApp.sResources.getString(R.string.closedloop));
} else {
@ -522,10 +590,10 @@ public class OverviewFragment extends Fragment {
@Override
public boolean onLongClick(View view) {
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
if (activeloop == null){
if (activeloop == null) {
log.error("no active loop?");
return true;
} else if (activeloop.isEnabled(PluginBase.LOOP)){
} else if (activeloop.isEnabled(PluginBase.LOOP)) {
activeloop.setFragmentEnabled(PluginBase.LOOP, false);
activeloop.setFragmentVisible(PluginBase.LOOP, false);
} else {
@ -578,7 +646,7 @@ public class OverviewFragment extends Fragment {
showAcceptButton = showAcceptButton && (finalLastRun.lastOpenModeAccept == null || finalLastRun.lastOpenModeAccept.getTime() < finalLastRun.lastAPSRun.getTime()); // never accepted or before last result
showAcceptButton = showAcceptButton && finalLastRun.constraintsProcessed.changeRequested; // change is requested
if (showAcceptButton && pump.isInitialized() && ConfigBuilderPlugin.getActiveLoop() != null) {
if (showAcceptButton && pump.isInitialized() && !pump.isSuspended() && ConfigBuilderPlugin.getActiveLoop() != null) {
acceptTempLayout.setVisibility(View.VISIBLE);
acceptTempButton.setText(getContext().getString(R.string.setbasalquestion) + "\n" + finalLastRun.constraintsProcessed);
} else {
@ -644,7 +712,7 @@ public class OverviewFragment extends Fragment {
// QuickWizard button
QuickWizard.QuickWizardEntry quickWizardEntry = getPlugin().quickWizard.getActive();
if (quickWizardEntry != null && lastBG != null && pump.isInitialized()) {
if (quickWizardEntry != null && lastBG != null && pump.isInitialized() && !pump.isSuspended()) {
quickWizardButton.setVisibility(View.VISIBLE);
String text = MainApp.sResources.getString(R.string.bolus) + ": " + quickWizardEntry.buttonText() + " " + DecimalFormatter.to0Decimal(quickWizardEntry.carbs()) + "g";
BolusWizard wizard = new BolusWizard();
@ -663,7 +731,7 @@ public class OverviewFragment extends Fragment {
bgView.setText(lastBG.valueToUnitsToString(profile.getUnits()));
arrowView.setText(lastBG.directionToSymbol());
GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData();
if (glucoseStatus != null){
if (glucoseStatus != null) {
deltaView.setText("Δ " + NSProfile.toUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) + " " + units);
avgdeltaView.setText("øΔ15m: " + NSProfile.toUnitsString(glucoseStatus.short_avgdelta, glucoseStatus.short_avgdelta * Constants.MGDL_TO_MMOLL, units) +
" øΔ40m: " + NSProfile.toUnitsString(glucoseStatus.long_avgdelta, glucoseStatus.long_avgdelta * Constants.MGDL_TO_MMOLL, units));
@ -717,7 +785,7 @@ public class OverviewFragment extends Fragment {
long fromTime;
long endTime;
if (showPrediction) {
int predHours = (int) (Math.ceil(((DetermineBasalResultAMA)finalLastRun.constraintsProcessed).getLatestPredictionsTime() - new Date().getTime()) / (60 * 60 * 1000));
int predHours = (int) (Math.ceil(((DetermineBasalResultAMA) finalLastRun.constraintsProcessed).getLatestPredictionsTime() - new Date().getTime()) / (60 * 60 * 1000));
predHours = Math.min(2, predHours);
predHours = Math.max(0, predHours);
hoursToFetch = (int) (6 - predHours);
@ -734,11 +802,11 @@ public class OverviewFragment extends Fragment {
Double lowLine = SafeParse.stringToDouble(prefs.getString("low_mark", "0"));
Double highLine = SafeParse.stringToDouble(prefs.getString("high_mark", "0"));
if (lowLine < 1){
if (lowLine < 1) {
lowLine = NSProfile.fromMgdlToUnits(OverviewPlugin.bgTargetLow, units);
}
if(highLine < 1){
if (highLine < 1) {
highLine = NSProfile.fromMgdlToUnits(OverviewPlugin.bgTargetHigh, units);
}
@ -847,7 +915,7 @@ public class OverviewFragment extends Fragment {
}
maxBgValue = NSProfile.fromMgdlToUnits(maxBgValue, units);
maxBgValue = units.equals(Constants.MGDL) ? Round.roundTo(maxBgValue, 40d) + 80 : Round.roundTo(maxBgValue, 2d) + 4;
if(highLine > maxBgValue) maxBgValue = highLine;
if (highLine > maxBgValue) maxBgValue = highLine;
Integer numOfHorizLines = units.equals(Constants.MGDL) ? (int) (maxBgValue / 40 + 1) : (int) (maxBgValue / 2 + 1);
BgReading[] inRange = new BgReading[inRangeArray.size()];
@ -935,20 +1003,7 @@ public class OverviewFragment extends Fragment {
bgGraph.getGridLabelRenderer().setVerticalLabelsSecondScaleColor(ContextCompat.getColor(MainApp.instance(), R.color.background_material_dark)); // same color as backround = hide
}
// Pump not initialized message
if (!pump.isInitialized()) {
// disable all treatment buttons because we are not able to check constraints without profile
wizardButton.setVisibility(View.INVISIBLE);
treatmentButton.setVisibility(View.INVISIBLE);
quickWizardButton.setVisibility(View.INVISIBLE);
initializingView.setText(R.string.waitingforpump);
initializingView.setVisibility(View.VISIBLE);
} else {
wizardButton.setVisibility(View.VISIBLE);
treatmentButton.setVisibility(View.VISIBLE);
initializingView.setVisibility(View.GONE);
}
updatePumpStatus(null);
}
//Notifications
@ -1040,5 +1095,4 @@ public class OverviewFragment extends Fragment {
}
}

View file

@ -170,7 +170,7 @@ public class SimpleProfileFragment extends Fragment implements FragmentBase {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (!MainApp.getConfigBuilder().isInitialized() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
profileswitchButton.setVisibility(View.GONE);
} else {
profileswitchButton.setVisibility(View.VISIBLE);

View file

@ -1,9 +1,11 @@
package info.nightscout.androidaps.plugins.Treatments;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Paint;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
@ -55,7 +57,9 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
TextView activityTotal;
Button refreshFromNS;
public static class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.TreatmentsViewHolder> {
Context context;
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.TreatmentsViewHolder> {
List<Treatment> treatments;
@ -88,6 +92,7 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
holder.dateLinearLayout.setBackgroundColor(ContextCompat.getColor(MainApp.instance(), R.color.colorAffectingIOB));
else
holder.dateLinearLayout.setBackgroundColor(ContextCompat.getColor(MainApp.instance(), R.color.cardColorBackground));
holder.remove.setTag(treatments.get(position));
}
@Override
@ -100,7 +105,7 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
super.onAttachedToRecyclerView(recyclerView);
}
public static class TreatmentsViewHolder extends RecyclerView.ViewHolder {
public class TreatmentsViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
CardView cv;
TextView date;
TextView insulin;
@ -109,6 +114,7 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
TextView activity;
TextView mealOrCorrection;
LinearLayout dateLinearLayout;
TextView remove;
TreatmentsViewHolder(View itemView) {
super(itemView);
@ -120,6 +126,35 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
activity = (TextView) itemView.findViewById(R.id.treatments_activity);
mealOrCorrection = (TextView) itemView.findViewById(R.id.treatments_mealorcorrection);
dateLinearLayout = (LinearLayout) itemView.findViewById(R.id.treatments_datelinearlayout);
remove = (TextView) itemView.findViewById(R.id.treatments_remove);
remove.setOnClickListener(this);
remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
}
@Override
public void onClick(View v) {
final Treatment treatment = (Treatment) v.getTag();
final Context finalContext = context;
switch (v.getId()) {
case R.id.treatments_remove:
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
builder.setMessage(MainApp.sResources.getString(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(treatment.created_at));
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
final String _id = treatment._id;
if (_id != null && !_id.equals("")) {
MainApp.getConfigBuilder().removeCareportalEntryFromNS(_id);
}
MainApp.getDbHelper().delete(treatment);
treatmentsPlugin.initializeData();
updateGUI();
}
});
builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null);
builder.show();
break;
}
}
}
}
@ -143,6 +178,8 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
refreshFromNS = (Button) view.findViewById(R.id.treatments_reshreshfromnightscout);
refreshFromNS.setOnClickListener(this);
context = getContext();
updateGUI();
return view;
}
@ -153,8 +190,8 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
case R.id.treatments_reshreshfromnightscout:
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean nsUploadOnly = SP.getBoolean("ns_upload_only", false);
if(nsUploadOnly){
ToastUtils.showToastInUiThread(getContext(),this.getContext().getString(R.string.ns_upload_only_enabled));
if (nsUploadOnly) {
ToastUtils.showToastInUiThread(getContext(), this.getContext().getString(R.string.ns_upload_only_enabled));
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(this.getContext());
builder.setTitle(this.getContext().getString(R.string.confirmation));

View file

@ -1,6 +1,8 @@
package info.nightscout.androidaps.plugins.VirtualPump;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import org.json.JSONException;
import org.json.JSONObject;
@ -124,6 +126,16 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
return true;
}
@Override
public boolean isSuspended() {
return false;
}
@Override
public boolean isBusy() {
return false;
}
@Override
public boolean isTempBasalInProgress() {
return getTempBasal() != null;
@ -391,6 +403,10 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
@Override
public JSONObject getJSONStatus() {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
if (!preferences.getBoolean("virtualpump_uploadstatus", false)) {
return null;
}
JSONObject pump = new JSONObject();
JSONObject battery = new JSONObject();
JSONObject status = new JSONObject();

View file

@ -58,7 +58,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
}
});
t.start();
} else if (isStatusOutdated) {
} else if (isStatusOutdated && !pump.isBusy()) {
Thread t = new Thread(new Runnable() {
@Override
public void run() {
@ -66,7 +66,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
}
});
t.start();
} else if (isBasalOutdated) {
} else if (isBasalOutdated && !pump.isBusy()) {
Thread t = new Thread(new Runnable() {
@Override
public void run() {

View file

@ -0,0 +1,72 @@
package info.nightscout.utils;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
/**
* Created by mike on 14.02.2017.
*/
public class PasswordProtection {
static public boolean isLocked(String preference) {
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
final String password = SP.getString(preference, "");
if (password.equals("")) {
return false;
}
return true;
}
static public void QueryPassword(final Context context, int stringID, String preference, final Runnable ok, final Runnable fail) {
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
final String password = SP.getString(preference, "");
if (password.equals("")) {
if (ok != null) ok.run();
return;
}
LayoutInflater li = LayoutInflater.from(context);
View promptsView = li.inflate(R.layout.passwordprompt, null);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
alertDialogBuilder.setView(promptsView);
final TextView label = (TextView) promptsView.findViewById(R.id.passwordprompt_text);
label.setText(MainApp.sResources.getString(stringID));
final EditText userInput = (EditText) promptsView.findViewById(R.id.passwordprompt_pass);
// set dialog message
alertDialogBuilder
.setCancelable(false)
.setPositiveButton("OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
String enteredPassword = userInput.getText().toString();
if (password.equals(enteredPassword)) {
if (ok != null) ok.run();
} else {
ToastUtils.showToastInUiThread(context, MainApp.sResources.getString(R.string.wrongpassword));
if (fail != null) fail.run();
}
}
})
.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
dialog.cancel();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
}

View file

@ -94,14 +94,15 @@
android:id="@+id/careportal_newnstreatment_meter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:checked="false"
android:text="@string/careportal_newnstreatment_meter" />
<RadioButton
android:id="@+id/careportal_newnstreatment_sensor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/careportal_newnstreatment_sensor" />
android:text="@string/careportal_newnstreatment_sensor"
android:checked="true" />
<RadioButton
android:id="@+id/careportal_newnstreatment_other"

View file

@ -3,6 +3,10 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/circadianpercentageprofile_framelayout"
android:focusable="true"
android:focusableInTouchMode="true"
android:descendantFocusability="beforeDescendants"
tools:context=".plugins.CircadianPercentageProfile.CircadianPercentageProfileFragment">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
@ -13,10 +17,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/circadianpercentageprofile_linearlayout"
android:focusable="true"
android:focusableInTouchMode="true" >
android:orientation="vertical">
<TextView
android:id="@+id/circadianpercentageprofile_profileview"

View file

@ -13,44 +13,17 @@
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/configbuilder_nsclientversion_label" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/configbuilder_nsclientversion"
android:layout_marginLeft="10dp" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
<Button
android:id="@+id/configbuilder_unlock"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp">
android:text="@string/unlock_settings" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/configbuilder_nightscoutversion_label" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/configbuilder_nightscoutversion"
android:layout_marginLeft="10dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/configbuilder_mainlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
@ -201,6 +174,47 @@
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@color/cardColorBackground" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/configbuilder_nsclientversion_label"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/configbuilder_nsclientversion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/configbuilder_nightscoutversion_label"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/configbuilder_nightscoutversion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</FrameLayout>

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="10dp" >
<TextView
android:id="@+id/passwordprompt_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="@+id/passwordprompt_pass"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword">
<requestFocus />
</EditText>
</LinearLayout>

View file

@ -134,6 +134,13 @@
android:layout_marginRight="30dp"
android:textStyle="bold" />
<TextView
android:text="@string/overview_quickwizard_item_remove_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/treatments_remove"
android:textAlignment="viewEnd"
android:textColor="@android:color/holo_orange_light" />
</LinearLayout>

View file

@ -246,7 +246,7 @@
<string name="overview_bolusprogress_stoppressed">НАТИСНАТ СТОП</string>
<string name="openapsma_target_bg">КЗ цел за изчисления</string>
<string name="pumpbusy">Помпата е заета</string>
<string name="waitingforpump">Изчаква за помпа</string>
<string name="waitingforpumpclicktorefresh">Изчаква за помпа. Click to refresh.</string>
<string name="wrongpumppassword">Грешна парола за помпата!</string>
<string name="youareonallowedlimit">Достигнахте лимита</string>
<string name="danar_alarm">аларма</string>
@ -434,4 +434,5 @@
<string name="sms_delta">Delta:</string>
<string name="sms_iob">IOB:</string>
<string name="sms_minago" formatted="false">%dmin ago</string>
<string name="waitingforpump">Изчаква за помпа</string>
</resources>

View file

@ -249,7 +249,7 @@
<string name="danar_glucose">glykémie</string>
<string name="danar_history">Historie</string>
<string name="danar_history_alarm">Alarmy</string>
<string name="danar_history_basalhours">Hodinvé bazály</string>
<string name="danar_history_basalhours">Hodinové bazály</string>
<string name="danar_history_bolus">Bolusy</string>
<string name="danar_history_carbohydrates">Sacharidy</string>
<string name="danar_history_connectingfor" formatted="false">Připojování %d sec</string>
@ -271,7 +271,7 @@
<string name="overview_bolusprogress_stop">Stop</string>
<string name="overview_bolusprogress_stoped">Zastaveno</string>
<string name="overview_bolusprogress_stoppressed">STISKNUTO STOP</string>
<string name="waitingforpump">Čekání na pumpu</string>
<string name="waitingforpumpclicktorefresh">Čekání na pumpu. Klik pro připojení.</string>
<string name="overview_bolusprogress_goingtodeliver" formatted="false">Podávání %.2fU inzulínu</string>
<string name="objectives_0_gate">Zkontrolovat, zda jsou glykémie a údaje z pumpy viditelné v Nightscoutu</string>
<string name="objectives_0_objective">Nastavit vizualizaci a monitoring, analyzovat bazály a koeficienty</string>
@ -457,6 +457,25 @@
<string name="xdripnotinstalled">xDrip+ není nainstalován</string>
<string name="smscommunicator_calibrationfailed">xDrip nepřijímá kalibrace</string>
<string name="smscommunicator_calibrationreplywithcode" formatted="false">Odeslání kalibrace %.2f potvrďte kódem %s</string>
<string name="smscommunicator_calibrationsent">Kalibrace odeslána</string>
<string name="smscommunicator_calibrationsent">Kalibrace odeslána. Příjem musí být v xDripu povolený.</string>
<string name="smscommunicator_remotecalibrationnotallowed">Vzdálené kalibrace nejsou povoleny</string>
<string name="disconnecting">Odpojuji</string>
<string name="dont_show_again">Nezobrazovat znovu</string>
<string name="executing">Provádím</string>
<string name="gettingpumpstatus">Načítám stav pumpy</string>
<string name="pumpsuspended">Pumpa vypnuta</string>
<string name="pumpsuspendedclicktorefresh">Pumpa vypnuta. Klik pro obnovení stavu</string>
<string name="settingextendedbolus">Nastavuji extended bolus</string>
<string name="settingtempbasal">Nastavuji dočasný bazál</string>
<string name="stoppingextendedbolus">Zastavuji extended bolus</string>
<string name="stoppingtempbasal">Zastavuji dočasný bazál</string>
<string name="updatingbasalrates">Aktualizuji bazály</string>
<string name="bolusrequested">Spouštím dodávání %.2fU</string>
<string name="waitingforpump">Čekání na pumpu</string>
<string name="settings_password">Heslo do nastavení</string>
<string name="virtualpump_settings">Nastavení virtuální pumpy</string>
<string name="virtualpump_uploadstatus_title">Nahrávat status do NS</string>
<string name="wrongpassword">Chybné heslo</string>
<string name="unlock_settings">Odemknout nastavení</string>
<string name="approachingdailylimit">Blíží se denní limit inzulínu</string>
</resources>

View file

@ -242,7 +242,7 @@
<string name="ko_lang">Korean</string>
<string name="youareonallowedlimit">Limit erreicht</string>
<string name="wrongpumppassword">Falsches Pumpen-Passwort!</string>
<string name="waitingforpump">Warte auf Pumpe</string>
<string name="waitingforpumpclicktorefresh">Warte auf Pumpe. Click to refresh.</string>
<string name="correctionbous">Korr</string>
<string name="bolusdelivering">Abgabe %.2fU</string>
<string name="bolusdelivered">%.2fU Bolus erfolgreich abgegeben</string>
@ -332,4 +332,6 @@
<string name="error_field_must_not_be_empty">Pflichtfeld</string>
<string name="error_phone_not_valid">Telefonnummer ist nicht gültig.</string>
<string name="error_only_numeric_digits_range_allowed">Bitte verwenden Sie nur Ziffern von %1$s - %2$s</string>
<string name="waitingforpump">Warte auf Pumpe</string>
<string name="wear"></string>
</resources>

View file

@ -283,7 +283,7 @@
<string name="occlusion">Oclusión</string>
<string name="overview_bolusprogress_stop">Detener</string>
<string name="overview_bolusprogress_stoppressed">Parar pulsado</string>
<string name="waitingforpump">Esperando bomba</string>
<string name="waitingforpumpclicktorefresh">Esperando bomba. Click to refresh.</string>
<string formatted="false" name="overview_bolusprogress_goingtodeliver">Va a entregar% .2fU</string>
<string name="objectives_0_objective">Configuración de visualización y monitoreo, y el análisis de los basales y ratios</string>
<string name="objectives_0_gate">Comprobar que los datos de BG están disponibles en Nightscout, y que los datos de la bomba de insulina se están subiendo</string>
@ -405,4 +405,5 @@
<string name="error_only_numeric_digits_range_allowed">Sólo se permiten dígitos en el rango %1$s - %2$s</string>
<string name="error_field_must_not_be_empty">Este campo no puede estar vacío</string>
<string name="error_phone_not_valid">Número de teléfono inválido</string>
<string name="waitingforpump">Esperando bomba</string>
</resources>

View file

@ -286,7 +286,7 @@
<string name="occlusion">막힘</string>
<string name="overview_bolusprogress_stop">정지</string>
<string name="overview_bolusprogress_stoppressed">정지 누름</string>
<string name="waitingforpump">펌프를 기다리고 있습니다.</string>
<string name="waitingforpumpclicktorefresh">펌프를 기다리고 있습니다. Click to refresh.</string>
<string name="overview_bolusprogress_goingtodeliver" formatted="false">%.2fU을 주입합니다</string>
<string name="objectives_0_objective">나이트스카우트를 세팅하고, 기초주입과 비율을 분석한다.</string>
<string name="objectives_0_gate">나이트스카우트에서 혈당 데이터가 잘 들어오는지, 펌프데이터가 업로드 되는지 확인한다.</string>
@ -402,4 +402,5 @@
<string name="error_only_numeric_digits_allowed">숫자만 입력가능합니다.</string>
<string name="error_only_numeric_digits_range_allowed">이 범위(%1$s - %2$s)안에 해당하는 숫자만 입력가능합니다.</string>
<string name="error_phone_not_valid">유효한 도메인 이름이 아닙니다.</string>
<string name="waitingforpump">펌프를 기다리고 있습니다</string>
</resources>

View file

@ -303,6 +303,7 @@
<string name="overview_bolusprogress_stop">Stop</string>
<string name="overview_bolusprogress_stoppressed">STOP PRESSED</string>
<string name="waitingforpump">Waiting for pump</string>
<string name="waitingforpumpclicktorefresh">Waiting for pump. Click to refresh.</string>
<string name="overview_bolusprogress_goingtodeliver" formatted="false">Going to deliver %.2fU</string>
<string name="objectives_0_objective">Setting up visualization and monitoring, and analyzing basals and ratios</string>
<string name="objectives_0_gate">Verify that BG is available in Nightscout, and pump insulin data is being uploaded</string>
@ -487,7 +488,23 @@
<string name="xdripnotinstalled">xDrip+ not installed</string>
<string name="calibrationsent">Calibration sent to xDrip</string>
<string name="smscommunicator_remotecalibrationnotallowed">Remote calibration not allowed</string>
<string name="smscommunicator_calibrationsent">Calibration sent</string>
<string name="smscommunicator_calibrationsent">Calibration sent. Receiving must be enabled in xDrip.</string>
<string name="smscommunicator_calibrationfailed">xDrip is not receiving calibrations</string>
<string name="dont_show_again">Don\'t show again</string>
<string name="pumpsuspendedclicktorefresh">Pump suspended. Click to refresh state</string>
<string name="pumpsuspended">Pump suspended</string>
<string name="gettingpumpstatus">Getting pump status</string>
<string name="settingtempbasal">Setting temp basal</string>
<string name="stoppingtempbasal">Stopping temp basal</string>
<string name="settingextendedbolus">Setting extended bolus</string>
<string name="stoppingextendedbolus">Stopping extended bolus</string>
<string name="updatingbasalrates">Updating basal rates</string>
<string name="disconnecting">Disconnecting</string>
<string name="executing">Executing</string>
<string name="virtualpump_settings">Virtual pump settings</string>
<string name="virtualpump_uploadstatus_title">Upload status to NS</string>
<string name="wrongpassword">Wrong password</string>
<string name="settings_password">Password for settings</string>
<string name="unlock_settings">Unlock settings</string>
<string name="approachingdailylimit">Approaching insulin daily limit</string>
</resources>

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:key="password"
android:title="@string/settings_password">
<EditTextPreference
android:title="@string/settings_password"
android:key="settings_password"
android:inputType="textPassword">
</EditTextPreference>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:key="virtualpump"
android:title="@string/virtualpump_settings">
<SwitchPreference
android:defaultValue="false"
android:key="virtualpump_uploadstatus"
android:title="@string/virtualpump_uploadstatus_title" />
</PreferenceCategory>
</PreferenceScreen>