DATA logging & refactor

This commit is contained in:
Milos Kozak 2018-07-28 16:26:36 +02:00
parent b8a41e5f5b
commit a7efa317be
15 changed files with 222 additions and 160 deletions

View file

@ -40,6 +40,10 @@ public class Config {
public static final boolean logOverview = true; public static final boolean logOverview = true;
public static final boolean logNotification = true; public static final boolean logNotification = true;
public static final boolean logAlarm = false; public static final boolean logAlarm = false;
public static final boolean logDataService = true;
public static final boolean logDataNS = true;
public static final boolean logDataFood = true;
public static final boolean logDataTreatments = true;
// DanaR specific // DanaR specific
public static final boolean logDanaBTComm = true; public static final boolean logDanaBTComm = true;

View file

@ -76,4 +76,8 @@ public class Constants {
public static final String OVERVIEW = "OVERVIEW"; public static final String OVERVIEW = "OVERVIEW";
public static final String NOTIFICATION = "NOTIFICATION"; public static final String NOTIFICATION = "NOTIFICATION";
public static final String ALARM = "ALARM"; public static final String ALARM = "ALARM";
public static final String DATASERVICE = "DATASERVICE";
public static final String DATANS = "DATANS";
public static final String DATAFOOD = "DATAFOOD";
public static final String DATATREATMENTS = "DATATREATMENTS";
} }

View file

@ -44,8 +44,8 @@ import info.nightscout.androidaps.events.EventFeatureRunning;
import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventRefreshGui; import info.nightscout.androidaps.events.EventRefreshGui;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Food.FoodPlugin; import info.nightscout.androidaps.plugins.Food.FoodPlugin;
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSSettingsStatus;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.androidaps.setupwizard.SetupWizardActivity; import info.nightscout.androidaps.setupwizard.SetupWizardActivity;
import info.nightscout.androidaps.tabs.TabPageAdapter; import info.nightscout.androidaps.tabs.TabPageAdapter;
@ -400,7 +400,7 @@ public class MainActivity extends AppCompatActivity {
builder.setIcon(R.mipmap.blueowl); builder.setIcon(R.mipmap.blueowl);
String message = "Build: " + BuildConfig.BUILDVERSION + "\n"; String message = "Build: " + BuildConfig.BUILDVERSION + "\n";
message += "Flavor: " + BuildConfig.FLAVOR + BuildConfig.BUILD_TYPE + "\n"; message += "Flavor: " + BuildConfig.FLAVOR + BuildConfig.BUILD_TYPE + "\n";
message += MainApp.gs(R.string.configbuilder_nightscoutversion_label) + " " + ConfigBuilderPlugin.nightscoutVersionName; message += MainApp.gs(R.string.configbuilder_nightscoutversion_label) + " " + NSSettingsStatus.getInstance().nightscoutVersionName;
if (MainApp.engineeringMode) if (MainApp.engineeringMode)
message += "\n" + MainApp.gs(R.string.engineering_mode_enabled); message += "\n" + MainApp.gs(R.string.engineering_mode_enabled);
message += MainApp.gs(R.string.about_link_urls); message += MainApp.gs(R.string.about_link_urls);

View file

@ -2,7 +2,6 @@ package info.nightscout.androidaps.Services;
import android.app.IntentService; import android.app.IntentService;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Telephony; import android.provider.Telephony;
@ -13,18 +12,15 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.db.CareportalEvent; import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.events.EventNsFood; import info.nightscout.androidaps.events.EventNsFood;
import info.nightscout.androidaps.events.EventNsTreatment; import info.nightscout.androidaps.events.EventNsTreatment;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.ConstraintsObjectives.ObjectivesPlugin;
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSDeviceStatus; import info.nightscout.androidaps.plugins.NSClientInternal.data.NSDeviceStatus;
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSMbg; import info.nightscout.androidaps.plugins.NSClientInternal.data.NSMbg;
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSSettingsStatus; import info.nightscout.androidaps.plugins.NSClientInternal.data.NSSettingsStatus;
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin; import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin;
@ -43,7 +39,7 @@ import info.nightscout.utils.SP;
public class DataService extends IntentService { public class DataService extends IntentService {
private static Logger log = LoggerFactory.getLogger(DataService.class); private Logger log = LoggerFactory.getLogger(Constants.DATASERVICE);
public DataService() { public DataService() {
super("DataService"); super("DataService");
@ -52,8 +48,10 @@ public class DataService extends IntentService {
@Override @Override
protected void onHandleIntent(final Intent intent) { protected void onHandleIntent(final Intent intent) {
if (Config.logFunctionCalls) if (Config.logDataService) {
log.debug("onHandleIntent " + intent);
log.debug("onHandleIntent " + BundleLogger.log(intent.getExtras())); log.debug("onHandleIntent " + BundleLogger.log(intent.getExtras()));
}
boolean acceptNSData = !SP.getBoolean(R.string.key_ns_upload_only, false); boolean acceptNSData = !SP.getBoolean(R.string.key_ns_upload_only, false);
Bundle bundles = intent.getExtras(); Bundle bundles = intent.getExtras();
@ -78,15 +76,23 @@ public class DataService extends IntentService {
} else if (Intents.ACTION_NEW_PROFILE.equals(action)) { } else if (Intents.ACTION_NEW_PROFILE.equals(action)) {
// always handle Profile if NSProfile is enabled without looking at nsUploadOnly // always handle Profile if NSProfile is enabled without looking at nsUploadOnly
NSProfilePlugin.getPlugin().handleNewData(intent); NSProfilePlugin.getPlugin().handleNewData(intent);
} else if (Intents.ACTION_NEW_DEVICESTATUS.equals(action)) {
NSDeviceStatus.getInstance().handleNewData(intent);
} else if (Intents.ACTION_NEW_STATUS.equals(action)) {
NSSettingsStatus.getInstance().handleNewData(intent);
} else if (Intents.ACTION_NEW_FOOD.equals(action)) {
EventNsFood evt = new EventNsFood(EventNsFood.ADD, bundles);
MainApp.bus().post(evt);
} else if (Intents.ACTION_CHANGED_FOOD.equals(action)) {
EventNsFood evt = new EventNsFood(EventNsFood.UPDATE, bundles);
MainApp.bus().post(evt);
} else if (Intents.ACTION_REMOVED_FOOD.equals(action)) {
EventNsFood evt = new EventNsFood(EventNsFood.REMOVE, bundles);
MainApp.bus().post(evt);
} else if (acceptNSData && } else if (acceptNSData &&
(Intents.ACTION_NEW_TREATMENT.equals(action) || (Intents.ACTION_NEW_TREATMENT.equals(action) ||
Intents.ACTION_CHANGED_TREATMENT.equals(action) || Intents.ACTION_CHANGED_TREATMENT.equals(action) ||
Intents.ACTION_REMOVED_TREATMENT.equals(action) || Intents.ACTION_REMOVED_TREATMENT.equals(action) ||
Intents.ACTION_NEW_STATUS.equals(action) ||
Intents.ACTION_NEW_DEVICESTATUS.equals(action) ||
Intents.ACTION_NEW_FOOD.equals(action) ||
Intents.ACTION_CHANGED_FOOD.equals(action) ||
Intents.ACTION_REMOVED_FOOD.equals(action) ||
Intents.ACTION_NEW_CAL.equals(action) || Intents.ACTION_NEW_CAL.equals(action) ||
Intents.ACTION_NEW_MBG.equals(action)) Intents.ACTION_NEW_MBG.equals(action))
) { ) {
@ -95,7 +101,7 @@ public class DataService extends IntentService {
SmsCommunicatorPlugin.getPlugin().handleNewData(intent); SmsCommunicatorPlugin.getPlugin().handleNewData(intent);
} }
if (Config.logFunctionCalls) if (Config.logDataService)
log.debug("onHandleIntent exit " + intent); log.debug("onHandleIntent exit " + intent);
DataReceiver.completeWakefulIntent(intent); DataReceiver.completeWakefulIntent(intent);
} }
@ -122,79 +128,6 @@ public class DataService extends IntentService {
log.debug("Got intent: " + intent.getAction()); log.debug("Got intent: " + intent.getAction());
if (intent.getAction().equals(Intents.ACTION_NEW_STATUS)) {
if (bundles.containsKey("nsclientversioncode")) {
ConfigBuilderPlugin.nightscoutVersionCode = bundles.getInt("nightscoutversioncode"); // for ver 1.2.3 contains 10203
ConfigBuilderPlugin.nightscoutVersionName = bundles.getString("nightscoutversionname");
ConfigBuilderPlugin.nsClientVersionCode = bundles.getInt("nsclientversioncode"); // for ver 1.17 contains 117
ConfigBuilderPlugin.nsClientVersionName = bundles.getString("nsclientversionname");
log.debug("Got versions: NSClient: " + ConfigBuilderPlugin.nsClientVersionName + " Nightscout: " + ConfigBuilderPlugin.nightscoutVersionName);
try {
if (ConfigBuilderPlugin.nsClientVersionCode < MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionCode) {
Notification notification = new Notification(Notification.OLD_NSCLIENT, MainApp.gs(R.string.unsupportedclientver), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
} else {
MainApp.bus().post(new EventDismissNotification(Notification.OLD_NSCLIENT));
}
} catch (PackageManager.NameNotFoundException e) {
log.error("Unhandled exception", e);
}
if (ConfigBuilderPlugin.nightscoutVersionCode < Config.SUPPORTEDNSVERSION) {
Notification notification = new Notification(Notification.OLD_NS, MainApp.gs(R.string.unsupportednsversion), Notification.NORMAL);
MainApp.bus().post(new EventNewNotification(notification));
} else {
MainApp.bus().post(new EventDismissNotification(Notification.OLD_NS));
}
} else {
Notification notification = new Notification(Notification.OLD_NSCLIENT, MainApp.gs(R.string.unsupportedclientver), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
}
if (bundles.containsKey("status")) {
try {
JSONObject statusJson = new JSONObject(bundles.getString("status"));
NSSettingsStatus.getInstance().setData(statusJson);
if (Config.logIncommingData)
log.debug("Received status: " + statusJson.toString());
Double targetHigh = NSSettingsStatus.getInstance().getThreshold("bgTargetTop");
Double targetlow = NSSettingsStatus.getInstance().getThreshold("bgTargetBottom");
if (targetHigh != null)
OverviewPlugin.bgTargetHigh = targetHigh;
if (targetlow != null)
OverviewPlugin.bgTargetLow = targetlow;
} catch (JSONException e) {
log.error("Unhandled exception", e);
}
}
}
if (intent.getAction().equals(Intents.ACTION_NEW_DEVICESTATUS)) {
try {
if (bundles.containsKey("devicestatus")) {
JSONObject devicestatusJson = new JSONObject(bundles.getString("devicestatus"));
NSDeviceStatus.getInstance().setData(devicestatusJson);
if (devicestatusJson.has("pump")) {
// Objectives 0
ObjectivesPlugin.pumpStatusIsAvailableInNS = true;
ObjectivesPlugin.saveProgress();
}
}
if (bundles.containsKey("devicestatuses")) {
String devicestatusesstring = bundles.getString("devicestatuses");
JSONArray jsonArray = new JSONArray(devicestatusesstring);
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject devicestatusJson = jsonArray.getJSONObject(i);
NSDeviceStatus.getInstance().setData(devicestatusJson);
if (devicestatusJson.has("pump")) {
// Objectives 0
ObjectivesPlugin.pumpStatusIsAvailableInNS = true;
ObjectivesPlugin.saveProgress();
}
}
}
} catch (Exception e) {
log.error("Unhandled exception", e);
}
}
if (intent.getAction().equals(Intents.ACTION_NEW_TREATMENT) || intent.getAction().equals(Intents.ACTION_CHANGED_TREATMENT)) { if (intent.getAction().equals(Intents.ACTION_NEW_TREATMENT) || intent.getAction().equals(Intents.ACTION_CHANGED_TREATMENT)) {
try { try {
if (bundles.containsKey("treatment")) { if (bundles.containsKey("treatment")) {
@ -219,7 +152,7 @@ public class DataService extends IntentService {
if (bundles.containsKey("treatment")) { if (bundles.containsKey("treatment")) {
String trstring = bundles.getString("treatment"); String trstring = bundles.getString("treatment");
JSONObject json = new JSONObject(trstring); JSONObject json = new JSONObject(trstring);
handleTreatmentFromNS(json); handleRemovedTreatmentFromNS(json);
} }
if (bundles.containsKey("treatments")) { if (bundles.containsKey("treatments")) {
@ -227,7 +160,7 @@ public class DataService extends IntentService {
JSONArray jsonArray = new JSONArray(trstring); JSONArray jsonArray = new JSONArray(trstring);
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
JSONObject json = jsonArray.getJSONObject(i); JSONObject json = jsonArray.getJSONObject(i);
handleTreatmentFromNS(json); handleRemovedTreatmentFromNS(json);
} }
} }
} catch (JSONException e) { } catch (JSONException e) {
@ -255,21 +188,9 @@ public class DataService extends IntentService {
log.error("Unhandled exception", e); log.error("Unhandled exception", e);
} }
} }
if (intent.getAction().equals(Intents.ACTION_NEW_FOOD)
|| intent.getAction().equals(Intents.ACTION_CHANGED_FOOD)) {
int mode = Intents.ACTION_NEW_FOOD.equals(intent.getAction()) ? EventNsFood.ADD : EventNsFood.UPDATE;
EventNsFood evt = new EventNsFood(mode, bundles);
MainApp.bus().post(evt);
} }
if (intent.getAction().equals(Intents.ACTION_REMOVED_FOOD)) { private void handleRemovedTreatmentFromNS(JSONObject json) {
EventNsFood evt = new EventNsFood(EventNsFood.REMOVE, bundles);
MainApp.bus().post(evt);
}
}
private void handleTreatmentFromNS(JSONObject json) {
// new DB model // new DB model
EventNsTreatment evtTreatment = new EventNsTreatment(EventNsTreatment.REMOVE, json); EventNsTreatment evtTreatment = new EventNsTreatment(EventNsTreatment.REMOVE, json);
MainApp.bus().post(evtTreatment); MainApp.bus().post(evtTreatment);

View file

@ -70,15 +70,9 @@ public class ConfigBuilderPlugin extends PluginBase {
private static ProfileInterface activeProfile; private static ProfileInterface activeProfile;
private static TreatmentsInterface activeTreatments; private static TreatmentsInterface activeTreatments;
private static APSInterface activeAPS; private static APSInterface activeAPS;
private static LoopPlugin activeLoop;
private static InsulinInterface activeInsulin; private static InsulinInterface activeInsulin;
private static SensitivityInterface activeSensitivity; private static SensitivityInterface activeSensitivity;
static public String nightscoutVersionName = "";
static public Integer nightscoutVersionCode = 0;
static public String nsClientVersionName = "";
static public Integer nsClientVersionCode = 0;
private static ArrayList<PluginBase> pluginList; private static ArrayList<PluginBase> pluginList;
private static CommandQueue commandQueue = new CommandQueue(); private static CommandQueue commandQueue = new CommandQueue();
@ -337,9 +331,6 @@ public class ConfigBuilderPlugin extends PluginBase {
} }
this.setFragmentVisiblities(((PluginBase) activePump).getName(), pluginsInCategory, PluginType.PUMP); this.setFragmentVisiblities(((PluginBase) activePump).getName(), pluginsInCategory, PluginType.PUMP);
// PluginType.LOOP
activeLoop = this.determineActivePlugin(PluginType.LOOP);
// PluginType.TREATMENT // PluginType.TREATMENT
activeTreatments = this.determineActivePlugin(PluginType.TREATMENT); activeTreatments = this.determineActivePlugin(PluginType.TREATMENT);
} }

View file

@ -27,6 +27,8 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.db.ICallback; import info.nightscout.androidaps.db.ICallback;
@ -39,7 +41,7 @@ import info.nightscout.androidaps.events.EventNsFood;
*/ */
public class FoodService extends OrmLiteBaseService<DatabaseHelper> { public class FoodService extends OrmLiteBaseService<DatabaseHelper> {
private static Logger log = LoggerFactory.getLogger(FoodService.class); private Logger log = LoggerFactory.getLogger(Constants.DATAFOOD);
private static final ScheduledExecutorService foodEventWorker = Executors.newSingleThreadScheduledExecutor(); private static final ScheduledExecutorService foodEventWorker = Executors.newSingleThreadScheduledExecutor();
private static ScheduledFuture<?> scheduledFoodEventPost = null; private static ScheduledFuture<?> scheduledFoodEventPost = null;
@ -110,6 +112,7 @@ public class FoodService extends OrmLiteBaseService<DatabaseHelper> {
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
try { try {
if (Config.logDataFood)
log.info("onCreate"); log.info("onCreate");
TableUtils.createTableIfNotExists(this.getConnectionSource(), Food.class); TableUtils.createTableIfNotExists(this.getConnectionSource(), Food.class);
} catch (SQLException e) { } catch (SQLException e) {
@ -122,6 +125,7 @@ public class FoodService extends OrmLiteBaseService<DatabaseHelper> {
if (oldVersion == 7 && newVersion == 8) { if (oldVersion == 7 && newVersion == 8) {
log.debug("Upgrading database from v7 to v8"); log.debug("Upgrading database from v7 to v8");
} else { } else {
if (Config.logDataFood)
log.info("onUpgrade"); log.info("onUpgrade");
// this.resetFood(); // this.resetFood();
} }
@ -161,6 +165,7 @@ public class FoodService extends OrmLiteBaseService<DatabaseHelper> {
class PostRunnable implements Runnable { class PostRunnable implements Runnable {
public void run() { public void run() {
if (Config.logDataFood)
log.debug("Firing EventFoodChange"); log.debug("Firing EventFoodChange");
MainApp.bus().post(event); MainApp.bus().post(event);
callback.setPost(null); callback.setPost(null);
@ -271,7 +276,8 @@ public class FoodService extends OrmLiteBaseService<DatabaseHelper> {
public void deleteByNSId(String _id) throws SQLException { public void deleteByNSId(String _id) throws SQLException {
Food stored = this.findByNSId(_id); Food stored = this.findByNSId(_id);
if (stored != null) { if (stored != null) {
log.debug("FOOD: Removing Food record from database: " + stored.toString()); if (Config.logDataFood)
log.debug("Removing Food record from database: " + stored.toString());
this.delete(stored); this.delete(stored);
} }
} }
@ -324,7 +330,8 @@ public class FoodService extends OrmLiteBaseService<DatabaseHelper> {
public void createOrUpdate(Food food) { public void createOrUpdate(Food food) {
try { try {
this.getDao().createOrUpdate(food); this.getDao().createOrUpdate(food);
log.debug("FOOD: Created or Updated: " + food.toString()); if (Config.logDataFood)
log.debug("Created or Updated: " + food.toString());
} catch (SQLException e) { } catch (SQLException e) {
log.error("Unable to createOrUpdate Food", e); log.error("Unable to createOrUpdate Food", e);
} }
@ -334,7 +341,8 @@ public class FoodService extends OrmLiteBaseService<DatabaseHelper> {
public void create(Food food) { public void create(Food food) {
try { try {
this.getDao().create(food); this.getDao().create(food);
log.debug("FOOD: New record: " + food.toString()); if (Config.logDataFood)
log.debug("New record: " + food.toString());
} catch (SQLException e) { } catch (SQLException e) {
log.error("Unable to create Food", e); log.error("Unable to create Food", e);
} }

View file

@ -1,8 +1,11 @@
package info.nightscout.androidaps.plugins.NSClientInternal.data; package info.nightscout.androidaps.plugins.NSClientInternal.data;
import android.content.Intent;
import android.os.Bundle;
import android.text.Html; import android.text.Html;
import android.text.Spanned; import android.text.Spanned;
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.Logger;
@ -12,8 +15,12 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.ConstraintsObjectives.ObjectivesPlugin;
import info.nightscout.androidaps.plugins.Loop.APSResult; import info.nightscout.androidaps.plugins.Loop.APSResult;
import info.nightscout.utils.BundleLogger;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.Round; import info.nightscout.utils.Round;
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
@ -73,7 +80,7 @@ import info.nightscout.utils.SP;
} }
*/ */
public class NSDeviceStatus { public class NSDeviceStatus {
private static Logger log = LoggerFactory.getLogger(NSDeviceStatus.class); private Logger log = LoggerFactory.getLogger(Constants.DATANS);
private static NSDeviceStatus instance = null; private static NSDeviceStatus instance = null;
@ -88,6 +95,41 @@ public class NSDeviceStatus {
public NSDeviceStatus() { public NSDeviceStatus() {
} }
public void handleNewData(Intent intent) {
Bundle bundle = intent.getExtras();
if (bundle == null) return;
if (Config.logDataNS)
log.debug("Got NS devicestatus: " + BundleLogger.log(bundle));
try {
if (bundle.containsKey("devicestatus")) {
JSONObject devicestatusJson = new JSONObject(bundle.getString("devicestatus"));
setData(devicestatusJson);
if (devicestatusJson.has("pump")) {
// Objectives 0
ObjectivesPlugin.pumpStatusIsAvailableInNS = true;
ObjectivesPlugin.saveProgress();
}
}
if (bundle.containsKey("devicestatuses")) {
String devicestatusesstring = bundle.getString("devicestatuses");
JSONArray jsonArray = new JSONArray(devicestatusesstring);
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject devicestatusJson = jsonArray.getJSONObject(i);
setData(devicestatusJson);
if (devicestatusJson.has("pump")) {
// Objectives 0
ObjectivesPlugin.pumpStatusIsAvailableInNS = true;
ObjectivesPlugin.saveProgress();
}
}
}
} catch (Exception e) {
log.error("Unhandled exception", e);
}
}
public NSDeviceStatus setData(JSONObject obj) { public NSDeviceStatus setData(JSONObject obj) {
this.data = obj; this.data = obj;
updatePumpData(obj); updatePumpData(obj);

View file

@ -1,5 +1,8 @@
package info.nightscout.androidaps.plugins.NSClientInternal.data; package info.nightscout.androidaps.plugins.NSClientInternal.data;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import org.json.JSONException; import org.json.JSONException;
@ -10,6 +13,16 @@ import org.slf4j.LoggerFactory;
import java.util.Date; import java.util.Date;
import java.util.Objects; import java.util.Objects;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.utils.BundleLogger;
/* /*
{ {
"status": "ok", "status": "ok",
@ -101,7 +114,7 @@ import java.util.Objects;
} }
*/ */
public class NSSettingsStatus { public class NSSettingsStatus {
private static Logger log = LoggerFactory.getLogger(NSSettingsStatus.class); private Logger log = LoggerFactory.getLogger(Constants.DATANS);
private static NSSettingsStatus instance = null; private static NSSettingsStatus instance = null;
@ -111,6 +124,8 @@ public class NSSettingsStatus {
return instance; return instance;
} }
public String nightscoutVersionName = "";
private JSONObject data = null; private JSONObject data = null;
public NSSettingsStatus() { public NSSettingsStatus() {
@ -121,6 +136,59 @@ public class NSSettingsStatus {
return this; return this;
} }
public void handleNewData(Intent intent) {
Bundle bundle = intent.getExtras();
if (bundle == null) return;
if (Config.logDataNS)
log.debug("Got NS status: " + BundleLogger.log(bundle));
if (bundle.containsKey("nsclientversioncode")) {
Integer nightscoutVersionCode = bundle.getInt("nightscoutversioncode");
nightscoutVersionName = bundle.getString("nightscoutversionname");
Integer nsClientVersionCode = bundle.getInt("nsclientversioncode");
String nsClientVersionName = bundle.getString("nsclientversionname");
if (Config.logDataNS)
log.debug("Got versions: NSClient: " + nsClientVersionName + " Nightscout: " + nightscoutVersionName);
try {
if (nsClientVersionCode < MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionCode) {
Notification notification = new Notification(Notification.OLD_NSCLIENT, MainApp.gs(R.string.unsupportedclientver), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
} else {
MainApp.bus().post(new EventDismissNotification(Notification.OLD_NSCLIENT));
}
} catch (PackageManager.NameNotFoundException e) {
log.error("Unhandled exception", e);
}
if (nightscoutVersionCode < Config.SUPPORTEDNSVERSION) {
Notification notification = new Notification(Notification.OLD_NS, MainApp.gs(R.string.unsupportednsversion), Notification.NORMAL);
MainApp.bus().post(new EventNewNotification(notification));
} else {
MainApp.bus().post(new EventDismissNotification(Notification.OLD_NS));
}
} else {
Notification notification = new Notification(Notification.OLD_NSCLIENT, MainApp.gs(R.string.unsupportedclientver), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
}
if (bundle.containsKey("status")) {
try {
JSONObject statusJson = new JSONObject(bundle.getString("status"));
setData(statusJson);
if (Config.logDataNS)
log.debug("Received status: " + statusJson.toString());
Double targetHigh = getThreshold("bgTargetTop");
Double targetlow = getThreshold("bgTargetBottom");
if (targetHigh != null)
OverviewPlugin.bgTargetHigh = targetHigh;
if (targetlow != null)
OverviewPlugin.bgTargetLow = targetlow;
} catch (JSONException e) {
log.error("Unhandled exception", e);
}
}
}
public String getName() { public String getName() {
return getStringOrNull("name"); return getStringOrNull("name");
} }
@ -134,7 +202,7 @@ public class NSSettingsStatus {
} }
public Date getServerTime() { public Date getServerTime() {
return getDateOrNull("versionNum"); return getDateOrNull("serverTime");
} }
public boolean getApiEnabled() { public boolean getApiEnabled() {
@ -202,13 +270,11 @@ public class NSSettingsStatus {
if (settingsO.has("thresholds")) { if (settingsO.has("thresholds")) {
JSONObject tObject = settingsO.getJSONObject("thresholds"); JSONObject tObject = settingsO.getJSONObject("thresholds");
if (tObject.has(what)) { if (tObject.has(what)) {
Double result = tObject.getDouble(what); return tObject.getDouble(what);
return result;
} }
} }
if (settingsO.has("alarmTimeagoWarnMins") && Objects.equals(what, "alarmTimeagoWarnMins")) { if (settingsO.has("alarmTimeagoWarnMins") && Objects.equals(what, "alarmTimeagoWarnMins")) {
Double result = settingsO.getDouble(what); return settingsO.getDouble(what);
return result;
} }
} }
} catch (JSONException e) { } catch (JSONException e) {

View file

@ -29,8 +29,6 @@ import info.nightscout.utils.JsonHelper;
@DatabaseTable(tableName = Treatment.TABLE_TREATMENTS) @DatabaseTable(tableName = Treatment.TABLE_TREATMENTS)
public class Treatment implements DataPointWithLabelInterface { public class Treatment implements DataPointWithLabelInterface {
private static Logger log = LoggerFactory.getLogger(Treatment.class);
public static final String TABLE_TREATMENTS = "Treatments"; public static final String TABLE_TREATMENTS = "Treatments";
@DatabaseField(id = true) @DatabaseField(id = true)

View file

@ -29,6 +29,8 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.db.ICallback; import info.nightscout.androidaps.db.ICallback;
@ -46,7 +48,7 @@ import info.nightscout.utils.JsonHelper;
*/ */
public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> { public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
private static Logger log = LoggerFactory.getLogger(TreatmentService.class); private static Logger log = LoggerFactory.getLogger(Constants.DATATREATMENTS);
private static final ScheduledExecutorService treatmentEventWorker = Executors.newSingleThreadScheduledExecutor(); private static final ScheduledExecutorService treatmentEventWorker = Executors.newSingleThreadScheduledExecutor();
private static ScheduledFuture<?> scheduledTreatmentEventPost = null; private static ScheduledFuture<?> scheduledTreatmentEventPost = null;
@ -102,6 +104,7 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
try { try {
if (Config.logDataTreatments)
log.info("onCreate"); log.info("onCreate");
TableUtils.createTableIfNotExists(this.getConnectionSource(), Treatment.class); TableUtils.createTableIfNotExists(this.getConnectionSource(), Treatment.class);
} catch (SQLException e) { } catch (SQLException e) {
@ -121,6 +124,7 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} else { } else {
if (Config.logDataTreatments)
log.info("onUpgrade"); log.info("onUpgrade");
// this.resetFood(); // this.resetFood();
} }
@ -161,10 +165,14 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
class PostRunnable implements Runnable { class PostRunnable implements Runnable {
public void run() { public void run() {
log.debug("Firing EventFoodChange"); if (Config.logDataTreatments)
log.debug("Firing EventReloadTreatmentData");
MainApp.bus().post(event); MainApp.bus().post(event);
if (DatabaseHelper.earliestDataChange != null) if (DatabaseHelper.earliestDataChange != null) {
if (Config.logDataTreatments)
log.debug("Firing EventNewHistoryData");
MainApp.bus().post(new EventNewHistoryData(DatabaseHelper.earliestDataChange)); MainApp.bus().post(new EventNewHistoryData(DatabaseHelper.earliestDataChange));
}
DatabaseHelper.earliestDataChange = null; DatabaseHelper.earliestDataChange = null;
callback.setPost(null); callback.setPost(null);
} }
@ -252,13 +260,14 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
if (existingTreatment != null) { if (existingTreatment != null) {
boolean equalRePumpHistory = existingTreatment.equalsRePumpHistory(treatment); boolean equalRePumpHistory = existingTreatment.equalsRePumpHistory(treatment);
boolean sameSource = existingTreatment.source == treatment.source; boolean sameSource = existingTreatment.source == treatment.source;
if(!equalRePumpHistory) { if (!equalRePumpHistory) {
// another treatment exists. Update it with the treatment coming from the pump // another treatment exists. Update it with the treatment coming from the pump
log.debug("TREATMENT: Pump record already found in database: " + existingTreatment.toString() + " wanting to add " + treatment.toString()); if (Config.logDataTreatments)
log.debug("Pump record already found in database: " + existingTreatment.toString() + " wanting to add " + treatment.toString());
long oldDate = existingTreatment.date; long oldDate = existingTreatment.date;
//preserve carbs //preserve carbs
if(existingTreatment.isValid && existingTreatment.carbs > 0 && treatment.carbs == 0){ if (existingTreatment.isValid && existingTreatment.carbs > 0 && treatment.carbs == 0) {
treatment.carbs = existingTreatment.carbs; treatment.carbs = existingTreatment.carbs;
} }
@ -278,10 +287,11 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
boolean equalRePumpHistory = existingTreatment.equalsRePumpHistory(treatment); boolean equalRePumpHistory = existingTreatment.equalsRePumpHistory(treatment);
boolean sameSource = existingTreatment.source == treatment.source; boolean sameSource = existingTreatment.source == treatment.source;
long oldDate = existingTreatment.date; long oldDate = existingTreatment.date;
log.debug("TREATMENT: Pump record already found in database: " + existingTreatment.toString() + " wanting to add " + treatment.toString()); if (Config.logDataTreatments)
log.debug("Pump record already found in database: " + existingTreatment.toString() + " wanting to add " + treatment.toString());
//preserve carbs //preserve carbs
if(existingTreatment.isValid && existingTreatment.carbs > 0 && treatment.carbs == 0){ if (existingTreatment.isValid && existingTreatment.carbs > 0 && treatment.carbs == 0) {
treatment.carbs = existingTreatment.carbs; treatment.carbs = existingTreatment.carbs;
} }
@ -294,7 +304,8 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
return new UpdateReturn(equalRePumpHistory || sameSource, false); return new UpdateReturn(equalRePumpHistory || sameSource, false);
} }
getDao().create(treatment); getDao().create(treatment);
log.debug("TREATMENT: New record from: " + Source.getString(treatment.source) + " " + treatment.toString()); if (Config.logDataTreatments)
log.debug("New record from: " + Source.getString(treatment.source) + " " + treatment.toString());
DatabaseHelper.updateEarliestDataChange(treatment.date); DatabaseHelper.updateEarliestDataChange(treatment.date);
scheduleTreatmentChange(treatment); scheduleTreatmentChange(treatment);
return new UpdateReturn(true, true); return new UpdateReturn(true, true);
@ -308,7 +319,8 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
getDao().delete(old); // need to delete/create because date may change too getDao().delete(old); // need to delete/create because date may change too
old.copyFrom(treatment); old.copyFrom(treatment);
getDao().create(old); getDao().create(old);
log.debug("TREATMENT: Updating record by date from: " + Source.getString(treatment.source) + " " + old.toString()); if (Config.logDataTreatments)
log.debug("Updating record by date from: " + Source.getString(treatment.source) + " " + old.toString());
if (historyChange) { if (historyChange) {
DatabaseHelper.updateEarliestDataChange(oldDate); DatabaseHelper.updateEarliestDataChange(oldDate);
DatabaseHelper.updateEarliestDataChange(old.date); DatabaseHelper.updateEarliestDataChange(old.date);
@ -328,7 +340,8 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
getDao().delete(old); // need to delete/create because date may change too getDao().delete(old); // need to delete/create because date may change too
old.copyFrom(treatment); old.copyFrom(treatment);
getDao().create(old); getDao().create(old);
log.debug("TREATMENT: Updating record by _id from: " + Source.getString(treatment.source) + " " + old.toString()); if (Config.logDataTreatments)
log.debug("Updating record by _id from: " + Source.getString(treatment.source) + " " + old.toString());
if (historyChange) { if (historyChange) {
DatabaseHelper.updateEarliestDataChange(oldDate); DatabaseHelper.updateEarliestDataChange(oldDate);
DatabaseHelper.updateEarliestDataChange(old.date); DatabaseHelper.updateEarliestDataChange(old.date);
@ -339,14 +352,16 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
} }
} }
getDao().create(treatment); getDao().create(treatment);
log.debug("TREATMENT: New record from: " + Source.getString(treatment.source) + " " + treatment.toString()); if (Config.logDataTreatments)
log.debug("New record from: " + Source.getString(treatment.source) + " " + treatment.toString());
DatabaseHelper.updateEarliestDataChange(treatment.date); DatabaseHelper.updateEarliestDataChange(treatment.date);
scheduleTreatmentChange(treatment); scheduleTreatmentChange(treatment);
return new UpdateReturn(true, true); return new UpdateReturn(true, true);
} }
if (treatment.source == Source.USER) { if (treatment.source == Source.USER) {
getDao().create(treatment); getDao().create(treatment);
log.debug("TREATMENT: New record from: " + Source.getString(treatment.source) + " " + treatment.toString()); if (Config.logDataTreatments)
log.debug("New record from: " + Source.getString(treatment.source) + " " + treatment.toString());
DatabaseHelper.updateEarliestDataChange(treatment.date); DatabaseHelper.updateEarliestDataChange(treatment.date);
scheduleTreatmentChange(treatment); scheduleTreatmentChange(treatment);
return new UpdateReturn(true, true); return new UpdateReturn(true, true);
@ -357,8 +372,10 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
return new UpdateReturn(false, false); return new UpdateReturn(false, false);
} }
/** Returns the record for the given id, null if none, throws RuntimeException /**
* if multiple records with the same pump id exist. */ * Returns the record for the given id, null if none, throws RuntimeException
* if multiple records with the same pump id exist.
*/
@Nullable @Nullable
public Treatment getPumpRecordById(long pumpId) { public Treatment getPumpRecordById(long pumpId) {
try { try {
@ -368,9 +385,12 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
PreparedQuery<Treatment> preparedQuery = queryBuilder.prepare(); PreparedQuery<Treatment> preparedQuery = queryBuilder.prepare();
List<Treatment> result = getDao().query(preparedQuery); List<Treatment> result = getDao().query(preparedQuery);
switch (result.size()) { switch (result.size()) {
case 0: return null; case 0:
case 1: return result.get(0); return null;
default: throw new RuntimeException("Multiple records with the same pump id found: " + result.toString()); case 1:
return result.get(0);
default:
throw new RuntimeException("Multiple records with the same pump id found: " + result.toString());
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@ -393,7 +413,8 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
private void deleteByNSId(String _id) { private void deleteByNSId(String _id) {
Treatment stored = findByNSId(_id); Treatment stored = findByNSId(_id);
if (stored != null) { if (stored != null) {
log.debug("TREATMENT: Removing Treatment record from database: " + stored.toString()); if (Config.logDataTreatments)
log.debug("Removing Treatment record from database: " + stored.toString());
delete(stored); delete(stored);
DatabaseHelper.updateEarliestDataChange(stored.date); DatabaseHelper.updateEarliestDataChange(stored.date);
scheduleTreatmentChange(null); scheduleTreatmentChange(null);
@ -480,10 +501,11 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
} }
public class UpdateReturn { public class UpdateReturn {
public UpdateReturn(boolean success, boolean newRecord){ public UpdateReturn(boolean success, boolean newRecord) {
this.success = success; this.success = success;
this.newRecord = newRecord; this.newRecord = newRecord;
} }
boolean newRecord; boolean newRecord;
boolean success; boolean success;
} }

View file

@ -27,8 +27,6 @@ import info.nightscout.androidaps.plugins.Treatments.fragments.TreatmentsTempora
import info.nightscout.utils.FabricPrivacy; import info.nightscout.utils.FabricPrivacy;
public class TreatmentsFragment extends SubscriberFragment implements View.OnClickListener { public class TreatmentsFragment extends SubscriberFragment implements View.OnClickListener {
private static Logger log = LoggerFactory.getLogger(TreatmentsFragment.class);
TextView treatmentsTab; TextView treatmentsTab;
TextView extendedBolusesTab; TextView extendedBolusesTab;
TextView tempBasalsTab; TextView tempBasalsTab;

View file

@ -13,6 +13,7 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
@ -55,7 +56,7 @@ import info.nightscout.utils.T;
* Created by mike on 05.08.2016. * Created by mike on 05.08.2016.
*/ */
public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface { public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface {
private static Logger log = LoggerFactory.getLogger(TreatmentsPlugin.class); private Logger log = LoggerFactory.getLogger(Constants.DATATREATMENTS);
private static TreatmentsPlugin treatmentsPlugin; private static TreatmentsPlugin treatmentsPlugin;
@ -109,6 +110,8 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
} }
private void initializeTreatmentData() { private void initializeTreatmentData() {
if (Config.logDataTreatments)
log.debug("initializeTreatmentData");
double dia = Constants.defaultDIA; double dia = Constants.defaultDIA;
if (MainApp.getConfigBuilder() != null && MainApp.getConfigBuilder().getProfile() != null) if (MainApp.getConfigBuilder() != null && MainApp.getConfigBuilder().getProfile() != null)
dia = MainApp.getConfigBuilder().getProfile().getDia(); dia = MainApp.getConfigBuilder().getProfile().getDia();
@ -120,6 +123,8 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
} }
private void initializeTempBasalData() { private void initializeTempBasalData() {
if (Config.logDataTreatments)
log.debug("initializeTempBasalData");
double dia = Constants.defaultDIA; double dia = Constants.defaultDIA;
if (MainApp.getConfigBuilder() != null && MainApp.getConfigBuilder().getProfile() != null) if (MainApp.getConfigBuilder() != null && MainApp.getConfigBuilder().getProfile() != null)
dia = MainApp.getConfigBuilder().getProfile().getDia(); dia = MainApp.getConfigBuilder().getProfile().getDia();
@ -132,6 +137,8 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
} }
private void initializeExtendedBolusData() { private void initializeExtendedBolusData() {
if (Config.logDataTreatments)
log.debug("initializeExtendedBolusData");
double dia = Constants.defaultDIA; double dia = Constants.defaultDIA;
if (MainApp.getConfigBuilder() != null && MainApp.getConfigBuilder().getProfile() != null) if (MainApp.getConfigBuilder() != null && MainApp.getConfigBuilder().getProfile() != null)
dia = MainApp.getConfigBuilder().getProfile().getDia(); dia = MainApp.getConfigBuilder().getProfile().getDia();
@ -144,6 +151,8 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
} }
private void initializeTempTargetData() { private void initializeTempTargetData() {
if (Config.logDataTreatments)
log.debug("initializeTempTargetData");
synchronized (tempTargets) { synchronized (tempTargets) {
long fromMills = System.currentTimeMillis() - 60 * 60 * 1000L * 24; long fromMills = System.currentTimeMillis() - 60 * 60 * 1000L * 24;
tempTargets.reset().add(MainApp.getDbHelper().getTemptargetsDataFromTime(fromMills, false)); tempTargets.reset().add(MainApp.getDbHelper().getTemptargetsDataFromTime(fromMills, false));
@ -151,6 +160,8 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
} }
private void initializeProfileSwitchData() { private void initializeProfileSwitchData() {
if (Config.logDataTreatments)
log.debug("initializeProfileSwitchData");
synchronized (profiles) { synchronized (profiles) {
profiles.reset().add(MainApp.getDbHelper().getProfileSwitchData(false)); profiles.reset().add(MainApp.getDbHelper().getProfileSwitchData(false));
} }
@ -294,6 +305,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
last = t.date; last = t.date;
} }
} }
if (Config.logDataTreatments)
log.debug("Last bolus time: " + new Date(last).toLocaleString()); log.debug("Last bolus time: " + new Date(last).toLocaleString());
return last; return last;
} }
@ -322,6 +334,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
@Subscribe @Subscribe
public void onStatusEvent(final EventReloadTreatmentData ev) { public void onStatusEvent(final EventReloadTreatmentData ev) {
if (Config.logDataTreatments)
log.debug("EventReloadTreatmentData"); log.debug("EventReloadTreatmentData");
initializeTreatmentData(); initializeTreatmentData();
initializeExtendedBolusData(); initializeExtendedBolusData();
@ -332,6 +345,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
@Subscribe @Subscribe
@SuppressWarnings("unused") @SuppressWarnings("unused")
public void onStatusEvent(final EventReloadTempBasalData ev) { public void onStatusEvent(final EventReloadTempBasalData ev) {
if (Config.logDataTreatments)
log.debug("EventReloadTempBasalData"); log.debug("EventReloadTempBasalData");
initializeTempBasalData(); initializeTempBasalData();
updateTotalIOBTempBasals(); updateTotalIOBTempBasals();

View file

@ -31,8 +31,6 @@ public class ProfileViewerDialog extends DialogFragment {
private long time; private long time;
private static Logger log = LoggerFactory.getLogger(ProfileViewDialog.class);
@BindView(R.id.profileview_noprofile) @BindView(R.id.profileview_noprofile)
TextView noProfile; TextView noProfile;
@BindView(R.id.profileview_invalidprofile) @BindView(R.id.profileview_invalidprofile)

View file

@ -46,8 +46,6 @@ import info.nightscout.utils.SP;
import static info.nightscout.utils.DateUtil.now; import static info.nightscout.utils.DateUtil.now;
public class TreatmentsBolusFragment extends SubscriberFragment implements View.OnClickListener { public class TreatmentsBolusFragment extends SubscriberFragment implements View.OnClickListener {
private static Logger log = LoggerFactory.getLogger(TreatmentsBolusFragment.class);
RecyclerView recyclerView; RecyclerView recyclerView;
LinearLayoutManager llm; LinearLayoutManager llm;

View file

@ -39,8 +39,6 @@ import info.nightscout.utils.NSUpload;
public class TreatmentsExtendedBolusesFragment extends SubscriberFragment { public class TreatmentsExtendedBolusesFragment extends SubscriberFragment {
private static Logger log = LoggerFactory.getLogger(TreatmentsExtendedBolusesFragment.class);
RecyclerView recyclerView; RecyclerView recyclerView;
LinearLayoutManager llm; LinearLayoutManager llm;