Merge branch 'dev' into tt-in-wizard
This commit is contained in:
commit
c2afa328e3
81 changed files with 496 additions and 402 deletions
|
@ -114,7 +114,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||||
try { // activity may be destroyed
|
try { // activity may be destroyed
|
||||||
setUpTabs(true);
|
setUpTabs(true);
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
boolean lockScreen = BuildConfig.NSCLIENTOLNY && SP.getBoolean("lockscreen", false);
|
boolean lockScreen = BuildConfig.NSCLIENTOLNY && SP.getBoolean("lockscreen", false);
|
||||||
if (lockScreen)
|
if (lockScreen)
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.app.Application;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
|
|
||||||
|
@ -167,10 +168,7 @@ public class MainApp extends Application {
|
||||||
Thread t = new Thread(new Runnable() {
|
Thread t = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
SystemClock.sleep(5000);
|
||||||
Thread.sleep(5000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
|
||||||
PumpInterface pump = MainApp.getConfigBuilder();
|
PumpInterface pump = MainApp.getConfigBuilder();
|
||||||
if (pump != null)
|
if (pump != null)
|
||||||
pump.refreshDataFromPump("Initialization");
|
pump.refreshDataFromPump("Initialization");
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class AlarmSoundService extends Service {
|
||||||
player.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
|
player.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
|
||||||
afd.close();
|
afd.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
player.setLooping(true); // Set looping
|
player.setLooping(true); // Set looping
|
||||||
player.setVolume(100, 100);
|
player.setVolume(100, 100);
|
||||||
|
@ -59,7 +59,7 @@ public class AlarmSoundService extends Service {
|
||||||
player.prepare();
|
player.prepare();
|
||||||
player.start();
|
player.start();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return START_STICKY;
|
return START_STICKY;
|
||||||
|
|
|
@ -244,7 +244,7 @@ public class DataService extends IntentService {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.OLD_NSCLIENT));
|
MainApp.bus().post(new EventDismissNotification(Notification.OLD_NSCLIENT));
|
||||||
}
|
}
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
if (ConfigBuilderPlugin.nightscoutVersionCode < Config.SUPPORTEDNSVERSION) {
|
if (ConfigBuilderPlugin.nightscoutVersionCode < Config.SUPPORTEDNSVERSION) {
|
||||||
Notification notification = new Notification(Notification.OLD_NS, MainApp.sResources.getString(R.string.unsupportednsversion), Notification.URGENT);
|
Notification notification = new Notification(Notification.OLD_NS, MainApp.sResources.getString(R.string.unsupportednsversion), Notification.URGENT);
|
||||||
|
@ -269,7 +269,7 @@ public class DataService extends IntentService {
|
||||||
if (targetlow != null)
|
if (targetlow != null)
|
||||||
OverviewPlugin.bgTargetLow = targetlow;
|
OverviewPlugin.bgTargetLow = targetlow;
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,7 +298,7 @@ public class DataService extends IntentService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Handle profile
|
// Handle profile
|
||||||
|
@ -313,7 +313,7 @@ public class DataService extends IntentService {
|
||||||
if (Config.logIncommingData)
|
if (Config.logIncommingData)
|
||||||
log.debug("Received profileStore: " + activeProfile + " " + profile);
|
log.debug("Received profileStore: " + activeProfile + " " + profile);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (intent.getAction().equals(Intents.ACTION_NEW_TREATMENT)) {
|
if (intent.getAction().equals(Intents.ACTION_NEW_TREATMENT)) {
|
||||||
|
@ -332,7 +332,7 @@ public class DataService extends IntentService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,7 @@ public class DataService extends IntentService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ public class DataService extends IntentService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ public class DataService extends IntentService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,7 +430,7 @@ public class DataService extends IntentService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@ package info.nightscout.androidaps.data;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@ -9,6 +11,8 @@ import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.Round;
|
import info.nightscout.utils.Round;
|
||||||
|
|
||||||
public class IobTotal {
|
public class IobTotal {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(IobTotal.class);
|
||||||
|
|
||||||
public double iob;
|
public double iob;
|
||||||
public double activity;
|
public double activity;
|
||||||
public double bolussnooze;
|
public double bolussnooze;
|
||||||
|
@ -86,7 +90,7 @@ public class IobTotal {
|
||||||
json.put("activity", activity);
|
json.put("activity", activity);
|
||||||
json.put("time", DateUtil.toISOString(new Date()));
|
json.put("time", DateUtil.toISOString(new Date()));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +104,7 @@ public class IobTotal {
|
||||||
json.put("activity", activity);
|
json.put("activity", activity);
|
||||||
json.put("time", DateUtil.toISOString(new Date(time)));
|
json.put("time", DateUtil.toISOString(new Date(time)));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class Profile {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.TARGET_MISSING));
|
MainApp.bus().post(new EventDismissNotification(Notification.TARGET_MISSING));
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.invalidprofile));
|
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.invalidprofile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ public class Profile {
|
||||||
try {
|
try {
|
||||||
json.put("units", units);
|
json.put("units", units);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ public class Profile {
|
||||||
Double value = o.getDouble("value");
|
Double value = o.getDouble("value");
|
||||||
sparse.put(tas, value);
|
sparse.put(tas, value);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sparse;
|
return sparse;
|
||||||
|
@ -176,7 +176,7 @@ public class Profile {
|
||||||
}
|
}
|
||||||
lastValue = value;
|
lastValue = value;
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return lastValue;
|
return lastValue;
|
||||||
|
@ -215,7 +215,7 @@ public class Profile {
|
||||||
if (index + 1 < array.length())
|
if (index + 1 < array.length())
|
||||||
retValue += "\n";
|
retValue += "\n";
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return retValue;
|
return retValue;
|
||||||
|
@ -297,7 +297,7 @@ public class Profile {
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return new BasalValue[0];
|
return new BasalValue[0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class ProfileStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public class ProfileStore {
|
||||||
return defaultProfileName;
|
return defaultProfileName;
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return defaultProfileName;
|
return defaultProfileName;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ public class ProfileStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ public class ProfileStore {
|
||||||
ret.add(profileName);
|
ret.add(profileName);
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -5,6 +5,8 @@ import android.text.Spanned;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
@ -12,6 +14,8 @@ import info.nightscout.utils.DecimalFormatter;
|
||||||
import info.nightscout.utils.Round;
|
import info.nightscout.utils.Round;
|
||||||
|
|
||||||
public class PumpEnactResult extends Object {
|
public class PumpEnactResult extends Object {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(PumpEnactResult.class);
|
||||||
|
|
||||||
public boolean success = false; // request was processed successfully (but possible no change was needed)
|
public boolean success = false; // request was processed successfully (but possible no change was needed)
|
||||||
public boolean enacted = false; // request was processed successfully and change has been made
|
public boolean enacted = false; // request was processed successfully and change has been made
|
||||||
public String comment = "";
|
public String comment = "";
|
||||||
|
@ -101,7 +105,7 @@ public class PumpEnactResult extends Object {
|
||||||
result.put("duration", duration);
|
result.put("duration", duration);
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class CareportalEvent implements DataPointWithLabelInterface {
|
||||||
JSONObject object = new JSONObject(json);
|
JSONObject object = new JSONObject(json);
|
||||||
mbg = object.getDouble("mgdl");
|
mbg = object.getDouble("mgdl");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return Profile.fromMgdlToUnits(mbg, units);
|
return Profile.fromMgdlToUnits(mbg, units);
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ public class CareportalEvent implements DataPointWithLabelInterface {
|
||||||
units = object.getString("units");
|
units = object.getString("units");
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
if (glucose != 0d) {
|
if (glucose != 0d) {
|
||||||
double mmol = 0d;
|
double mmol = 0d;
|
||||||
|
@ -186,7 +186,7 @@ public class CareportalEvent implements DataPointWithLabelInterface {
|
||||||
if (object.has("notes"))
|
if (object.has("notes"))
|
||||||
return object.getString("notes");
|
return object.getString("notes");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return Translator.translate(eventType);
|
return Translator.translate(eventType);
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ public class CareportalEvent implements DataPointWithLabelInterface {
|
||||||
if (object.has("duration"))
|
if (object.has("duration"))
|
||||||
return object.getInt("duration") * 60 * 1000L;
|
return object.getInt("duration") * 60 * 1000L;
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
TableUtils.createTableIfNotExists(connectionSource, ProfileSwitch.class);
|
TableUtils.createTableIfNotExists(connectionSource, ProfileSwitch.class);
|
||||||
updateEarliestDataChange(0);
|
updateEarliestDataChange(0);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
VirtualPumpPlugin.setFakingStatus(true);
|
VirtualPumpPlugin.setFakingStatus(true);
|
||||||
scheduleBgChange(); // trigger refresh
|
scheduleBgChange(); // trigger refresh
|
||||||
|
@ -234,7 +234,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
TableUtils.createTableIfNotExists(connectionSource, Treatment.class);
|
TableUtils.createTableIfNotExists(connectionSource, Treatment.class);
|
||||||
updateEarliestDataChange(0);
|
updateEarliestDataChange(0);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
scheduleTreatmentChange();
|
scheduleTreatmentChange();
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
TableUtils.dropTable(connectionSource, TempTarget.class, true);
|
TableUtils.dropTable(connectionSource, TempTarget.class, true);
|
||||||
TableUtils.createTableIfNotExists(connectionSource, TempTarget.class);
|
TableUtils.createTableIfNotExists(connectionSource, TempTarget.class);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
scheduleTemporaryTargetChange();
|
scheduleTemporaryTargetChange();
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
TableUtils.createTableIfNotExists(connectionSource, TemporaryBasal.class);
|
TableUtils.createTableIfNotExists(connectionSource, TemporaryBasal.class);
|
||||||
updateEarliestDataChange(0);
|
updateEarliestDataChange(0);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
VirtualPumpPlugin.setFakingStatus(false);
|
VirtualPumpPlugin.setFakingStatus(false);
|
||||||
scheduleTemporaryBasalChange();
|
scheduleTemporaryBasalChange();
|
||||||
|
@ -267,7 +267,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
TableUtils.createTableIfNotExists(connectionSource, ExtendedBolus.class);
|
TableUtils.createTableIfNotExists(connectionSource, ExtendedBolus.class);
|
||||||
updateEarliestDataChange(0);
|
updateEarliestDataChange(0);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
scheduleExtendedBolusChange();
|
scheduleExtendedBolusChange();
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
TableUtils.dropTable(connectionSource, CareportalEvent.class, true);
|
TableUtils.dropTable(connectionSource, CareportalEvent.class, true);
|
||||||
TableUtils.createTableIfNotExists(connectionSource, CareportalEvent.class);
|
TableUtils.createTableIfNotExists(connectionSource, CareportalEvent.class);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
scheduleCareportalEventChange();
|
scheduleCareportalEventChange();
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
TableUtils.dropTable(connectionSource, ProfileSwitch.class, true);
|
TableUtils.dropTable(connectionSource, ProfileSwitch.class, true);
|
||||||
TableUtils.createTableIfNotExists(connectionSource, ProfileSwitch.class);
|
TableUtils.createTableIfNotExists(connectionSource, ProfileSwitch.class);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
scheduleProfileSwitchChange();
|
scheduleProfileSwitchChange();
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,7 +430,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
bgReadings = daoBgreadings.query(preparedQuery);
|
bgReadings = daoBgreadings.query(preparedQuery);
|
||||||
return bgReadings;
|
return bgReadings;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return new ArrayList<BgReading>();
|
return new ArrayList<BgReading>();
|
||||||
}
|
}
|
||||||
|
@ -441,7 +441,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
try {
|
try {
|
||||||
getDaoDbRequest().create(dbr);
|
getDaoDbRequest().create(dbr);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,7 +449,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
try {
|
try {
|
||||||
return getDaoDbRequest().delete(dbr);
|
return getDaoDbRequest().delete(dbr);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -458,7 +458,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
try {
|
try {
|
||||||
return getDaoDbRequest().deleteById(nsClientId);
|
return getDaoDbRequest().deleteById(nsClientId);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -478,7 +478,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
return delete(dbList.get(0));
|
return delete(dbList.get(0));
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -487,7 +487,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
try {
|
try {
|
||||||
TableUtils.clearTable(connectionSource, DbRequest.class);
|
TableUtils.clearTable(connectionSource, DbRequest.class);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
try {
|
try {
|
||||||
return getDaoDbRequest().closeableIterator();
|
return getDaoDbRequest().closeableIterator();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -583,7 +583,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -593,7 +593,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
getDaoTreatments().delete(treatment);
|
getDaoTreatments().delete(treatment);
|
||||||
updateEarliestDataChange(treatment.date);
|
updateEarliestDataChange(treatment.date);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
scheduleTreatmentChange();
|
scheduleTreatmentChange();
|
||||||
}
|
}
|
||||||
|
@ -603,7 +603,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
getDaoTreatments().update(treatment);
|
getDaoTreatments().update(treatment);
|
||||||
updateEarliestDataChange(treatment.date);
|
updateEarliestDataChange(treatment.date);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
scheduleTreatmentChange();
|
scheduleTreatmentChange();
|
||||||
}
|
}
|
||||||
|
@ -636,7 +636,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
return trList.get(0);
|
return trList.get(0);
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -685,7 +685,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
treatments = daoTreatments.query(preparedQuery);
|
treatments = daoTreatments.query(preparedQuery);
|
||||||
return treatments;
|
return treatments;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return new ArrayList<Treatment>();
|
return new ArrayList<Treatment>();
|
||||||
}
|
}
|
||||||
|
@ -715,7 +715,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
}
|
}
|
||||||
createOrUpdate(treatment);
|
createOrUpdate(treatment);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -733,7 +733,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
tempTargets = daoTempTargets.query(preparedQuery);
|
tempTargets = daoTempTargets.query(preparedQuery);
|
||||||
return tempTargets;
|
return tempTargets;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return new ArrayList<TempTarget>();
|
return new ArrayList<TempTarget>();
|
||||||
}
|
}
|
||||||
|
@ -787,7 +787,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -797,7 +797,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
getDaoTempTargets().delete(tempTarget);
|
getDaoTempTargets().delete(tempTarget);
|
||||||
scheduleTemporaryTargetChange();
|
scheduleTemporaryTargetChange();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -847,7 +847,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
tempTarget.source = Source.NIGHTSCOUT;
|
tempTarget.source = Source.NIGHTSCOUT;
|
||||||
createOrUpdate(tempTarget);
|
createOrUpdate(tempTarget);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -874,7 +874,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -885,7 +885,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
try {
|
try {
|
||||||
getDaoDanaRHistory().createOrUpdate(record);
|
getDaoDanaRHistory().createOrUpdate(record);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -900,7 +900,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
PreparedQuery<DanaRHistoryRecord> preparedQuery = queryBuilder.prepare();
|
PreparedQuery<DanaRHistoryRecord> preparedQuery = queryBuilder.prepare();
|
||||||
historyList = getDaoDanaRHistory().query(preparedQuery);
|
historyList = getDaoDanaRHistory().query(preparedQuery);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
historyList = new ArrayList<>();
|
historyList = new ArrayList<>();
|
||||||
}
|
}
|
||||||
return historyList;
|
return historyList;
|
||||||
|
@ -927,7 +927,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException | JSONException e) {
|
} catch (SQLException | JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1013,7 +1013,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1023,7 +1023,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
getDaoTemporaryBasal().delete(tempBasal);
|
getDaoTemporaryBasal().delete(tempBasal);
|
||||||
updateEarliestDataChange(tempBasal.date);
|
updateEarliestDataChange(tempBasal.date);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
scheduleTemporaryBasalChange();
|
scheduleTemporaryBasalChange();
|
||||||
}
|
}
|
||||||
|
@ -1039,7 +1039,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
tempbasals = getDaoTemporaryBasal().query(preparedQuery);
|
tempbasals = getDaoTemporaryBasal().query(preparedQuery);
|
||||||
return tempbasals;
|
return tempbasals;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return new ArrayList<TemporaryBasal>();
|
return new ArrayList<TemporaryBasal>();
|
||||||
}
|
}
|
||||||
|
@ -1132,7 +1132,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
createOrUpdate(tempBasal);
|
createOrUpdate(tempBasal);
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1161,7 +1161,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
return list.get(0);
|
return list.get(0);
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1242,7 +1242,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1252,7 +1252,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
getDaoExtendedBolus().delete(extendedBolus);
|
getDaoExtendedBolus().delete(extendedBolus);
|
||||||
updateEarliestDataChange(extendedBolus.date);
|
updateEarliestDataChange(extendedBolus.date);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
scheduleExtendedBolusChange();
|
scheduleExtendedBolusChange();
|
||||||
}
|
}
|
||||||
|
@ -1268,7 +1268,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
extendedBoluses = getDaoExtendedBolus().query(preparedQuery);
|
extendedBoluses = getDaoExtendedBolus().query(preparedQuery);
|
||||||
return extendedBoluses;
|
return extendedBoluses;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return new ArrayList<ExtendedBolus>();
|
return new ArrayList<ExtendedBolus>();
|
||||||
}
|
}
|
||||||
|
@ -1298,7 +1298,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1349,7 +1349,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
extendedBolus._id = trJson.getString("_id");
|
extendedBolus._id = trJson.getString("_id");
|
||||||
createOrUpdate(extendedBolus);
|
createOrUpdate(extendedBolus);
|
||||||
} catch (SQLException | JSONException e) {
|
} catch (SQLException | JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1383,7 +1383,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
try {
|
try {
|
||||||
getDaoCareportalEvents().createOrUpdate(careportalEvent);
|
getDaoCareportalEvents().createOrUpdate(careportalEvent);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
scheduleCareportalEventChange();
|
scheduleCareportalEventChange();
|
||||||
}
|
}
|
||||||
|
@ -1392,7 +1392,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
try {
|
try {
|
||||||
getDaoCareportalEvents().delete(careportalEvent);
|
getDaoCareportalEvents().delete(careportalEvent);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
scheduleCareportalEventChange();
|
scheduleCareportalEventChange();
|
||||||
}
|
}
|
||||||
|
@ -1413,7 +1413,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1429,7 +1429,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
careportalEvents = getDaoCareportalEvents().query(preparedQuery);
|
careportalEvents = getDaoCareportalEvents().query(preparedQuery);
|
||||||
return careportalEvents;
|
return careportalEvents;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return new ArrayList<CareportalEvent>();
|
return new ArrayList<CareportalEvent>();
|
||||||
}
|
}
|
||||||
|
@ -1453,7 +1453,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
log.debug("CareportalEvent not found database: " + _id);
|
log.debug("CareportalEvent not found database: " + _id);
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1486,7 +1486,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
careportalEvent._id = trJson.getString("_id");
|
careportalEvent._id = trJson.getString("_id");
|
||||||
createOrUpdate(careportalEvent);
|
createOrUpdate(careportalEvent);
|
||||||
} catch (SQLException | JSONException e) {
|
} catch (SQLException | JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1521,7 +1521,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
profileSwitches = daoProfileSwitch.query(preparedQuery);
|
profileSwitches = daoProfileSwitch.query(preparedQuery);
|
||||||
return profileSwitches;
|
return profileSwitches;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return new ArrayList<ProfileSwitch>();
|
return new ArrayList<ProfileSwitch>();
|
||||||
}
|
}
|
||||||
|
@ -1575,7 +1575,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1585,7 +1585,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
getDaoProfileSwitch().delete(profileSwitch);
|
getDaoProfileSwitch().delete(profileSwitch);
|
||||||
scheduleProfileSwitchChange();
|
scheduleProfileSwitchChange();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1640,7 +1640,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
profileSwitch.profilePlugin = trJson.getString("profilePlugin");
|
profileSwitch.profilePlugin = trJson.getString("profilePlugin");
|
||||||
createOrUpdate(profileSwitch);
|
createOrUpdate(profileSwitch);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1667,7 +1667,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class DbRequest {
|
||||||
if (_id != null) object.put("_id", _id);
|
if (_id != null) object.put("_id", _id);
|
||||||
if (nsClientID != null) object.put("nsClientID", nsClientID);
|
if (nsClientID != null) object.put("nsClientID", nsClientID);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ public class DbRequest {
|
||||||
if (jsonObject.has("nsClientID"))
|
if (jsonObject.has("nsClientID"))
|
||||||
result.nsClientID = jsonObject.getString("nsClientID");
|
result.nsClientID = jsonObject.getString("nsClientID");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
|
||||||
try {
|
try {
|
||||||
profile = new Profile(new JSONObject(profileJson));
|
profile = new Profile(new JSONObject(profileJson));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,9 @@ import android.widget.TextView;
|
||||||
import com.crashlytics.android.answers.Answers;
|
import com.crashlytics.android.answers.Answers;
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
import com.crashlytics.android.answers.CustomEvent;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
|
@ -31,12 +34,15 @@ import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.db.Source;
|
import info.nightscout.androidaps.db.Source;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
import info.nightscout.utils.PlusMinusEditText;
|
import info.nightscout.utils.PlusMinusEditText;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
import info.nightscout.utils.SafeParse;
|
import info.nightscout.utils.SafeParse;
|
||||||
|
|
||||||
public class FillDialog extends DialogFragment implements OnClickListener {
|
public class FillDialog extends DialogFragment implements OnClickListener {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(FillDialog.class);
|
||||||
|
|
||||||
Button deliverButton;
|
Button deliverButton;
|
||||||
TextView insulin;
|
TextView insulin;
|
||||||
|
@ -168,11 +174,17 @@ public class FillDialog extends DialogFragment implements OnClickListener {
|
||||||
detailedBolusInfo.isValid = false; // do not count it in IOB (for pump history)
|
detailedBolusInfo.isValid = false; // do not count it in IOB (for pump history)
|
||||||
PumpEnactResult result = pump.deliverTreatment(detailedBolusInfo);
|
PumpEnactResult result = pump.deliverTreatment(detailedBolusInfo);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
try {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror));
|
builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror));
|
||||||
builder.setMessage(result.comment);
|
builder.setMessage(result.comment);
|
||||||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
|
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
|
||||||
builder.show();
|
builder.show();
|
||||||
|
} catch (WindowManager.BadTokenException e) {
|
||||||
|
// window has been destroyed
|
||||||
|
Notification notification = new Notification(Notification.BOLUS_DELIVERY_ERROR, MainApp.sResources.getString(R.string.treatmentdeliveryerror), Notification.URGENT);
|
||||||
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -183,8 +195,8 @@ public class FillDialog extends DialogFragment implements OnClickListener {
|
||||||
builder.setNegativeButton(getString(R.string.cancel), null);
|
builder.setNegativeButton(getString(R.string.cancel), null);
|
||||||
builder.show();
|
builder.show();
|
||||||
dismiss();
|
dismiss();
|
||||||
} catch (Exception e) {
|
} catch (RuntimeException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import android.support.v7.app.AlertDialog;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
|
@ -17,6 +18,9 @@ import android.widget.RadioButton;
|
||||||
import com.crashlytics.android.answers.Answers;
|
import com.crashlytics.android.answers.Answers;
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
import com.crashlytics.android.answers.CustomEvent;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
|
@ -24,10 +28,13 @@ import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
import info.nightscout.utils.PlusMinusEditText;
|
import info.nightscout.utils.PlusMinusEditText;
|
||||||
import info.nightscout.utils.SafeParse;
|
import info.nightscout.utils.SafeParse;
|
||||||
|
|
||||||
public class NewExtendedBolusDialog extends DialogFragment implements View.OnClickListener {
|
public class NewExtendedBolusDialog extends DialogFragment implements View.OnClickListener {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(NewExtendedBolusDialog.class);
|
||||||
|
|
||||||
PlusMinusEditText editInsulin;
|
PlusMinusEditText editInsulin;
|
||||||
PlusMinusEditText editDuration;
|
PlusMinusEditText editDuration;
|
||||||
|
@ -99,11 +106,17 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
|
||||||
public void run() {
|
public void run() {
|
||||||
PumpEnactResult result = pump.setExtendedBolus(finalInsulin, finalDurationInMinutes);
|
PumpEnactResult result = pump.setExtendedBolus(finalInsulin, finalDurationInMinutes);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
try {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
builder.setTitle(context.getString(R.string.treatmentdeliveryerror));
|
builder.setTitle(context.getString(R.string.treatmentdeliveryerror));
|
||||||
builder.setMessage(result.comment);
|
builder.setMessage(result.comment);
|
||||||
builder.setPositiveButton(context.getString(R.string.ok), null);
|
builder.setPositiveButton(context.getString(R.string.ok), null);
|
||||||
builder.show();
|
builder.show();
|
||||||
|
} catch (WindowManager.BadTokenException e) {
|
||||||
|
// window has been destroyed
|
||||||
|
Notification notification = new Notification(Notification.BOLUS_DELIVERY_ERROR, MainApp.sResources.getString(R.string.treatmentdeliveryerror), Notification.URGENT);
|
||||||
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -115,7 +128,7 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
|
||||||
dismiss();
|
dismiss();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.cancel:
|
case R.id.cancel:
|
||||||
|
|
|
@ -19,6 +19,9 @@ import android.widget.RelativeLayout;
|
||||||
import com.crashlytics.android.answers.Answers;
|
import com.crashlytics.android.answers.Answers;
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
import com.crashlytics.android.answers.CustomEvent;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
@ -32,6 +35,7 @@ import info.nightscout.utils.PlusMinusEditText;
|
||||||
import info.nightscout.utils.SafeParse;
|
import info.nightscout.utils.SafeParse;
|
||||||
|
|
||||||
public class NewTempBasalDialog extends DialogFragment implements View.OnClickListener, RadioGroup.OnCheckedChangeListener {
|
public class NewTempBasalDialog extends DialogFragment implements View.OnClickListener, RadioGroup.OnCheckedChangeListener {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(NewTempBasalDialog.class);
|
||||||
|
|
||||||
RadioButton percentRadio;
|
RadioButton percentRadio;
|
||||||
RadioButton absoluteRadio;
|
RadioButton absoluteRadio;
|
||||||
|
@ -180,7 +184,7 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
|
||||||
dismiss();
|
dismiss();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.cancel:
|
case R.id.cancel:
|
||||||
|
|
|
@ -482,7 +482,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
data.put("relative", enteredInsulin * (100 - SafeParse.stringToDouble(editSplit.getText())) / 100 / SafeParse.stringToDouble(editDuration.getText()) * 60);
|
data.put("relative", enteredInsulin * (100 - SafeParse.stringToDouble(editSplit.getText())) / 100 / SafeParse.stringToDouble(editDuration.getText()) * 60);
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -577,7 +577,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
ret += "\n";
|
ret += "\n";
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -596,7 +596,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
try {
|
try {
|
||||||
doProfileSwitch(profileStore, data.getString("profile"), data.getInt("duration"));
|
doProfileSwitch(profileStore, data.getString("profile"), data.getInt("duration"));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (options.executeTempTarget) {
|
} else if (options.executeTempTarget) {
|
||||||
|
@ -623,13 +623,13 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
NSUpload.uploadCareportalEntryToNS(data);
|
NSUpload.uploadCareportalEntryToNS(data);
|
||||||
Answers.getInstance().logCustom(new CustomEvent("TempTarget"));
|
Answers.getInstance().logCustom(new CustomEvent("TempTarget"));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NSUpload.uploadCareportalEntryToNS(data);
|
NSUpload.uploadCareportalEntryToNS(data);
|
||||||
|
|
|
@ -185,7 +185,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
if (SP.contains(settingVisible))
|
if (SP.contains(settingVisible))
|
||||||
p.setFragmentVisible(type, SP.getBoolean(settingVisible, true) && SP.getBoolean(settingEnabled, true));
|
p.setFragmentVisible(type, SP.getBoolean(settingVisible, true) && SP.getBoolean(settingEnabled, true));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -995,7 +995,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
MainApp.bus().post(new EventNewNotification(notarget));
|
MainApp.bus().post(new EventNewNotification(notarget));
|
||||||
return new Profile(new JSONObject("{\"dia\":\"3\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"20\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"20\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"0.1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"6\"}],\"target_high\":[{\"time\":\"00:00\",\"value\":\"8\"}],\"startDate\":\"1970-01-01T00:00:00.000Z\",\"units\":\"mmol\"}}"));
|
return new Profile(new JSONObject("{\"dia\":\"3\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"20\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"20\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"0.1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"6\"}],\"target_high\":[{\"time\":\"00:00\",\"value\":\"8\"}],\"startDate\":\"1970-01-01T00:00:00.000Z\",\"units\":\"mmol\"}}"));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,7 +227,7 @@ public class ObjectivesPlugin implements PluginBase, ConstraintsInterface {
|
||||||
o.started = new Date(SP.getLong("Objectives" + num + "started", 0L));
|
o.started = new Date(SP.getLong("Objectives" + num + "started", 0L));
|
||||||
o.accomplished = new Date(SP.getLong("Objectives" + num + "accomplished", 0L));
|
o.accomplished = new Date(SP.getLong("Objectives" + num + "accomplished", 0L));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bgIsAvailableInNS = SP.getBoolean("Objectives" + "bgIsAvailableInNS", false);
|
bgIsAvailableInNS = SP.getBoolean("Objectives" + "bgIsAvailableInNS", false);
|
||||||
|
@ -235,7 +235,7 @@ public class ObjectivesPlugin implements PluginBase, ConstraintsInterface {
|
||||||
try {
|
try {
|
||||||
manualEnacts = SP.getInt("Objectives" + "manualEnacts", 0);
|
manualEnacts = SP.getInt("Objectives" + "manualEnacts", 0);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
if (Config.logPrefsChange)
|
if (Config.logPrefsChange)
|
||||||
log.debug("Objectives loaded");
|
log.debug("Objectives loaded");
|
||||||
|
|
|
@ -2,11 +2,14 @@ package info.nightscout.androidaps.plugins.IobCobCalculator;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 06.01.2017.
|
* Created by mike on 06.01.2017.
|
||||||
*/
|
*/
|
||||||
public class AutosensResult {
|
public class AutosensResult {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(AutosensResult.class);
|
||||||
|
|
||||||
//default values to show when autosens algorithm is not called
|
//default values to show when autosens algorithm is not called
|
||||||
public double ratio = 1d;
|
public double ratio = 1d;
|
||||||
|
@ -24,7 +27,7 @@ public class AutosensResult {
|
||||||
ret.put("sensResult", sensResult);
|
ret.put("sensResult", sensResult);
|
||||||
ret.put("ratio", ratio);
|
ret.put("ratio", ratio);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import android.text.Spanned;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
@ -17,6 +19,8 @@ import info.nightscout.utils.DecimalFormatter;
|
||||||
* Created by mike on 09.06.2016.
|
* Created by mike on 09.06.2016.
|
||||||
*/
|
*/
|
||||||
public class APSResult {
|
public class APSResult {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(APSResult.class);
|
||||||
|
|
||||||
public String reason;
|
public String reason;
|
||||||
public double rate;
|
public double rate;
|
||||||
public int duration;
|
public int duration;
|
||||||
|
@ -72,7 +76,7 @@ public class APSResult {
|
||||||
json.put("reason", reason);
|
json.put("reason", reason);
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
|
@ -397,7 +397,7 @@ public class DeviceStatus {
|
||||||
if (uploaderBattery != 0) record.put("uploaderBattery", uploaderBattery);
|
if (uploaderBattery != 0) record.put("uploaderBattery", uploaderBattery);
|
||||||
if (created_at != null) record.put("created_at" , created_at);
|
if (created_at != null) record.put("created_at" , created_at);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.NSClientInternal;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
|
||||||
import com.j256.ormlite.dao.CloseableIterator;
|
import com.j256.ormlite.dao.CloseableIterator;
|
||||||
|
|
||||||
|
@ -35,10 +36,7 @@ public class UploadQueue {
|
||||||
if (NSClientService.handler == null) {
|
if (NSClientService.handler == null) {
|
||||||
Context context = MainApp.instance();
|
Context context = MainApp.instance();
|
||||||
context.startService(new Intent(context, NSClientService.class));
|
context.startService(new Intent(context, NSClientService.class));
|
||||||
try {
|
SystemClock.sleep(2000);
|
||||||
Thread.sleep(2000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +88,7 @@ public class UploadQueue {
|
||||||
log.debug("Removed item from UploadQueue. " + UploadQueue.status());
|
log.debug("Removed item from UploadQueue. " + UploadQueue.status());
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -126,7 +124,7 @@ public class UploadQueue {
|
||||||
iterator.close();
|
iterator.close();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class NSAddAck implements Ack {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,11 @@
|
||||||
package info.nightscout.androidaps.plugins.NSClientInternal.acks;
|
package info.nightscout.androidaps.plugins.NSClientInternal.acks;
|
||||||
|
|
||||||
|
import android.os.SystemClock;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import io.socket.client.Ack;
|
import io.socket.client.Ack;
|
||||||
|
|
||||||
|
@ -9,6 +13,8 @@ import io.socket.client.Ack;
|
||||||
* Created by mike on 29.12.2015.
|
* Created by mike on 29.12.2015.
|
||||||
*/
|
*/
|
||||||
public class NSPingAck implements Ack {
|
public class NSPingAck implements Ack {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(NSPingAck.class);
|
||||||
|
|
||||||
public long mills = 0;
|
public long mills = 0;
|
||||||
public boolean received = false;
|
public boolean received = false;
|
||||||
public boolean auth_received = false;
|
public boolean auth_received = false;
|
||||||
|
@ -27,7 +33,7 @@ public class NSPingAck implements Ack {
|
||||||
write = authorization.optBoolean("write");
|
write = authorization.optBoolean("write");
|
||||||
write_treatment = authorization.optBoolean("write_treatment");
|
write_treatment = authorization.optBoolean("write_treatment");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
received = true;
|
received = true;
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class BroadcastStatus {
|
||||||
bundle.putString("nsclientversionname", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionName);
|
bundle.putString("nsclientversionname", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionName);
|
||||||
bundle.putInt("nsclientversioncode", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionCode);
|
bundle.putInt("nsclientversioncode", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionCode);
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
bundle.putString("nightscoutversionname", NSClientService.nightscoutVersionName);
|
bundle.putString("nightscoutversionname", NSClientService.nightscoutVersionName);
|
||||||
bundle.putInt("nightscoutversioncode", NSClientService.nightscoutVersionCode);
|
bundle.putInt("nightscoutversioncode", NSClientService.nightscoutVersionCode);
|
||||||
|
@ -49,7 +49,7 @@ public class BroadcastStatus {
|
||||||
bundle.putString("nsclientversionname", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionName);
|
bundle.putString("nsclientversionname", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionName);
|
||||||
bundle.putInt("nsclientversioncode", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionCode);
|
bundle.putInt("nsclientversioncode", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionCode);
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
bundle.putString("nightscoutversionname", NSClientService.nightscoutVersionName);
|
bundle.putString("nightscoutversionname", NSClientService.nightscoutVersionName);
|
||||||
bundle.putInt("nightscoutversioncode", NSClientService.nightscoutVersionCode);
|
bundle.putInt("nightscoutversioncode", NSClientService.nightscoutVersionCode);
|
||||||
|
|
|
@ -183,7 +183,7 @@ public class BroadcastTreatment {
|
||||||
ret.add(newarr);
|
ret.add(newarr);
|
||||||
}
|
}
|
||||||
newarr = new JSONArray();
|
newarr = new JSONArray();
|
||||||
count = 100;
|
count = 50;
|
||||||
}
|
}
|
||||||
newarr.put(array.get(i));
|
newarr.put(array.get(i));
|
||||||
--count;
|
--count;
|
||||||
|
@ -192,7 +192,7 @@ public class BroadcastTreatment {
|
||||||
ret.add(newarr);
|
ret.add(newarr);
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
ret = new ArrayList<>();
|
ret = new ArrayList<>();
|
||||||
ret.add(array);
|
ret.add(array);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,16 @@ package info.nightscout.androidaps.plugins.NSClientInternal.data;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 11.06.2017.
|
* Created by mike on 11.06.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class NSAlarm {
|
public class NSAlarm {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(NSAlarm.class);
|
||||||
|
|
||||||
JSONObject data;
|
JSONObject data;
|
||||||
|
|
||||||
public NSAlarm(JSONObject data) {
|
public NSAlarm(JSONObject data) {
|
||||||
|
@ -20,7 +24,7 @@ public class NSAlarm {
|
||||||
try {
|
try {
|
||||||
retval = data.getInt("level");
|
retval = data.getInt("level");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -32,7 +36,7 @@ public class NSAlarm {
|
||||||
try {
|
try {
|
||||||
retval = data.getString("group");
|
retval = data.getString("group");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -44,7 +48,7 @@ public class NSAlarm {
|
||||||
try {
|
try {
|
||||||
retval = data.getString("title");
|
retval = data.getString("title");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -56,7 +60,7 @@ public class NSAlarm {
|
||||||
try {
|
try {
|
||||||
retval = data.getString("message");
|
retval = data.getString("message");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class NSCal {
|
||||||
intercept = json.getDouble("intercept");
|
intercept = json.getDouble("intercept");
|
||||||
scale = json.getDouble("scale");
|
scale = json.getDouble("scale");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
log.debug("Data: " + json.toString());
|
log.debug("Data: " + json.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ import android.text.Spanned;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -70,6 +72,7 @@ import info.nightscout.utils.SP;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
public class NSDeviceStatus {
|
public class NSDeviceStatus {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(NSDeviceStatus.class);
|
||||||
|
|
||||||
private static NSDeviceStatus instance = null;
|
private static NSDeviceStatus instance = null;
|
||||||
|
|
||||||
|
@ -102,7 +105,7 @@ public class NSDeviceStatus {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -237,7 +240,7 @@ public class NSDeviceStatus {
|
||||||
deviceStatusPumpData.extended = Html.fromHtml(exteneded.toString());
|
deviceStatusPumpData.extended = Html.fromHtml(exteneded.toString());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +281,7 @@ public class NSDeviceStatus {
|
||||||
deviceStatusOpenAPSData.clockEnacted = clock;
|
deviceStatusOpenAPSData.clockEnacted = clock;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +318,7 @@ public class NSDeviceStatus {
|
||||||
string.append("<b>").append(DateUtil.minAgo(deviceStatusOpenAPSData.clockSuggested)).append("</b> ").append(deviceStatusOpenAPSData.suggested.getString("reason")).append("<br>");
|
string.append("<b>").append(DateUtil.minAgo(deviceStatusOpenAPSData.clockSuggested)).append("</b> ").append(deviceStatusOpenAPSData.suggested.getString("reason")).append("<br>");
|
||||||
return Html.fromHtml(string.toString());
|
return Html.fromHtml(string.toString());
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return Html.fromHtml("");
|
return Html.fromHtml("");
|
||||||
}
|
}
|
||||||
|
@ -353,7 +356,7 @@ public class NSDeviceStatus {
|
||||||
uploaders.put(device, uploader);
|
uploaders.put(device, uploader);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class NSMbg {
|
||||||
mbg = json.getDouble("mgdl");
|
mbg = json.getDouble("mgdl");
|
||||||
this.json = json.toString();
|
this.json = json.toString();
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
log.debug("Data: " + json.toString());
|
log.debug("Data: " + json.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@ import android.support.annotation.Nullable;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -99,6 +101,8 @@ import java.util.Objects;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
public class NSSettingsStatus {
|
public class NSSettingsStatus {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(NSSettingsStatus.class);
|
||||||
|
|
||||||
private static NSSettingsStatus instance = null;
|
private static NSSettingsStatus instance = null;
|
||||||
|
|
||||||
public static NSSettingsStatus getInstance() {
|
public static NSSettingsStatus getInstance() {
|
||||||
|
@ -160,7 +164,7 @@ public class NSSettingsStatus {
|
||||||
return new JSONObject(extended);
|
return new JSONObject(extended);
|
||||||
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -195,7 +199,7 @@ public class NSSettingsStatus {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -207,7 +211,7 @@ public class NSSettingsStatus {
|
||||||
try {
|
try {
|
||||||
ret = data.getString(key);
|
ret = data.getString(key);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -219,7 +223,7 @@ public class NSSettingsStatus {
|
||||||
try {
|
try {
|
||||||
ret = data.getInt(key);
|
ret = data.getInt(key);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -231,7 +235,7 @@ public class NSSettingsStatus {
|
||||||
try {
|
try {
|
||||||
ret = data.getLong(key);
|
ret = data.getLong(key);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -243,7 +247,7 @@ public class NSSettingsStatus {
|
||||||
try {
|
try {
|
||||||
ret = new Date(data.getString(key));
|
ret = new Date(data.getString(key));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -255,7 +259,7 @@ public class NSSettingsStatus {
|
||||||
try {
|
try {
|
||||||
ret = data.getBoolean(key);
|
ret = data.getBoolean(key);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -301,7 +305,7 @@ public class NSSettingsStatus {
|
||||||
return pump != null && pump.has(setting) ? pump.getDouble(setting) : 30;
|
return pump != null && pump.has(setting) ? pump.getDouble(setting) : 30;
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return 0d;
|
return 0d;
|
||||||
}
|
}
|
||||||
|
@ -317,7 +321,7 @@ public class NSSettingsStatus {
|
||||||
return pump;
|
return pump;
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -329,7 +333,7 @@ public class NSSettingsStatus {
|
||||||
return pump.getBoolean("enableAlerts");
|
return pump.getBoolean("enableAlerts");
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -341,7 +345,7 @@ public class NSSettingsStatus {
|
||||||
return pump.getString("fields");
|
return pump.getString("fields");
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -353,7 +357,7 @@ public class NSSettingsStatus {
|
||||||
return pump.getBoolean("enableAlerts");
|
return pump.getBoolean("enableAlerts");
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,16 @@ package info.nightscout.androidaps.plugins.NSClientInternal.data;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* {"mgdl":105,"mills":1455136282375,"device":"xDrip-BluetoothWixel","direction":"Flat","filtered":98272,"unfiltered":98272,"noise":1,"rssi":100}
|
* {"mgdl":105,"mills":1455136282375,"device":"xDrip-BluetoothWixel","direction":"Flat","filtered":98272,"unfiltered":98272,"noise":1,"rssi":100}
|
||||||
*/
|
*/
|
||||||
public class NSSgv {
|
public class NSSgv {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(NSSgv.class);
|
||||||
|
|
||||||
private JSONObject data;
|
private JSONObject data;
|
||||||
|
|
||||||
public NSSgv(JSONObject obj) {
|
public NSSgv(JSONObject obj) {
|
||||||
|
@ -20,7 +24,7 @@ public class NSSgv {
|
||||||
try {
|
try {
|
||||||
ret = data.getString(key);
|
ret = data.getString(key);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -32,7 +36,7 @@ public class NSSgv {
|
||||||
try {
|
try {
|
||||||
ret = data.getInt(key);
|
ret = data.getInt(key);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -44,7 +48,7 @@ public class NSSgv {
|
||||||
try {
|
try {
|
||||||
ret = data.getLong(key);
|
ret = data.getLong(key);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -2,10 +2,14 @@ package info.nightscout.androidaps.plugins.NSClientInternal.data;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class NSTreatment {
|
public class NSTreatment {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(NSTreatment.class);
|
||||||
|
|
||||||
private JSONObject data;
|
private JSONObject data;
|
||||||
private String action = null; // "update", "remove" or null (add)
|
private String action = null; // "update", "remove" or null (add)
|
||||||
|
|
||||||
|
@ -21,7 +25,7 @@ public class NSTreatment {
|
||||||
try {
|
try {
|
||||||
ret = data.getString(key);
|
ret = data.getString(key);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -33,7 +37,7 @@ public class NSTreatment {
|
||||||
try {
|
try {
|
||||||
ret = data.getDouble(key);
|
ret = data.getDouble(key);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -45,7 +49,7 @@ public class NSTreatment {
|
||||||
try {
|
try {
|
||||||
ret = data.getInt(key);
|
ret = data.getInt(key);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -57,7 +61,7 @@ public class NSTreatment {
|
||||||
try {
|
try {
|
||||||
ret = data.getLong(key);
|
ret = data.getLong(key);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -69,7 +73,7 @@ public class NSTreatment {
|
||||||
try {
|
try {
|
||||||
ret = new Date(data.getString(key));
|
ret = new Date(data.getString(key));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -50,9 +50,18 @@ public class DBAccessReceiver extends BroadcastReceiver {
|
||||||
String _id = null;
|
String _id = null;
|
||||||
JSONObject data = null;
|
JSONObject data = null;
|
||||||
String action = bundles.getString("action");
|
String action = bundles.getString("action");
|
||||||
try { collection = bundles.getString("collection"); } catch (Exception e) {}
|
try {
|
||||||
try { _id = bundles.getString("_id"); } catch (Exception e) {}
|
collection = bundles.getString("collection");
|
||||||
try { data = new JSONObject(bundles.getString("data")); } catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
_id = bundles.getString("_id");
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
data = new JSONObject(bundles.getString("data"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
if (data == null && !action.equals("dbRemove") || _id == null && action.equals("dbRemove")) {
|
if (data == null && !action.equals("dbRemove") || _id == null && action.equals("dbRemove")) {
|
||||||
log.debug("DBACCESS no data inside record");
|
log.debug("DBACCESS no data inside record");
|
||||||
|
@ -67,7 +76,7 @@ public class DBAccessReceiver extends BroadcastReceiver {
|
||||||
try {
|
try {
|
||||||
data.put("NSCLIENT_ID", nsclientid);
|
data.put("NSCLIENT_ID", nsclientid);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isAllowedCollection(collection)) {
|
if (!isAllowedCollection(collection)) {
|
||||||
|
|
|
@ -258,7 +258,7 @@ public class NSClientService extends Service {
|
||||||
authMessage.put("from", latestDateInReceivedData); // send data newer than
|
authMessage.put("from", latestDateInReceivedData); // send data newer than
|
||||||
authMessage.put("secret", nsAPIhashCode);
|
authMessage.put("secret", nsAPIhashCode);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MainApp.bus().post(new EventNSClientNewLog("AUTH", "requesting auth"));
|
MainApp.bus().post(new EventNSClientNewLog("AUTH", "requesting auth"));
|
||||||
|
@ -326,7 +326,7 @@ public class NSClientService extends Service {
|
||||||
try {
|
try {
|
||||||
MainApp.bus().post(new EventNSClientNewLog("ANNOUNCEMENT", data.has("message") ? data.getString("message") : "received"));
|
MainApp.bus().post(new EventNSClientNewLog("ANNOUNCEMENT", data.has("message") ? data.getString("message") : "received"));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
BroadcastAnnouncement.handleAnnouncement(data, getApplicationContext());
|
BroadcastAnnouncement.handleAnnouncement(data, getApplicationContext());
|
||||||
log.debug(data.toString());
|
log.debug(data.toString());
|
||||||
|
@ -561,7 +561,7 @@ public class NSClientService extends Service {
|
||||||
}
|
}
|
||||||
MainApp.bus().post(new EventNSClientNewLog("LAST", DateUtil.dateAndTimeString(latestDateInReceivedData)));
|
MainApp.bus().post(new EventNSClientNewLog("LAST", DateUtil.dateAndTimeString(latestDateInReceivedData)));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
//MainApp.bus().post(new EventNSClientNewLog("NSCLIENT", "onDataUpdate end");
|
//MainApp.bus().post(new EventNSClientNewLog("NSCLIENT", "onDataUpdate end");
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -583,7 +583,7 @@ public class NSClientService extends Service {
|
||||||
mSocket.emit("dbUpdate", message, ack);
|
mSocket.emit("dbUpdate", message, ack);
|
||||||
MainApp.bus().post(new EventNSClientNewLog("DBUPDATE " + dbr.collection, "Sent " + dbr._id));
|
MainApp.bus().post(new EventNSClientNewLog("DBUPDATE " + dbr.collection, "Sent " + dbr._id));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,7 +597,7 @@ public class NSClientService extends Service {
|
||||||
mSocket.emit("dbUpdateUnset", message, ack);
|
mSocket.emit("dbUpdateUnset", message, ack);
|
||||||
MainApp.bus().post(new EventNSClientNewLog("DBUPDATEUNSET " + dbr.collection, "Sent " + dbr._id));
|
MainApp.bus().post(new EventNSClientNewLog("DBUPDATEUNSET " + dbr.collection, "Sent " + dbr._id));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -610,7 +610,7 @@ public class NSClientService extends Service {
|
||||||
mSocket.emit("dbRemove", message, ack);
|
mSocket.emit("dbRemove", message, ack);
|
||||||
MainApp.bus().post(new EventNSClientNewLog("DBREMOVE " + dbr.collection, "Sent " + dbr._id));
|
MainApp.bus().post(new EventNSClientNewLog("DBREMOVE " + dbr.collection, "Sent " + dbr._id));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -633,7 +633,7 @@ public class NSClientService extends Service {
|
||||||
mSocket.emit("dbAdd", message, ack);
|
mSocket.emit("dbAdd", message, ack);
|
||||||
MainApp.bus().post(new EventNSClientNewLog("DBADD " + dbr.collection, "Sent " + dbr.nsClientID));
|
MainApp.bus().post(new EventNSClientNewLog("DBADD " + dbr.collection, "Sent " + dbr.nsClientID));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -709,7 +709,7 @@ public class NSClientService extends Service {
|
||||||
iterator.close();
|
iterator.close();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainApp.bus().post(new EventNSClientNewLog("QUEUE", "Resend ended: " + reason));
|
MainApp.bus().post(new EventNSClientNewLog("QUEUE", "Resend ended: " + reason));
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class DetermineBasalAdapterAMAJS {
|
||||||
try {
|
try {
|
||||||
result = new DetermineBasalResultAMA(v8ObjectReuslt, new JSONObject(ret));
|
result = new DetermineBasalResultAMA(v8ObjectReuslt, new JSONObject(ret));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -5,6 +5,8 @@ import com.eclipsesource.v8.V8Object;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -15,6 +17,8 @@ import info.nightscout.androidaps.plugins.Loop.APSResult;
|
||||||
import info.nightscout.androidaps.data.IobTotal;
|
import info.nightscout.androidaps.data.IobTotal;
|
||||||
|
|
||||||
public class DetermineBasalResultAMA extends APSResult {
|
public class DetermineBasalResultAMA extends APSResult {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(DetermineBasalResultAMA.class);
|
||||||
|
|
||||||
public Date date;
|
public Date date;
|
||||||
public JSONObject json = new JSONObject();
|
public JSONObject json = new JSONObject();
|
||||||
public double eventualBG;
|
public double eventualBG;
|
||||||
|
@ -69,7 +73,7 @@ public class DetermineBasalResultAMA extends APSResult {
|
||||||
try {
|
try {
|
||||||
newResult.json = new JSONObject(json.toString());
|
newResult.json = new JSONObject(json.toString());
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
newResult.eventualBG = eventualBG;
|
newResult.eventualBG = eventualBG;
|
||||||
newResult.snoozeBG = snoozeBG;
|
newResult.snoozeBG = snoozeBG;
|
||||||
|
@ -83,7 +87,7 @@ public class DetermineBasalResultAMA extends APSResult {
|
||||||
JSONObject ret = new JSONObject(this.json.toString());
|
JSONObject ret = new JSONObject(this.json.toString());
|
||||||
return ret;
|
return ret;
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +130,7 @@ public class DetermineBasalResultAMA extends APSResult {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +155,7 @@ public class DetermineBasalResultAMA extends APSResult {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return latest;
|
return latest;
|
||||||
|
|
|
@ -112,7 +112,7 @@ public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnCli
|
||||||
JSONArray iobArray = new JSONArray(determineBasalAdapterAMAJS.getIobDataParam());
|
JSONArray iobArray = new JSONArray(determineBasalAdapterAMAJS.getIobDataParam());
|
||||||
iobDataView.setText(String.format(MainApp.sResources.getString(R.string.array_of_elements), iobArray.length()) + "\n" + JSONFormatter.format(iobArray.getString(0)));
|
iobDataView.setText(String.format(MainApp.sResources.getString(R.string.array_of_elements), iobArray.length()) + "\n" + JSONFormatter.format(iobArray.getString(0)));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
iobDataView.setText("JSONException");
|
iobDataView.setText("JSONException");
|
||||||
}
|
}
|
||||||
profileView.setText(JSONFormatter.format(determineBasalAdapterAMAJS.getProfileParam()));
|
profileView.setText(JSONFormatter.format(determineBasalAdapterAMAJS.getProfileParam()));
|
||||||
|
|
|
@ -242,7 +242,7 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
|
||||||
try {
|
try {
|
||||||
determineBasalResultAMA.json.put("timestamp", DateUtil.toISOString(now));
|
determineBasalResultAMA.json.put("timestamp", DateUtil.toISOString(now));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastDetermineBasalAdapterAMAJS = determineBasalAdapterAMAJS;
|
lastDetermineBasalAdapterAMAJS = determineBasalAdapterAMAJS;
|
||||||
|
|
|
@ -135,7 +135,7 @@ public class DetermineBasalAdapterMAJS {
|
||||||
try {
|
try {
|
||||||
result = new DetermineBasalResultMA(v8ObjectReuslt, new JSONObject(ret));
|
result = new DetermineBasalResultMA(v8ObjectReuslt, new JSONObject(ret));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
storedGlucoseStatus = mV8rt.executeStringScript("JSON.stringify(" + PARAM_glucoseStatus + ");");
|
storedGlucoseStatus = mV8rt.executeStringScript("JSON.stringify(" + PARAM_glucoseStatus + ");");
|
||||||
|
|
|
@ -7,11 +7,14 @@ import com.eclipsesource.v8.V8Object;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.data.IobTotal;
|
import info.nightscout.androidaps.data.IobTotal;
|
||||||
import info.nightscout.androidaps.plugins.Loop.APSResult;
|
import info.nightscout.androidaps.plugins.Loop.APSResult;
|
||||||
|
|
||||||
public class DetermineBasalResultMA extends APSResult {
|
public class DetermineBasalResultMA extends APSResult {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(DetermineBasalResultMA.class);
|
||||||
|
|
||||||
public JSONObject json = new JSONObject();
|
public JSONObject json = new JSONObject();
|
||||||
public double eventualBG;
|
public double eventualBG;
|
||||||
|
@ -70,7 +73,7 @@ public class DetermineBasalResultMA extends APSResult {
|
||||||
try {
|
try {
|
||||||
newResult.json = new JSONObject(json.toString());
|
newResult.json = new JSONObject(json.toString());
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
newResult.eventualBG = eventualBG;
|
newResult.eventualBG = eventualBG;
|
||||||
newResult.snoozeBG = snoozeBG;
|
newResult.snoozeBG = snoozeBG;
|
||||||
|
@ -84,7 +87,7 @@ public class DetermineBasalResultMA extends APSResult {
|
||||||
JSONObject ret = new JSONObject(this.json.toString());
|
JSONObject ret = new JSONObject(this.json.toString());
|
||||||
return ret;
|
return ret;
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,7 +196,8 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
|
||||||
|
|
||||||
if (!checkOnlyHardLimits(profile.getDia(), "dia", 2, 7)) return;
|
if (!checkOnlyHardLimits(profile.getDia(), "dia", 2, 7)) return;
|
||||||
if (!checkOnlyHardLimits(profile.getIc(), "carbratio", 2, 100)) return;
|
if (!checkOnlyHardLimits(profile.getIc(), "carbratio", 2, 100)) return;
|
||||||
if (!checkOnlyHardLimits(Profile.toMgdl(profile.getIsf().doubleValue(), units), "sens", 2, 900)) return;
|
if (!checkOnlyHardLimits(Profile.toMgdl(profile.getIsf().doubleValue(), units), "sens", 2, 900))
|
||||||
|
return;
|
||||||
if (!checkOnlyHardLimits(profile.getMaxDailyBasal(), "max_daily_basal", 0.1, 10)) return;
|
if (!checkOnlyHardLimits(profile.getMaxDailyBasal(), "max_daily_basal", 0.1, 10)) return;
|
||||||
if (!checkOnlyHardLimits(pump.getBaseBasalRate(), "current_basal", 0.01, 5)) return;
|
if (!checkOnlyHardLimits(pump.getBaseBasalRate(), "current_basal", 0.01, 5)) return;
|
||||||
|
|
||||||
|
@ -224,7 +225,7 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
|
||||||
try {
|
try {
|
||||||
determineBasalResultMA.json.put("timestamp", DateUtil.toISOString(now));
|
determineBasalResultMA.json.put("timestamp", DateUtil.toISOString(now));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastDetermineBasalAdapterMAJS = determineBasalAdapterMAJS;
|
lastDetermineBasalAdapterMAJS = determineBasalAdapterMAJS;
|
||||||
|
|
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.Overview.Dialogs;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -22,7 +23,6 @@ import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissBolusprogressIfRunning;
|
import info.nightscout.androidaps.plugins.Overview.events.EventDismissBolusprogressIfRunning;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRBolusStart;
|
|
||||||
|
|
||||||
public class BolusProgressDialog extends DialogFragment implements View.OnClickListener {
|
public class BolusProgressDialog extends DialogFragment implements View.OnClickListener {
|
||||||
private static Logger log = LoggerFactory.getLogger(BolusProgressDialog.class);
|
private static Logger log = LoggerFactory.getLogger(BolusProgressDialog.class);
|
||||||
|
@ -36,8 +36,6 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
|
||||||
public static boolean bolusEnded = false;
|
public static boolean bolusEnded = false;
|
||||||
public static boolean running = true;
|
public static boolean running = true;
|
||||||
|
|
||||||
boolean started = false;
|
|
||||||
|
|
||||||
public BolusProgressDialog() {
|
public BolusProgressDialog() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
@ -123,11 +121,6 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void onStatusEvent(final EventDanaRBolusStart ev) {
|
|
||||||
started = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatusEvent(final EventDismissBolusprogressIfRunning ev) {
|
public void onStatusEvent(final EventDismissBolusprogressIfRunning ev) {
|
||||||
if(BolusProgressDialog.running){
|
if(BolusProgressDialog.running){
|
||||||
|
@ -156,11 +149,7 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
|
||||||
Thread t = new Thread(new Runnable() {
|
Thread t = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
SystemClock.sleep(5000);
|
||||||
Thread.sleep(5000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
BolusProgressDialog.bolusEnded = true;
|
BolusProgressDialog.bolusEnded = true;
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
|
@ -171,7 +160,7 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
|
||||||
try {
|
try {
|
||||||
dismiss();
|
dismiss();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace(); // TODO: do this better way
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,6 +14,8 @@ import android.widget.EditText;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -27,6 +29,7 @@ import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.SafeParse;
|
import info.nightscout.utils.SafeParse;
|
||||||
|
|
||||||
public class EditQuickWizardDialog extends DialogFragment implements View.OnClickListener {
|
public class EditQuickWizardDialog extends DialogFragment implements View.OnClickListener {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(EditQuickWizardDialog.class);
|
||||||
|
|
||||||
QuickWizard.QuickWizardEntry entry = new QuickWizard().newEmptyItem();
|
QuickWizard.QuickWizardEntry entry = new QuickWizard().newEmptyItem();
|
||||||
QuickWizard quickWizard = MainApp.getSpecificPlugin(OverviewPlugin.class).quickWizard;
|
QuickWizard quickWizard = MainApp.getSpecificPlugin(OverviewPlugin.class).quickWizard;
|
||||||
|
@ -104,7 +107,7 @@ public class EditQuickWizardDialog extends DialogFragment implements View.OnClic
|
||||||
int validToInt = DateUtil.toSeconds(toSpinner.getSelectedItem().toString());
|
int validToInt = DateUtil.toSeconds(toSpinner.getSelectedItem().toString());
|
||||||
entry.storage.put("validTo", validToInt);
|
entry.storage.put("validTo", validToInt);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
quickWizard.addOrUpdate(entry);
|
quickWizard.addOrUpdate(entry);
|
||||||
dismiss();
|
dismiss();
|
||||||
|
|
|
@ -7,18 +7,20 @@ import android.os.Handler;
|
||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
|
import android.text.Html;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.crashlytics.android.answers.Answers;
|
import com.crashlytics.android.answers.Answers;
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
import com.crashlytics.android.answers.CustomEvent;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@ -30,11 +32,13 @@ import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.db.CareportalEvent;
|
import info.nightscout.androidaps.db.CareportalEvent;
|
||||||
import info.nightscout.androidaps.db.Source;
|
import info.nightscout.androidaps.db.Source;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
import info.nightscout.utils.NumberPicker;
|
import info.nightscout.utils.NumberPicker;
|
||||||
import info.nightscout.utils.PlusMinusEditText;
|
|
||||||
import info.nightscout.utils.SafeParse;
|
import info.nightscout.utils.SafeParse;
|
||||||
|
|
||||||
public class NewTreatmentDialog extends DialogFragment implements OnClickListener {
|
public class NewTreatmentDialog extends DialogFragment implements OnClickListener {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(NewTreatmentDialog.class);
|
||||||
|
|
||||||
NumberPicker editCarbs;
|
NumberPicker editCarbs;
|
||||||
NumberPicker editInsulin;
|
NumberPicker editInsulin;
|
||||||
|
@ -80,15 +84,16 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
||||||
Double insulin = SafeParse.stringToDouble(editInsulin.getText());
|
Double insulin = SafeParse.stringToDouble(editInsulin.getText());
|
||||||
final Integer carbs = SafeParse.stringToInt(editCarbs.getText());
|
final Integer carbs = SafeParse.stringToInt(editCarbs.getText());
|
||||||
|
|
||||||
String confirmMessage = getString(R.string.entertreatmentquestion) + "\n";
|
String confirmMessage = getString(R.string.entertreatmentquestion) + "<br/>";
|
||||||
|
|
||||||
Double insulinAfterConstraints = MainApp.getConfigBuilder().applyBolusConstraints(insulin);
|
Double insulinAfterConstraints = MainApp.getConfigBuilder().applyBolusConstraints(insulin);
|
||||||
Integer carbsAfterConstraints = MainApp.getConfigBuilder().applyCarbsConstraints(carbs);
|
Integer carbsAfterConstraints = MainApp.getConfigBuilder().applyCarbsConstraints(carbs);
|
||||||
|
|
||||||
confirmMessage += getString(R.string.bolus) + ": " + insulinAfterConstraints + "U";
|
confirmMessage += getString(R.string.bolus) + ": " + "<font color='" + MainApp.sResources.getColor(R.color.bolus) + "'>" + insulinAfterConstraints + "U" + "</font>";
|
||||||
confirmMessage += "\n" + getString(R.string.carbs) + ": " + carbsAfterConstraints + "g";
|
confirmMessage += "<br/>" + getString(R.string.carbs) + ": " + carbsAfterConstraints + "g";
|
||||||
if (insulinAfterConstraints - insulin != 0 || !Objects.equals(carbsAfterConstraints, carbs))
|
if (insulinAfterConstraints - insulin != 0 || !Objects.equals(carbsAfterConstraints, carbs))
|
||||||
confirmMessage += "\n" + getString(R.string.constraintapllied);
|
confirmMessage += "<br/>" + getString(R.string.constraintapllied);
|
||||||
|
|
||||||
|
|
||||||
final double finalInsulinAfterConstraints = insulinAfterConstraints;
|
final double finalInsulinAfterConstraints = insulinAfterConstraints;
|
||||||
final int finalCarbsAfterConstraints = carbsAfterConstraints;
|
final int finalCarbsAfterConstraints = carbsAfterConstraints;
|
||||||
|
@ -97,7 +102,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
|
|
||||||
builder.setTitle(this.getContext().getString(R.string.confirmation));
|
builder.setTitle(this.getContext().getString(R.string.confirmation));
|
||||||
builder.setMessage(confirmMessage);
|
builder.setMessage(Html.fromHtml(confirmMessage));
|
||||||
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
if (finalInsulinAfterConstraints > 0 || finalCarbsAfterConstraints > 0) {
|
if (finalInsulinAfterConstraints > 0 || finalCarbsAfterConstraints > 0) {
|
||||||
|
@ -106,19 +111,27 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
|
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
|
||||||
if (finalInsulinAfterConstraints == 0) detailedBolusInfo.eventType = CareportalEvent.CARBCORRECTION;
|
if (finalInsulinAfterConstraints == 0)
|
||||||
if (finalCarbsAfterConstraints == 0) detailedBolusInfo.eventType = CareportalEvent.CORRECTIONBOLUS;
|
detailedBolusInfo.eventType = CareportalEvent.CARBCORRECTION;
|
||||||
|
if (finalCarbsAfterConstraints == 0)
|
||||||
|
detailedBolusInfo.eventType = CareportalEvent.CORRECTIONBOLUS;
|
||||||
detailedBolusInfo.insulin = finalInsulinAfterConstraints;
|
detailedBolusInfo.insulin = finalInsulinAfterConstraints;
|
||||||
detailedBolusInfo.carbs = finalCarbsAfterConstraints;
|
detailedBolusInfo.carbs = finalCarbsAfterConstraints;
|
||||||
detailedBolusInfo.context = context;
|
detailedBolusInfo.context = context;
|
||||||
detailedBolusInfo.source = Source.USER;
|
detailedBolusInfo.source = Source.USER;
|
||||||
PumpEnactResult result = pump.deliverTreatment(detailedBolusInfo);
|
PumpEnactResult result = pump.deliverTreatment(detailedBolusInfo);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
try {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror));
|
builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror));
|
||||||
builder.setMessage(result.comment);
|
builder.setMessage(result.comment);
|
||||||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
|
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
|
||||||
builder.show();
|
builder.show();
|
||||||
|
} catch (WindowManager.BadTokenException e) {
|
||||||
|
// window has been destroyed
|
||||||
|
Notification notification = new Notification(Notification.BOLUS_DELIVERY_ERROR, MainApp.sResources.getString(R.string.treatmentdeliveryerror), Notification.URGENT);
|
||||||
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -130,7 +143,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
||||||
builder.show();
|
builder.show();
|
||||||
dismiss();
|
dismiss();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.cancel:
|
case R.id.cancel:
|
||||||
|
|
|
@ -9,6 +9,7 @@ import android.os.HandlerThread;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
|
import android.text.Html;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -57,6 +58,8 @@ import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
|
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
import info.nightscout.utils.BolusWizard;
|
import info.nightscout.utils.BolusWizard;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
|
@ -298,13 +301,15 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
||||||
case R.id.ok:
|
case R.id.ok:
|
||||||
if (calculatedTotalInsulin > 0d || calculatedCarbs > 0d) {
|
if (calculatedTotalInsulin > 0d || calculatedCarbs > 0d) {
|
||||||
DecimalFormat formatNumber2decimalplaces = new DecimalFormat("0.00");
|
DecimalFormat formatNumber2decimalplaces = new DecimalFormat("0.00");
|
||||||
|
|
||||||
String confirmMessage = getString(R.string.entertreatmentquestion);
|
String confirmMessage = getString(R.string.entertreatmentquestion);
|
||||||
|
|
||||||
Double insulinAfterConstraints = MainApp.getConfigBuilder().applyBolusConstraints(calculatedTotalInsulin);
|
Double insulinAfterConstraints = MainApp.getConfigBuilder().applyBolusConstraints(calculatedTotalInsulin);
|
||||||
Integer carbsAfterConstraints = MainApp.getConfigBuilder().applyCarbsConstraints(calculatedCarbs);
|
Integer carbsAfterConstraints = MainApp.getConfigBuilder().applyCarbsConstraints(calculatedCarbs);
|
||||||
|
|
||||||
confirmMessage += "\n" + getString(R.string.bolus) + ": " + formatNumber2decimalplaces.format(insulinAfterConstraints) + "U";
|
confirmMessage += "<br/>" + getString(R.string.bolus) + ": " + "<font color='" + MainApp.sResources.getColor(R.color.bolus) + "'>" + formatNumber2decimalplaces.format(insulinAfterConstraints) + "U" + "</font>";
|
||||||
confirmMessage += "\n" + getString(R.string.carbs) + ": " + carbsAfterConstraints + "g";
|
confirmMessage += "<br/>" + getString(R.string.carbs) + ": " + carbsAfterConstraints + "g";
|
||||||
|
|
||||||
|
|
||||||
if (insulinAfterConstraints - calculatedTotalInsulin != 0 || !carbsAfterConstraints.equals(calculatedCarbs)) {
|
if (insulinAfterConstraints - calculatedTotalInsulin != 0 || !carbsAfterConstraints.equals(calculatedCarbs)) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
|
@ -323,7 +328,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
|
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
|
||||||
builder.setMessage(confirmMessage);
|
builder.setMessage(Html.fromHtml(confirmMessage));
|
||||||
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
if (finalInsulinAfterConstraints > 0 || finalCarbsAfterConstraints > 0) {
|
if (finalInsulinAfterConstraints > 0 || finalCarbsAfterConstraints > 0) {
|
||||||
|
@ -356,7 +361,17 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
||||||
detailedBolusInfo.source = Source.USER;
|
detailedBolusInfo.source = Source.USER;
|
||||||
result = pump.deliverTreatment(detailedBolusInfo);
|
result = pump.deliverTreatment(detailedBolusInfo);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
OKDialog.show(getActivity(), MainApp.sResources.getString(R.string.treatmentdeliveryerror), result.comment, null);
|
try {
|
||||||
|
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();
|
||||||
|
} catch (WindowManager.BadTokenException e) {
|
||||||
|
// window has been destroyed
|
||||||
|
Notification notification = new Notification(Notification.BOLUS_DELIVERY_ERROR, MainApp.sResources.getString(R.string.treatmentdeliveryerror), Notification.URGENT);
|
||||||
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -564,7 +579,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
||||||
boluscalcJSON.put("insulintrend", wizard.insulinFromTrend);
|
boluscalcJSON.put("insulintrend", wizard.insulinFromTrend);
|
||||||
boluscalcJSON.put("insulin", calculatedTotalInsulin);
|
boluscalcJSON.put("insulin", calculatedTotalInsulin);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class Notification {
|
||||||
public static final int NSURGENTALARM = 20;
|
public static final int NSURGENTALARM = 20;
|
||||||
public static final int SHORT_DIA = 21;
|
public static final int SHORT_DIA = 21;
|
||||||
public static final int TOAST_ALARM = 22;
|
public static final int TOAST_ALARM = 22;
|
||||||
|
public static final int BOLUS_DELIVERY_ERROR = 24;
|
||||||
|
|
||||||
|
|
||||||
public int id;
|
public int id;
|
||||||
|
|
|
@ -26,6 +26,7 @@ import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
|
@ -110,6 +111,7 @@ import info.nightscout.androidaps.plugins.Overview.Dialogs.CalibrationDialog;
|
||||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewTreatmentDialog;
|
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewTreatmentDialog;
|
||||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.WizardDialog;
|
import info.nightscout.androidaps.plugins.Overview.Dialogs.WizardDialog;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventSetWakeLock;
|
import info.nightscout.androidaps.plugins.Overview.events.EventSetWakeLock;
|
||||||
import info.nightscout.androidaps.plugins.Overview.graphExtensions.AreaGraphSeries;
|
import info.nightscout.androidaps.plugins.Overview.graphExtensions.AreaGraphSeries;
|
||||||
import info.nightscout.androidaps.plugins.Overview.graphExtensions.DataPointWithLabelInterface;
|
import info.nightscout.androidaps.plugins.Overview.graphExtensions.DataPointWithLabelInterface;
|
||||||
|
@ -662,7 +664,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
boluscalcJSON.put("insulintrend", wizard.insulinFromTrend);
|
boluscalcJSON.put("insulintrend", wizard.insulinFromTrend);
|
||||||
boluscalcJSON.put("insulin", wizard.calculatedTotalInsulin);
|
boluscalcJSON.put("insulin", wizard.calculatedTotalInsulin);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
if (wizard.calculatedTotalInsulin > 0d && quickWizardEntry.carbs() > 0d) {
|
if (wizard.calculatedTotalInsulin > 0d && quickWizardEntry.carbs() > 0d) {
|
||||||
DecimalFormat formatNumber2decimalplaces = new DecimalFormat("0.00");
|
DecimalFormat formatNumber2decimalplaces = new DecimalFormat("0.00");
|
||||||
|
@ -705,11 +707,17 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
detailedBolusInfo.source = Source.USER;
|
detailedBolusInfo.source = Source.USER;
|
||||||
PumpEnactResult result = pump.deliverTreatment(detailedBolusInfo);
|
PumpEnactResult result = pump.deliverTreatment(detailedBolusInfo);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
try {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||||
builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror));
|
builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror));
|
||||||
builder.setMessage(result.comment);
|
builder.setMessage(result.comment);
|
||||||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
|
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
|
||||||
builder.show();
|
builder.show();
|
||||||
|
} catch (WindowManager.BadTokenException e) {
|
||||||
|
// window has been destroyed
|
||||||
|
Notification notification = new Notification(Notification.BOLUS_DELIVERY_ERROR, MainApp.sResources.getString(R.string.treatmentdeliveryerror), Notification.URGENT);
|
||||||
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,6 +4,8 @@ import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
@ -17,6 +19,7 @@ import info.nightscout.utils.SP;
|
||||||
* Created by mike on 05.08.2016.
|
* Created by mike on 05.08.2016.
|
||||||
*/
|
*/
|
||||||
public class OverviewPlugin implements PluginBase {
|
public class OverviewPlugin implements PluginBase {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(OverviewPlugin.class);
|
||||||
|
|
||||||
public static double bgTargetLow = 80d;
|
public static double bgTargetLow = 80d;
|
||||||
public static double bgTargetHigh = 180d;
|
public static double bgTargetHigh = 180d;
|
||||||
|
@ -30,7 +33,7 @@ public class OverviewPlugin implements PluginBase {
|
||||||
try {
|
try {
|
||||||
quickWizard.setData(new JSONArray(storedData));
|
quickWizard.setData(new JSONArray(storedData));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
MainApp.bus().register(this);
|
MainApp.bus().register(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ import android.preference.PreferenceManager;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@ -18,6 +20,7 @@ import info.nightscout.utils.DateUtil;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class QuickWizard {
|
public class QuickWizard {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(QuickWizard.class);
|
||||||
|
|
||||||
public class QuickWizardEntry {
|
public class QuickWizardEntry {
|
||||||
public JSONObject storage;
|
public JSONObject storage;
|
||||||
|
@ -36,7 +39,7 @@ public class QuickWizard {
|
||||||
try {
|
try {
|
||||||
storage = new JSONObject(emptyData);
|
storage = new JSONObject(emptyData);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
position = -1;
|
position = -1;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +57,7 @@ public class QuickWizard {
|
||||||
try {
|
try {
|
||||||
return storage.getString("buttonText");
|
return storage.getString("buttonText");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -63,7 +66,7 @@ public class QuickWizard {
|
||||||
try {
|
try {
|
||||||
return storage.getInt("carbs");
|
return storage.getInt("carbs");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +83,7 @@ public class QuickWizard {
|
||||||
try {
|
try {
|
||||||
return storage.getInt("validFrom");
|
return storage.getInt("validFrom");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +92,7 @@ public class QuickWizard {
|
||||||
try {
|
try {
|
||||||
return storage.getInt("validTo");
|
return storage.getInt("validTo");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -117,7 +120,7 @@ public class QuickWizard {
|
||||||
try {
|
try {
|
||||||
return new QuickWizardEntry((JSONObject) storage.get(position), position);
|
return new QuickWizardEntry((JSONObject) storage.get(position), position);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +130,7 @@ public class QuickWizard {
|
||||||
try {
|
try {
|
||||||
if (new QuickWizardEntry((JSONObject) storage.get(i), i).isActive()) return true;
|
if (new QuickWizardEntry((JSONObject) storage.get(i), i).isActive()) return true;
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -157,7 +160,7 @@ public class QuickWizard {
|
||||||
try {
|
try {
|
||||||
storage.put(newItem.position, newItem.storage);
|
storage.put(newItem.position, newItem.storage);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
save();
|
save();
|
||||||
|
|
|
@ -253,7 +253,7 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
|
||||||
profile.put("units", mgdl ? Constants.MGDL : Constants.MMOL);
|
profile.put("units", mgdl ? Constants.MGDL : Constants.MMOL);
|
||||||
store.put(profileName, profile);
|
store.put(profileName, profile);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
convertedProfile = new ProfileStore(json);
|
convertedProfile = new ProfileStore(json);
|
||||||
convertedProfileName = profileName;
|
convertedProfileName = profileName;
|
||||||
|
|
|
@ -229,7 +229,7 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
profile.put("units", mgdl ? Constants.MGDL : Constants.MMOL);
|
profile.put("units", mgdl ? Constants.MGDL : Constants.MMOL);
|
||||||
store.put("LocalProfile", profile);
|
store.put("LocalProfile", profile);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
convertedProfile = new ProfileStore(json);
|
convertedProfile = new ProfileStore(json);
|
||||||
convertedProfileName = "LocalProfile";
|
convertedProfileName = "LocalProfile";
|
||||||
|
|
|
@ -134,7 +134,7 @@ public class NSProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
try {
|
try {
|
||||||
profile = new ProfileStore(new JSONObject(profileString));
|
profile = new ProfileStore(new JSONObject(profileString));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
profile = null;
|
profile = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
profile.put("units", mgdl ? Constants.MGDL : Constants.MMOL);
|
profile.put("units", mgdl ? Constants.MGDL : Constants.MMOL);
|
||||||
store.put("SimpleProfile", profile);
|
store.put("SimpleProfile", profile);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
convertedProfile = new ProfileStore(json);
|
convertedProfile = new ProfileStore(json);
|
||||||
}
|
}
|
||||||
|
|
|
@ -703,7 +703,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
||||||
pumpjson.put("reservoir", (int) pump.reservoirRemainingUnits);
|
pumpjson.put("reservoir", (int) pump.reservoirRemainingUnits);
|
||||||
pumpjson.put("clock", DateUtil.toISOString(new Date()));
|
pumpjson.put("clock", DateUtil.toISOString(new Date()));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return pumpjson;
|
return pumpjson;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package info.nightscout.androidaps.plugins.PumpDanaR;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -16,6 +18,8 @@ import info.nightscout.utils.SP;
|
||||||
* Created by mike on 04.07.2016.
|
* Created by mike on 04.07.2016.
|
||||||
*/
|
*/
|
||||||
public class DanaRPump {
|
public class DanaRPump {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(DanaRPump.class);
|
||||||
|
|
||||||
private static DanaRPump instance = null;
|
private static DanaRPump instance = null;
|
||||||
|
|
||||||
public static DanaRPump getInstance() {
|
public static DanaRPump getInstance() {
|
||||||
|
@ -189,7 +193,7 @@ public class DanaRPump {
|
||||||
profile.put("units", units == UNITS_MGDL ? Constants.MGDL : Constants.MMOL);
|
profile.put("units", units == UNITS_MGDL ? Constants.MGDL : Constants.MMOL);
|
||||||
store.put(PROFILE_PREFIX + (activeProfile + 1), profile);
|
store.put(PROFILE_PREFIX + (activeProfile + 1), profile);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpDanaR;
|
package info.nightscout.androidaps.plugins.PumpDanaR;
|
||||||
|
|
||||||
import android.bluetooth.BluetoothSocket;
|
import android.bluetooth.BluetoothSocket;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -44,7 +45,7 @@ public class SerialIOThread extends Thread {
|
||||||
mOutputStream = mRfCommSocket.getOutputStream();
|
mOutputStream = mRfCommSocket.getOutputStream();
|
||||||
mInputStream = mRfCommSocket.getInputStream();
|
mInputStream = mRfCommSocket.getInputStream();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
this.start();
|
this.start();
|
||||||
}
|
}
|
||||||
|
@ -158,7 +159,6 @@ public class SerialIOThread extends Thread {
|
||||||
mOutputStream.write(messageBytes);
|
mOutputStream.write(messageBytes);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("sendMessage write exception: ", e);
|
log.error("sendMessage write exception: ", e);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (message) {
|
synchronized (message) {
|
||||||
|
@ -166,14 +166,10 @@ public class SerialIOThread extends Thread {
|
||||||
message.wait(5000);
|
message.wait(5000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
log.error("sendMessage InterruptedException", e);
|
log.error("sendMessage InterruptedException", e);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
SystemClock.sleep(200);
|
||||||
Thread.sleep(200);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
|
||||||
if (!message.received) {
|
if (!message.received) {
|
||||||
log.warn("Reply not received " + message.getMessageName());
|
log.warn("Reply not received " + message.getMessageName());
|
||||||
if (message.getCommand() == 0xF0F1) {
|
if (message.getCommand() == 0xF0F1) {
|
||||||
|
|
|
@ -220,7 +220,7 @@ public class DanaRNSHistorySync {
|
||||||
MainApp.bus().post(ev);
|
MainApp.bus().post(ev);
|
||||||
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import android.content.IntentFilter;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
|
@ -75,7 +76,6 @@ import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusBasic;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusBolusExtended;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusBolusExtended;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusTempBasal;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusTempBasal;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRBolusStart;
|
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
|
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
|
||||||
import info.nightscout.androidaps.plugins.Overview.Notification;
|
import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
|
@ -209,9 +209,9 @@ public class DanaRExecutionService extends Service {
|
||||||
try {
|
try {
|
||||||
mRfcommSocket.connect();
|
mRfcommSocket.connect();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
//e.printStackTrace();
|
//log.error("Unhandled exception", e);
|
||||||
if (e.getMessage().contains("socket closed")) {
|
if (e.getMessage().contains("socket closed")) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -352,7 +352,7 @@ public class DanaRExecutionService extends Service {
|
||||||
NSUpload.uploadError(MainApp.sResources.getString(R.string.approachingdailylimit) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
|
NSUpload.uploadError(MainApp.sResources.getString(R.string.approachingdailylimit) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -415,7 +415,6 @@ public class DanaRExecutionService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
MsgBolusProgress progress = new MsgBolusProgress(amount, t); // initialize static variables
|
MsgBolusProgress progress = new MsgBolusProgress(amount, t); // initialize static variables
|
||||||
MainApp.bus().post(new EventDanaRBolusStart());
|
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
if (!stop.stopped) {
|
if (!stop.stopped) {
|
||||||
|
@ -552,10 +551,6 @@ public class DanaRExecutionService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitMsec(long msecs) {
|
private void waitMsec(long msecs) {
|
||||||
try {
|
SystemClock.sleep(msecs);
|
||||||
Thread.sleep(msecs);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -700,7 +700,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
||||||
pumpjson.put("reservoir", (int) pump.reservoirRemainingUnits);
|
pumpjson.put("reservoir", (int) pump.reservoirRemainingUnits);
|
||||||
pumpjson.put("clock", DateUtil.toISOString(new Date()));
|
pumpjson.put("clock", DateUtil.toISOString(new Date()));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return pumpjson;
|
return pumpjson;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpDanaRKorean;
|
package info.nightscout.androidaps.plugins.PumpDanaRKorean;
|
||||||
|
|
||||||
import android.bluetooth.BluetoothSocket;
|
import android.bluetooth.BluetoothSocket;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -45,7 +46,7 @@ public class SerialIOThread extends Thread {
|
||||||
mOutputStream = mRfCommSocket.getOutputStream();
|
mOutputStream = mRfCommSocket.getOutputStream();
|
||||||
mInputStream = mRfCommSocket.getInputStream();
|
mInputStream = mRfCommSocket.getInputStream();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
this.start();
|
this.start();
|
||||||
}
|
}
|
||||||
|
@ -159,7 +160,6 @@ public class SerialIOThread extends Thread {
|
||||||
mOutputStream.write(messageBytes);
|
mOutputStream.write(messageBytes);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("sendMessage write exception: ", e);
|
log.error("sendMessage write exception: ", e);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (message) {
|
synchronized (message) {
|
||||||
|
@ -167,14 +167,10 @@ public class SerialIOThread extends Thread {
|
||||||
message.wait(5000);
|
message.wait(5000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
log.error("sendMessage InterruptedException", e);
|
log.error("sendMessage InterruptedException", e);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
SystemClock.sleep(200);
|
||||||
Thread.sleep(200);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
|
||||||
if (!message.received) {
|
if (!message.received) {
|
||||||
log.warn("Reply not received " + message.getMessageName());
|
log.warn("Reply not received " + message.getMessageName());
|
||||||
if (message.getCommand() == 0xF0F1) {
|
if (message.getCommand() == 0xF0F1) {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import android.content.IntentFilter;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
|
@ -66,7 +67,6 @@ import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingShippingInfo;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusBolusExtended;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusBolusExtended;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusTempBasal;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusTempBasal;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRBolusStart;
|
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
|
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
|
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRKorean.SerialIOThread;
|
import info.nightscout.androidaps.plugins.PumpDanaRKorean.SerialIOThread;
|
||||||
|
@ -205,9 +205,9 @@ public class DanaRKoreanExecutionService extends Service {
|
||||||
try {
|
try {
|
||||||
mRfcommSocket.connect();
|
mRfcommSocket.connect();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
//e.printStackTrace();
|
//log.error("Unhandled exception", e);
|
||||||
if (e.getMessage().contains("socket closed")) {
|
if (e.getMessage().contains("socket closed")) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -345,7 +345,7 @@ public class DanaRKoreanExecutionService extends Service {
|
||||||
NSUpload.uploadError(MainApp.sResources.getString(R.string.approachingdailylimit) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
|
NSUpload.uploadError(MainApp.sResources.getString(R.string.approachingdailylimit) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -408,7 +408,6 @@ public class DanaRKoreanExecutionService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
MsgBolusProgress progress = new MsgBolusProgress(amount, t); // initialize static variables
|
MsgBolusProgress progress = new MsgBolusProgress(amount, t); // initialize static variables
|
||||||
MainApp.bus().post(new EventDanaRBolusStart());
|
|
||||||
|
|
||||||
if (!stop.stopped) {
|
if (!stop.stopped) {
|
||||||
mSerialIOThread.sendMessage(start);
|
mSerialIOThread.sendMessage(start);
|
||||||
|
@ -524,10 +523,6 @@ public class DanaRKoreanExecutionService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitMsec(long msecs) {
|
private void waitMsec(long msecs) {
|
||||||
try {
|
SystemClock.sleep(msecs);
|
||||||
Thread.sleep(msecs);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -632,7 +632,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
||||||
pumpjson.put("reservoir", (int) pump.reservoirRemainingUnits);
|
pumpjson.put("reservoir", (int) pump.reservoirRemainingUnits);
|
||||||
pumpjson.put("clock", DateUtil.toISOString(new Date()));
|
pumpjson.put("clock", DateUtil.toISOString(new Date()));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return pumpjson;
|
return pumpjson;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpDanaRv2;
|
package info.nightscout.androidaps.plugins.PumpDanaRv2;
|
||||||
|
|
||||||
import android.bluetooth.BluetoothSocket;
|
import android.bluetooth.BluetoothSocket;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -45,7 +46,7 @@ public class SerialIOThread extends Thread {
|
||||||
mOutputStream = mRfCommSocket.getOutputStream();
|
mOutputStream = mRfCommSocket.getOutputStream();
|
||||||
mInputStream = mRfCommSocket.getInputStream();
|
mInputStream = mRfCommSocket.getInputStream();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
this.start();
|
this.start();
|
||||||
}
|
}
|
||||||
|
@ -159,7 +160,6 @@ public class SerialIOThread extends Thread {
|
||||||
mOutputStream.write(messageBytes);
|
mOutputStream.write(messageBytes);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("sendMessage write exception: ", e);
|
log.error("sendMessage write exception: ", e);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (message) {
|
synchronized (message) {
|
||||||
|
@ -167,14 +167,10 @@ public class SerialIOThread extends Thread {
|
||||||
message.wait(5000);
|
message.wait(5000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
log.error("sendMessage InterruptedException", e);
|
log.error("sendMessage InterruptedException", e);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
SystemClock.sleep(200);
|
||||||
Thread.sleep(200);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
|
||||||
if (!message.received) {
|
if (!message.received) {
|
||||||
log.warn("Reply not received " + message.getMessageName());
|
log.warn("Reply not received " + message.getMessageName());
|
||||||
if (message.getCommand() == 0xF0F1) {
|
if (message.getCommand() == 0xF0F1) {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import android.content.IntentFilter;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
|
@ -37,7 +38,6 @@ import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.*;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.*;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRBolusStart;
|
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
|
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRv2.DanaRv2Plugin;
|
import info.nightscout.androidaps.plugins.PumpDanaRv2.DanaRv2Plugin;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRv2.SerialIOThread;
|
import info.nightscout.androidaps.plugins.PumpDanaRv2.SerialIOThread;
|
||||||
|
@ -180,9 +180,9 @@ public class DanaRv2ExecutionService extends Service {
|
||||||
try {
|
try {
|
||||||
mRfcommSocket.connect();
|
mRfcommSocket.connect();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
//e.printStackTrace();
|
//log.error("Unhandled exception", e);
|
||||||
if (e.getMessage().contains("socket closed")) {
|
if (e.getMessage().contains("socket closed")) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ public class DanaRv2ExecutionService extends Service {
|
||||||
NSUpload.uploadError(MainApp.sResources.getString(R.string.approachingdailylimit) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
|
NSUpload.uploadError(MainApp.sResources.getString(R.string.approachingdailylimit) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -412,7 +412,6 @@ public class DanaRv2ExecutionService extends Service {
|
||||||
}
|
}
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
MsgBolusProgress progress = new MsgBolusProgress(amount, t); // initialize static variables
|
MsgBolusProgress progress = new MsgBolusProgress(amount, t); // initialize static variables
|
||||||
MainApp.bus().post(new EventDanaRBolusStart());
|
|
||||||
|
|
||||||
if (!stop.stopped) {
|
if (!stop.stopped) {
|
||||||
mSerialIOThread.sendMessage(start);
|
mSerialIOThread.sendMessage(start);
|
||||||
|
@ -554,10 +553,6 @@ public class DanaRv2ExecutionService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitMsec(long msecs) {
|
private void waitMsec(long msecs) {
|
||||||
try {
|
SystemClock.sleep(msecs);
|
||||||
Thread.sleep(msecs);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpVirtual;
|
package info.nightscout.androidaps.plugins.PumpVirtual;
|
||||||
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
@ -217,33 +218,25 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.bolusDelivered = detailedBolusInfo.insulin;
|
result.bolusDelivered = detailedBolusInfo.insulin;
|
||||||
result.carbsDelivered = detailedBolusInfo.carbs;
|
result.carbsDelivered = detailedBolusInfo.carbs;
|
||||||
|
result.enacted = result.bolusDelivered > 0 || result.carbsDelivered > 0;
|
||||||
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
||||||
|
|
||||||
Double delivering = 0d;
|
Double delivering = 0d;
|
||||||
|
|
||||||
while (delivering < detailedBolusInfo.insulin) {
|
while (delivering < detailedBolusInfo.insulin) {
|
||||||
try {
|
SystemClock.sleep(200);
|
||||||
Thread.sleep(200);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
|
||||||
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
|
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
|
||||||
bolusingEvent.status = String.format(MainApp.sResources.getString(R.string.bolusdelivering), delivering);
|
bolusingEvent.status = String.format(MainApp.sResources.getString(R.string.bolusdelivering), delivering);
|
||||||
bolusingEvent.percent = Math.min((int) (delivering / detailedBolusInfo.insulin * 100), 100);
|
bolusingEvent.percent = Math.min((int) (delivering / detailedBolusInfo.insulin * 100), 100);
|
||||||
MainApp.bus().post(bolusingEvent);
|
MainApp.bus().post(bolusingEvent);
|
||||||
delivering += 0.1d;
|
delivering += 0.1d;
|
||||||
}
|
}
|
||||||
try {
|
SystemClock.sleep(200);
|
||||||
Thread.sleep(200);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
|
||||||
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
|
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
|
||||||
bolusingEvent.status = String.format(MainApp.sResources.getString(R.string.bolusdelivered), detailedBolusInfo.insulin);
|
bolusingEvent.status = String.format(MainApp.sResources.getString(R.string.bolusdelivered), detailedBolusInfo.insulin);
|
||||||
bolusingEvent.percent = 100;
|
bolusingEvent.percent = 100;
|
||||||
MainApp.bus().post(bolusingEvent);
|
MainApp.bus().post(bolusingEvent);
|
||||||
try {
|
SystemClock.sleep(1000);
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
|
||||||
if (Config.logPumpComm)
|
if (Config.logPumpComm)
|
||||||
log.debug("Delivering treatment insulin: " + detailedBolusInfo.insulin + "U carbs: " + detailedBolusInfo.carbs + "g " + result);
|
log.debug("Delivering treatment insulin: " + detailedBolusInfo.insulin + "U carbs: " + detailedBolusInfo.carbs + "g " + result);
|
||||||
MainApp.bus().post(new EventVirtualPumpUpdateGui());
|
MainApp.bus().post(new EventVirtualPumpUpdateGui());
|
||||||
|
@ -415,7 +408,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
||||||
pump.put("reservoir", reservoirInUnits);
|
pump.put("reservoir", reservoirInUnits);
|
||||||
pump.put("clock", DateUtil.toISOString(new Date()));
|
pump.put("clock", DateUtil.toISOString(new Date()));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return pump;
|
return pump;
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,6 +192,10 @@ public class StatuslinePlugin implements PluginBase {
|
||||||
+ DecimalFormatter.to2Decimal(basalIob.basaliob) + ")";
|
+ DecimalFormatter.to2Decimal(basalIob.basaliob) + ")";
|
||||||
}
|
}
|
||||||
Profile profile = MainApp.getConfigBuilder().getProfile();
|
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||||
|
|
||||||
|
if (profile == null)
|
||||||
|
return status;
|
||||||
|
|
||||||
if (!mPrefs.getBoolean("xdripstatus_showbgi", false)) {
|
if (!mPrefs.getBoolean("xdripstatus_showbgi", false)) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import android.os.Bundle;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.Services.Intents;
|
import info.nightscout.androidaps.Services.Intents;
|
||||||
|
@ -16,6 +18,7 @@ import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotificati
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
|
|
||||||
public class NSAlarmReceiver extends BroadcastReceiver {
|
public class NSAlarmReceiver extends BroadcastReceiver {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(NSAlarmReceiver.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
@ -27,7 +30,7 @@ public class NSAlarmReceiver extends BroadcastReceiver {
|
||||||
try {
|
try {
|
||||||
json = new JSONObject(data);
|
json = new JSONObject(data);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NSAlarm nsAlarm = new NSAlarm(json);
|
NSAlarm nsAlarm = new NSAlarm(json);
|
||||||
|
|
|
@ -76,9 +76,9 @@ public class ImportExportPrefs {
|
||||||
ToastUtils.showToastInUiThread(c, MainApp.sResources.getString(R.string.exported));
|
ToastUtils.showToastInUiThread(c, MainApp.sResources.getString(R.string.exported));
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
ToastUtils.showToastInUiThread(c, MainApp.sResources.getString(R.string.filenotfound) + " " + file);
|
ToastUtils.showToastInUiThread(c, MainApp.sResources.getString(R.string.filenotfound) + " " + file);
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -127,9 +127,9 @@ public class ImportExportPrefs {
|
||||||
});
|
});
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
ToastUtils.showToastInUiThread(c, MainApp.sResources.getString(R.string.filenotfound) + " " + file);
|
ToastUtils.showToastInUiThread(c, MainApp.sResources.getString(R.string.filenotfound) + " " + file);
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -6,6 +6,8 @@ import android.text.Spanned;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
@ -13,6 +15,7 @@ import java.util.Iterator;
|
||||||
* Created by mike on 11.07.2016.
|
* Created by mike on 11.07.2016.
|
||||||
*/
|
*/
|
||||||
public class JSONFormatter {
|
public class JSONFormatter {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(JSONFormatter.class);
|
||||||
|
|
||||||
public static Spanned format(final String jsonString) {
|
public static Spanned format(final String jsonString) {
|
||||||
final JsonVisitor visitor = new JsonVisitor(4, ' ');
|
final JsonVisitor visitor = new JsonVisitor(4, ' ');
|
||||||
|
@ -24,7 +27,7 @@ public class JSONFormatter {
|
||||||
else
|
else
|
||||||
return Html.fromHtml(visitor.visit(new JSONObject(jsonString), 0));
|
return Html.fromHtml(visitor.visit(new JSONObject(jsonString), 0));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
return Html.fromHtml("");
|
return Html.fromHtml("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +37,7 @@ public class JSONFormatter {
|
||||||
try {
|
try {
|
||||||
return Html.fromHtml(visitor.visit(object, 0));
|
return Html.fromHtml(visitor.visit(object, 0));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
return Html.fromHtml("");
|
return Html.fromHtml("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class NSUpload {
|
||||||
context.sendBroadcast(intent);
|
context.sendBroadcast(intent);
|
||||||
DbLogger.dbAdd(intent, data.toString());
|
DbLogger.dbAdd(intent, data.toString());
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ public class NSUpload {
|
||||||
DbLogger.dbAdd(intent, data.toString());
|
DbLogger.dbAdd(intent, data.toString());
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ public class NSUpload {
|
||||||
context.sendBroadcast(intent);
|
context.sendBroadcast(intent);
|
||||||
DbLogger.dbAdd(intent, data.toString());
|
DbLogger.dbAdd(intent, data.toString());
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ public class NSUpload {
|
||||||
context.sendBroadcast(intent);
|
context.sendBroadcast(intent);
|
||||||
DbLogger.dbAdd(intent, data.toString());
|
DbLogger.dbAdd(intent, data.toString());
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ public class NSUpload {
|
||||||
context.sendBroadcast(intent);
|
context.sendBroadcast(intent);
|
||||||
DbLogger.dbAdd(intent, data.toString());
|
DbLogger.dbAdd(intent, data.toString());
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ public class NSUpload {
|
||||||
context.sendBroadcast(intent);
|
context.sendBroadcast(intent);
|
||||||
DbLogger.dbAdd(intent, deviceStatus.mongoRecord().toString());
|
DbLogger.dbAdd(intent, deviceStatus.mongoRecord().toString());
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ public class NSUpload {
|
||||||
if (detailedBolusInfo.carbTime != 0)
|
if (detailedBolusInfo.carbTime != 0)
|
||||||
data.put("preBolus", detailedBolusInfo.carbTime);
|
data.put("preBolus", detailedBolusInfo.carbTime);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
uploadCareportalEntryToNS(data);
|
uploadCareportalEntryToNS(data);
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ public class NSUpload {
|
||||||
data.put("enteredBy", MainApp.instance().getString(R.string.app_name));
|
data.put("enteredBy", MainApp.instance().getString(R.string.app_name));
|
||||||
uploadCareportalEntryToNS(data);
|
uploadCareportalEntryToNS(data);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ public class NSUpload {
|
||||||
context.sendBroadcast(intent);
|
context.sendBroadcast(intent);
|
||||||
DbLogger.dbAdd(intent, data.toString());
|
DbLogger.dbAdd(intent, data.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -333,7 +333,7 @@ public class NSUpload {
|
||||||
context.sendBroadcast(intent);
|
context.sendBroadcast(intent);
|
||||||
DbLogger.dbRemove(intent, _id);
|
DbLogger.dbRemove(intent, _id);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -356,7 +356,7 @@ public class NSUpload {
|
||||||
context.sendBroadcast(intent);
|
context.sendBroadcast(intent);
|
||||||
DbLogger.dbAdd(intent, data.toString());
|
DbLogger.dbAdd(intent, data.toString());
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ public class NSUpload {
|
||||||
data.put("notes", error);
|
data.put("notes", error);
|
||||||
data.put("isAnnouncement", true);
|
data.put("isAnnouncement", true);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
bundle.putString("data", data.toString());
|
bundle.putString("data", data.toString());
|
||||||
Intent intent = new Intent(Intents.ACTION_DATABASE);
|
Intent intent = new Intent(Intents.ACTION_DATABASE);
|
||||||
|
@ -394,7 +394,7 @@ public class NSUpload {
|
||||||
data.put("created_at", DateUtil.toISOString(new Date()));
|
data.put("created_at", DateUtil.toISOString(new Date()));
|
||||||
data.put("notes", MainApp.sResources.getString(R.string.androidaps_start));
|
data.put("notes", MainApp.sResources.getString(R.string.androidaps_start));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
bundle.putString("data", data.toString());
|
bundle.putString("data", data.toString());
|
||||||
Intent intent = new Intent(Intents.ACTION_DATABASE);
|
Intent intent = new Intent(Intents.ACTION_DATABASE);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package info.nightscout.utils;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.view.ContextThemeWrapper;
|
import android.support.v7.view.ContextThemeWrapper;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
|
@ -28,10 +29,7 @@ public class OKDialog {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
if (runnable != null) {
|
if (runnable != null) {
|
||||||
try {
|
SystemClock.sleep(100);
|
||||||
Thread.sleep(100);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
|
||||||
activity.runOnUiThread(runnable);
|
activity.runOnUiThread(runnable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,10 +50,7 @@ public class OKDialog {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
if (runnable != null) {
|
if (runnable != null) {
|
||||||
try {
|
SystemClock.sleep(100);
|
||||||
Thread.sleep(100);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
|
||||||
activity.runOnUiThread(runnable);
|
activity.runOnUiThread(runnable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,37 @@
|
||||||
package info.nightscout.utils;
|
package info.nightscout.utils;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 20.06.2016.
|
* Created by mike on 20.06.2016.
|
||||||
*/
|
*/
|
||||||
public class Round {
|
public class Round {
|
||||||
public static Double roundTo(double x, Double step) {
|
public static Double roundTo(Double x, Double step) {
|
||||||
if (x != 0d) {
|
return round(x, step, BigDecimal.ROUND_HALF_UP);
|
||||||
return Math.round(x / step) * step;
|
|
||||||
}
|
|
||||||
return 0d;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Double floorTo(Double x, Double step) {
|
public static Double floorTo(Double x, Double step) {
|
||||||
if (x != 0d) {
|
return round(x, step, BigDecimal.ROUND_FLOOR);
|
||||||
return Math.floor(x / step) * step;
|
|
||||||
}
|
|
||||||
return 0d;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Double ceilTo(Double x, Double step) {
|
public static Double ceilTo(Double x, Double step) {
|
||||||
if (x != 0d) {
|
return round(x, step, BigDecimal.ROUND_CEILING);
|
||||||
return Math.ceil(x / step) * step;
|
|
||||||
}
|
}
|
||||||
return 0d;
|
|
||||||
|
private static Double round(Double x, Double step, int roundingMode) {
|
||||||
|
BigDecimal numberToRound = new BigDecimal((Double.toString(x)));
|
||||||
|
BigDecimal stepSize = new BigDecimal((Double.toString(step)));
|
||||||
|
int scale = getDecimalsFromStep(step);
|
||||||
|
|
||||||
|
numberToRound.setScale(scale, BigDecimal.ROUND_HALF_UP);
|
||||||
|
|
||||||
|
BigDecimal rounded = numberToRound.divide(stepSize, 0, roundingMode).multiply(stepSize);
|
||||||
|
|
||||||
|
return rounded.doubleValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int getDecimalsFromStep(Double step) {
|
||||||
|
String stepString = Double.toString(step);
|
||||||
|
return stepString.substring(stepString.indexOf('.') + 1).length();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,7 +253,7 @@ public class TimeListEdit {
|
||||||
return item.getInt("timeAsSeconds");
|
return item.getInt("timeAsSeconds");
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ public class TimeListEdit {
|
||||||
return item.getDouble("value");
|
return item.getDouble("value");
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return 0d;
|
return 0d;
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ public class TimeListEdit {
|
||||||
return item.getDouble("value");
|
return item.getDouble("value");
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0d;
|
return 0d;
|
||||||
|
@ -305,7 +305,7 @@ public class TimeListEdit {
|
||||||
}
|
}
|
||||||
if (save != null) save.run();
|
if (save != null) save.run();
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -322,7 +322,7 @@ public class TimeListEdit {
|
||||||
editItem(index, timeAsSeconds, value1, value2);
|
editItem(index, timeAsSeconds, value1, value2);
|
||||||
if (save != null) save.run();
|
if (save != null) save.run();
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<string name="waitingforpumpclicktorefresh">Wacht op pomp. Klik om te vernieuwen.</string>
|
<string name="waitingforpumpclicktorefresh">Wacht op pomp. Klik om te vernieuwen.</string>
|
||||||
<string name="waitingforpump">Wacht op pomp</string>
|
<string name="waitingforpump">Wacht op pomp</string>
|
||||||
<string name="vitualpump_label">VIRTUELE POMP</string>
|
<string name="vitualpump_label">VIRTUELE POMP</string>
|
||||||
<string name="visible">Zichtbaar</string>
|
<string name="visible">Toon</string>
|
||||||
<string name="virtualpump_uploadstatus_title">Upload status naar NS</string>
|
<string name="virtualpump_uploadstatus_title">Upload status naar NS</string>
|
||||||
<string name="virtualpump_tempbasal_label">Tijdelijk basaal</string>
|
<string name="virtualpump_tempbasal_label">Tijdelijk basaal</string>
|
||||||
<string name="virtualpump_sqlerror">SQL Storing</string>
|
<string name="virtualpump_sqlerror">SQL Storing</string>
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
<string name="button1">Knop 1</string>
|
<string name="button1">Knop 1</string>
|
||||||
<string name="button2">Knop 2</string>
|
<string name="button2">Knop 2</string>
|
||||||
<string name="button3">Knop 3</string>
|
<string name="button3">Knop 3</string>
|
||||||
<string name="calibrationsent">Kalibratie naat xDrip verzonden</string>
|
<string name="calibrationsent">Kalibratie naar xDrip verzonden</string>
|
||||||
<string name="cancel">Annuleer</string>
|
<string name="cancel">Annuleer</string>
|
||||||
<string name="canceltemp">Annuleer tijdelijk basaal</string>
|
<string name="canceltemp">Annuleer tijdelijk basaal</string>
|
||||||
<string name="carbs">Koolhydraten</string>
|
<string name="carbs">Koolhydraten</string>
|
||||||
|
@ -91,12 +91,12 @@
|
||||||
<string name="careportal_carbsandbolus_label">KOOLHYDRATEN & BOLUS</string>
|
<string name="careportal_carbsandbolus_label">KOOLHYDRATEN & BOLUS</string>
|
||||||
<string name="careportal_carbscorrection">Koolhydraten correctie</string>
|
<string name="careportal_carbscorrection">Koolhydraten correctie</string>
|
||||||
<string name="careportal_cgm_label">CGM & OPENAPS</string>
|
<string name="careportal_cgm_label">CGM & OPENAPS</string>
|
||||||
<string name="careportal_cgmsensorinsert">CGM Sensor geplaatst</string>
|
<string name="careportal_cgmsensorinsert">CGM Sens. ingebracht</string>
|
||||||
<string name="careportal_cgmsensorstart">CGM Sensor Start</string>
|
<string name="careportal_cgmsensorstart">CGM Sens. Start</string>
|
||||||
<string name="careportal_combobolus">Multiwave bolus</string>
|
<string name="careportal_combobolus">Multiwave bolus</string>
|
||||||
<string name="careportal_correctionbolus">Correctie bolus</string>
|
<string name="careportal_correctionbolus">Correctie bolus</string>
|
||||||
<string name="careportal_exercise">Sport</string>
|
<string name="careportal_exercise">Sport</string>
|
||||||
<string name="careportal_insulinage_label">Insuline leeftijd</string>
|
<string name="careportal_insulinage_label">Ouderdom insuline</string>
|
||||||
<string name="careportal_insulinage_label_short">IAGE</string>
|
<string name="careportal_insulinage_label_short">IAGE</string>
|
||||||
<string name="careportal_insulincartridgechange">Insuline ampul wissel</string>
|
<string name="careportal_insulincartridgechange">Insuline ampul wissel</string>
|
||||||
<string name="careportal_mealbolus">Maaltijd bolus</string>
|
<string name="careportal_mealbolus">Maaltijd bolus</string>
|
||||||
|
@ -118,19 +118,19 @@
|
||||||
<string name="careportal_newnstreatment_split_label">Splitzen</string>
|
<string name="careportal_newnstreatment_split_label">Splitzen</string>
|
||||||
<string name="careportal_note">Notitie</string>
|
<string name="careportal_note">Notitie</string>
|
||||||
<string name="careportal_openapsoffline">OpenAPS Offline</string>
|
<string name="careportal_openapsoffline">OpenAPS Offline</string>
|
||||||
<string name="careportal_pbage_label">Leeftijd batterij</string>
|
<string name="careportal_pbage_label">Ouderdom batterij</string>
|
||||||
<string name="careportal_profileswitch">Profiel wissel</string>
|
<string name="careportal_profileswitch">Profiel wissel</string>
|
||||||
<string name="careportal_pump_label">Pomp</string>
|
<string name="careportal_pump_label">Pomp</string>
|
||||||
<string name="careportal_pumpbatterychange">Pomp batterij wissel</string>
|
<string name="careportal_pumpbatterychange">Pomp bat. wissel</string>
|
||||||
<string name="careportal_pumpsitechange">Infusieplaats wissel</string>
|
<string name="careportal_pumpsitechange">Infuus wissel</string>
|
||||||
<string name="careportal_question">Vraag</string>
|
<string name="careportal_question">Vraag</string>
|
||||||
<string name="careportal_sensorage_label">Leeftijd sensor</string>
|
<string name="careportal_sensorage_label">Ouderdom sensor</string>
|
||||||
<string name="careportal_sensorage_label_short">SAGE</string>
|
<string name="careportal_sensorage_label_short">SAGE</string>
|
||||||
<string name="careportal_shortname">CP</string>
|
<string name="careportal_shortname">CP</string>
|
||||||
<string name="careportal_snackbolus">Snack bolus</string>
|
<string name="careportal_snackbolus">Snack bolus</string>
|
||||||
<string name="careportal_tempbasalend">Einde tijdelijk basaal</string>
|
<string name="careportal_tempbasalend">Einde tijd. basaal</string>
|
||||||
<string name="careportal_tempbasalstart">Begin tijdelijk basaal</string>
|
<string name="careportal_tempbasalstart">Start tijd. basaal</string>
|
||||||
<string name="careportal_temporarytarget">Tijdelijk streefdoel</string>
|
<string name="careportal_temporarytarget">Tijd. streefdoel</string>
|
||||||
<string name="careportal_temporarytargetcancel">Tijdelijk streefdoel annuleren</string>
|
<string name="careportal_temporarytargetcancel">Tijdelijk streefdoel annuleren</string>
|
||||||
<string name="changeyourinput">Wijzig het ingegevene!</string>
|
<string name="changeyourinput">Wijzig het ingegevene!</string>
|
||||||
<string name="child">Kind</string>
|
<string name="child">Kind</string>
|
||||||
|
@ -143,7 +143,7 @@
|
||||||
<string name="configbuilder_bgsource">BG bron</string>
|
<string name="configbuilder_bgsource">BG bron</string>
|
||||||
<string name="configbuilder_constraints">Beperkingen</string>
|
<string name="configbuilder_constraints">Beperkingen</string>
|
||||||
<string name="configbuilder_general">Algemeen</string>
|
<string name="configbuilder_general">Algemeen</string>
|
||||||
<string name="configbuilder_insulin">insuline</string>
|
<string name="configbuilder_insulin">Insuline curve</string>
|
||||||
<string name="clear_queue">Ledig wachtrij</string>
|
<string name="clear_queue">Ledig wachtrij</string>
|
||||||
<string name="configbuilder_loop">Loop</string>
|
<string name="configbuilder_loop">Loop</string>
|
||||||
<string name="configbuilder_nightscoutversion_label">Nightscout versie:</string>
|
<string name="configbuilder_nightscoutversion_label">Nightscout versie:</string>
|
||||||
|
@ -213,7 +213,7 @@
|
||||||
<string name="smscommunicator_bolusreplywithcode" formatted="false">Om de bolus %.2fU toe te dienen antwoord met de code %s</string>
|
<string name="smscommunicator_bolusreplywithcode" formatted="false">Om de bolus %.2fU toe te dienen antwoord met de code %s</string>
|
||||||
<string name="smscommunicator_calibrationfailed">XDrip ontvangt geen callibraties</string>
|
<string name="smscommunicator_calibrationfailed">XDrip ontvangt geen callibraties</string>
|
||||||
<string name="smscommunicator_calibrationreplywithcode" formatted="false">Om calibratie %.2f te verzenden antwoord met de code %s</string>
|
<string name="smscommunicator_calibrationreplywithcode" formatted="false">Om calibratie %.2f te verzenden antwoord met de code %s</string>
|
||||||
<string name="smscommunicator_calibrationsent">Callibratie verzonden. Het ontvangen van callibraties moet actief zijn in xDrip.</string>
|
<string name="smscommunicator_calibrationsent">Kalibratie verzonden. Het ontvangen van kalibraties moet actief zijn in xDrip.</string>
|
||||||
<string name="ko_lang">한국어</string>
|
<string name="ko_lang">한국어</string>
|
||||||
<string name="language">Taal</string>
|
<string name="language">Taal</string>
|
||||||
<string name="localprofile">Lokaal profiel</string>
|
<string name="localprofile">Lokaal profiel</string>
|
||||||
|
@ -269,7 +269,7 @@
|
||||||
<string name="end_user_license_agreement">Eind gebruiker overeenkomst</string>
|
<string name="end_user_license_agreement">Eind gebruiker overeenkomst</string>
|
||||||
<string name="enablesuperbolus_summary">Activeer de superbolus functie in de wizard. Activeer deze niet tot je begrijpt wat dit doet. OVERDOSISEN ZIJN MOGELIJK BIJ ONWETENDHEID</string>
|
<string name="enablesuperbolus_summary">Activeer de superbolus functie in de wizard. Activeer deze niet tot je begrijpt wat dit doet. OVERDOSISEN ZIJN MOGELIJK BIJ ONWETENDHEID</string>
|
||||||
<string name="enablesuperbolus">Activeer superbolus in de wizard</string>
|
<string name="enablesuperbolus">Activeer superbolus in de wizard</string>
|
||||||
<string name="enabled">Geactiveerd</string>
|
<string name="enabled">Actief</string>
|
||||||
<string name="dont_show_again">Toon niet opnieuw</string>
|
<string name="dont_show_again">Toon niet opnieuw</string>
|
||||||
<string name="eatingsoon">Eet binnenkort</string>
|
<string name="eatingsoon">Eet binnenkort</string>
|
||||||
<string name="edit_base_basal">Verander basaal patroon</string>
|
<string name="edit_base_basal">Verander basaal patroon</string>
|
||||||
|
@ -306,7 +306,7 @@
|
||||||
<string name="nsclientinternal_url">URL:</string>
|
<string name="nsclientinternal_url">URL:</string>
|
||||||
<string name="nsclientinternal_url_dialogmessage">Nightscout URL ingeven</string>
|
<string name="nsclientinternal_url_dialogmessage">Nightscout URL ingeven</string>
|
||||||
<string name="nsclientinternal_url_title">Nightscout URL</string>
|
<string name="nsclientinternal_url_title">Nightscout URL</string>
|
||||||
<string name="nsprofileview_target_label">Doelstelling</string>
|
<string name="nsprofileview_target_label">Streefdoel</string>
|
||||||
<string name="nsprofileview_isf_label">ISF</string>
|
<string name="nsprofileview_isf_label">ISF</string>
|
||||||
<string name="nsclientinternal_secret_dialogtitle">NS API geheim</string>
|
<string name="nsclientinternal_secret_dialogtitle">NS API geheim</string>
|
||||||
<string name="danar_invalidinput">Verkeerde ingave</string>
|
<string name="danar_invalidinput">Verkeerde ingave</string>
|
||||||
|
@ -341,13 +341,13 @@
|
||||||
<string name="nightscout">Nightscout</string>
|
<string name="nightscout">Nightscout</string>
|
||||||
<string name="ok">Ok</string>
|
<string name="ok">Ok</string>
|
||||||
<string name="danar_stats_basalrate">Basaal</string>
|
<string name="danar_stats_basalrate">Basaal</string>
|
||||||
<string name="loopdisabled">Loop gedeactiveerd door beperkingen</string>
|
<string name="loopdisabled">Loop gedeactiveerd door doelen tab</string>
|
||||||
<string name="loopmenu">Loop menu</string>
|
<string name="loopmenu">Loop menu</string>
|
||||||
<string name="loopsuperbolusfor" formatted="false">Superbolus (%d m)</string>
|
<string name="loopsuperbolusfor" formatted="false">Superbolus (%d m)</string>
|
||||||
<string name="loopsuspended">Loop pauzeren</string>
|
<string name="loopsuspended">Loop pauzeren</string>
|
||||||
<string name="loopsuspendedfor" formatted="false">Pauzeer (%d m)</string>
|
<string name="loopsuspendedfor" formatted="false">Pauzeer (%d m)</string>
|
||||||
<string name="lowbattery">Batterij bijna leeg</string>
|
<string name="lowbattery">Batterij bijna leeg</string>
|
||||||
<string name="manual">Maneel</string>
|
<string name="manual">Manueel</string>
|
||||||
<string name="mdi">MDI</string>
|
<string name="mdi">MDI</string>
|
||||||
<string name="mdtp_cancel">Afbreken</string>
|
<string name="mdtp_cancel">Afbreken</string>
|
||||||
<string name="mdtp_ok">OK</string>
|
<string name="mdtp_ok">OK</string>
|
||||||
|
@ -430,17 +430,17 @@
|
||||||
<string name="duration">Periode</string>
|
<string name="duration">Periode</string>
|
||||||
<string name="openapsma_scriptdebugdata_label">Script debug</string>
|
<string name="openapsma_scriptdebugdata_label">Script debug</string>
|
||||||
<string name="openapsma_mealdata_label">Maaltijd gegevens</string>
|
<string name="openapsma_mealdata_label">Maaltijd gegevens</string>
|
||||||
<string name="nsprofileview_units_label">éénheid</string>
|
<string name="nsprofileview_units_label">Eénheid</string>
|
||||||
<string name="objectives">Doelen</string>
|
<string name="objectives">Doelen</string>
|
||||||
<string name="objectives_0_gate">Controleren dat BG beschikbaar is op Nightscout en dat de insulinepomp data is geupload</string>
|
<string name="objectives_0_gate">Controleren van beschikbaarheid BG en insuline pomp data op Nightscout</string>
|
||||||
<string name="objectives_0_objective">Opzetten van visualisatie en monitoring eveneens onalyze van basaal en ratio\'s</string>
|
<string name="objectives_0_objective">Opzetten van visualisatie en monitoring eveneens analyze van basaal en ratio\'s</string>
|
||||||
<string name="objectives_1_gate">Werking in Open Loop modus voor enkele dagen, manueel vele tijdelijke basalen instellen</string>
|
<string name="objectives_1_gate">In Open Loop modus werken voor enkele dagen, manueel tijdelijke basaal instellen</string>
|
||||||
<string name="objectives_1_objective">Starten met de Open Loop modus</string>
|
<string name="objectives_1_objective">Starten met de Open Loop modus</string>
|
||||||
<string name="objectives_2_gate">Gebaseerd op deze ervarinegen beslissen wat het maximale basaal mag zijn en dit in de pomp instellen</string>
|
<string name="objectives_2_gate">Gebaseerd op deze ervaringen beslissen wat het maximale basaal mag zijn en dit in de pomp instellen</string>
|
||||||
<string name="objectives_2_objective">De Open Loop begrijpen, inclusief de voorgestelde tijdelijke basalen</string>
|
<string name="objectives_2_objective">De Open Loop begrijpen, inclusief de voorgestelde tijdelijke basalen</string>
|
||||||
<string name="objectives_3_gate">In gesloten Loop werken met een max. IOB = 0 voor enkele dagen met een beperkt aantal LBG</string>
|
<string name="objectives_3_gate">In closed Loop werken met een max. IOB = 0 gedurende enkele dagen met een beperkt aantal lage BG</string>
|
||||||
<string name="objectives_3_objective">Starten met gesloten Loop met lage glucose begrenzing</string>
|
<string name="objectives_3_objective">Starten met closed Loop met bescherming tegen lage BG</string>
|
||||||
<string name="objectives_4_gate">Gebruik enkele dagen en ten miinste 1 naght zonder een laag BG alarm voordat je je BG doel laat dalen</string>
|
<string name="objectives_4_gate">Verhoog max. IOB en test enkele dagen alsook minstens 1 nacht zonder een laag BG alarm voordat je jouw BG doel laat dalen</string>
|
||||||
<string name="objectives_bgavailableinns">BG beschikbaar op NS</string>
|
<string name="objectives_bgavailableinns">BG beschikbaar op NS</string>
|
||||||
<string name="objectives_5_objective">Pas het basaal en de ratios aan indien nodig, activeer hierna de auto-sens optie</string>
|
<string name="objectives_5_objective">Pas het basaal en de ratios aan indien nodig, activeer hierna de auto-sens optie</string>
|
||||||
<string name="openapsma_run">Bereken nu</string>
|
<string name="openapsma_run">Bereken nu</string>
|
||||||
|
@ -627,7 +627,7 @@
|
||||||
<string name="openapsama_autosens_min_summary">Standaard waarde: 0.7 Dit is de andere kan van de autosens veiligheid limiet. Dit zet een limiet op hoe laag het basaal kan aangepast worden, en hoe hoog het ISF en het BG doel</string>
|
<string name="openapsama_autosens_min_summary">Standaard waarde: 0.7 Dit is de andere kan van de autosens veiligheid limiet. Dit zet een limiet op hoe laag het basaal kan aangepast worden, en hoe hoog het ISF en het BG doel</string>
|
||||||
<string name="openapsama_bolussnooze_dia_divisor_summary">Standaard waarde: 2 Bolus snooze is actief nadat je een maaltijd bolus toegediend hebt, zodat de loop geen tegenvoorstel met een verlaagd tijdelijk basaal doet nadat je gegeten hebt. Het voorbeeld hier van van standaard 2; dus een 3 u DIA betekent dat de bolus snooze gemiddeld 1.5u actief is (3DIA/2).</string>
|
<string name="openapsama_bolussnooze_dia_divisor_summary">Standaard waarde: 2 Bolus snooze is actief nadat je een maaltijd bolus toegediend hebt, zodat de loop geen tegenvoorstel met een verlaagd tijdelijk basaal doet nadat je gegeten hebt. Het voorbeeld hier van van standaard 2; dus een 3 u DIA betekent dat de bolus snooze gemiddeld 1.5u actief is (3DIA/2).</string>
|
||||||
<string name="openapsama_current_basal_safety_multiplier_summary">Standaard waarde: 4 Dit is een combinatie van enerzijds het OpenAPS veiligheid limieten en anderzijds van “3 x max dagelijks basaal ; 4x actueel”. Dit betekent dat het basaal niet hoger kan ingesteld worden dan het ingestelde nummer keer het actueel basaal waarbij de limiet in de pomp geen invloed heeft.Dit is een veiligheidsmaatregel om te vermijden dat patiënten in gevaarlijke laag bereik komen zonder te snappen hoe het algoritme werkt. Nogmaals de standaard waarde is 4x; de meeste zullen deze waarde nooit moeten aanpassen maar zullen eerder andere waardes moeten aanpassen als ze tegen een limiet aanstoten.</string>
|
<string name="openapsama_current_basal_safety_multiplier_summary">Standaard waarde: 4 Dit is een combinatie van enerzijds het OpenAPS veiligheid limieten en anderzijds van “3 x max dagelijks basaal ; 4x actueel”. Dit betekent dat het basaal niet hoger kan ingesteld worden dan het ingestelde nummer keer het actueel basaal waarbij de limiet in de pomp geen invloed heeft.Dit is een veiligheidsmaatregel om te vermijden dat patiënten in gevaarlijke laag bereik komen zonder te snappen hoe het algoritme werkt. Nogmaals de standaard waarde is 4x; de meeste zullen deze waarde nooit moeten aanpassen maar zullen eerder andere waardes moeten aanpassen als ze tegen een limiet aanstoten.</string>
|
||||||
<string name="objectives_5_gate">1 week succesvol loop gedurende de dag met geregeld KH ingave</string>
|
<string name="objectives_5_gate">Gedurende 1 week succesvol closed loop met KH ingave</string>
|
||||||
<string name="syncprofiletopump_title">Synchroniseer profiel met de pomp</string>
|
<string name="syncprofiletopump_title">Synchroniseer profiel met de pomp</string>
|
||||||
<string name="careportal_activity_label">ACTIVITIJD & FEEDBACK</string>
|
<string name="careportal_activity_label">ACTIVITIJD & FEEDBACK</string>
|
||||||
<string name="danar_model" formatted="false">Model: %02X Protokoll: %02X Code: %02X</string>
|
<string name="danar_model" formatted="false">Model: %02X Protokoll: %02X Code: %02X</string>
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<color name="prediction">#ff00ff</color>
|
<color name="prediction">#ff00ff</color>
|
||||||
<color name="basal">#00ffff</color>
|
<color name="basal">#00ffff</color>
|
||||||
<color name="iob">#FFFB8C00</color>
|
<color name="iob">#FFFB8C00</color>
|
||||||
|
<color name="bolus">#FFFFCC03</color>
|
||||||
<color name="cob">#8BC34A</color>
|
<color name="cob">#8BC34A</color>
|
||||||
<color name="ratio">#FFFFFF</color>
|
<color name="ratio">#FFFFFF</color>
|
||||||
<color name="inrange">#00FF00</color>
|
<color name="inrange">#00FF00</color>
|
||||||
|
|
|
@ -14,6 +14,8 @@ public class RoundTest {
|
||||||
public void roundToTest() throws Exception {
|
public void roundToTest() throws Exception {
|
||||||
assertEquals( 0.55d, Round.roundTo(0.54d, 0.05d), 0.00000001d );
|
assertEquals( 0.55d, Round.roundTo(0.54d, 0.05d), 0.00000001d );
|
||||||
assertEquals( 1d, Round.roundTo(1.49d, 1d), 0.00000001d );
|
assertEquals( 1d, Round.roundTo(1.49d, 1d), 0.00000001d );
|
||||||
|
assertEquals( 80d, Round.roundTo(65d, 40d), 0.00000001d );
|
||||||
|
assertEquals( 0d, Round.roundTo(0d, 0.1d), 0.00000001d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -27,5 +29,4 @@ public class RoundTest {
|
||||||
assertEquals( 0.6d, Round.ceilTo(0.54d, 0.1d), 0.00000001d );
|
assertEquals( 0.6d, Round.ceilTo(0.54d, 0.1d), 0.00000001d );
|
||||||
assertEquals( 2d, Round.ceilTo(1.49999d, 1d), 0.00000001d );
|
assertEquals( 2d, Round.ceilTo(1.49999d, 1d), 0.00000001d );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -5,6 +5,7 @@ import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
import android.support.v4.app.NotificationCompat;
|
import android.support.v4.app.NotificationCompat;
|
||||||
|
@ -400,11 +401,7 @@ public class ListenerService extends WearableListenerService implements GoogleAp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
SystemClock.sleep(seconds * 1000);
|
||||||
Thread.sleep(seconds * 1000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
//e.printStackTrace();
|
|
||||||
}
|
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if(valid) {
|
if(valid) {
|
||||||
NotificationManagerCompat notificationManager =
|
NotificationManagerCompat notificationManager =
|
||||||
|
|
|
@ -15,6 +15,7 @@ import android.graphics.Rect;
|
||||||
import android.graphics.Shader;
|
import android.graphics.Shader;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
|
@ -473,11 +474,7 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
|
||||||
setIsAnimated(true);
|
setIsAnimated(true);
|
||||||
for (int i = 0; i <= 8 * 1000 / 40; i++) {
|
for (int i = 0; i <= 8 * 1000 / 40; i++) {
|
||||||
updateRainbow();
|
updateRainbow();
|
||||||
try {
|
SystemClock.sleep(40);
|
||||||
Thread.sleep(40);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mSgv.getPaint().setShader(null);
|
mSgv.getPaint().setShader(null);
|
||||||
setIsAnimated(false);
|
setIsAnimated(false);
|
||||||
|
|
|
@ -15,6 +15,7 @@ import android.graphics.RectF;
|
||||||
import android.graphics.Shader;
|
import android.graphics.Shader;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
import android.support.wearable.watchface.WatchFaceStyle;
|
import android.support.wearable.watchface.WatchFaceStyle;
|
||||||
|
@ -504,11 +505,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
|
||||||
setIsAnimated(true);
|
setIsAnimated(true);
|
||||||
for (int i = 0; i <= 8 * 1000 / 40; i++) {
|
for (int i = 0; i <= 8 * 1000 / 40; i++) {
|
||||||
animationStep();
|
animationStep();
|
||||||
try {
|
SystemClock.sleep(40);
|
||||||
Thread.sleep(40);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
setIsAnimated(false);
|
setIsAnimated(false);
|
||||||
prepareDrawTime();
|
prepareDrawTime();
|
||||||
|
|
|
@ -15,6 +15,7 @@ import android.graphics.Rect;
|
||||||
import android.graphics.Shader;
|
import android.graphics.Shader;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
|
@ -427,11 +428,7 @@ public class NOChart extends WatchFace implements SharedPreferences.OnSharedPref
|
||||||
setIsAnimated(true);
|
setIsAnimated(true);
|
||||||
for (int i = 0; i <= 8 * 1000 / 40; i++) {
|
for (int i = 0; i <= 8 * 1000 / 40; i++) {
|
||||||
updateRainbow();
|
updateRainbow();
|
||||||
try {
|
SystemClock.sleep(40);
|
||||||
Thread.sleep(40);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mSgv.getPaint().setShader(null);
|
mSgv.getPaint().setShader(null);
|
||||||
setIsAnimated(false);
|
setIsAnimated(false);
|
||||||
|
|
Loading…
Reference in a new issue