Merge pull request #1 from MilosKozak/dev

Dev
This commit is contained in:
winni67 2017-04-15 20:09:55 +02:00 committed by GitHub
commit 7e92b43e11
50 changed files with 1540 additions and 413 deletions

View file

@ -44,7 +44,7 @@ android {
minSdkVersion 21
targetSdkVersion 23
versionCode 1100
version "1.3rc1"
version "1.33"
buildConfigField "String", "VERSION", '"' + version + '"'
buildConfigField "String", "BUILDVERSION", generateGitBuild()
}
@ -140,10 +140,10 @@ dependencies {
wearcontrolWearApp project(path: ':wear', configuration: 'fullRelease')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') {
compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
transitive = true;
}
compile('com.crashlytics.sdk.android:answers:1.3.11@aar') {
compile('com.crashlytics.sdk.android:answers:1.3.12@aar') {
transitive = true;
}
@ -170,14 +170,18 @@ dependencies {
testCompile 'org.json:json:20140107'
testCompile 'org.mockito:mockito-core:2.+'
androidTestCompile 'org.mockito:mockito-core:2.+'
androidTestCompile "com.google.dexmaker:dexmaker:1.2"
androidTestCompile "com.google.dexmaker:dexmaker-mockito:1.2"
compile(name:'android-edittext-validator-v1.3.4-mod', ext:'aar')
compile ('io.socket:socket.io-client:0.8.3') {
androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
compile(name: 'android-edittext-validator-v1.3.4-mod', ext: 'aar')
compile('io.socket:socket.io-client:0.8.3') {
// excluding org.json which is provided by Android
exclude group: 'org.json', module: 'json'
}
compile 'com.google.code.gson:gson:2.4'
compile 'com.google.guava:guava:18.0'
compile ('com.jakewharton:butterknife:8.5.1') {
exclude module: 'support-compat'
}
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
}

View file

@ -17,6 +17,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
<uses-permission-sdk-23 android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<!-- To receive data from xdrip. -->
<uses-permission android:name="com.eveningoutpost.dexdrip.permissions.RECEIVE_BG_ESTIMATE" />
@ -74,6 +75,8 @@
<action android:name="com.eveningoutpost.dexdrip.BgEstimate" />
<!-- Receiver from 640g uploader -->
<action android:name="com.eveningoutpost.dexdrip.NS_EMULATOR" />
<!-- Receiver from glimp -->
<action android:name="it.ct.glicemia.ACTION_GLUCOSE_MEASURED" />
</intent-filter>
</receiver>

View file

@ -1,13 +1,17 @@
package info.nightscout.androidaps;
import android.Manifest;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.PowerManager;
import android.provider.Settings;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewPager;
@ -37,8 +41,10 @@ import info.nightscout.androidaps.tabs.TabPageAdapter;
import info.nightscout.utils.ImportExportPrefs;
import info.nightscout.utils.LocaleHelper;
import info.nightscout.utils.LogDialog;
import info.nightscout.utils.OKDialog;
import info.nightscout.utils.PasswordProtection;
import info.nightscout.utils.SP;
import info.nightscout.utils.ToastUtils;
public class MainActivity extends AppCompatActivity {
private static Logger log = LoggerFactory.getLogger(MainActivity.class);
@ -59,6 +65,7 @@ public class MainActivity extends AppCompatActivity {
askForPermission(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE}, CASE_STORAGE);
}
askForBatteryOptimizationPermission();
if (Config.logFunctionCalls)
log.debug("onCreate");
@ -228,6 +235,37 @@ public class MainActivity extends AppCompatActivity {
askForSMSPermissions();
}
private void askForBatteryOptimizationPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
final String packageName = getPackageName();
final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
if (!pm.isIgnoringBatteryOptimizations(packageName)) {
log.debug("Requesting ignore battery optimization");
OKDialog.show(this, getString(R.string.pleaseallowpermission), String.format(getString(R.string.needwhitelisting), getString(R.string.app_name)), new Runnable() {
@Override
public void run() {
try {
final Intent intent = new Intent();
// ignoring battery optimizations required for constant connection
intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
intent.setData(Uri.parse("package:" + packageName));
startActivity(intent);
} catch (ActivityNotFoundException e) {
final String msg = getString(R.string.batteryoptimalizationerror);
ToastUtils.showToastInUiThread(getApplicationContext(), msg);
log.error(msg);
}
}
});
}
}
}
private synchronized void askForSMSPermissions() {
if (askForSMS) { //only when settings were changed an MainActivity resumes.
askForSMS = false;

View file

@ -19,6 +19,7 @@ import java.util.ArrayList;
import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.Actions.ActionsFragment;
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
import info.nightscout.androidaps.plugins.CircadianPercentageProfile.CircadianPercentageProfileFragment;
@ -38,6 +39,7 @@ import info.nightscout.androidaps.plugins.Overview.OverviewFragment;
import info.nightscout.androidaps.plugins.SafetyFragment.SafetyFragment;
import info.nightscout.androidaps.plugins.SimpleProfile.SimpleProfileFragment;
import info.nightscout.androidaps.plugins.SmsCommunicator.SmsCommunicatorFragment;
import info.nightscout.androidaps.plugins.SourceGlimp.SourceGlimpFragment;
import info.nightscout.androidaps.plugins.SourceMM640g.SourceMM640gFragment;
import info.nightscout.androidaps.plugins.SourceNSClient.SourceNSClientFragment;
import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripFragment;
@ -104,6 +106,7 @@ public class MainApp extends Application {
pluginsList.add(SourceXdripFragment.getPlugin());
pluginsList.add(SourceNSClientFragment.getPlugin());
pluginsList.add(SourceMM640gFragment.getPlugin());
pluginsList.add(SourceGlimpFragment.getPlugin());
if (Config.SMSCOMMUNICATORENABLED) pluginsList.add(SmsCommunicatorFragment.getPlugin());
if (Config.WEAR) pluginsList.add(WearFragment.getPlugin(this));
@ -117,6 +120,20 @@ public class MainApp extends Application {
MainApp.getConfigBuilder().uploadAppStart();
startKeepAliveService();
Thread t = new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
}
PumpInterface pump = MainApp.getConfigBuilder();
if (pump != null)
pump.refreshDataFromPump("Initialization");
}
});
t.start();
}
private void startKeepAliveService() {

View file

@ -11,7 +11,6 @@ import android.preference.PreferenceFragment;
import android.preference.PreferenceGroup;
import android.preference.PreferenceManager;
import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventRefreshGui;
import info.nightscout.androidaps.interfaces.PluginBase;
@ -50,14 +49,14 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
updatePrefSummary(myPreferenceFragment.getPreference(key));
}
private static void updatePrefSummary(Preference pref) {
private static void updatePrefSummary(Preference pref) {
if (pref instanceof ListPreference || pref instanceof BluetoothDevicePreference) {
ListPreference listPref = (ListPreference) pref;
pref.setSummary(listPref.getEntry());
}
if (pref instanceof EditTextPreference) {
EditTextPreference editTextPref = (EditTextPreference) pref;
if (pref.getKey().contains("password")|| pref.getKey().contains("secret")) {
if (pref.getKey().contains("password") || pref.getKey().contains("secret")) {
pref.setSummary("******");
} else if (editTextPref.getText() != null && !editTextPref.getText().equals("")) {
((EditTextPreference) pref).setDialogMessage(editTextPref.getDialogMessage());
@ -119,11 +118,11 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
}
VirtualPumpPlugin virtualPumpPlugin = (VirtualPumpPlugin) MainApp.getSpecificPlugin(VirtualPumpPlugin.class);
if (virtualPumpPlugin != null && virtualPumpPlugin.isEnabled(PluginBase.PUMP)) {
addPreferencesFromResource(R.xml.pref_virtualpump);
addPreferencesFromResource(R.xml.pref_virtualpump);
}
NSClientInternalPlugin nsClientInternalPlugin = (NSClientInternalPlugin) MainApp.getSpecificPlugin(NSClientInternalPlugin.class);
if (nsClientInternalPlugin != null && nsClientInternalPlugin.isEnabled(PluginBase.GENERAL)) {
addPreferencesFromResource(R.xml.pref_nsclientinternal);
addPreferencesFromResource(R.xml.pref_nsclientinternal);
}
if (Config.SMSCOMMUNICATORENABLED)
addPreferencesFromResource(R.xml.pref_smscommunicator);
@ -131,7 +130,6 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
addPreferencesFromResource(R.xml.pref_others);
addPreferencesFromResource(R.xml.pref_advanced);
}
initSummary(getPreferenceScreen());
if (Config.WEAR) {
WearPlugin wearPlugin = (WearPlugin) MainApp.getSpecificPlugin(WearPlugin.class);
@ -139,9 +137,11 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
addPreferencesFromResource(R.xml.pref_wear);
}
}
initSummary(getPreferenceScreen());
}
public Preference getPreference (String key) {
public Preference getPreference(String key) {
return findPreference(key);
}
}

View file

@ -44,6 +44,7 @@ import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotificati
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.SmsCommunicator.SmsCommunicatorPlugin;
import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventNewSMS;
import info.nightscout.androidaps.plugins.SourceGlimp.SourceGlimpPlugin;
import info.nightscout.androidaps.plugins.SourceMM640g.SourceMM640gPlugin;
import info.nightscout.androidaps.plugins.SourceNSClient.SourceNSClientPlugin;
import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripPlugin;
@ -59,6 +60,7 @@ public class DataService extends IntentService {
boolean xDripEnabled = false;
boolean nsClientEnabled = true;
boolean mm640gEnabled = false;
boolean glimpEnabled = false;
public DataService() {
super("DataService");
@ -74,14 +76,22 @@ public class DataService extends IntentService {
xDripEnabled = true;
nsClientEnabled = false;
mm640gEnabled = false;
glimpEnabled = false;
} else if (ConfigBuilderPlugin.getActiveBgSource().getClass().equals(SourceNSClientPlugin.class)) {
xDripEnabled = false;
nsClientEnabled = true;
mm640gEnabled = false;
glimpEnabled = false;
} else if (ConfigBuilderPlugin.getActiveBgSource().getClass().equals(SourceMM640gPlugin.class)) {
xDripEnabled = false;
nsClientEnabled = false;
mm640gEnabled = true;
glimpEnabled = false;
} else if (ConfigBuilderPlugin.getActiveBgSource().getClass().equals(SourceGlimpPlugin.class)) {
xDripEnabled = false;
nsClientEnabled = false;
mm640gEnabled = false;
glimpEnabled = true;
}
boolean isNSProfile = ConfigBuilderPlugin.getActiveProfile().getClass().equals(NSProfilePlugin.class);
@ -99,6 +109,10 @@ public class DataService extends IntentService {
if (mm640gEnabled) {
handleNewDataFromMM640g(intent);
}
} else if (Intents.GLIMP_BG.equals(action)) {
if (glimpEnabled) {
handleNewDataFromGlimp(intent);
}
} else if (Intents.ACTION_NEW_SGV.equals(action)) {
// always handle SGV if NS-Client is the source
if (nsClientEnabled) {
@ -185,6 +199,30 @@ public class DataService extends IntentService {
MainApp.bus().post(new EventNewBG());
}
private void handleNewDataFromGlimp(Intent intent) {
Bundle bundle = intent.getExtras();
if (bundle == null) return;
BgReading bgReading = new BgReading();
bgReading.value = bundle.getDouble("mySGV");
bgReading.direction = bundle.getString("myTrend");
bgReading.battery_level = bundle.getInt("myBatLvl");
bgReading.timeIndex = bundle.getLong("myTimestamp");
bgReading.raw = 0;
if (Config.logIncommingBG)
log.debug(bundle.toString());
log.debug("GLIMP BG " + bgReading.toString());
try {
MainApp.getDbHelper().getDaoBgReadings().createIfNotExists(bgReading);
} catch (SQLException e) {
e.printStackTrace();
}
MainApp.bus().post(new EventNewBG());
}
private void handleNewDataFromMM640g(Intent intent) {
Bundle bundle = intent.getExtras();
if (bundle == null) return;

View file

@ -35,4 +35,6 @@ public interface Intents {
String NS_EMULATOR = "com.eveningoutpost.dexdrip.NS_EMULATOR";
String ACTION_REMOTE_CALIBRATION = "com.eveningoutpost.dexdrip.NewCalibration";
String GLIMP_BG = "it.ct.glicemia.ACTION_GLUCOSE_MEASURED";
}

View file

@ -73,7 +73,7 @@ public class GlucoseStatus {
List<BgReading> data = MainApp.getDbHelper().getBgreadingsDataFromTime(fromtime, false);
int sizeRecords = data.size();
if (sizeRecords < 4 || data.get(0).timeIndex < new Date().getTime() - 7 * 60 * 1000L) {
if (sizeRecords < 1 || data.get(0).timeIndex < new Date().getTime() - 7 * 60 * 1000L) {
return null;
}
@ -81,6 +81,16 @@ public class GlucoseStatus {
long now_date = now.timeIndex;
double change;
if (sizeRecords < 2) {
GlucoseStatus status = new GlucoseStatus();
status.glucose = now.value;
status.short_avgdelta = 0d;
status.delta = 0d;
status.long_avgdelta = 0d;
status.avgdelta = 0d; // for OpenAPS MA
return status.round();
}
ArrayList<Double> last_deltas = new ArrayList<Double>();
ArrayList<Double> short_deltas = new ArrayList<Double>();
ArrayList<Double> long_deltas = new ArrayList<Double>();
@ -121,7 +131,7 @@ public class GlucoseStatus {
status.short_avgdelta = average(short_deltas);
if(prefs.getBoolean("always_use_shortavg",false) || last_deltas.isEmpty()){
if (prefs.getBoolean("always_use_shortavg", false) || last_deltas.isEmpty()) {
status.delta = status.short_avgdelta;
} else {
status.delta = average(last_deltas);

View file

@ -47,7 +47,7 @@ public class BgReading implements DataPointInterface {
public BgReading(NSSgv sgv) {
timeIndex = sgv.getMills();
value = sgv.getMgdl();
raw = sgv.getFiltered();
raw = sgv.getFiltered() != null ? sgv.getFiltered() : value;
direction = sgv.getDirection();
}

View file

@ -59,11 +59,15 @@ public class TempBasal {
if (profile == null)
return result;
Double basalRate = profile.getBasal(profile.secondsFromMidnight(time));
if (basalRate == null)
return result;
int realDuration = getRealDuration();
if (realDuration > 0) {
Double netBasalRate = 0d;
Double basalRate = profile.getBasal(profile.secondsFromMidnight(time));
Double tempBolusSize = 0.05;
if (isExtended) {

View file

@ -54,7 +54,7 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
public static HandlerThread mHandlerThread;
public NewTempBasalDialog() {
mHandlerThread = new HandlerThread(NewExtendedBolusDialog.class.getSimpleName());
mHandlerThread = new HandlerThread(NewTempBasalDialog.class.getSimpleName());
mHandlerThread.start();
this.mHandler = new Handler(mHandlerThread.getLooper());
}

View file

@ -59,6 +59,7 @@ import info.nightscout.androidaps.plugins.NSClientInternal.data.DbLogger;
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSProfile;
import info.nightscout.utils.BatteryLevel;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.SP;
/**
* Created by mike on 05.08.2016.
@ -1025,7 +1026,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
deviceStatus.device = "openaps://" + deviceID();
JSONObject pumpstatus = getJSONStatus();
if (pumpstatus != null) {
deviceStatus.pump = getJSONStatus();
deviceStatus.pump = pumpstatus;
}
}
@ -1128,24 +1129,26 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
}
public void uploadAppStart() {
Context context = MainApp.instance().getApplicationContext();
Bundle bundle = new Bundle();
bundle.putString("action", "dbAdd");
bundle.putString("collection", "treatments");
JSONObject data = new JSONObject();
try {
data.put("eventType", "Note");
data.put("created_at", DateUtil.toISOString(new Date()));
data.put("notes", MainApp.sResources.getString(R.string.androidaps_start));
} catch (JSONException e) {
e.printStackTrace();
if (SP.getBoolean(R.string.key_ns_logappstartedevent, true)) {
Context context = MainApp.instance().getApplicationContext();
Bundle bundle = new Bundle();
bundle.putString("action", "dbAdd");
bundle.putString("collection", "treatments");
JSONObject data = new JSONObject();
try {
data.put("eventType", "Note");
data.put("created_at", DateUtil.toISOString(new Date()));
data.put("notes", MainApp.sResources.getString(R.string.androidaps_start));
} catch (JSONException e) {
e.printStackTrace();
}
bundle.putString("data", data.toString());
Intent intent = new Intent(Intents.ACTION_DATABASE);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
DbLogger.dbAdd(intent, data.toString(), ConfigBuilderPlugin.class);
}
bundle.putString("data", data.toString());
Intent intent = new Intent(Intents.ACTION_DATABASE);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
DbLogger.dbAdd(intent, data.toString(), ConfigBuilderPlugin.class);
}
}

View file

@ -276,6 +276,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
for (int h = 0; h < basalValues; h++) {
Double pumpValue = pump.pumpProfiles[pump.activeProfile][h];
Double profileValue = profile.getBasal(h * basalIncrement);
if (profileValue == null) return true;
if (Math.abs(pumpValue - profileValue) > getPumpDescription().basalStep) {
log.debug("Diff found. Hour: " + h + " Pump: " + pumpValue + " Profile: " + profileValue);
return false;

View file

@ -215,7 +215,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
@Override
public boolean isSuspended() {
return false;
return getDanaRPump().pumpSuspended;
}
@Override

View file

@ -43,6 +43,8 @@ public class DanaRKoreanPump {
public int protocol;
public int productCode;
public boolean pumpSuspended;
public boolean isConfigUD;
public boolean isExtendedBolusEnabled;
public boolean isEasyModeEnabled;

View file

@ -26,13 +26,13 @@ public class MsgInitConnStatusBasic extends MessageBase {
return;
}
DanaRKoreanPump pump = DanaRKoreanPlugin.getDanaRPump();
int isStatusSuspendOn = intFromBuff(bytes, 0, 1);
pump.pumpSuspended = intFromBuff(bytes, 0, 1) == 1;
int isUtilityEnable = intFromBuff(bytes, 1, 1);
pump.isEasyModeEnabled = intFromBuff(bytes, 2, 1) == 1;
int easyUIMode = intFromBuff(bytes, 3, 1);
pump.password = intFromBuff(bytes, 4, 2) ^ 0x3463;
if (Config.logDanaMessageDetail) {
log.debug("isStatusSuspendOn: " + isStatusSuspendOn);
log.debug("isStatusSuspendOn: " + pump.pumpSuspended);
log.debug("isUtilityEnable: " + isUtilityEnable);
log.debug("Is EasyUI Enabled: " + pump.isEasyModeEnabled);
log.debug("easyUIMode: " + easyUIMode);

View file

@ -32,6 +32,7 @@ import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Loop.events.EventLoopSetLastRunGui;
import info.nightscout.androidaps.plugins.Loop.events.EventLoopUpdateGui;
import info.nightscout.androidaps.plugins.Loop.events.EventNewOpenLoopNotification;
import info.nightscout.utils.SP;
/**
* Created by mike on 05.08.2016.
@ -45,6 +46,9 @@ public class LoopPlugin implements PluginBase {
private boolean fragmentEnabled = false;
private boolean fragmentVisible = true;
private long loopSuspendedTill = 0L; // end of manual loop suspend
private boolean isSuperBolus = false;
public class LastRun {
public APSResult request = null;
public APSResult constraintsProcessed = null;
@ -64,6 +68,8 @@ public class LoopPlugin implements PluginBase {
sHandler = new Handler(sHandlerThread.getLooper());
}
MainApp.bus().register(this);
loopSuspendedTill = SP.getLong("loopSuspendedTill", 0L);
isSuperBolus = SP.getBoolean("isSuperBolus", false);
}
@Override
@ -127,12 +133,72 @@ public class LoopPlugin implements PluginBase {
invoke("EventNewBG", true);
}
public long suspendedTo() {
return loopSuspendedTill;
}
public void suspendTo(long endTime) {
loopSuspendedTill = endTime;
isSuperBolus = false;
SP.putLong("loopSuspendedTill", loopSuspendedTill);
}
public void superBolusTo(long endTime) {
loopSuspendedTill = endTime;
isSuperBolus = true;
SP.putLong("loopSuspendedTill", loopSuspendedTill);
}
public int minutesToEndOfSuspend() {
if (loopSuspendedTill == 0)
return 0;
long now = new Date().getTime();
long msecDiff = loopSuspendedTill - now;
if (loopSuspendedTill <= now) { // time exceeded
suspendTo(0L);
return 0;
}
return (int) (msecDiff / 60d / 1000d);
}
public boolean isSuspended() {
if (loopSuspendedTill == 0)
return false;
long now = new Date().getTime();
if (loopSuspendedTill <= now) { // time exceeded
suspendTo(0L);
return false;
}
return true;
}
public boolean isSuperBolus() {
if (loopSuspendedTill == 0)
return false;
long now = new Date().getTime();
if (loopSuspendedTill <= now) { // time exceeded
suspendTo(0L);
return false;
}
return isSuperBolus;
}
public void invoke(String initiator, boolean allowNotification) {
try {
if (Config.logFunctionCalls)
log.debug("invoke");
ConstraintsInterface constraintsInterface = MainApp.getConfigBuilder();
if (!constraintsInterface.isLoopEnabled()) {
log.debug(MainApp.sResources.getString(R.string.loopdisabled));
MainApp.bus().post(new EventLoopSetLastRunGui(MainApp.sResources.getString(R.string.loopdisabled)));
return;
}
@ -142,6 +208,18 @@ public class LoopPlugin implements PluginBase {
if (configBuilder == null || !isEnabled(PluginBase.LOOP))
return;
if (isSuspended()) {
log.debug(MainApp.sResources.getString(R.string.loopsuspended));
MainApp.bus().post(new EventLoopSetLastRunGui(MainApp.sResources.getString(R.string.loopsuspended)));
return;
}
if (configBuilder.isSuspended()) {
log.debug(MainApp.sResources.getString(R.string.pumpsuspended));
MainApp.bus().post(new EventLoopSetLastRunGui(MainApp.sResources.getString(R.string.pumpsuspended)));
return;
}
// Check if pump info is loaded
if (configBuilder.getBaseBasalRate() < 0.01d) return;

View file

@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
@ -37,12 +38,13 @@ import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientS
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientUpdateGUI;
import info.nightscout.androidaps.plugins.NSClientInternal.services.NSClientService;
import info.nightscout.utils.SP;
import info.nightscout.utils.ToastUtils;
public class NSClientInternalPlugin implements PluginBase {
private static Logger log = LoggerFactory.getLogger(NSClientInternalPlugin.class);
boolean fragmentEnabled = false;
boolean fragmentVisible = false;
boolean fragmentEnabled = true;
boolean fragmentVisible = true;
static public Handler handler;
static private HandlerThread handlerThread;
@ -188,12 +190,16 @@ public class NSClientInternalPlugin implements PluginBase {
}
private void updateLog() {
Spanned newTextLog = Html.fromHtml("");
for (EventNSClientNewLog log : listLog) {
newTextLog = (Spanned) TextUtils.concat(newTextLog, log.toHtml());
try {
Spanned newTextLog = Html.fromHtml("");
for (EventNSClientNewLog log : listLog) {
newTextLog = (Spanned) TextUtils.concat(newTextLog, log.toHtml());
}
textLog = newTextLog;
MainApp.bus().post(new EventNSClientUpdateGUI());
} catch (OutOfMemoryError e) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), "Out of memory!\nStop using this phone !!!", R.raw.error);
}
textLog = newTextLog;
MainApp.bus().post(new EventNSClientUpdateGUI());
}
public void resend(String reason) {

View file

@ -40,66 +40,78 @@ public class UploadQueue {
if (NSClientService.handler == null) {
Context context = MainApp.instance();
context.startService(new Intent(context, NSClientService.class));
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
}
}
}
public static void add(final DbRequest dbr) {
startService();
NSClientService.handler.post(new Runnable() {
@Override
public void run() {
log.debug("QUEUE adding: " + dbr.data);
MainApp.getDbHelper().create(dbr);
NSClientInternalPlugin plugin = (NSClientInternalPlugin) MainApp.getSpecificPlugin(NSClientInternalPlugin.class);
if (plugin != null) {
plugin.resend("newdata");
if (NSClientService.handler != null) {
NSClientService.handler.post(new Runnable() {
@Override
public void run() {
log.debug("QUEUE adding: " + dbr.data);
MainApp.getDbHelper().create(dbr);
NSClientInternalPlugin plugin = (NSClientInternalPlugin) MainApp.getSpecificPlugin(NSClientInternalPlugin.class);
if (plugin != null) {
plugin.resend("newdata");
}
}
}
});
});
}
}
public static void clearQueue() {
startService();
NSClientService.handler.post(new Runnable() {
@Override
public void run() {
log.debug("QUEUE ClearQueue");
MainApp.getDbHelper().deleteAllDbRequests();
log.debug(status());
}
});
if (NSClientService.handler != null) {
NSClientService.handler.post(new Runnable() {
@Override
public void run() {
log.debug("QUEUE ClearQueue");
MainApp.getDbHelper().deleteAllDbRequests();
log.debug(status());
}
});
}
}
public static void removeID(final JSONObject record) {
startService();
NSClientService.handler.post(new Runnable() {
@Override
public void run() {
try {
String id;
if (record.has("NSCLIENT_ID")) {
id = record.getString("NSCLIENT_ID");
} else {
return;
if (NSClientService.handler != null) {
NSClientService.handler.post(new Runnable() {
@Override
public void run() {
try {
String id;
if (record.has("NSCLIENT_ID")) {
id = record.getString("NSCLIENT_ID");
} else {
return;
}
if (MainApp.getDbHelper().deleteDbRequest(id) == 1) {
log.debug("Removed item from UploadQueue. " + UploadQueue.status());
}
} catch (JSONException e) {
e.printStackTrace();
}
if (MainApp.getDbHelper().deleteDbRequest(id) == 1) {
log.debug("Removed item from UploadQueue. " + UploadQueue.status());
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
});
}
}
public static void removeID(final String action, final String _id) {
startService();
NSClientService.handler.post(new Runnable() {
@Override
public void run() {
MainApp.getDbHelper().deleteDbRequestbyMongoId(action, _id);
}
});
if (NSClientService.handler != null) {
NSClientService.handler.post(new Runnable() {
@Override
public void run() {
MainApp.getDbHelper().deleteDbRequestbyMongoId(action, _id);
}
});
}
}
public String textList() {

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.NSClientInternal.data;
import android.support.annotation.Nullable;
import com.crashlytics.android.Crashlytics;
import org.json.JSONArray;
@ -178,6 +180,7 @@ public class NSProfile {
return TimeZone.getDefault();
}
@Nullable
public Double getValueToTime(JSONArray array, Integer timeAsSeconds) {
Double lastValue = null;
@ -221,10 +224,12 @@ public class NSProfile {
return retValue;
}
@Nullable
public Double getIsf(Integer timeAsSeconds) {
return getIsf(getDefaultProfile(), timeAsSeconds);
}
@Nullable
public Double getIsf(JSONObject profile, Integer timeAsSeconds) {
if (profile != null) {
try {
@ -251,10 +256,12 @@ public class NSProfile {
return "";
}
@Nullable
public Double getIc(Integer timeAsSeconds) {
return getIc(getDefaultProfile(), timeAsSeconds);
}
@Nullable
public Double getIc(JSONObject profile, Integer timeAsSeconds) {
if (profile != null) {
try {
@ -281,10 +288,12 @@ public class NSProfile {
return "";
}
@Nullable
public Double getBasal(Integer timeAsSeconds) {
return getBasal(getDefaultProfile(), timeAsSeconds);
}
@Nullable
public Double getBasal(JSONObject profile, Integer timeAsSeconds) {
if (profile != null) {
try {
@ -339,10 +348,12 @@ public class NSProfile {
return "";
}
@Nullable
public Double getTargetLow(Integer timeAsSeconds) {
return getTargetLow(getDefaultProfile(), timeAsSeconds);
}
@Nullable
public Double getTargetLow(JSONObject profile, Integer timeAsSeconds) {
if (profile != null) {
try {
@ -354,10 +365,12 @@ public class NSProfile {
return 0D;
}
@Nullable
public Double getTargetHigh(Integer timeAsSeconds) {
return getTargetHigh(getDefaultProfile(), timeAsSeconds);
}
@Nullable
public Double getTargetHigh(JSONObject profile, Integer timeAsSeconds) {
if (profile != null) {
try {

View file

@ -153,7 +153,7 @@ public class ObjectivesPlugin implements PluginBase, ConstraintsInterface {
MainApp.sResources.getString(R.string.objectives_0_objective),
MainApp.sResources.getString(R.string.objectives_0_gate),
new Date(0),
1, // 1 day
0, // 0 day
new Date(0)));
objectives.add(new Objective(1,
MainApp.sResources.getString(R.string.objectives_1_objective),

View file

@ -34,6 +34,7 @@ public class Autosens {
for (int i = 1; i < glucose_data.size(); ++i) {
long bgTime = glucose_data.get(i).getTimeIndex();
long lastbgTime = glucose_data.get(i - 1).getTimeIndex();
//log.error("Processing " + i + ": " + new Date(bgTime).toString() + " " + glucose_data.get(i).value + " Previous: " + new Date(lastbgTime).toString() + " " + glucose_data.get(i - 1).value);
if (glucose_data.get(i).value < 39 || glucose_data.get(i - 1).value < 39) {
continue;
}
@ -46,29 +47,38 @@ public class Autosens {
//console.error(elapsed_minutes);
long nextbgTime;
while (elapsed_minutes > 5) {
nextbgTime = lastbgTime + 5 * 60 * 1000;
nextbgTime = lastbgTime - 5 * 60 * 1000;
j++;
BgReading newBgreading = new BgReading();
newBgreading.timeIndex = nextbgTime;
double gapDelta = glucose_data.get(i).value - lastbg;
//console.error(gapDelta, lastbg, elapsed_minutes);
double nextbg = lastbg + (5 / elapsed_minutes * gapDelta);
double nextbg = lastbg + (5d / elapsed_minutes * gapDelta);
newBgreading.value = Math.round(nextbg);
//console.error("Interpolated", bucketed_data[j]);
bucketed_data.add(newBgreading);
//log.error("******************************************************************************************************* Adding:" + new Date(newBgreading.timeIndex).toString() + " " + newBgreading.value);
elapsed_minutes = elapsed_minutes - 5;
lastbg = nextbg;
lastbgTime = nextbgTime;
}
j++;
BgReading newBgreading = new BgReading();
newBgreading.value = glucose_data.get(i).value;
newBgreading.timeIndex = bgTime;
bucketed_data.add(newBgreading);
//log.error("******************************************************************************************************* Copying:" + new Date(newBgreading.timeIndex).toString() + " " + newBgreading.value);
} else if (Math.abs(elapsed_minutes) > 2) {
j++;
BgReading newBgreading = new BgReading();
newBgreading.value = glucose_data.get(i).value;
newBgreading.timeIndex = bgTime;
bucketed_data.add(newBgreading);
//log.error("******************************************************************************************************* Copying:" + new Date(newBgreading.timeIndex).toString() + " " + newBgreading.value);
} else {
bucketed_data.get(j).value = (bucketed_data.get(j).value + glucose_data.get(i).value) / 2;
//log.error("***** Average");
}
}
//console.error(bucketed_data);
@ -81,6 +91,12 @@ public class Autosens {
long bgTime = bucketed_data.get(i).timeIndex;
int secondsFromMidnight = NSProfile.secondsFromMidnight(new Date(bgTime));
String hour = "";
//log.debug(new Date(bgTime).toString());
if (secondsFromMidnight % 3600 < 2.5 * 60 || secondsFromMidnight % 3600 > 57.5 * 60) {
hour += "(" + Math.round(secondsFromMidnight / 3600d) + ")";
}
double sens = NSProfile.toMgdl(profile.getIsf(secondsFromMidnight), profile.getUnits());
//console.error(bgTime , bucketed_data[i].glucose);
@ -122,6 +138,7 @@ public class Autosens {
pastSensitivity += ">";
//console.error(bgTime);
}
pastSensitivity += hour;
//log.debug("TIME: " + new Date(bgTime).toString() + " BG: " + bg + " SENS: " + sens + " DELTA: " + delta + " AVGDELTA: " + avgDelta + " IOB: " + iob.iob + " ACTIVITY: " + iob.activity + " BGI: " + bgi + " DEVIATION: " + deviation);
// if bgTime is more recent than mealTime

View file

@ -35,14 +35,16 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis
PlusMinusEditText bgText;
TextView unitsView;
Context parentContext;
Context context;
public CalibrationDialog() {
// Required empty public constructor
}
public void setContext(Context context) {
parentContext = context;
@Override
public void onAttach(Context context) {
super.onAttach(context);
this.context = context;
}
@Override
@ -58,13 +60,18 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
Double bg = profile != null ? NSProfile.fromMgdlToUnits(GlucoseStatus.getGlucoseStatusData() != null ? GlucoseStatus.getGlucoseStatusData().glucose : 0d, profile.getUnits()) : 0d;
if (profile.getUnits().equals(Constants.MMOL))
String units = Constants.MGDL;
if (profile != null)
units = profile.getUnits();
if (units.equals(Constants.MMOL))
bgText = new PlusMinusEditText(view, R.id.overview_calibration_bg, R.id.overview_calibration_bg_plus, R.id.overview_calibration_bg_minus, bg, 0d, 30d, 0.1d, new DecimalFormat("0.0"), false);
else
bgText = new PlusMinusEditText(view, R.id.overview_calibration_bg, R.id.overview_calibration_bg_plus, R.id.overview_calibration_bg_minus, bg, 0d, 500d, 1d, new DecimalFormat("0"), false);
unitsView = (TextView) view.findViewById(R.id.overview_calibration_units);
unitsView.setText(profile.getUnits());
unitsView.setText(units);
return view;
}
@ -74,7 +81,7 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis
switch (view.getId()) {
case R.id.overview_calibration_okbutton:
final Double bg = bgText.getValue();
XdripCalibrations.confirmAndSendCalibration(bg, parentContext);
XdripCalibrations.confirmAndSendCalibration(bg, context);
dismiss();
Answers.getInstance().logCustom(new CustomEvent("Calibration"));
break;

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.Overview.Dialogs;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
@ -21,32 +22,49 @@ import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Text;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnCheckedChanged;
import butterknife.OnClick;
import butterknife.OnItemSelected;
import butterknife.OnTextChanged;
import butterknife.Unbinder;
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.data.PumpEnactResult;
import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.events.EventNewBG;
import info.nightscout.androidaps.events.EventRefreshGui;
import info.nightscout.androidaps.interfaces.TempBasalsInterface;
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.plugins.Loop.APSResult;
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSProfile;
import info.nightscout.androidaps.plugins.OpenAPSAMA.DetermineBasalResultAMA;
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
import info.nightscout.utils.BolusWizard;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
@ -54,48 +72,149 @@ import info.nightscout.utils.PlusMinusEditText;
import info.nightscout.utils.SafeParse;
import info.nightscout.utils.ToastUtils;
public class WizardDialog extends DialogFragment implements OnClickListener {
import static butterknife.OnItemSelected.Callback.NOTHING_SELECTED;
public class WizardDialog extends DialogFragment {
private static Logger log = LoggerFactory.getLogger(WizardDialog.class);
@BindView(R.id.treatments_wizard_deliverButton)
Button wizardDialogDeliverButton;
@BindView(R.id.treatments_wizard_correctioninput)
TextView correctionInput;
@BindView(R.id.treatments_wizard_carbsinput)
TextView carbsInput;
@BindView(R.id.treatments_wizard_bginput)
TextView bgInput;
TextView bg, bgInsulin, bgUnits;
@BindView(R.id.treatments_wizard_bg)
TextView bg;
@BindView(R.id.treatments_wizard_bginsulin)
TextView bgInsulin;
@BindView(R.id.treatments_wizard_bgunits)
TextView bgUnits;
@BindView(R.id.treatments_wizard_bgcheckbox)
CheckBox bgCheckbox;
TextView carbs, carbsInsulin;
@BindView(R.id.treatments_wizard_carbs)
TextView carbs;
@BindView(R.id.treatments_wizard_carbsinsulin)
TextView carbsInsulin;
@BindView(R.id.treatments_wizard_bolusiobinsulin)
TextView bolusIobInsulin;
@BindView(R.id.treatments_wizard_basaliobinsulin)
TextView basalIobInsulin;
@BindView(R.id.treatments_wizard_bolusiobcheckbox)
CheckBox bolusIobCheckbox;
@BindView(R.id.treatments_wizard_basaliobcheckbox)
CheckBox basalIobCheckbox;
@BindView(R.id.treatments_wizard_correctioninsulin)
TextView correctionInsulin;
TextView total, totalInsulin;
@BindView(R.id.treatments_wizard_total)
TextView total;
@BindView(R.id.treatments_wizard_totalinsulin)
TextView totalInsulin;
@BindView(R.id.treatments_wizard_carbtimeinput)
EditText carbTimeEdit;
@BindView(R.id.treatments_wizard_profile)
Spinner profileSpinner;
@BindView(R.id.treatments_wizard_sbcheckbox)
CheckBox superbolusCheckbox;
@BindView(R.id.treatments_wizard_sb)
TextView superbolus;
@BindView(R.id.treatments_wizard_sbinsulin)
TextView superbolusInsulin;
@BindView(R.id.treatments_wizard_bgtrendcheckbox)
CheckBox bgtrendCheckbox;
@BindView(R.id.treatments_wizard_bgtrend)
TextView bgTrend;
@BindView(R.id.treatments_wizard_bgtrendinsulin)
TextView bgTrendInsulin;
@BindView(R.id.treatments_wizard_cob_layout)
LinearLayout cobLayout;
@BindView(R.id.treatments_wizard_cobcheckbox)
CheckBox cobCheckbox;
@BindView(R.id.treatments_wizard_cob)
TextView cob;
@BindView(R.id.treatments_wizard_cobinsulin)
TextView cobInsulin;
PlusMinusEditText editBg;
PlusMinusEditText editCarbs;
PlusMinusEditText editCorr;
PlusMinusEditText editCarbTime;
private Unbinder unbinder;
Integer calculatedCarbs = 0;
Double calculatedTotalInsulin = 0d;
JSONObject boluscalcJSON;
boolean cobAvailable = false;
Handler mHandler;
public static HandlerThread mHandlerThread;
Context parentContext;
Context context;
public WizardDialog() {
super();
mHandlerThread = new HandlerThread(WizardDialog.class.getSimpleName());
mHandlerThread.start();
mHandler = new Handler(mHandlerThread.getLooper());
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
this.context = context;
}
public void setContext(Context context) {
parentContext = context;
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
}
@Override
public void onResume() {
super.onResume();
if (getDialog() != null)
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
MainApp.bus().register(this);
}
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Subscribe
public void onStatusEvent(final EventOpenAPSUpdateGui e) {
Activity activity = getActivity();
if (activity != null)
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (ConfigBuilderPlugin.getActiveAPS() instanceof OpenAPSAMAPlugin && ConfigBuilderPlugin.getActiveAPS().getLastAPSResult() != null && ConfigBuilderPlugin.getActiveAPS().getLastAPSRun().after(new Date(new Date().getTime() - 11 * 60 * 1000L))) {
cobLayout.setVisibility(View.VISIBLE);
cobAvailable = true;
} else {
cobLayout.setVisibility(View.GONE);
cobAvailable = false;
}
calculateInsulin();
}
});
}
@Subscribe
public void onStatusEvent(final EventNewBG e) {
Activity activity = getActivity();
if (activity != null)
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
calculateInsulin();
}
});
}
final private TextWatcher textWatcher = new TextWatcher() {
@ -113,67 +232,20 @@ public class WizardDialog extends DialogFragment implements OnClickListener {
}
};
final CompoundButton.OnCheckedChangeListener onCheckedChangeListener = new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
calculateInsulin();
}
};
final AdapterView.OnItemSelectedListener onItemSelectedListener = new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
calculateInsulin();
wizardDialogDeliverButton.setVisibility(View.VISIBLE);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
ToastUtils.showToastInUiThread(parentContext, MainApp.sResources.getString(R.string.noprofileselected));
wizardDialogDeliverButton.setVisibility(View.GONE);
}
};
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.overview_wizard_dialog, null, false);
wizardDialogDeliverButton = (Button) view.findViewById(R.id.treatments_wizard_deliverButton);
wizardDialogDeliverButton.setOnClickListener(this);
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
correctionInput = (TextView) view.findViewById(R.id.treatments_wizard_correctioninput);
carbsInput = (TextView) view.findViewById(R.id.treatments_wizard_carbsinput);
bgInput = (TextView) view.findViewById(R.id.treatments_wizard_bginput);
unbinder = ButterKnife.bind(this, view);
correctionInput.addTextChangedListener(textWatcher);
carbsInput.addTextChangedListener(textWatcher);
bgInput.addTextChangedListener(textWatcher);
bg = (TextView) view.findViewById(R.id.treatments_wizard_bg);
bgInsulin = (TextView) view.findViewById(R.id.treatments_wizard_bginsulin);
bgUnits = (TextView) view.findViewById(R.id.treatments_wizard_bgunits);
bgCheckbox = (CheckBox) view.findViewById(R.id.treatments_wizard_bgcheckbox);
carbs = (TextView) view.findViewById(R.id.treatments_wizard_carbs);
carbsInsulin = (TextView) view.findViewById(R.id.treatments_wizard_carbsinsulin);
bolusIobInsulin = (TextView) view.findViewById(R.id.treatments_wizard_bolusiobinsulin);
basalIobInsulin = (TextView) view.findViewById(R.id.treatments_wizard_basaliobinsulin);
bolusIobCheckbox = (CheckBox) view.findViewById(R.id.treatments_wizard_bolusiobcheckbox);
basalIobCheckbox = (CheckBox) view.findViewById(R.id.treatments_wizard_basaliobcheckbox);
correctionInsulin = (TextView) view.findViewById(R.id.treatments_wizard_correctioninsulin);
total = (TextView) view.findViewById(R.id.treatments_wizard_total);
totalInsulin = (TextView) view.findViewById(R.id.treatments_wizard_totalinsulin);
carbTimeEdit = (EditText) view.findViewById(R.id.treatments_wizard_carbtimeinput);
profileSpinner = (Spinner) view.findViewById(R.id.treatments_wizard_profile);
bgCheckbox.setOnCheckedChangeListener(onCheckedChangeListener);
basalIobCheckbox.setOnCheckedChangeListener(onCheckedChangeListener);
bolusIobCheckbox.setOnCheckedChangeListener(onCheckedChangeListener);
profileSpinner.setOnItemSelectedListener(onItemSelectedListener);
Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
Double maxCorrection = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit);
@ -186,75 +258,102 @@ public class WizardDialog extends DialogFragment implements OnClickListener {
return view;
}
@Override
@OnCheckedChanged({R.id.treatments_wizard_bgcheckbox, R.id.treatments_wizard_bolusiobcheckbox, R.id.treatments_wizard_basaliobcheckbox, R.id.treatments_wizard_sbcheckbox, R.id.treatments_wizard_cobcheckbox, R.id.treatments_wizard_bgtrendcheckbox})
public void checkboxToggled(boolean isChecked) {
calculateInsulin();
}
@OnItemSelected(R.id.treatments_wizard_profile)
public void profileSelected(int position) {
calculateInsulin();
wizardDialogDeliverButton.setVisibility(View.VISIBLE);
}
@OnItemSelected(value = R.id.treatments_wizard_profile,
callback = NOTHING_SELECTED)
public void profileNotSelected() {
ToastUtils.showToastInUiThread(context, MainApp.sResources.getString(R.string.noprofileselected));
wizardDialogDeliverButton.setVisibility(View.GONE);
}
@OnClick(R.id.treatments_wizard_deliverButton)
public void onClick(View view) {
switch (view.getId()) {
case R.id.treatments_wizard_deliverButton:
if (calculatedTotalInsulin > 0d || calculatedCarbs > 0d) {
DecimalFormat formatNumber2decimalplaces = new DecimalFormat("0.00");
String confirmMessage = getString(R.string.entertreatmentquestion);
if (calculatedTotalInsulin > 0d || calculatedCarbs > 0d) {
DecimalFormat formatNumber2decimalplaces = new DecimalFormat("0.00");
String confirmMessage = getString(R.string.entertreatmentquestion);
Double insulinAfterConstraints = MainApp.getConfigBuilder().applyBolusConstraints(calculatedTotalInsulin);
Integer carbsAfterConstraints = MainApp.getConfigBuilder().applyCarbsConstraints(calculatedCarbs);
Double insulinAfterConstraints = MainApp.getConfigBuilder().applyBolusConstraints(calculatedTotalInsulin);
Integer carbsAfterConstraints = MainApp.getConfigBuilder().applyCarbsConstraints(calculatedCarbs);
confirmMessage += "\n" + getString(R.string.bolus) + ": " + formatNumber2decimalplaces.format(insulinAfterConstraints) + "U";
confirmMessage += "\n" + getString(R.string.carbs) + ": " + carbsAfterConstraints + "g";
confirmMessage += "\n" + getString(R.string.bolus) + ": " + formatNumber2decimalplaces.format(insulinAfterConstraints) + "U";
confirmMessage += "\n" + getString(R.string.carbs) + ": " + carbsAfterConstraints + "g";
if (insulinAfterConstraints - calculatedTotalInsulin != 0 || !carbsAfterConstraints.equals(calculatedCarbs)) {
AlertDialog.Builder builder = new AlertDialog.Builder(parentContext);
builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror));
builder.setMessage(getString(R.string.constraints_violation) + "\n" + getString(R.string.changeyourinput));
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
builder.show();
return;
}
if (insulinAfterConstraints - calculatedTotalInsulin != 0 || !carbsAfterConstraints.equals(calculatedCarbs)) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror));
builder.setMessage(getString(R.string.constraints_violation) + "\n" + getString(R.string.changeyourinput));
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
builder.show();
return;
}
final Double finalInsulinAfterConstraints = insulinAfterConstraints;
final Integer finalCarbsAfterConstraints = carbsAfterConstraints;
final Double finalInsulinAfterConstraints = insulinAfterConstraints;
final Integer finalCarbsAfterConstraints = carbsAfterConstraints;
final Double bg = SafeParse.stringToDouble(bgInput.getText().toString());
final int carbTime = SafeParse.stringToInt(carbTimeEdit.getText().toString());
final boolean useSuperBolus = superbolusCheckbox.isChecked();
if (parentContext != null) {
AlertDialog.Builder builder = new AlertDialog.Builder(parentContext);
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
builder.setMessage(confirmMessage);
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
if (finalInsulinAfterConstraints > 0 || finalCarbsAfterConstraints > 0) {
final ConfigBuilderPlugin pump = MainApp.getConfigBuilder();
mHandler.post(new Runnable() {
@Override
public void run() {
PumpEnactResult result = pump.deliverTreatmentFromBolusWizard(
parentContext,
finalInsulinAfterConstraints,
finalCarbsAfterConstraints,
SafeParse.stringToDouble(bgInput.getText().toString()),
"Manual",
SafeParse.stringToInt(carbTimeEdit.getText().toString()),
boluscalcJSON
);
if (!result.success) {
AlertDialog.Builder builder = new AlertDialog.Builder(parentContext);
builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror));
builder.setMessage(result.comment);
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
builder.show();
}
}
});
Answers.getInstance().logCustom(new CustomEvent("Wizard"));
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
builder.setMessage(confirmMessage);
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
if (finalInsulinAfterConstraints > 0 || finalCarbsAfterConstraints > 0) {
final ConfigBuilderPlugin pump = MainApp.getConfigBuilder();
mHandler.post(new Runnable() {
@Override
public void run() {
PumpEnactResult result = pump.deliverTreatmentFromBolusWizard(
context,
finalInsulinAfterConstraints,
finalCarbsAfterConstraints,
bg,
"Manual",
carbTime,
boluscalcJSON
);
if (!result.success) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror));
builder.setMessage(result.comment);
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
builder.show();
}
if (useSuperBolus) {
final LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
result = pump.setTempBasalAbsolute(0d, 120);
if (!result.success) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
builder.setMessage(result.comment);
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
builder.show();
}
if (activeloop != null) {
activeloop.superBolusTo(new Date().getTime() + 2 * 60L * 60 * 1000);
MainApp.bus().post(new EventRefreshGui(false));
}
}
}
});
builder.setNegativeButton(getString(R.string.cancel), null);
builder.show();
dismiss();
} else {
log.error("parentContext == null");
Answers.getInstance().logCustom(new CustomEvent("Wizard"));
}
}
break;
});
builder.setNegativeButton(getString(R.string.cancel), null);
builder.show();
dismiss();
}
}
private void initDialog() {
@ -329,13 +428,14 @@ public class WizardDialog extends DialogFragment implements OnClickListener {
totalInsulin.setText("");
wizardDialogDeliverButton.setVisibility(Button.INVISIBLE);
}
@Override
public void onResume() {
super.onResume();
if (getDialog() != null)
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
// COB only if AMA is selected
if (ConfigBuilderPlugin.getActiveAPS() instanceof OpenAPSAMAPlugin && ConfigBuilderPlugin.getActiveAPS().getLastAPSResult() != null && ConfigBuilderPlugin.getActiveAPS().getLastAPSRun().after(new Date(new Date().getTime() - 11 * 60 * 1000L))) {
cobLayout.setVisibility(View.VISIBLE);
cobAvailable = true;
} else {
cobLayout.setVisibility(View.GONE);
cobAvailable = false;
}
}
private void calculateInsulin() {
@ -370,8 +470,19 @@ public class WizardDialog extends DialogFragment implements OnClickListener {
c_bg = bgCheckbox.isChecked() ? c_bg : 0d;
// COB
Double c_cob = 0d;
if (cobAvailable && cobCheckbox.isChecked()) {
if (ConfigBuilderPlugin.getActiveAPS().getLastAPSResult() != null && ConfigBuilderPlugin.getActiveAPS().getLastAPSRun().after(new Date(new Date().getTime() - 11 * 60 * 1000L))) {
try {
c_cob = SafeParse.stringToDouble(ConfigBuilderPlugin.getActiveAPS().getLastAPSResult().json().getString("COB"));
} catch (JSONException e) {
}
}
}
BolusWizard wizard = new BolusWizard();
wizard.doCalc(specificProfile, carbsAfterConstraint, c_bg, corrAfterConstraint, bolusIobCheckbox.isChecked(), basalIobCheckbox.isChecked());
wizard.doCalc(specificProfile, carbsAfterConstraint, c_cob, c_bg, corrAfterConstraint, bolusIobCheckbox.isChecked(), basalIobCheckbox.isChecked(), superbolusCheckbox.isChecked(), bgtrendCheckbox.isChecked());
bg.setText(c_bg + " ISF: " + DecimalFormatter.to1Decimal(wizard.sens));
bgInsulin.setText(DecimalFormatter.to2Decimal(wizard.insulinFromBG) + "U");
@ -395,6 +506,35 @@ public class WizardDialog extends DialogFragment implements OnClickListener {
calculatedCarbs = carbsAfterConstraint;
// Superbolus
if (superbolusCheckbox.isChecked()) {
superbolus.setText("2h");
} else {
superbolus.setText("");
}
superbolusInsulin.setText(DecimalFormatter.to2Decimal(wizard.insulinFromSuperBolus) + "U");
// Trend
if (bgtrendCheckbox.isChecked()) {
if (wizard.glucoseStatus != null) {
bgTrend.setText((wizard.glucoseStatus.avgdelta > 0 ? "+" : "") + NSProfile.toUnitsString(wizard.glucoseStatus.avgdelta * 3, wizard.glucoseStatus.avgdelta * 3 / 18, profile.getUnits()) + " " + profile.getUnits());
} else {
bgTrend.setText("");
}
} else {
bgTrend.setText("");
}
bgTrendInsulin.setText(DecimalFormatter.to2Decimal(wizard.insulinFromTrend) + "U");
// COB
if (cobAvailable && cobCheckbox.isChecked()) {
cob.setText(DecimalFormatter.to2Decimal(c_cob) + "g IC: " + DecimalFormatter.to1Decimal(wizard.ic));
cobInsulin.setText(DecimalFormatter.to2Decimal(wizard.insulinFromCOB) + "U");
} else {
cob.setText("");
cobInsulin.setText("");
}
if (calculatedTotalInsulin > 0d || calculatedCarbs > 0d) {
String insulinText = calculatedTotalInsulin > 0d ? (DecimalFormatter.to2Decimal(calculatedTotalInsulin) + "U") : "";
String carbsText = calculatedCarbs > 0d ? (DecimalFormatter.to0Decimal(calculatedCarbs) + "g") : "";
@ -421,7 +561,11 @@ public class WizardDialog extends DialogFragment implements OnClickListener {
boluscalcJSON.put("bgdiff", wizard.bgDiff);
boluscalcJSON.put("insulincarbs", wizard.insulinFromCarbs);
boluscalcJSON.put("carbs", c_carbs);
boluscalcJSON.put("cob", c_cob);
boluscalcJSON.put("insulincob", wizard.insulinFromCOB);
boluscalcJSON.put("othercorrection", corrAfterConstraint);
boluscalcJSON.put("insulinsuperbolus", wizard.insulinFromSuperBolus);
boluscalcJSON.put("insulintrend", wizard.insulinFromTrend);
boluscalcJSON.put("insulin", calculatedTotalInsulin);
} catch (JSONException e) {
e.printStackTrace();

View file

@ -18,8 +18,10 @@ import android.support.v7.app.AlertDialog;
import android.support.v7.widget.CardView;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.ContextMenu;
import android.view.HapticFeedbackConstants;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
@ -95,6 +97,7 @@ import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.Round;
import info.nightscout.utils.SP;
import info.nightscout.utils.ToastUtils;
public class OverviewFragment extends Fragment {
@ -216,7 +219,6 @@ public class OverviewFragment extends Fragment {
public void onClick(View view) {
FragmentManager manager = getFragmentManager();
WizardDialog wizardDialog = new WizardDialog();
wizardDialog.setContext(getContext());
wizardDialog.show(manager, "WizardDialog");
}
});
@ -250,7 +252,6 @@ public class OverviewFragment extends Fragment {
public void onClick(View view) {
FragmentManager manager = getFragmentManager();
CalibrationDialog calibrationDialog = new CalibrationDialog();
calibrationDialog.setContext(getContext());
calibrationDialog.show(manager, "CalibrationDialog");
}
});
@ -258,40 +259,42 @@ public class OverviewFragment extends Fragment {
acceptTempButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ConfigBuilderPlugin.getActiveLoop().invoke("Accept temp button", false);
final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun;
if (finalLastRun != null && finalLastRun.lastAPSRun != null && finalLastRun.constraintsProcessed.changeRequested) {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setTitle(getContext().getString(R.string.confirmation));
builder.setMessage(getContext().getString(R.string.setbasalquestion) + "\n" + finalLastRun.constraintsProcessed);
builder.setPositiveButton(getContext().getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
sHandler.post(new Runnable() {
@Override
public void run() {
hideTempRecommendation();
PumpEnactResult applyResult = MainApp.getConfigBuilder().applyAPSRequest(finalLastRun.constraintsProcessed);
if (applyResult.enacted) {
finalLastRun.setByPump = applyResult;
finalLastRun.lastEnact = new Date();
finalLastRun.lastOpenModeAccept = new Date();
MainApp.getConfigBuilder().uploadDeviceStatus();
ObjectivesPlugin objectivesPlugin = (ObjectivesPlugin) MainApp.getSpecificPlugin(ObjectivesPlugin.class);
if (objectivesPlugin != null) {
objectivesPlugin.manualEnacts++;
objectivesPlugin.saveProgress();
if (ConfigBuilderPlugin.getActiveLoop() != null) {
ConfigBuilderPlugin.getActiveLoop().invoke("Accept temp button", false);
final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun;
if (finalLastRun != null && finalLastRun.lastAPSRun != null && finalLastRun.constraintsProcessed.changeRequested) {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setTitle(getContext().getString(R.string.confirmation));
builder.setMessage(getContext().getString(R.string.setbasalquestion) + "\n" + finalLastRun.constraintsProcessed);
builder.setPositiveButton(getContext().getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
sHandler.post(new Runnable() {
@Override
public void run() {
hideTempRecommendation();
PumpEnactResult applyResult = MainApp.getConfigBuilder().applyAPSRequest(finalLastRun.constraintsProcessed);
if (applyResult.enacted) {
finalLastRun.setByPump = applyResult;
finalLastRun.lastEnact = new Date();
finalLastRun.lastOpenModeAccept = new Date();
MainApp.getConfigBuilder().uploadDeviceStatus();
ObjectivesPlugin objectivesPlugin = (ObjectivesPlugin) MainApp.getSpecificPlugin(ObjectivesPlugin.class);
if (objectivesPlugin != null) {
objectivesPlugin.manualEnacts++;
objectivesPlugin.saveProgress();
}
}
updateGUIIfVisible();
}
updateGUIIfVisible();
}
});
Answers.getInstance().logCustom(new CustomEvent("AcceptTemp"));
}
});
builder.setNegativeButton(getContext().getString(R.string.cancel), null);
builder.show();
});
Answers.getInstance().logCustom(new CustomEvent("AcceptTemp"));
}
});
builder.setNegativeButton(getContext().getString(R.string.cancel), null);
builder.show();
}
updateGUI();
}
updateGUI();
}
});
@ -312,6 +315,133 @@ public class OverviewFragment extends Fragment {
return view;
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
final LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
if (activeloop == null)
return;
menu.setHeaderTitle(MainApp.sResources.getString(R.string.loop));
if (activeloop.isEnabled(PluginBase.LOOP)) {
menu.add(MainApp.sResources.getString(R.string.disableloop));
if (!activeloop.isSuspended()) {
menu.add(MainApp.sResources.getString(R.string.suspendloopfor1h));
menu.add(MainApp.sResources.getString(R.string.suspendloopfor2h));
menu.add(MainApp.sResources.getString(R.string.suspendloopfor3h));
menu.add(MainApp.sResources.getString(R.string.suspendloopfor10h));
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor30m));
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor1h));
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor2h));
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor3h));
} else {
menu.add(MainApp.sResources.getString(R.string.resume));
}
}
if (!activeloop.isEnabled(PluginBase.LOOP))
menu.add(MainApp.sResources.getString(R.string.enableloop));
}
@Override
public boolean onContextItemSelected(MenuItem item) {
final LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
if (item.getTitle().equals(MainApp.sResources.getString(R.string.disableloop))) {
activeloop.setFragmentEnabled(PluginBase.LOOP, false);
activeloop.setFragmentVisible(PluginBase.LOOP, false);
MainApp.getConfigBuilder().storeSettings();
MainApp.bus().post(new EventRefreshGui(false));
return true;
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.enableloop))) {
activeloop.setFragmentEnabled(PluginBase.LOOP, true);
activeloop.setFragmentVisible(PluginBase.LOOP, true);
MainApp.getConfigBuilder().storeSettings();
MainApp.bus().post(new EventRefreshGui(false));
return true;
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.resume))) {
activeloop.suspendTo(0L);
sHandler.post(new Runnable() {
@Override
public void run() {
MainApp.bus().post(new EventRefreshGui(false));
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
}
}
});
return true;
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor1h))) {
activeloop.suspendTo(new Date().getTime() + 60L * 60 * 1000);
MainApp.bus().post(new EventRefreshGui(false));
return true;
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor2h))) {
activeloop.suspendTo(new Date().getTime() + 2 * 60L * 60 * 1000);
MainApp.bus().post(new EventRefreshGui(false));
return true;
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor3h))) {
activeloop.suspendTo(new Date().getTime() + 3 * 60L * 60 * 1000);
MainApp.bus().post(new EventRefreshGui(false));
return true;
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor10h))) {
activeloop.suspendTo(new Date().getTime() + 10 * 60L * 60 * 1000);
MainApp.bus().post(new EventRefreshGui(false));
return true;
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor30m))) {
activeloop.suspendTo(new Date().getTime() + 30L * 60 * 1000);
sHandler.post(new Runnable() {
@Override
public void run() {
PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 30);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
}
MainApp.bus().post(new EventRefreshGui(false));
}
});
return true;
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor1h))) {
activeloop.suspendTo(new Date().getTime() + 1 * 60L * 60 * 1000);
sHandler.post(new Runnable() {
@Override
public void run() {
MainApp.bus().post(new EventRefreshGui(false));
PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 60);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
}
}
});
return true;
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor2h))) {
activeloop.suspendTo(new Date().getTime() + 2 * 60L * 60 * 1000);
sHandler.post(new Runnable() {
@Override
public void run() {
MainApp.bus().post(new EventRefreshGui(false));
PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 2 * 60);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
}
}
});
return true;
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor3h))) {
activeloop.suspendTo(new Date().getTime() + 3 * 60L * 60 * 1000);
sHandler.post(new Runnable() {
@Override
public void run() {
MainApp.bus().post(new EventRefreshGui(false));
PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 3 * 60);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
}
}
});
return true;
}
return super.onContextItemSelected(item);
}
void processQuickWizard() {
final BgReading actualBg = GlucoseStatus.actualBg();
if (MainApp.getConfigBuilder() == null || ConfigBuilderPlugin.getActiveProfile() == null) // app not initialized yet
@ -323,7 +453,7 @@ public class OverviewFragment extends Fragment {
quickWizardButton.setVisibility(View.VISIBLE);
String text = MainApp.sResources.getString(R.string.bolus) + ": " + quickWizardEntry.buttonText();
BolusWizard wizard = new BolusWizard();
wizard.doCalc(profile.getDefaultProfile(), quickWizardEntry.carbs(), actualBg.valueToUnits(profile.getUnits()), 0d, true, true);
wizard.doCalc(profile.getDefaultProfile(), quickWizardEntry.carbs(), 0d, actualBg.valueToUnits(profile.getUnits()), 0d, true, true, false, true);
final JSONObject boluscalcJSON = new JSONObject();
try {
@ -342,6 +472,7 @@ public class OverviewFragment extends Fragment {
boluscalcJSON.put("insulincarbs", wizard.insulinFromCarbs);
boluscalcJSON.put("carbs", quickWizardEntry.carbs());
boluscalcJSON.put("othercorrection", 0d);
boluscalcJSON.put("insulintrend", wizard.insulinFromTrend);
boluscalcJSON.put("insulin", wizard.calculatedTotalInsulin);
} catch (JSONException e) {
e.printStackTrace();
@ -412,6 +543,7 @@ public class OverviewFragment extends Fragment {
super.onPause();
MainApp.bus().unregister(this);
sLoopHandler.removeCallbacksAndMessages(null);
unregisterForContextMenu(apsModeView);
}
@Override
@ -426,6 +558,7 @@ public class OverviewFragment extends Fragment {
}
};
sLoopHandler.postDelayed(sRefreshLoop, 60 * 1000L);
registerForContextMenu(apsModeView);
updateGUIIfVisible();
}
@ -548,6 +681,8 @@ public class OverviewFragment extends Fragment {
loopStatusLayout.setVisibility(View.VISIBLE);
}
PumpInterface pump = MainApp.getConfigBuilder();
// Skip if not initialized yet
if (bgGraph == null)
return;
@ -562,7 +697,19 @@ 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()) && activeloop.isSuperBolus()) {
apsModeView.setBackgroundResource(R.drawable.loopmodesuspendedborder);
apsModeView.setText(String.format(MainApp.sResources.getString(R.string.loopsuperbolusfor), activeloop.minutesToEndOfSuspend()));
apsModeView.setTextColor(Color.WHITE);
} else if (activeloop != null && activeloop.isEnabled(activeloop.getType()) && activeloop.isSuspended()) {
apsModeView.setBackgroundResource(R.drawable.loopmodesuspendedborder);
apsModeView.setText(String.format(MainApp.sResources.getString(R.string.loopsuspendedfor), activeloop.minutesToEndOfSuspend()));
apsModeView.setTextColor(Color.WHITE);
} else if (pump.isSuspended()) {
apsModeView.setBackgroundResource(R.drawable.loopmodesuspendedborder);
apsModeView.setText(MainApp.sResources.getString(R.string.pumpsuspended));
apsModeView.setTextColor(Color.WHITE);
} else if (activeloop != null && activeloop.isEnabled(activeloop.getType())) {
if (MainApp.getConfigBuilder().isClosedModeEnabled()) {
apsModeView.setText(MainApp.sResources.getString(R.string.closedloop));
} else {
@ -572,31 +719,7 @@ public class OverviewFragment extends Fragment {
apsModeView.setBackgroundResource(R.drawable.loopmodedisabledborder);
apsModeView.setText(MainApp.sResources.getString(R.string.disabledloop));
apsModeView.setTextColor(Color.WHITE);
}
apsModeView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
if (activeloop == null) {
log.error("no active loop?");
return true;
} else if (activeloop.isEnabled(PluginBase.LOOP)) {
activeloop.setFragmentEnabled(PluginBase.LOOP, false);
activeloop.setFragmentVisible(PluginBase.LOOP, false);
} else {
activeloop.setFragmentEnabled(PluginBase.LOOP, true);
activeloop.setFragmentVisible(PluginBase.LOOP, true);
}
MainApp.getConfigBuilder().storeSettings();
MainApp.bus().post(new EventRefreshGui(false));
return true;
}
});
apsModeView.setLongClickable(true);
} else {
apsModeView.setVisibility(View.GONE);
}
@ -629,8 +752,6 @@ public class OverviewFragment extends Fragment {
}
// **** Temp button ****
PumpInterface pump = MainApp.getConfigBuilder();
boolean showAcceptButton = !MainApp.getConfigBuilder().isClosedModeEnabled(); // Open mode needed
showAcceptButton = showAcceptButton && finalLastRun != null && finalLastRun.lastAPSRun != null; // aps result must exist
showAcceptButton = showAcceptButton && (finalLastRun.lastOpenModeAccept == null || finalLastRun.lastOpenModeAccept.getTime() < finalLastRun.lastAPSRun.getTime()); // never accepted or before last result
@ -706,7 +827,7 @@ public class OverviewFragment extends Fragment {
quickWizardButton.setVisibility(View.VISIBLE);
String text = MainApp.sResources.getString(R.string.bolus) + ": " + quickWizardEntry.buttonText() + " " + DecimalFormatter.to0Decimal(quickWizardEntry.carbs()) + "g";
BolusWizard wizard = new BolusWizard();
wizard.doCalc(profile.getDefaultProfile(), quickWizardEntry.carbs(), lastBG.valueToUnits(profile.getUnits()), 0d, true, true);
wizard.doCalc(profile.getDefaultProfile(), quickWizardEntry.carbs(), 0d, lastBG.valueToUnits(profile.getUnits()), 0d, true, true, false, true);
text += " " + DecimalFormatter.to2Decimal(wizard.calculatedTotalInsulin) + "U";
quickWizardButton.setText(text);
if (wizard.calculatedTotalInsulin <= 0)

View file

@ -7,6 +7,8 @@ import android.preference.PreferenceManager;
import android.telephony.SmsManager;
import android.telephony.SmsMessage;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe;
import org.slf4j.Logger;
@ -26,6 +28,7 @@ import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventRefreshGui;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
@ -66,6 +69,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
double bolusRequested = 0d;
double tempBasal = 0d;
double calibrationRequested = 0d;
int duration = 0;
public Sms(SmsMessage message) {
phoneNumber = message.getOriginatingAddress();
@ -98,6 +102,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
Sms tempBasalWaitingForConfirmation = null;
Sms bolusWaitingForConfirmation = null;
Sms calibrationWaitingForConfirmation = null;
Sms suspendWaitingForConfirmation = null;
Date lastRemoteBolusTime = new Date(0);
ArrayList<Sms> messages = new ArrayList<>();
@ -210,7 +215,9 @@ public class SmsCommunicatorPlugin implements PluginBase {
String[] splited = receivedSms.text.split("\\s+");
Double amount = 0d;
Double tempBasal = 0d;
int duration = 0;
String passCode = "";
boolean remoteCommandsAllowed = SP.getBoolean(R.string.key_smscommunicator_remotecommandsallowed, false);
if (splited.length > 0) {
switch (splited[0].toUpperCase()) {
@ -244,9 +251,11 @@ public class SmsCommunicatorPlugin implements PluginBase {
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Bg"));
break;
case "LOOP":
switch (splited[1].toUpperCase()) {
case "DISABLE":
case "STOP":
LoopPlugin loopPlugin = (LoopPlugin) MainApp.getSpecificPlugin(LoopPlugin.class);
if (loopPlugin != null && loopPlugin.isEnabled(PluginBase.LOOP)) {
@ -255,7 +264,9 @@ public class SmsCommunicatorPlugin implements PluginBase {
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
}
receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Loop_Stop"));
break;
case "ENABLE":
case "START":
loopPlugin = (LoopPlugin) MainApp.getSpecificPlugin(LoopPlugin.class);
if (loopPlugin != null && !loopPlugin.isEnabled(PluginBase.LOOP)) {
@ -264,18 +275,52 @@ public class SmsCommunicatorPlugin implements PluginBase {
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
}
receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Loop_Start"));
break;
case "STATUS":
loopPlugin = (LoopPlugin) MainApp.getSpecificPlugin(LoopPlugin.class);
if (loopPlugin != null) {
if (loopPlugin.isEnabled(PluginBase.LOOP)) {
reply = MainApp.sResources.getString(R.string.smscommunicator_loopisenabled);
if (loopPlugin.isSuspended())
reply = String.format(MainApp.sResources.getString(R.string.loopsuspendedfor), loopPlugin.minutesToEndOfSuspend());
else
reply = MainApp.sResources.getString(R.string.smscommunicator_loopisenabled);
} else {
reply = MainApp.sResources.getString(R.string.smscommunicator_loopisdisabled);
}
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
}
receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Loop_Status"));
break;
case "RESUME":
final LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
activeloop.suspendTo(0);
MainApp.bus().post(new EventRefreshGui(false));
reply = String.format(MainApp.sResources.getString(R.string.smscommunicator_loopresumed));
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, new Date()));
Answers.getInstance().logCustom(new CustomEvent("SMS_Loop_Resume"));
break;
case "SUSPEND":
if (splited.length >= 3)
duration = SafeParse.stringToInt(splited[2]);
duration = Math.max(0, duration);
duration = Math.min(180, duration);
if (duration == 0) {
reply = MainApp.sResources.getString(R.string.smscommunicator_wrongduration);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
} else if (remoteCommandsAllowed) {
passCode = generatePasscode();
reply = String.format(MainApp.sResources.getString(R.string.smscommunicator_suspendreplywithcode), duration, passCode);
receivedSms.processed = true;
resetWaitingMessages();
sendSMS(suspendWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode));
suspendWaitingForConfirmation.duration = duration;
Answers.getInstance().logCustom(new CustomEvent("SMS_Loop_Suspend"));
} else {
reply = MainApp.sResources.getString(R.string.smscommunicator_remotecommandnotallowed);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
}
break;
}
break;
@ -289,6 +334,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
reply = "TERATMENTS REFRESH " + q.size() + " receivers";
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Treatments_Refresh"));
break;
}
break;
@ -301,6 +347,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
reply = "NSCLIENT RESTART " + q.size() + " receivers";
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Nsclient_Restart"));
break;
}
break;
@ -316,10 +363,10 @@ public class SmsCommunicatorPlugin implements PluginBase {
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
}
receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Danar"));
break;
case "BASAL":
if (splited.length > 1) {
boolean remoteCommandsAllowed = SP.getBoolean(R.string.key_smscommunicator_remotecommandsallowed, false);
if (splited[1].toUpperCase().equals("CANCEL") || splited[1].toUpperCase().equals("STOP")) {
if (remoteCommandsAllowed) {
passCode = generatePasscode();
@ -327,6 +374,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
receivedSms.processed = true;
resetWaitingMessages();
sendSMS(cancelTempBasalWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode));
Answers.getInstance().logCustom(new CustomEvent("SMS_Basal"));
} else {
reply = MainApp.sResources.getString(R.string.smscommunicator_remotebasalnotallowed);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
@ -341,6 +389,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
resetWaitingMessages();
sendSMS(tempBasalWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode));
tempBasalWaitingForConfirmation.tempBasal = tempBasal;
Answers.getInstance().logCustom(new CustomEvent("SMS_Basal"));
} else {
reply = MainApp.sResources.getString(R.string.smscommunicator_remotebasalnotallowed);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
@ -355,7 +404,6 @@ public class SmsCommunicatorPlugin implements PluginBase {
} else if (splited.length > 1) {
amount = SafeParse.stringToDouble(splited[1]);
amount = MainApp.getConfigBuilder().applyBolusConstraints(amount);
boolean remoteCommandsAllowed = SP.getBoolean(R.string.key_smscommunicator_remotecommandsallowed, false);
if (amount > 0d && remoteCommandsAllowed) {
passCode = generatePasscode();
reply = String.format(MainApp.sResources.getString(R.string.smscommunicator_bolusreplywithcode), amount, passCode);
@ -363,6 +411,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
resetWaitingMessages();
sendSMS(bolusWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode));
bolusWaitingForConfirmation.bolusRequested = amount;
Answers.getInstance().logCustom(new CustomEvent("SMS_Bolus"));
} else {
reply = MainApp.sResources.getString(R.string.smscommunicator_remotebolusnotallowed);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
@ -372,7 +421,6 @@ public class SmsCommunicatorPlugin implements PluginBase {
case "CAL":
if (splited.length > 1) {
amount = SafeParse.stringToDouble(splited[1]);
boolean remoteCommandsAllowed = SP.getBoolean(R.string.key_smscommunicator_remotecommandsallowed, false);
if (amount > 0d && remoteCommandsAllowed) {
passCode = generatePasscode();
reply = String.format(MainApp.sResources.getString(R.string.smscommunicator_calibrationreplywithcode), amount, passCode);
@ -380,6 +428,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
resetWaitingMessages();
sendSMS(calibrationWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode));
calibrationWaitingForConfirmation.calibrationRequested = amount;
Answers.getInstance().logCustom(new CustomEvent("SMS_Cal"));
} else {
reply = MainApp.sResources.getString(R.string.smscommunicator_remotecalibrationnotallowed);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
@ -396,12 +445,14 @@ public class SmsCommunicatorPlugin implements PluginBase {
PumpEnactResult result = pumpInterface.deliverTreatment(bolusWaitingForConfirmation.bolusRequested, 0, null);
if (result.success) {
reply = String.format(MainApp.sResources.getString(R.string.smscommunicator_bolusdelivered), result.bolusDelivered);
if (danaRPlugin != null) reply += "\n" + danaRPlugin.shortStatus(true);
if (danaRPlugin != null)
reply += "\n" + danaRPlugin.shortStatus(true);
lastRemoteBolusTime = new Date();
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, new Date()));
} else {
reply = MainApp.sResources.getString(R.string.smscommunicator_bolusfailed);
if (danaRPlugin != null) reply += "\n" + danaRPlugin.shortStatus(true);
if (danaRPlugin != null)
reply += "\n" + danaRPlugin.shortStatus(true);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
}
}
@ -414,11 +465,13 @@ public class SmsCommunicatorPlugin implements PluginBase {
PumpEnactResult result = pumpInterface.setTempBasalAbsolute(tempBasalWaitingForConfirmation.tempBasal, 30);
if (result.success) {
reply = String.format(MainApp.sResources.getString(R.string.smscommunicator_tempbasalset), result.absolute, result.duration);
if (danaRPlugin != null) reply += "\n" + danaRPlugin.shortStatus(true);
if (danaRPlugin != null)
reply += "\n" + danaRPlugin.shortStatus(true);
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, new Date()));
} else {
reply = MainApp.sResources.getString(R.string.smscommunicator_tempbasalfailed);
if (danaRPlugin != null) reply += "\n" + danaRPlugin.shortStatus(true);
if (danaRPlugin != null)
reply += "\n" + danaRPlugin.shortStatus(true);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
}
}
@ -431,11 +484,13 @@ public class SmsCommunicatorPlugin implements PluginBase {
PumpEnactResult result = pumpInterface.cancelTempBasal();
if (result.success) {
reply = String.format(MainApp.sResources.getString(R.string.smscommunicator_tempbasalcanceled));
if (danaRPlugin != null) reply += "\n" + danaRPlugin.shortStatus(true);
if (danaRPlugin != null)
reply += "\n" + danaRPlugin.shortStatus(true);
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, new Date()));
} else {
reply = MainApp.sResources.getString(R.string.smscommunicator_tempbasalcancelfailed);
if (danaRPlugin != null) reply += "\n" + danaRPlugin.shortStatus(true);
if (danaRPlugin != null)
reply += "\n" + danaRPlugin.shortStatus(true);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
}
}
@ -450,6 +505,14 @@ public class SmsCommunicatorPlugin implements PluginBase {
reply = MainApp.sResources.getString(R.string.smscommunicator_calibrationfailed);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
}
} else if (suspendWaitingForConfirmation != null && !suspendWaitingForConfirmation.processed &&
suspendWaitingForConfirmation.confirmCode.equals(splited[0]) && new Date().getTime() - suspendWaitingForConfirmation.date.getTime() < CONFIRM_TIMEOUT) {
suspendWaitingForConfirmation.processed = true;
final LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
activeloop.suspendTo(new Date().getTime() + suspendWaitingForConfirmation.duration * 60L * 1000);
MainApp.bus().post(new EventRefreshGui(false));
reply = String.format(MainApp.sResources.getString(R.string.smscommunicator_loopsuspended));
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, new Date()));
} else {
sendSMS(new Sms(receivedSms.phoneNumber, MainApp.sResources.getString(R.string.smscommunicator_unknowncommand), new Date()));
}
@ -469,7 +532,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
}
public void sendSMSToAllNumbers(Sms sms) {
for (String number: allowedNumbers) {
for (String number : allowedNumbers) {
sms.phoneNumber = number;
sendSMS(sms);
}
@ -504,6 +567,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
cancelTempBasalWaitingForConfirmation = null;
bolusWaitingForConfirmation = null;
calibrationWaitingForConfirmation = null;
suspendWaitingForConfirmation = null;
}
public static String stripAccents(String s) {

View file

@ -0,0 +1,16 @@
package info.nightscout.androidaps.plugins.SourceGlimp;
import android.support.v4.app.Fragment;
import info.nightscout.androidaps.interfaces.FragmentBase;
public class SourceGlimpFragment extends Fragment implements FragmentBase {
private static SourceGlimpPlugin sourceGlimpPlugin = new SourceGlimpPlugin();
public static SourceGlimpPlugin getPlugin() {
return sourceGlimpPlugin;
}
}

View file

@ -0,0 +1,62 @@
package info.nightscout.androidaps.plugins.SourceGlimp;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.BgSourceInterface;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.plugins.SourceMM640g.SourceMM640gFragment;
/**
* Created by mike on 05.08.2016.
*/
public class SourceGlimpPlugin implements PluginBase, BgSourceInterface {
boolean fragmentEnabled = false;
@Override
public String getFragmentClass() {
return SourceGlimpFragment.class.getName();
}
@Override
public int getType() {
return PluginBase.BGSOURCE;
}
@Override
public String getName() {
return MainApp.instance().getString(R.string.Glimp);
}
@Override
public String getNameShort() {
// use long name as fallback (no tabs)
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == BGSOURCE && fragmentEnabled;
}
@Override
public boolean isVisibleInTabs(int type) {
return false;
}
@Override
public boolean canBeHidden(int type) {
return true;
}
@Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
if (type == BGSOURCE) this.fragmentEnabled = fragmentEnabled;
}
@Override
public void setFragmentVisible(int type, boolean fragmentVisible) {
}
}

View file

@ -38,6 +38,8 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
public static Integer batteryPercent = 50;
public static Integer reservoirInUnits = 50;
Date lastDataTime = new Date(0);
boolean fragmentEnabled = true;
boolean fragmentVisible = true;
@ -150,6 +152,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
@Override
public int setNewBasalProfile(NSProfile profile) {
// Do nothing here. we are using MainApp.getConfigBuilder().getActiveProfile().getProfile();
lastDataTime = new Date();
return SUCCESS;
}
@ -160,12 +163,13 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
@Override
public Date lastDataTime() {
return new Date();
return lastDataTime;
}
@Override
public void refreshDataFromPump(String reason) {
// do nothing
MainApp.getConfigBuilder().uploadDeviceStatus();
lastDataTime = new Date();
}
@Override
@ -251,6 +255,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
if (Config.logPumpComm)
log.debug("Delivering treatment insulin: " + insulin + "U carbs: " + carbs + "g " + result);
MainApp.bus().post(new EventVirtualPumpUpdateGui());
lastDataTime = new Date();
return result;
}
@ -285,6 +290,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
if (Config.logPumpComm)
log.debug("Setting temp basal absolute: " + result);
MainApp.bus().post(new EventVirtualPumpUpdateGui());
lastDataTime = new Date();
return result;
}
@ -318,6 +324,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
if (Config.logPumpComm)
log.debug("Settings temp basal percent: " + result);
MainApp.bus().post(new EventVirtualPumpUpdateGui());
lastDataTime = new Date();
return result;
}
@ -349,6 +356,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
if (Config.logPumpComm)
log.debug("Setting extended bolus: " + result);
MainApp.bus().post(new EventVirtualPumpUpdateGui());
lastDataTime = new Date();
return result;
}
@ -375,6 +383,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
result.comment = MainApp.instance().getString(R.string.virtualpump_sqlerror);
}
}
lastDataTime = new Date();
return result;
}
@ -399,6 +408,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
if (Config.logPumpComm)
log.debug("Canceling extended basal: " + result);
MainApp.bus().post(new EventVirtualPumpUpdateGui());
lastDataTime = new Date();
return result;
}

View file

@ -192,7 +192,7 @@ public class ActionStringHandler {
}
DecimalFormat format = new DecimalFormat("0.00");
BolusWizard bolusWizard = new BolusWizard();
bolusWizard.doCalc(profile.getDefaultProfile(), carbsAfterConstraints, useBG?bgReading.valueToUnits(profile.getUnits()):0d, 0d, useBolusIOB, useBasalIOB);
bolusWizard.doCalc(profile.getDefaultProfile(), carbsAfterConstraints, 0d, useBG?bgReading.valueToUnits(profile.getUnits()):0d, 0d, useBolusIOB, useBasalIOB, false, false);
Double insulinAfterConstraints = MainApp.getConfigBuilder().applyBolusConstraints(bolusWizard.calculatedTotalInsulin);
if(insulinAfterConstraints - bolusWizard.calculatedTotalInsulin !=0){

View file

@ -35,7 +35,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
final PumpInterface pump = MainApp.getConfigBuilder();
final NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
if (pump != null && profile != null) {
if (pump != null && profile != null && profile.getBasal(NSProfile.secondsFromMidnight()) != null) {
boolean isBasalOutdated = false;
boolean isStatusOutdated = false;

View file

@ -5,6 +5,7 @@ import org.json.JSONObject;
import java.util.Date;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.data.GlucoseStatus;
import info.nightscout.androidaps.interfaces.TempBasalsInterface;
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.data.IobTotal;
@ -23,11 +24,15 @@ public class BolusWizard {
Double correction;
Boolean includeBolusIOB = true;
Boolean includeBasalIOB = true;
Boolean superBolus = false;
Boolean trend = false;
// Intermediate
public Double sens = 0d;
public Double ic = 0d;
public GlucoseStatus glucoseStatus;
public Double targetBGLow = 0d;
public Double targetBGHigh = 0d;
public Double bgDiff = 0d;
@ -40,16 +45,21 @@ public class BolusWizard {
public Double insulingFromBolusIOB = 0d;
public Double insulingFromBasalsIOB = 0d;
public Double insulinFromCorrection = 0d;
public Double insulinFromSuperBolus = 0d;
public Double insulinFromCOB = 0d;
public Double insulinFromTrend = 0d;
// Result
public Double calculatedTotalInsulin = 0d;
public Double carbsEquivalent = 0d;
public Double doCalc(JSONObject specificProfile, Integer carbs, Double bg, Double correction, Boolean includeBolusIOB, Boolean includeBasalIOB) {
public Double doCalc(JSONObject specificProfile, Integer carbs, Double cob, Double bg, Double correction, Boolean includeBolusIOB, Boolean includeBasalIOB, Boolean superBolus, Boolean trend) {
this.specificProfile = specificProfile;
this.carbs = carbs;
this.bg = bg;
this.correction = correction;
this.superBolus = superBolus;
this.trend = trend;
NSProfile profile = ConfigBuilderPlugin.getActiveProfile().getProfile();
@ -64,9 +74,16 @@ public class BolusWizard {
}
insulinFromBG = bg != 0d ? bgDiff / sens : 0d;
// Insulin from 15 min trend
glucoseStatus = GlucoseStatus.getGlucoseStatusData();
if (glucoseStatus != null) {
insulinFromTrend = (NSProfile.fromMgdlToUnits(glucoseStatus.short_avgdelta, profile.getUnits()) * 3) / sens;
}
// Insuling from carbs
ic = profile.getIc(specificProfile, NSProfile.secondsFromMidnight());
insulinFromCarbs = carbs / ic;
insulinFromCOB = -cob / ic;
// Insulin from IOB
// IOB calculation
@ -86,8 +103,16 @@ public class BolusWizard {
// Insulin from correction
insulinFromCorrection = correction;
// Insulin from superbolus for 2h. Get basal rate now and after 1h
if (superBolus) {
insulinFromSuperBolus = profile.getBasal(NSProfile.secondsFromMidnight());
long timeAfter1h = new Date().getTime();
timeAfter1h += 60L * 60 * 1000;
insulinFromSuperBolus += profile.getBasal(NSProfile.secondsFromMidnight(new Date(timeAfter1h)));
}
// Total
calculatedTotalInsulin = insulinFromBG + insulinFromCarbs + insulingFromBolusIOB + insulingFromBasalsIOB + insulinFromCorrection;
calculatedTotalInsulin = insulinFromBG + insulinFromTrend + insulinFromCarbs + insulingFromBolusIOB + insulingFromBasalsIOB + insulinFromCorrection + insulinFromSuperBolus + insulinFromCOB;
if (calculatedTotalInsulin < 0) {
carbsEquivalent = -calculatedTotalInsulin * ic;

View file

@ -0,0 +1,44 @@
package info.nightscout.utils;
import android.app.Activity;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;
import android.support.v7.view.ContextThemeWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
/**
* Created by mike on 31.03.2017.
*/
public class OKDialog {
private static Logger log = LoggerFactory.getLogger(OKDialog.class);
public static void show(final Activity activity, String title, String message, final Runnable runnable) {
try {
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(activity, R.style.AppTheme));
builder.setTitle(title);
builder.setMessage(message);
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
if (runnable != null) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
activity.runOnUiThread(runnable);
}
}
});
builder.create().show();
} catch (Exception e) {
log.debug("show_dialog exception: " + e);
}
}
}

View file

@ -61,7 +61,11 @@ public class SP {
}
static public long getLong(String key, Long defaultValue) {
return SafeParse.stringToLong(sharedPreferences.getString(key, defaultValue.toString()));
try {
return sharedPreferences.getLong(key, defaultValue);
} catch (Exception e) {
return SafeParse.stringToLong(sharedPreferences.getString(key, defaultValue.toString()));
}
}
static public void putBoolean(String key, boolean value) {
@ -82,9 +86,9 @@ public class SP {
editor.apply();
}
static public void putString(String key, String value) {
static public void putLong(String key, long value) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(key, value);
editor.putLong(key, value);
editor.apply();
}

View file

@ -1,15 +1,20 @@
package info.nightscout.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Created by mike on 23.06.2016.
*/
public class SafeParse {
private static Logger log = LoggerFactory.getLogger(SafeParse.class);
public static Double stringToDouble(String input) {
Double result = 0d;
input = input.replace(",", ".");
try {
result = Double.parseDouble(input);
} catch (Exception e) {
log.error("Error parsing " + input + " to double");
}
return result;
}
@ -20,6 +25,7 @@ public class SafeParse {
try {
result = Integer.parseInt(input);
} catch (Exception e) {
log.error("Error parsing " + input + " to int");
}
return result;
}
@ -30,6 +36,7 @@ public class SafeParse {
try {
result = Long.parseLong(input);
} catch (Exception e) {
log.error("Error parsing " + input + " to long");
}
return result;
}

View file

@ -1,5 +1,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@color/colorCancelTempButton" />
<solid android:color="@color/loopenabled" />
<stroke android:width="1dip" android:color="@android:color/white"/>
<corners
android:radius="2dp" >

View file

@ -1,5 +1,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@color/colorSetExtendedButton" />
<solid android:color="@color/loopdisabled" />
<stroke android:width="1dip" android:color="@android:color/white"/>
<corners
android:radius="2dp" >

View file

@ -0,0 +1,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@color/looppumpsuspended" />
<stroke android:width="1dip" android:color="@android:color/white"/>
<corners
android:radius="2dp" >
</corners>
</shape>

View file

@ -253,7 +253,7 @@
<LinearLayout
android:id="@+id/treatments_wizard_profile_layout"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="horizontal">
@ -269,9 +269,42 @@
<Spinner
android:id="@+id/treatments_wizard_profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.5" />
<CheckBox
android:id="@+id/treatments_wizard_sbcheckbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:checked="false"
android:text="Super\nbolus" />
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:orientation="horizontal"
android:padding="10dp">
<Button
android:id="@+id/treatments_wizard_deliverButton"
style="?android:attr/buttonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="10dp"
android:text="SEND TO PUMP"
android:textAllCaps="false"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
@ -288,7 +321,6 @@
android:checked="true" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="80dp"
@ -317,27 +349,66 @@
android:layout_gravity="center"
android:orientation="horizontal">
<TextView
<CheckBox
android:id="@+id/treatments_wizard_bgtrendcheckbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="32dp" />
android:width="32dp"
android:checked="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="80dp"
android:text="@string/treatments_wizard_carbs_label"
android:text="@string/treatments_wizard_bgtrend_label"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/treatments_wizard_carbs"
android:id="@+id/treatments_wizard_bgtrend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="100dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/treatments_wizard_carbsinsulin"
android:id="@+id/treatments_wizard_bgtrendinsulin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="50dp"
android:gravity="end"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:id="@+id/treatments_wizard_cob_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal">
<CheckBox
android:id="@+id/treatments_wizard_cobcheckbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="32dp"
android:checked="false" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="80dp"
android:text="@string/treatments_wizard_cob_label"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/treatments_wizard_cob"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="100dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/treatments_wizard_cobinsulin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="50dp"
@ -417,6 +488,74 @@
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="32dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="80dp"
android:text="@string/treatments_wizard_carbs_label"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/treatments_wizard_carbs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="100dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/treatments_wizard_carbsinsulin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="50dp"
android:gravity="end"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="32dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="80dp"
android:text="@string/treatments_wizard_sb_label"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/treatments_wizard_sb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="100dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/treatments_wizard_sbinsulin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="50dp"
android:gravity="end"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -491,27 +630,5 @@
android:textStyle="bold" />
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:orientation="horizontal"
android:padding="10dp">
<Button
android:id="@+id/treatments_wizard_deliverButton"
style="?android:attr/buttonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="10dp"
android:text="SEND TO PUMP"
android:textAllCaps="false"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
</ScrollView>

View file

@ -212,14 +212,14 @@
<string name="end_user_license_agreement_text">MUST NOT BE USED TO MAKE MEDICAL DECISIONS. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</string>
<string name="smscommunicator_allowednumbers_summary">+XXXXXXXXXX;+YYYYYYYYYY</string>
<string name="bolusdelivered" formatted="false">Болус %.2fU беше подаден успешно</string>
<string name="smscommunicator_bolusfailed">Болусът не е доставен</string>
<string name="smscommunicator_bolusfailed">Bolus failed</string>
<string name="canceltemp">Откажи временен базал</string>
<string name="virtualpump_lastconnection_label">Последно свързване:</string>
<string name="waitingforpumpresult">Изчаква резултат</string>
<string name="smscommunicator">SMS комуникатор</string>
<string name="smscommunicator_allowednumbers">Позволени телефонни номера</string>
<string name="success">Успех</string>
<string name="smscommunicator_bolusreplywithcode" formatted="false">За да доставите болус %.2fU отговорете с код %s</string>
<string name="smscommunicator_bolusreplywithcode" formatted="false">To deliver bolus %.2fU reply with code %s</string>
<string name="smscommunicator_remotebolusnotallowed">Отдалечен болус не е разрешен</string>
<string name="reloadprofile">Обнови профила</string>
<string name="percent">Процент</string>
@ -373,24 +373,24 @@
<string name="wear">Wear</string>
<string name="wrongpumpdriverselected">Избран е грешен тип помпа</string>
<string name="minago" formatted="false">преди %d м.</string>
<string name="actions_shortname">"ДЕЙСТВ"</string>
<string name="wear_shortname">"Wear"</string>
<string name="virtualpump_shortname">"ВП"</string>
<string name="treatments_shortname">"ТТ"</string>
<string name="temptargetrange_shortname">"ВЦeл"</string>
<string name="tempbasals_shortname">"ВБ"</string>
<string name="smscommunicator_shortname">"СМС"</string>
<string name="simpleprofile_shortname">"ОПРОФ"</string>
<string name="profileviewer_shortname">"ПРОф"</string>
<string name="overview_shortname">"ОСН"</string>
<string name="objectives_shortname">\"ЦЕЛИ"</string>
<string name="oaps_shortname">"OAPS"</string>
<string name="actions_shortname">ДЕЙСТВ</string>
<string name="wear_shortname">WEAR</string>
<string name="virtualpump_shortname">ВП</string>
<string name="treatments_shortname">TREAT</string>
<string name="temptargetrange_shortname">ВЦeл</string>
<string name="tempbasals_shortname">ВБ</string>
<string name="smscommunicator_shortname">SMS</string>
<string name="simpleprofile_shortname">ОПРОФ</string>
<string name="profileviewer_shortname">ПРОф</string>
<string name="overview_shortname">ОСН</string>
<string name="objectives_shortname">ЦЕЛИ</string>
<string name="oaps_shortname">OAPS</string>
<string name="loop_shortname">"Loop "</string>
<string name="localprofile_shortname">"ЛПр "</string>
<string name="danarpump_shortname">"Dana"</string>
<string name="configbuilder_shortname">"КОНФ"</string>
<string name="circadian_percentage_profile_shortname">"ППр "</string>
<string name="careportal_shortname">"CaPr"</string>
<string name="localprofile_shortname">ЛПр</string>
<string name="danarpump_shortname">Dana</string>
<string name="configbuilder_shortname">КОНФ</string>
<string name="circadian_percentage_profile_shortname">ППр</string>
<string name="careportal_shortname">CaPr</string>
<string name="activity">Физ.активност</string>
<string name="danar_stats">DanaR статистика</string>
<string name="danar_stats_basalrate">Базал</string>
@ -425,7 +425,7 @@
<string name="danar_stats_expweight">Експоненциално претеглена TDD</string>
<string name="danar_stats_cumulative_tdd">Комулативна TDD</string>
<string name="danar_stats_weight">Тегло</string>
<string name="danar_stats_amount_days"># Days</string>
<string name="danar_stats_amount_days">Дни</string>
<string name="MM640g">MM640g</string>
<string name="array_of_elements" formatted="false">Масив от %d елемента. Актуална стойност:</string>
<string name="sms_basal">Basal:</string>
@ -473,4 +473,43 @@
<string name="pumpsuspendedclicktorefresh">Помпата е спряна. Натиснете за обновяване</string>
<string name="prefs_delta_title">Настройки на параметър Δ КЗ</string>
<string name="overview_calibration_bg_label">Калибрация на КЗ</string>
<string name="adult">Възрастен</string>
<string name="advancedsettings_title">Разширени настройки</string>
<string name="child">Дете</string>
<string name="clear_queue">Изчисти опашката</string>
<string name="clearlog">Изчисти log</string>
<string name="danar_model"></string>
<string name="deliver_now">Изпрати сега</string>
<string name="nosuccess">неуспешно - проверете телефона</string>
<string name="notavailable">Недостъпно</string>
<string name="nowritepermission">NSCLIENT няма достъп. Грешна API secret?</string>
<string name="nsclientinternal">вътрешен NSClient</string>
<string name="nsclientinternal_autoscroll">Autoscroll</string>
<string name="nsclientinternal_devicename_dialogmessage">Ще бъде използвано в поле въведено от</string>
<string name="nsclientinternal_devicename_dialogtitle">Въведи име на устройство</string>
<string name="nsclientinternal_devicename_title">Име на устройство</string>
<string name="nsclientinternal_secret_dialogmessage">Въведи API secret (мин. 12 символа)</string>
<string name="nsclientinternal_title">Вътрешен NSClient</string>
<string name="nsclientinternal_url">URL:</string>
<string name="nsclientinternal_url_dialogmessage">Въведи Nightscout URL</string>
<string name="nsclientinternal_url_title">Nightscout URL</string>
<string name="nsclientinternal_secret_dialogtitle">NS API secret</string>
<string name="nsclientinternal_secret_title">NS API secret</string>
<string name="nsclientinternal_shortname">NSCL</string>
<string name="patientage">Възраст на потребителя</string>
<string name="patientage_summary">Изберете възраст за определяне лимитите на безопасност</string>
<string name="paused">На пауза</string>
<string name="profile">Профил</string>
<string name="restart">Рестарт</string>
<string name="show_queue">Покажи опашката</string>
<string name="smscommunicator_calibrationfailed">xDrip не приема калибрация</string>
<string name="status">Статус:</string>
<string name="teenage">Тийнейджър</string>
<string name="wear_detailedIOB_summary">Раздели IOB на болус и базал IOB на часовника</string>
<string name="wear_detailedIOB_title">Покажи подробен IOB</string>
<string name="wear_settings">Настройки на часовник</string>
<string name="smscommunicator_calibrationreplywithcode" formatted="false">To send calibration %.2f reply with code %s</string>
<string name="smscommunicator_calibrationsent">Calibration sent. Receiving must be enabled in xDrip.</string>
<string name="smscommunicator_invalidphonennumber">Invalid SMS phone number</string>
<string name="queue">Опашка:</string>
</resources>

View file

@ -143,7 +143,7 @@
<string name="treatments_iob_label_string">IOB:</string>
<string name="treatments_iobactivitytotal_label_string">Celková aktivita IOB:</string>
<string name="treatments_iobtotal_label_string">Celkové IOB:</string>
<string name="treatments_newtreatment_carbsamount_label">Množtví sacharidů</string>
<string name="treatments_newtreatment_carbsamount_label">Množství sacharidů</string>
<string name="treatments_newtreatment_insulinamount_label">Množství inzulínu</string>
<string name="treatments_wizard_basaliob_label">Bazální IOB</string>
<string name="treatments_wizard_bg_label">Glykémie</string>
@ -365,16 +365,16 @@
<string name="profile_set_ok">Bazální profil aktualizován</string>
<string name="pumpNotInitializedProfileNotSet">Pumpa není inicializována, profil nenastaven!</string>
<string name="wrongpumpdriverselected">Vybrán špatný ovladač pumpy</string>
<string name="basalvaluebelowminimum">Hodnota bazálu pod minimem. Nenastaveno!</string>
<string name="basalvaluebelowminimum">Hodnota bazálu pod povoleným minimem. Nenastaveno!</string>
<string name="mdi">Pera</string>
<string name="sms_actualbg">Glykémie:</string>
<string name="sms_lastbg">Poslední glykémie:</string>
<string name="minago">před %d min</string>
<string name="minago" formatted="false">před %d min</string>
<string name="sms_basal">Bazál:</string>
<string name="sms_bolus">Bolus:</string>
<string name="sms_delta">Rozdíl:</string>
<string name="sms_iob">IOB:</string>
<string name="sms_minago">před %d min</string>
<string name="sms_minago" formatted="false">před %d min</string>
<string name="smscommunicator_bolusdelivered">Bolus %.2fU aplikován úspěšně</string>
<string name="ongoingnotificaction">Průběžné oznámení</string>
<string name="old_data">ZASTARALÉ</string>
@ -382,7 +382,7 @@
<string name="activity">Aktivita</string>
<string name="array_of_elements">Pole %d prvků. Aktuální hodnota:</string>
<string name="eatingsoon">Před jídlem</string>
<string name="el_lang">Řečtina</string>
<string name="el_lang">Greek</string>
<string name="initializing">Inicializuji ...</string>
<string name="long_avgdelta">Dlouhodobý průměr</string>
<string name="openapsama">OpenAPS AMA</string>
@ -397,22 +397,22 @@
<string name="temptargetrange_refreshfromnightscout">Obnovit dočasné cíle z NS</string>
<string name="actions_shortname">" "</string>
<string name="wear_shortname">" "</string>
<string name="virtualpump_shortname">" "</string>
<string name="treatments_shortname">" "</string>
<string name="virtualpump_shortname">ViPu</string>
<string name="treatments_shortname"></string>
<string name="temptargetrange_shortname">" "</string>
<string name="tempbasals_shortname">" "</string>
<string name="smscommunicator_shortname">" "</string>
<string name="simpleprofile_shortname">" "</string>
<string name="smscommunicator_shortname">SMS</string>
<string name="simpleprofile_shortname">JP</string>
<string name="profileviewer_shortname">" "</string>
<string name="overview_shortname">" "</string>
<string name="objectives_shortname">" "</string>
<string name="overview_shortname">Přehl</string>
<string name="objectives_shortname">Cíle</string>
<string name="oaps_shortname">" "</string>
<string name="loop_shortname">" "</string>
<string name="localprofile_shortname">" "</string>
<string name="danarpump_shortname">" "</string>
<string name="configbuilder_shortname">" "</string>
<string name="circadian_percentage_profile_shortname">" "</string>
<string name="careportal_shortname">" "</string>
<string name="loop_shortname">Smyč</string>
<string name="localprofile_shortname">LP</string>
<string name="danarpump_shortname">Dana</string>
<string name="configbuilder_shortname">Konf</string>
<string name="circadian_percentage_profile_shortname">CPP</string>
<string name="careportal_shortname">Péče</string>
<string name="advancedsettings_title">Rozšířené nastavení</string>
<string name="always_use_shortavg">Vždy používat krátkodobý průměrný rozdíl glykémií místo rozdílu posledních 2 hodnot</string>
<string name="always_use_shortavg_summary">Výhodné, pokud data z xDripu obsahují velký šum</string>
@ -462,8 +462,8 @@
<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="pumpsuspended">Pumpa pozastavena</string>
<string name="pumpsuspendedclicktorefresh">Pumpa pozastavena. 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>
@ -477,4 +477,59 @@
<string name="wrongpassword">Chybné heslo</string>
<string name="unlock_settings">Odemknout nastavení</string>
<string name="approachingdailylimit">Blíží se denní limit inzulínu</string>
<string name="adult">Dospělý</string>
<string name="child">Dítě</string>
<string name="clear_queue">Vymazat frontu</string>
<string name="clearlog">Vymazat log</string>
<string name="deliver_now">Odeslat teď</string>
<string name="nosuccess">neúspěšně - zkontrolujte mobil</string>
<string name="notavailable">Nedostupný</string>
<string name="nowritepermission">NSClient nedostal oprávnění k zápisu. Špatné API secret?</string>
<string name="nsclientinternal">NSClient interní</string>
<string name="nsclientinternal_autoscroll">Posouvat</string>
<string name="nsclientinternal_devicename_dialogmessage">Bude použito v poli zadal</string>
<string name="nsclientinternal_devicename_dialogtitle">Zadej jméno zařízení</string>
<string name="nsclientinternal_devicename_title">Jméno zařízení</string>
<string name="nsclientinternal_secret_dialogmessage">Vložte API secret (min 12. znaků)</string>
<string name="nsclientinternal_shortname">NSCl</string>
<string name="nsclientinternal_title">Interní NSClient</string>
<string name="nsclientinternal_url">URL:</string>
<string name="nsclientinternal_url_dialogmessage">Vložte adresu Nightscoutu</string>
<string name="nsclientinternal_url_title">Adresa Nightscoutu</string>
<string name="patientage">Stáří pacienta</string>
<string name="patientage_summary">Vyberte věk pacienta pro nastavení bezpečnostních limitů</string>
<string name="paused">Pozastaveno</string>
<string name="queue">Fronta:</string>
<string name="restart">Restart</string>
<string name="show_queue">Zobrazit frontu</string>
<string name="status">Status:</string>
<string name="teenage">Dospívající</string>
<string name="wear_detailedIOB_summary">Rozepsat IOB do bolusového a bazálního na hodinkách</string>
<string name="wear_detailedIOB_title">Zobrazit detailní IOB</string>
<string name="wear_settings">Nastavení hodinek</string>
<string name="Glimp">Glimp</string>
<string name="batteryoptimalizationerror">Zařízení patrně nepodporuje vyloučení z optimalizace baterie.</string>
<string name="disconnectpumpfor10h">Odpojit pumpu na 10 h</string>
<string name="disconnectpumpfor1h">Odpojit pumpu na 1 h</string>
<string name="disconnectpumpfor2h">Odpojit pumpu na 2 h</string>
<string name="disconnectpumpfor30m">Odpojit pumpu na 30 min</string>
<string name="disconnectpumpfor3h">Odpojit pumpu na 3 h</string>
<string name="enableloop">Povolit smyčku</string>
<string name="loopmenu">Menu smyčky</string>
<string name="loopsuspended">Smyčka pozastavena</string>
<string name="loopsuspendedfor" formatted="false">Pozastaveno (%d min)</string>
<string name="needwhitelisting">%s potřebuje vypnout optimalizace baterie pro optimalní výkon</string>
<string name="pleaseallowpermission">Prosím povolte oprávnění</string>
<string name="resume">Uvolnit</string>
<string name="suspendloopfor10h">Pozastavit smyčku na 10 h</string>
<string name="suspendloopfor1h">Pozastavit smyčku na 1 h</string>
<string name="suspendloopfor2h">Pozastavit smyčku na 2 h</string>
<string name="suspendloopfor3h">Pozastavit smyčku na 3 h</string>
<string name="disableloop">Zakázat smyčku</string>
<string name="smscommunicator_loopresumed">Smyčka obnovena</string>
<string name="smscommunicator_loopsuspended">Smyčka pozastavena</string>
<string name="smscommunicator_remotecommandnotallowed">Vzdálení příkaz není povolen</string>
<string name="smscommunicator_suspendreplywithcode" formatted="false">K pozastavení smyčky na %d minut odpověz SMS s kódem %s</string>
<string name="smscommunicator_wrongduration">Chybná doba trvání</string>
<string name="ns_logappstartedevent">Logovat spuštění aplikace do NS</string>
</resources>

View file

@ -3,17 +3,17 @@
<string name="treatmentssafety_title">Treatments 안전설정</string>
<string name="treatmentssafety_maxbolus_title">최대 허용 식사주입인슐린 [U]</string>
<string name="treatmentssafety_maxcarbs_title">최대 허용 탄수화물 [g]</string>
<string name="nav_preferences">설정</string>
<string name="nav_refreshtreatments">NS에서 Treatments 새로고침</string>
<string name="nav_backup">백업</string>
<string name="nav_test_alert">테스트 알람</string>
<string name="nav_resetdb">데이터베이스 초기화</string>
<string name="reset_db_confirm">데이터 베이스를 정말 초기화하시겠습니까?</string>
<string name="nav_exit">종료</string>
<string name="danar_useextended_title">>200% 주입위한 확장식사주입</string>
<string name="danar_bt_name_title">다나R 블루투스</string>
<string name="ns_sync_use_absolute_title">기초주입량 절대값 사용하기</string>
<string name="alert_dialog_storage_permission_text">폰을 재부팅하고나 AndroidAPS를 재시작하세요 \n그렇지 않으면 로그가 기록이되지 않습니다.(알고리즘이 제대로 작동하는지 확인하기 위해 로그가 필요합니다.)!</string>
<string name="objectives_objective_label_string">목표:</string>
<string name="objectives_gate_label_string">방법:</string>
<string name="objectives_button_start">시작</string>
@ -29,6 +29,7 @@
<string name="treatments_insulin_label_string">인슐린:</string>
<string name="treatments_carbs_label_string">탄수화물:</string>
<string name="treatments_iob_label_string">IOB:</string>
<string name="sms_iob">IOB:</string>
<string name="treatments_activity_string">활동:</string>
<string name="treatments_iobtotal_label_string">IOB 총량:</string>
<string name="treatments_iobactivitytotal_label_string">활동 IOB 총량:</string>
@ -73,8 +74,8 @@
<string name="reason">근거</string>
<string name="glucose">혈당</string>
<string name="delta">Delta</string>
<string name="sms_delta">Delta:</string>
<string name="avgdelta">Avg. delta</string>
<string name="configbuilder">Config Builder</string>
<string name="objectives">목표</string>
<string name="openapsma">OpenAPS MA</string>
@ -85,8 +86,6 @@
<string name="treatments">Treatments</string>
<string name="virtualpump">가상펌프</string>
<string name="careportal">Careportal</string>
<string name="configbuilder_pump">펌프</string>
<string name="configbuilder_treatments">Treatments</string>
<string name="configbuilder_tempbasals">임시기초주입</string>
@ -96,7 +95,6 @@
<string name="days"></string>
<string name="objectives_minimalduration">최소기간</string>
<string name="configbuilder_constraints">제한</string>
<string name="loop">Loop</string>
<string name="configbuilder_loop">Loop</string>
<string name="loop_aps_label">APS</string>
@ -104,6 +102,7 @@
<string name="loop_setbypump_label">Set by pump</string>
<string name="openapsma_lastenact_label">최근 주입</string>
<string name="refreshtreatmentsfromnightscout">나이트스카우트에서 Treatments를 새로고치시겠습니까</string>
<string name="refreshtemptargetsfromnightscout">나이트스카우트에서 Temp Target을 새로고치시겠습니까</string>
<string name="ok">OK</string>
<string name="cancel">취소</string>
<string name="noapsselected">NO APS SELECTED OR PROVIDED RESULT</string>
@ -111,6 +110,7 @@
<string name="openapsma_disabled">플러그인이 사용불가능 합니다</string>
<string name="constraints_violation">제한 위반</string>
<string name="treatmentdeliveryerror">식사주입 전송 에러</string>
<string name="tempbasaldeliveryerror">Tempbasal delivery error</string>
<string name="overview_newtempbasal_basal_label">기초주입 값</string>
<string name="overview_newtempbasal_percent_label">% (100% = 현재)</string>
<string name="setbasalquestion">새 임시기초주입 적용:</string>
@ -120,7 +120,9 @@
<string name="confirmation">확인</string>
<string name="entertreatmentquestion">새 Treatment 입력:</string>
<string name="bolus">식사주입</string>
<string name="sms_bolus">Bolus:</string>
<string name="basal">기초주입</string>
<string name="sms_basal">Basal:</string>
<string name="carbs">탄수화물</string>
<string name="changeyourinput">입력값 변경!</string>
<string name="setextendedbolusquestion">새 확장식사주입 설정:</string>
@ -128,9 +130,9 @@
<string name="xdrip">xDrip</string>
<string name="nsclient">NSClient</string>
<string name="apsmode_title">APS 모드</string>
<string name="closedloop">Closed Loop</string>
<string name="openloop">Open Loop</string>
<string name="disabledloop">Loop Disabled</string>
<string name="openloop_newsuggestion">새로운 제안이 있습니다</string>
<string name="unsupportedclientver">지원하지 않는 NSClient 버전입니다</string>
<string name="nsclientnotinstalled">NSClient 가 설치되지 않았습니다. 기록이 삭제됩니다!</string>
@ -161,7 +163,6 @@
<string name="careportal_tempbasalend">Temp Basal End</string>
<string name="careportal_carbscorrection">Carbs correction</string>
<string name="careportal_openapsoffline">OpenAPS Offline</string>
<string name="careportal_newnstreatment_eventtype">Event type</string>
<string name="careportal_newnstreatment_other">Other</string>
<string name="careportal_newnstreatment_meter">Meter</string>
@ -198,14 +199,16 @@
<string name="nav_import">설정 불러오기</string>
<string name="de_lang">German</string>
<string name="es_lang">Spanish</string>
<string name="el_lang">Greek</string>
<string name="openapsma_low_summary">목표범위 최소 혈당값</string>
<string name="openapsma_high_summary">목표범위 최대 혈당값</string>
<string name="openapsma_maxbasal_summary">임시기초주입 최대량 [U/hr]</string>
<string name="openapsma_maxiob_summary">OpenAPS가 주입할수 있는 최대 기초주입 IOB [U]</string>
<string name="openapsma_maxbasal_title">임시기초주입 최대량 [U/hr]</string>
<string name="openapsma_maxbasal_summary">이 값은 OpenAPS에서 Max Basal(임시기초주입 최대량)로 설정되는 값입니다</string>
<string name="openapsma_maxiob_title">OpenAPS가 주입할수 있는 최대 기초주입 IOB [U]</string>
<string name="openapsma_maxiob_summary">이 값은 OpenAPS에서 Max IOB라고 부르는 값입니다\n기본값은 0으로 설정되어 있습니다. 몇일 혹은 몇주 정도 사용 후에 적정한 정도에 따라 값을 조정할 수 있습니다.</string>
<string name="bg_lang">Bulgarian</string>
<string name="dismiss">DISMISS</string>
<string name="dismiss">닫기</string>
<string name="language">언어</string>
<string name="danarpump">다나R</string>
<string name="connecting">연결중</string>
<string name="connected">연결됨</string>
@ -240,8 +243,11 @@
<string name="smscommunicator_allowednumbers">허가된 전화번호</string>
<string name="smscommunicator_allowednumbers_summary">+XXXXXXXXXX;+YYYYYYYYYY</string>
<string name="smscommunicator_bolusreplywithcode" formatted="false">식사주입 %.2fU 을 실행하려면 %s 를 입력하고 답장하세요</string>
<string name="smscommunicator_calibrationreplywithcode" formatted="false">To send calibration %.2f reply with code %s</string>
<string name="smscommunicator_bolusfailed">Bolus failed</string>
<string name="bolusdelivered" formatted="false">Bolus %.2fU delivered successfully</string>
<string name="bolusrequested" formatted="false">Going to deliver %.2fU</string>
<string name="smscommunicator_bolusdelivered" formatted="false">Bolus %.2fU delivered successfully</string>
<string name="bolusdelivering" formatted="false">%.2fU 주입중</string>
<string name="smscommunicator_remotecommandsallowed">SMS 원격 명령 사용하기</string>
<string name="smscommunicator_remotebolusnotallowed">원격 식사주입 허용되지 않음</string>
@ -252,6 +258,7 @@
<string name="careportal_temporarytargetcancel">Temporary Target Cancel</string>
<string name="danarprofile">DanaR 프로파일 설정</string>
<string name="danarprofile_dia">인슐린활동시간(DIA) [h]</string>
<string name="danarprofile_dia_summary">Duration of Insulin Activity</string>
<string name="failedupdatebasalprofile">기초주입 프로파일 갱신 실패</string>
<string name="danar_history">History</string>
<string name="danar_historyreload">Reload</string>
@ -285,6 +292,7 @@
<string name="occlusion">막힘</string>
<string name="overview_bolusprogress_stop">정지</string>
<string name="overview_bolusprogress_stoppressed">정지 누름</string>
<string name="waitingforpump">Waiting for pump</string>
<string name="waitingforpumpclicktorefresh">펌프를 기다리고 있습니다. Click to refresh.</string>
<string name="overview_bolusprogress_goingtodeliver" formatted="false">%.2fU을 주입합니다</string>
<string name="objectives_0_objective">나이트스카우트를 세팅하고, 기초주입과 비율을 분석한다.</string>
@ -307,6 +315,7 @@
<string name="smscommunicator_loophasbeenenabled">Loop가 실행되었습니다.</string>
<string name="smscommunicator_loopisdisabled">Loop가 중지중입니다.</string>
<string name="smscommunicator_loopisenabled">Loop가 실행중입니다.</string>
<string name="openapsma_valuelimitedto" formatted="false">%.2f limited to %.2f</string>
<string name="openapsma_valueoutofrange" formatted="false">값 %s 은 하드리밋(Hard Limit)를 벗어났습니다</string>
<string name="smscommunicator_remotebasalnotallowed">원격 기초주입설정이 허가되지 않았습니다</string>
<string name="smscommunicator_basalreplywithcode" formatted="false">기초주입 %.2fU/h 을 실행하려면 %s 를 입력하고 답장하세요</string>
@ -316,10 +325,9 @@
<string name="smscommunicator_tempbasalcanceled">Temp basal canceled</string>
<string name="smscommunicator_tempbasalcancelfailed">Canceling temp basal failed</string>
<string name="smscommunicator_unknowncommand">알려지지 않은 명령이거나 잘못된 답장입니다</string>
<string name="quickwizard">퀵마법사</string>
<string name="quickwizardsettings">퀵마법사 설정</string>
<string name="overview_editquickwizard_buttontext">버튼 글자:</string>
<string name="overview_editquickwizard_buttontext">버튼:</string>
<string name="overview_editquickwizard_carbs">탄수화물:</string>
<string name="overview_editquickwizard_valid">유효기간:</string>
<string name="overview_editquickwizardlistactivity_add">추가</string>
@ -334,6 +342,7 @@
<string name="ns_upload_only_summary">NS upload only. 로컬소스(xDrip)가 선택되지 않으면 SGV에는 효력이 없습니다. NS프로파일이 사용중이라면 프로파일에는 효력이 없습니다.</string>
<string name="ns_upload_only_enabled">이 기능을 사용하시려면 "NS upload only"을 비활성화 하세요.</string>
<string name="pumpNotInitialized">펌프가 초기화 되지 않았습니다!</string>
<string name="pumpNotInitializedProfileNotSet">펌프가 초기화와 프로파일 설정이 되지 않았습니다!</string>
<string name="primefill">공기/채움</string>
<string name="fillwarning">Please make sure the amount matches the specification of your infusion set!</string>
<string name="othersettings_title">기타</string>
@ -360,7 +369,7 @@
<string name="prefs_range_summary">Overview/스마트워치 차트 표시용 고/저혈당 선</string>
<string name="low_mark">저혈당 선</string>
<string name="high_mark">고혈당 선</string>
<string name="wear">Wear</string>
<string name="wear">웨어</string>
<string name="resend_all_data">모든 데이터 다시 보내기</string>
<string name="open_settings_on_wear">웨어에서 설정 열기</string>
<string name="pumperror">펌프 에러</string>
@ -379,27 +388,137 @@
<string name="sms_actualbg">BG:</string>
<string name="sms_lastbg">Last BG:</string>
<string name="mdi">MDI</string>
<string name="actions_shortname">" "</string>
<string name="wear_shortname">" "</string>
<string name="virtualpump_shortname">" "</string>
<string name="treatments_shortname">" "</string>
<string name="temptargetrange_shortname">" "</string>
<string name="tempbasals_shortname">" "</string>
<string name="smscommunicator_shortname">" "</string>
<string name="simpleprofile_shortname">" "</string>
<string name="profileviewer_shortname">" "</string>
<string name="overview_shortname">" "</string>
<string name="objectives_shortname">" "</string>
<string name="oaps_shortname">" "</string>
<string name="loop_shortname">" "</string>
<string name="localprofile_shortname">" "</string>
<string name="danarpump_shortname">" "</string>
<string name="configbuilder_shortname">" "</string>
<string name="circadian_percentage_profile_shortname">" "</string>
<string name="careportal_shortname">" "</string>
<string name="error_field_must_not_be_empty">필수 입력 항목입니다.</string>
<string name="MM640g">MM640g</string>
<string name="ongoingnotificaction">Ongoing Notification</string>
<string name="old_data">OLD DATA</string>
<string name="minago">%dmin ago</string>
<string name="sms_minago">%dmin ago</string>
<string name="localprofile">Local Profile</string>
<string name="openapsama">OpenAPS AMA</string>
<string name="short_avgdelta">Short avg. delta</string>
<string name="long_avgdelta">Long avg. delta</string>
<string name="array_of_elements">Array of %d elements.\nActual value:</string>
<string name="openapsma_autosensdata_label">Autosens data</string>
<string name="openapsma_scriptdebugdata_label">Script debug</string>
<string name="openapsama_useautosens">AMA autosens 기능 사용하기</string>
<string name="temptargetrange">Temp Target</string>
<string name="temptargetrange_refreshfromnightscout">Refresh temp targets from NS</string>
<string name="eatingsoon">Eating Soon</string>
<string name="activity">Activity</string>
<string name="removerecord">Remove record:</string>
<string name="danar_stats">DanaR Stats</string>
<string name="danar_stats_cumulative_tdd">Cumulative TDD</string>
<string name="danar_stats_expweight">Exponentially Weighted TDD</string>
<string name="danar_stats_basalrate">Basal</string>
<string name="danar_stats_bolus">Bolus</string>
<string name="danar_stats_tdd">TDD</string>
<string name="danar_stats_date">Date</string>
<string name="danar_stats_ratio">Ratio</string>
<string name="danar_stats_amount_days"># Days</string>
<string name="danar_stats_weight">Weight</string>
<string name="danar_stats_warning_Message">Possibly inaccurate if using boluses for priming/filling!</string>
<string name="danar_stats_olddata_Message">Old Data Please Press "RELOAD"</string>
<string name="danar_stats_tbb">Total Base Basal</string>
<string name="danar_stats_tbb2">TBB * 2</string>
<string name="initializing">Initializing ...</string>
<string name="actions_shortname">ACT</string>
<string name="configbuilder_shortname">CONF</string>
<string name="loop_shortname">LOOP</string>
<string name="simpleprofile_shortname">SP</string>
<string name="oaps_shortname">OAPS</string>
<string name="temptargetrange_shortname">TT</string>
<string name="localprofile_shortname">LP</string>
<string name="danarpump_shortname">DANA</string>
<string name="circadian_percentage_profile_shortname">CPP</string>
<string name="tempbasals_shortname">TB</string>
<string name="overview_shortname">HOME</string>
<string name="virtualpump_shortname">VPUMP</string>
<string name="profileviewer_shortname">NSPROFILE</string>
<string name="treatments_shortname">TREAT</string>
<string name="careportal_shortname">CP</string>
<string name="objectives_shortname">OBJ</string>
<string name="wear_shortname">WEAR</string>
<string name="smscommunicator_shortname">SMS</string>
<string name="short_tabtitles">탭 이름 단축</string>
<string name="prefs_delta_title">Delta Settings</string>
<string name="always_use_shortavg">Always use short average delta instead of simple delta</string>
<string name="always_use_shortavg_summary">Useful when data from unfiltered sources like xDrip gets noisy.</string>
<string name="advancedsettings_title">고급 설정</string>
<string name="virtualpump_firmware_label">Firmware:</string>
<string name="danar_model" formatted="false">Model: %02X Protocol: %02X Code: %02X</string>
<string name="profile">프로파일</string>
<string name="openapsama_max_daily_safety_multiplier_summary">Default value: 3\nThis is a key OpenAPS safety cap. What this does is limit your basals to be 3x (in this people) your biggest basal rate. You likely will not need to change this, but you should be aware thats what is discussed about “3x max daily; 4x current” for safety caps.</string>
<string name="openapsama_current_basal_safety_multiplier_summary">Default value: 4\nThis is the other half of the key OpenAPS safety caps, and the other half of “3x max daily; 4x current” of the safety caps. This means your basal, regardless of max basal set on your pump, cannot be any higher than this number times the current level of your basal. This is to prevent people from getting into dangerous territory by setting excessively high max basals before understanding how the algorithm works. Again, the default is 4x; most people will never need to adjust this and are instead more likely to need to adjust other settings if they feel like they are “running into” this safety cap.</string>
<string name="openapsama_autosens_max_summary">Default value: 1.2\nThis is a multiplier cap for autosens (and soon autotune) to set a 20% max limit on how high the autosens ratio can be, which in turn determines how high autosens can adjust basals, how low it can adjust ISF, and how low it can set the BG target.</string>
<string name="openapsama_autosens_min_summary">Default value: 0.7\nThe other side of the autosens safety limits, putting a cap on how low autosens can adjust basals, and how high it can adjust ISF and BG targets.</string>
<string name="openapsama_autosens_adjusttargets_summary">Default value: true\nThis is used to allow autosens to adjust BG targets, in addition to ISF and basals.</string>
<string name="openapsama_bolussnooze_dia_divisor_summary">Default value: 2\nBolus snooze is enacted after you do a meal bolus, so the loop wont counteract with low temps when youve just eaten. The example here and default is 2; so a 3 hour DIA means that bolus snooze will be gradually phased out over 1.5 hours (3DIA/2).</string>
<string name="openapsama_min_5m_carbimpact_summary">Default value: 3.0\nThis is a setting for default carb absorption impact per 5 minutes. The default is an expected 3mg/dl/5min. This affects how fast COB are decayed, and how much carb absorption is assumed in calculating future predicted BG, when BG is falling more than expected, or not rising as much as expected.</string>
<string name="openapsama_link_to_preferncejson_doc_txt">주의!\n보통의 경우 아래의 값을 변경하면 안됩니다. 이 값들을 변경하기 전에 반드시 이곳을 클릭하고 글을 정독해서 확실하게 이해를 하여야 합니다..</string>
<string name="openapsama_link_to_preferncejson_doc">http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-3/beyond-low-glucose-suspend.html</string>
<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>
<string name="error_field_must_not_be_empty">필수 입력 항목입니다.</string>
<string name="error_phone_not_valid">폰번호가 유효하지 않습니다</string>
<string name="smscommunicator_invalidphonennumber">SMS폰번호가 유효하지 않습니다</string>
<string name="copy_to_clipboard">Copy To Clipboard</string>
<string name="copied_to_clipboard">Copied to clipboard</string>
<string name="nav_show_logcat">Show log</string>
<string name="overview_calibration">보정</string>
<string name="overview_calibration_bg_label">혈당 보정</string>
<string name="send_calibration" formatted="false">Send calibration %.1f to xDrip?</string>
<string name="xdripnotinstalled">xDrip+가 설치되지 않았습니다</string>
<string name="calibrationsent">보정이 xDrip으로 전송되었습니다</string>
<string name="smscommunicator_remotecalibrationnotallowed">원격보정이 허용되지 않았습니다</string>
<string name="smscommunicator_calibrationsent">보정이 전송되었습니다. xDrip에서 수신이 되도록 설정되어 있어야 합니다.</string>
<string name="smscommunicator_calibrationfailed">xDrip에서 보정을 받지 못합니다.</string>
<string name="dont_show_again">Don\'t show again</string>
<string name="pumpsuspendedclicktorefresh">펌프 일시중지. 상태를 새로고치려면 클릭하세요</string>
<string name="pumpsuspended">펌프 일시중지됨</string>
<string name="gettingpumpstatus">펌프 상태 가져오는중</string>
<string name="settingtempbasal">임시 기초주입 설정중</string>
<string name="stoppingtempbasal">임시기초주입 취소중</string>
<string name="settingextendedbolus">확장식사주입 설정중</string>
<string name="stoppingextendedbolus">확장식사주입 취소중</string>
<string name="updatingbasalrates">기초주입량 업데이트중</string>
<string name="disconnecting">연결끊기중</string>
<string name="executing">실행중</string>
<string name="virtualpump_settings">가상펌프 설정</string>
<string name="virtualpump_uploadstatus_title">Upload status to NS</string>
<string name="wrongpassword">잘못된 비밀번호</string>
<string name="settings_password">설정 비밀번호</string>
<string name="unlock_settings">설정 잠금해제</string>
<string name="approachingdailylimit">인슐린 일 허용량에 근접중</string>
<string name="nsclientinternal">내장 NSClient</string>
<string name="nsclientinternal_shortname">NSCI</string>
<string name="nsclientinternal_url">URL:</string>
<string name="nsclientinternal_autoscroll">Autoscroll</string>
<string name="restart">Restart</string>
<string name="nsclientinternal_title">내장 NSClient</string>
<string name="nsclientinternal_url_title">Nightscout URL</string>
<string name="nsclientinternal_url_dialogmessage">Nightscout URL 입력</string>
<string name="nsclientinternal_secret_title">NS API secret</string>
<string name="nsclientinternal_secret_dialogtitle">NS API secret</string>
<string name="nsclientinternal_secret_dialogmessage">NS API secret 입력(최소 12글자)</string>
<string name="nsclientinternal_devicename_title">Device name</string>
<string name="nsclientinternal_devicename_dialogtitle">Enter device name</string>
<string name="nsclientinternal_devicename_dialogmessage">It will be used for enteredBy field</string>
<string name="deliver_now">Deliver now</string>
<string name="clear_queue">Clear queue</string>
<string name="show_queue">Show queue</string>
<string name="queue">Queue:</string>
<string name="status">Status:</string>
<string name="paused">Paused</string>
<string name="clearlog">Clear log</string>
<string name="nowritepermission">NSCLIENT이 쓰기 권한이 없습니다. 잘못된 API secret?</string>
<string name="wear_settings">웨어 설정</string>
<string name="wear_detailedIOB_title">IOB 자세하게 보여주기</string>
<string name="wear_detailedIOB_summary">워치페이스에 IOB를 식사주입IOB와 기초주입IOB로 나누어서 보여줍니다.</string>
<string name="nosuccess">not successful - please check phone</string>
<string name="notavailable">Not available</string>
<string name="patientage">나이</string>
<string name="child">어린이</string>
<string name="teenage">청소년</string>
<string name="adult">성인</string>
<string name="patientage_summary">안전제한을 설정하기 위해 당뇨인의 나이를 선택하세요</string>
</resources>

View file

@ -27,6 +27,10 @@
<color name="colorPumpLabel">#779ECB</color>
<color name="cardItemLabel">#FF478EFF</color>
<color name="loopenabled">#47c8ff</color>
<color name="loopdisabled">#FFDD7792</color>
<color name="looppumpsuspended">#ff0400</color>
<color name="notificationUrgent">#ff0400</color>
<color name="notificationNormal">#ff5e55</color>
<color name="notificationLow">#ff827c</color>

View file

@ -139,6 +139,8 @@
<string name="closedloop">Closed Loop</string>
<string name="openloop">Open Loop</string>
<string name="disabledloop">Loop Disabled</string>
<string name="disableloop">Disable loop</string>
<string name="enableloop">Enable loop</string>
<string name="openloop_newsuggestion">New suggestion available</string>
<string name="unsupportedclientver">Unsupported version of NSClient</string>
@ -327,7 +329,9 @@
<string name="openapsma_valuelimitedto" formatted="false">%.2f limited to %.2f</string>
<string name="openapsma_valueoutofrange" formatted="false">Value %s is out of hard limits</string>
<string name="smscommunicator_remotebasalnotallowed">Remote basal setting is not allowed</string>
<string name="smscommunicator_remotecommandnotallowed">Remote command is not allowed</string>
<string name="smscommunicator_basalreplywithcode" formatted="false">To start basal %.2fU/h reply with code %s</string>
<string name="smscommunicator_suspendreplywithcode" formatted="false">To suspend loop for %d minutes reply with code %s</string>
<string name="smscommunicator_tempbasalset" formatted="false">Temp basal %.2fU/h for %d min started successfully</string>
<string name="smscommunicator_tempbasalfailed">Temp basal start failed</string>
<string name="smscommunicator_basalstopreplywithcode" formatted="false">To stop temp basal reply with code %s</string>
@ -533,9 +537,9 @@
<string name="key_danar_useextended" translatable="false">danar_useextended</string>
<string name="key_danarprofile_dia" translatable="false">danarprofile_dia</string>
<string name="clearlog">Clear log</string>
<string name="key_nsclientinternal_autoscroll">nsclientinternal_autoscroll</string>
<string name="key_nsclientinternal_paused">nsclientinternal_paused</string>
<string name="nowritepermission">NSCLIENT has no write permission</string>
<string name="key_nsclientinternal_autoscroll" translatable="false">nsclientinternal_autoscroll</string>
<string name="key_nsclientinternal_paused" translatable="false">nsclientinternal_paused</string>
<string name="nowritepermission">NSCLIENT has no write permission. Wrong API secret?</string>
<string name="wear_settings">Wear settings</string>
<string name="wear_detailedIOB_title">Show detailed IOB</string>
<string name="wear_detailedIOB_summary">Break down IOB into bolus and basal IOB on the watchface</string>
@ -552,5 +556,31 @@
<string name="key_teenage" translatable="false">teenage</string>
<string name="key_adult" translatable="false">adult</string>
<string name="patientage_summary">Please select patient age to setup safety limits</string>
<string name="key_i_understand">I_understand</string>
<string name="key_i_understand" translatable="false">I_understand</string>
<string name="Glimp">Glimp</string>
<string name="batteryoptimalizationerror">Device does not appear to support battery optimization whitelisting!</string>
<string name="pleaseallowpermission">Please Allow Permission</string>
<string name="needwhitelisting">%s needs battery optimalization whitelisting for proper performance</string>
<string name="loopsuspended">Loop suspended</string>
<string name="loopsuspendedfor" formatted="false">Suspended (%d m)</string>
<string name="loopsuperbolusfor" formatted="false">Superbolus (%d m)</string>
<string name="loopmenu">Loop menu</string>
<string name="suspendloopfor1h">Suspend loop for 1h</string>
<string name="suspendloopfor2h">Suspend loop for 2h</string>
<string name="suspendloopfor3h">Suspend loop for 3h</string>
<string name="suspendloopfor10h">Suspend loop for 10 h</string>
<string name="disconnectpumpfor30m">Disconnect pump for 30 min</string>
<string name="disconnectpumpfor1h">Disconnect pump for 1 h</string>
<string name="disconnectpumpfor2h">Disconnect pump for 2 h</string>
<string name="disconnectpumpfor3h">Disconnect pump for 3 h</string>
<string name="disconnectpumpfor10h">Disconnect pump for 10 h</string>
<string name="resume">Resume</string>
<string name="smscommunicator_wrongduration">Wrong duration</string>
<string name="smscommunicator_loopsuspended">Loop suspended</string>
<string name="smscommunicator_loopresumed">Loop resumed</string>
<string name="treatments_wizard_bgtrend_label">15min trend</string>
<string name="treatments_wizard_cob_label">COB</string>
<string name="treatments_wizard_sb_label">Superbolus</string>
<string name="ns_logappstartedevent">Log app start to NS</string>
<string name="key_ns_logappstartedevent" translatable="false">ns_logappstartedevent</string>
</resources>

View file

@ -21,6 +21,10 @@
android:defaultValue=""
android:inputType="textPassword">
</EditTextPreference>
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_ns_logappstartedevent"
android:title="@string/ns_logappstartedevent" />
</PreferenceCategory>
</PreferenceScreen>

View file

@ -7,7 +7,7 @@
<EditTextPreference
android:title="@string/smscommunicator_allowednumbers"
android:summary="@string/smscommunicator_allowednumbers_summary"
android:key="@string/smscommunicator_allowednumbers"
android:key="@string/key_smscommunicator_allowednumbers"
android:defaultValue="">
</EditTextPreference>
<SwitchPreference

View file

@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.android.tools.build:gradle:2.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View file

@ -1,6 +1,6 @@
#Thu Aug 18 17:59:31 CEST 2016
#Sun Mar 05 11:39:37 CET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip