L.class
This commit is contained in:
parent
ce9e5b9165
commit
54c83dc374
243 changed files with 1406 additions and 1544 deletions
|
@ -10,8 +10,8 @@ import java.util.HashSet;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.events.Event;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/** Logs events has they're being posted to and dispatched from the event bus.
|
||||
*
|
||||
|
@ -19,7 +19,7 @@ import info.nightscout.androidaps.events.Event;
|
|||
* after 10s (after startup) and then again every 60s.
|
||||
* */
|
||||
public class LoggingBus extends Bus {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.EVENTS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.EVENTS);
|
||||
|
||||
private static long everyMinute = System.currentTimeMillis() + 10 * 1000;
|
||||
private Map<String, Set<String>> event2Receiver = new HashMap<>();
|
||||
|
|
|
@ -27,22 +27,5 @@ public class Config {
|
|||
public static boolean logPrefsChange = true;
|
||||
public static boolean logConfigBuilder = true;
|
||||
public static boolean logCongigBuilderActions = true;
|
||||
public static boolean logAutosensData = false;
|
||||
public static boolean logEvents = false;
|
||||
public static boolean logQueue = true;
|
||||
public static boolean logBgSource = true;
|
||||
public static boolean logOverview = true;
|
||||
public static boolean logNotification = true;
|
||||
public static boolean logAlarm = false;
|
||||
public static boolean logDataService = true;
|
||||
public static boolean logDataFood = true;
|
||||
public static boolean logDataTreatments = true;
|
||||
public static boolean logDatabase = true;
|
||||
public static boolean logNsclient = true;
|
||||
public static boolean logObjectives = false;
|
||||
public static boolean logPump = true;
|
||||
public static boolean logPumpComm = true;
|
||||
public static boolean logPumpBtComm = false;
|
||||
public static boolean logAps = true;
|
||||
|
||||
}
|
||||
|
|
|
@ -68,21 +68,4 @@ public class Constants {
|
|||
//SMS Communicator
|
||||
public static final long SMS_CONFIRM_TIMEOUT = T.mins(5).msecs();
|
||||
|
||||
// logging
|
||||
public static final String AUTOSENS = "AUTOSENS";
|
||||
public static final String EVENTS = "EVENTS";
|
||||
public static final String BGSOURCE = "BGSOURCE";
|
||||
public static final String OVERVIEW = "OVERVIEW";
|
||||
public static final String NOTIFICATION = "NOTIFICATION";
|
||||
public static final String ALARM = "ALARM";
|
||||
public static final String DATASERVICE = "DATASERVICE";
|
||||
public static final String DATAFOOD = "DATAFOOD";
|
||||
public static final String DATATREATMENTS = "DATATREATMENTS";
|
||||
public static final String NSCLIENT = "NSCLIENT";
|
||||
public static final String OBJECTIVES = "OBJECTIVES";
|
||||
public static final String PUMP = "PUMP";
|
||||
public static final String PUMPQUEUE = "PUMPQUEUE";
|
||||
public static final String PUMPCOMM = "PUMPCOMM";
|
||||
public static final String PUMPBTCOMM = "PUMPBTCOMM";
|
||||
public static final String APS = "APS";
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.io.File;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import ch.qos.logback.classic.LoggerContext;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.services.Intents;
|
||||
import info.nightscout.androidaps.data.ConstraintChecker;
|
||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||
|
@ -132,7 +133,7 @@ public class MainApp extends Application {
|
|||
engineeringMode = engineeringModeSemaphore.exists() && engineeringModeSemaphore.isFile();
|
||||
devBranch = BuildConfig.VERSION.contains("dev");
|
||||
|
||||
sBus = Config.logEvents ? new LoggingBus(ThreadEnforcer.ANY) : new Bus(ThreadEnforcer.ANY);
|
||||
sBus = L.isEnabled(L.EVENTS) ? new LoggingBus(ThreadEnforcer.ANY) : new Bus(ThreadEnforcer.ANY);
|
||||
|
||||
registerLocalBroadcastReceiver();
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.util.concurrent.ScheduledExecutorService;
|
|||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.data.OverlappingIntervals;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
|
@ -42,12 +41,13 @@ import info.nightscout.androidaps.events.EventReloadTempBasalData;
|
|||
import info.nightscout.androidaps.events.EventReloadTreatmentData;
|
||||
import info.nightscout.androidaps.events.EventTempBasalChange;
|
||||
import info.nightscout.androidaps.events.EventTempTargetChange;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventNewHistoryData;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSUpload;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRNSHistorySync;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes;
|
||||
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
|
||||
import info.nightscout.utils.JsonHelper;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSUpload;
|
||||
import info.nightscout.utils.PercentageSplitter;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
|
@ -60,7 +60,7 @@ import info.nightscout.utils.ToastUtils;
|
|||
* direct calls to the corresponding methods (eg. resetDatabases) should be done by a central service.
|
||||
*/
|
||||
public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||
private static Logger log = LoggerFactory.getLogger(DatabaseHelper.class);
|
||||
private static Logger log = LoggerFactory.getLogger(L.DATABASE);
|
||||
|
||||
public static final String DATABASE_NAME = "AndroidAPSDb";
|
||||
public static final String DATABASE_BGREADINGS = "BgReadings";
|
||||
|
@ -107,7 +107,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
@Override
|
||||
public void onCreate(SQLiteDatabase database, ConnectionSource connectionSource) {
|
||||
try {
|
||||
log.info("onCreate");
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.info("onCreate");
|
||||
TableUtils.createTableIfNotExists(connectionSource, TempTarget.class);
|
||||
TableUtils.createTableIfNotExists(connectionSource, BgReading.class);
|
||||
TableUtils.createTableIfNotExists(connectionSource, DanaRHistoryRecord.class);
|
||||
|
@ -325,15 +326,18 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
BgReading old = getDaoBgReadings().queryForId(bgReading.date);
|
||||
if (old == null) {
|
||||
getDaoBgReadings().create(bgReading);
|
||||
log.debug("BG: New record from: " + from + " " + bgReading.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("BG: New record from: " + from + " " + bgReading.toString());
|
||||
scheduleBgChange(bgReading);
|
||||
return true;
|
||||
}
|
||||
if (!old.isEqual(bgReading)) {
|
||||
log.debug("BG: Similiar found: " + old.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("BG: Similiar found: " + old.toString());
|
||||
old.copyFrom(bgReading);
|
||||
getDaoBgReadings().update(old);
|
||||
log.debug("BG: Updating record from: " + from + " New data: " + old.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("BG: Updating record from: " + from + " New data: " + old.toString());
|
||||
scheduleBgChange(bgReading);
|
||||
return false;
|
||||
}
|
||||
|
@ -355,7 +359,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
private static void scheduleBgChange(@Nullable final BgReading bgReading) {
|
||||
class PostRunnable implements Runnable {
|
||||
public void run() {
|
||||
log.debug("Firing EventNewBg");
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("Firing EventNewBg");
|
||||
MainApp.bus().post(new EventNewBG(bgReading));
|
||||
scheduledBgPost = null;
|
||||
}
|
||||
|
@ -387,7 +392,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
bgList = daoBgReadings.query(preparedQuery);
|
||||
|
||||
} catch (SQLException e) {
|
||||
log.debug(e.getMessage(), e);
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
if (bgList != null && bgList.size() > 0)
|
||||
return bgList.get(0);
|
||||
|
@ -595,7 +600,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
getDaoTempTargets().delete(old); // need to delete/create because date may change too
|
||||
old.copyFrom(tempTarget);
|
||||
getDaoTempTargets().create(old);
|
||||
log.debug("TEMPTARGET: Updating record by date from: " + Source.getString(tempTarget.source) + " " + old.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("TEMPTARGET: Updating record by date from: " + Source.getString(tempTarget.source) + " " + old.toString());
|
||||
scheduleTemporaryTargetChange();
|
||||
return true;
|
||||
}
|
||||
|
@ -614,20 +620,23 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
getDaoTempTargets().delete(old); // need to delete/create because date may change too
|
||||
old.copyFrom(tempTarget);
|
||||
getDaoTempTargets().create(old);
|
||||
log.debug("TEMPTARGET: Updating record by _id from: " + Source.getString(tempTarget.source) + " " + old.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("TEMPTARGET: Updating record by _id from: " + Source.getString(tempTarget.source) + " " + old.toString());
|
||||
scheduleTemporaryTargetChange();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
getDaoTempTargets().create(tempTarget);
|
||||
log.debug("TEMPTARGET: New record from: " + Source.getString(tempTarget.source) + " " + tempTarget.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("TEMPTARGET: New record from: " + Source.getString(tempTarget.source) + " " + tempTarget.toString());
|
||||
scheduleTemporaryTargetChange();
|
||||
return true;
|
||||
}
|
||||
if (tempTarget.source == Source.USER) {
|
||||
getDaoTempTargets().create(tempTarget);
|
||||
log.debug("TEMPTARGET: New record from: " + Source.getString(tempTarget.source) + " " + tempTarget.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("TEMPTARGET: New record from: " + Source.getString(tempTarget.source) + " " + tempTarget.toString());
|
||||
scheduleTemporaryTargetChange();
|
||||
return true;
|
||||
}
|
||||
|
@ -649,7 +658,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
private static void scheduleTemporaryTargetChange() {
|
||||
class PostRunnable implements Runnable {
|
||||
public void run() {
|
||||
log.debug("Firing EventTempTargetChange");
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("Firing EventTempTargetChange");
|
||||
MainApp.bus().post(new EventTempTargetChange());
|
||||
scheduledTemTargetPost = null;
|
||||
}
|
||||
|
@ -769,7 +779,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
} else if (list.size() == 1) {
|
||||
DanaRHistoryRecord record = list.get(0);
|
||||
if (record._id == null || !record._id.equals(trJson.getString("_id"))) {
|
||||
if (Config.logDatabase)
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("Updating _id in DanaR history database: " + trJson.getString("_id"));
|
||||
record._id = trJson.getString("_id");
|
||||
getDaoDanaRHistory().update(record);
|
||||
|
@ -799,11 +809,13 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
List<TemporaryBasal> trList = getDaoTemporaryBasal().query(preparedQuery);
|
||||
if (trList.size() > 0) {
|
||||
// do nothing, pump history record cannot be changed
|
||||
log.debug("TEMPBASAL: Already exists from: " + Source.getString(tempBasal.source) + " " + tempBasal.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("TEMPBASAL: Already exists from: " + Source.getString(tempBasal.source) + " " + tempBasal.toString());
|
||||
return false;
|
||||
}
|
||||
getDaoTemporaryBasal().create(tempBasal);
|
||||
log.debug("TEMPBASAL: New record from: " + Source.getString(tempBasal.source) + " " + tempBasal.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("TEMPBASAL: New record from: " + Source.getString(tempBasal.source) + " " + tempBasal.toString());
|
||||
updateEarliestDataChange(tempBasal.date);
|
||||
scheduleTemporaryBasalChange();
|
||||
return true;
|
||||
|
@ -820,7 +832,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
getDaoTemporaryBasal().delete(old); // need to delete/create because date may change too
|
||||
old.copyFrom(tempBasal);
|
||||
getDaoTemporaryBasal().create(old);
|
||||
log.debug("TEMPBASAL: Updating record by date from: " + Source.getString(tempBasal.source) + " " + old.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("TEMPBASAL: Updating record by date from: " + Source.getString(tempBasal.source) + " " + old.toString());
|
||||
updateEarliestDataChange(oldDate);
|
||||
updateEarliestDataChange(old.date);
|
||||
scheduleTemporaryBasalChange();
|
||||
|
@ -842,7 +855,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
getDaoTemporaryBasal().delete(old); // need to delete/create because date may change too
|
||||
old.copyFrom(tempBasal);
|
||||
getDaoTemporaryBasal().create(old);
|
||||
log.debug("TEMPBASAL: Updating record by _id from: " + Source.getString(tempBasal.source) + " " + old.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("TEMPBASAL: Updating record by _id from: " + Source.getString(tempBasal.source) + " " + old.toString());
|
||||
updateEarliestDataChange(oldDate);
|
||||
updateEarliestDataChange(old.date);
|
||||
scheduleTemporaryBasalChange();
|
||||
|
@ -851,14 +865,16 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
}
|
||||
}
|
||||
getDaoTemporaryBasal().create(tempBasal);
|
||||
log.debug("TEMPBASAL: New record from: " + Source.getString(tempBasal.source) + " " + tempBasal.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("TEMPBASAL: New record from: " + Source.getString(tempBasal.source) + " " + tempBasal.toString());
|
||||
updateEarliestDataChange(tempBasal.date);
|
||||
scheduleTemporaryBasalChange();
|
||||
return true;
|
||||
}
|
||||
if (tempBasal.source == Source.USER) {
|
||||
getDaoTemporaryBasal().create(tempBasal);
|
||||
log.debug("TEMPBASAL: New record from: " + Source.getString(tempBasal.source) + " " + tempBasal.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("TEMPBASAL: New record from: " + Source.getString(tempBasal.source) + " " + tempBasal.toString());
|
||||
updateEarliestDataChange(tempBasal.date);
|
||||
scheduleTemporaryBasalChange();
|
||||
return true;
|
||||
|
@ -898,7 +914,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
private static void scheduleTemporaryBasalChange() {
|
||||
class PostRunnable implements Runnable {
|
||||
public void run() {
|
||||
log.debug("Firing EventTempBasalChange");
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("Firing EventTempBasalChange");
|
||||
MainApp.bus().post(new EventReloadTempBasalData());
|
||||
MainApp.bus().post(new EventTempBasalChange());
|
||||
if (earliestDataChange != null)
|
||||
|
@ -990,7 +1007,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
public void deleteTempBasalById(String _id) {
|
||||
TemporaryBasal stored = findTempBasalById(_id);
|
||||
if (stored != null) {
|
||||
log.debug("TEMPBASAL: Removing TempBasal record from database: " + stored.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("TEMPBASAL: Removing TempBasal record from database: " + stored.toString());
|
||||
delete(stored);
|
||||
updateEarliestDataChange(stored.date);
|
||||
scheduleTemporaryBasalChange();
|
||||
|
@ -1036,7 +1054,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
return false;
|
||||
}
|
||||
getDaoExtendedBolus().create(extendedBolus);
|
||||
log.debug("EXTENDEDBOLUS: New record from: " + Source.getString(extendedBolus.source) + " " + extendedBolus.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("EXTENDEDBOLUS: New record from: " + Source.getString(extendedBolus.source) + " " + extendedBolus.toString());
|
||||
updateEarliestDataChange(extendedBolus.date);
|
||||
scheduleExtendedBolusChange();
|
||||
return true;
|
||||
|
@ -1049,7 +1068,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
getDaoExtendedBolus().delete(old); // need to delete/create because date may change too
|
||||
old.copyFrom(extendedBolus);
|
||||
getDaoExtendedBolus().create(old);
|
||||
log.debug("EXTENDEDBOLUS: Updating record by date from: " + Source.getString(extendedBolus.source) + " " + old.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("EXTENDEDBOLUS: Updating record by date from: " + Source.getString(extendedBolus.source) + " " + old.toString());
|
||||
updateEarliestDataChange(oldDate);
|
||||
updateEarliestDataChange(old.date);
|
||||
scheduleExtendedBolusChange();
|
||||
|
@ -1071,7 +1091,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
getDaoExtendedBolus().delete(old); // need to delete/create because date may change too
|
||||
old.copyFrom(extendedBolus);
|
||||
getDaoExtendedBolus().create(old);
|
||||
log.debug("EXTENDEDBOLUS: Updating record by _id from: " + Source.getString(extendedBolus.source) + " " + old.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("EXTENDEDBOLUS: Updating record by _id from: " + Source.getString(extendedBolus.source) + " " + old.toString());
|
||||
updateEarliestDataChange(oldDate);
|
||||
updateEarliestDataChange(old.date);
|
||||
scheduleExtendedBolusChange();
|
||||
|
@ -1080,14 +1101,16 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
}
|
||||
}
|
||||
getDaoExtendedBolus().create(extendedBolus);
|
||||
log.debug("EXTENDEDBOLUS: New record from: " + Source.getString(extendedBolus.source) + " " + extendedBolus.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("EXTENDEDBOLUS: New record from: " + Source.getString(extendedBolus.source) + " " + extendedBolus.toString());
|
||||
updateEarliestDataChange(extendedBolus.date);
|
||||
scheduleExtendedBolusChange();
|
||||
return true;
|
||||
}
|
||||
if (extendedBolus.source == Source.USER) {
|
||||
getDaoExtendedBolus().create(extendedBolus);
|
||||
log.debug("EXTENDEDBOLUS: New record from: " + Source.getString(extendedBolus.source) + " " + extendedBolus.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("EXTENDEDBOLUS: New record from: " + Source.getString(extendedBolus.source) + " " + extendedBolus.toString());
|
||||
updateEarliestDataChange(extendedBolus.date);
|
||||
scheduleExtendedBolusChange();
|
||||
return true;
|
||||
|
@ -1127,7 +1150,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
public void deleteExtendedBolusById(String _id) {
|
||||
ExtendedBolus stored = findExtendedBolusById(_id);
|
||||
if (stored != null) {
|
||||
log.debug("EXTENDEDBOLUS: Removing ExtendedBolus record from database: " + stored.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("EXTENDEDBOLUS: Removing ExtendedBolus record from database: " + stored.toString());
|
||||
delete(stored);
|
||||
updateEarliestDataChange(stored.date);
|
||||
scheduleExtendedBolusChange();
|
||||
|
@ -1180,7 +1204,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
private static void scheduleExtendedBolusChange() {
|
||||
class PostRunnable implements Runnable {
|
||||
public void run() {
|
||||
log.debug("Firing EventExtendedBolusChange");
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("Firing EventExtendedBolusChange");
|
||||
MainApp.bus().post(new EventReloadTreatmentData(new EventExtendedBolusChange()));
|
||||
if (earliestDataChange != null)
|
||||
MainApp.bus().post(new EventNewHistoryData(earliestDataChange));
|
||||
|
@ -1320,11 +1345,11 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
|
||||
if (list.size() == 1) {
|
||||
CareportalEvent record = list.get(0);
|
||||
if (Config.logDatabase)
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("Removing CareportalEvent record from database: " + record.log());
|
||||
delete(record);
|
||||
} else {
|
||||
if (Config.logDatabase)
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("CareportalEvent not found database: " + _id);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
|
@ -1344,12 +1369,12 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
if (list.size() == 0) {
|
||||
careportalEvent = new CareportalEvent();
|
||||
careportalEvent.source = Source.NIGHTSCOUT;
|
||||
if (Config.logDatabase)
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("Adding CareportalEvent record to database: " + trJson.toString());
|
||||
// Record does not exists. add
|
||||
} else if (list.size() == 1) {
|
||||
careportalEvent = list.get(0);
|
||||
if (Config.logDatabase)
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("Updating CareportalEvent record in database: " + trJson.toString());
|
||||
} else {
|
||||
log.error("Something went wrong");
|
||||
|
@ -1368,7 +1393,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
private static void scheduleCareportalEventChange() {
|
||||
class PostRunnable implements Runnable {
|
||||
public void run() {
|
||||
log.debug("Firing scheduleCareportalEventChange");
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("Firing scheduleCareportalEventChange");
|
||||
MainApp.bus().post(new EventCareportalEventChange());
|
||||
scheduledCareportalEventPost = null;
|
||||
}
|
||||
|
@ -1414,7 +1440,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
profileSwitch.profileName = old.profileName; // preserver profileName to prevent multiple CPP extension
|
||||
getDaoProfileSwitch().delete(old); // need to delete/create because date may change too
|
||||
getDaoProfileSwitch().create(profileSwitch);
|
||||
log.debug("PROFILESWITCH: Updating record by date from: " + Source.getString(profileSwitch.source) + " " + old.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("PROFILESWITCH: Updating record by date from: " + Source.getString(profileSwitch.source) + " " + old.toString());
|
||||
scheduleProfileSwitchChange();
|
||||
return true;
|
||||
}
|
||||
|
@ -1433,7 +1460,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
getDaoProfileSwitch().delete(old); // need to delete/create because date may change too
|
||||
old.copyFrom(profileSwitch);
|
||||
getDaoProfileSwitch().create(old);
|
||||
log.debug("PROFILESWITCH: Updating record by _id from: " + Source.getString(profileSwitch.source) + " " + old.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("PROFILESWITCH: Updating record by _id from: " + Source.getString(profileSwitch.source) + " " + old.toString());
|
||||
scheduleProfileSwitchChange();
|
||||
return true;
|
||||
}
|
||||
|
@ -1442,13 +1470,15 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
// look for already added percentage from NS
|
||||
profileSwitch.profileName = PercentageSplitter.pureName(profileSwitch.profileName);
|
||||
getDaoProfileSwitch().create(profileSwitch);
|
||||
log.debug("PROFILESWITCH: New record from: " + Source.getString(profileSwitch.source) + " " + profileSwitch.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("PROFILESWITCH: New record from: " + Source.getString(profileSwitch.source) + " " + profileSwitch.toString());
|
||||
scheduleProfileSwitchChange();
|
||||
return true;
|
||||
}
|
||||
if (profileSwitch.source == Source.USER) {
|
||||
getDaoProfileSwitch().create(profileSwitch);
|
||||
log.debug("PROFILESWITCH: New record from: " + Source.getString(profileSwitch.source) + " " + profileSwitch.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("PROFILESWITCH: New record from: " + Source.getString(profileSwitch.source) + " " + profileSwitch.toString());
|
||||
scheduleProfileSwitchChange();
|
||||
return true;
|
||||
}
|
||||
|
@ -1470,7 +1500,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
private static void scheduleProfileSwitchChange() {
|
||||
class PostRunnable implements Runnable {
|
||||
public void run() {
|
||||
log.debug("Firing EventProfileSwitchChange");
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("Firing EventProfileSwitchChange");
|
||||
MainApp.bus().post(new EventReloadProfileSwitchData());
|
||||
MainApp.bus().post(new EventProfileSwitchChange());
|
||||
scheduledProfileSwitchEventPost = null;
|
||||
|
@ -1520,15 +1551,18 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
Profile profile = store.getSpecificProfile(profileSwitch.profileName);
|
||||
if (profile != null) {
|
||||
profileSwitch.profileJson = profile.getData().toString();
|
||||
log.debug("Profile switch prefilled with JSON from local store");
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("Profile switch prefilled with JSON from local store");
|
||||
// Update data in NS
|
||||
NSUpload.updateProfileSwitch(profileSwitch);
|
||||
} else {
|
||||
log.debug("JSON for profile switch doesn't exist. Ignoring: " + trJson.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("JSON for profile switch doesn't exist. Ignoring: " + trJson.toString());
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
log.debug("Store for profile switch doesn't exist. Ignoring: " + trJson.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("Store for profile switch doesn't exist. Ignoring: " + trJson.toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1543,7 +1577,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
public void deleteProfileSwitchById(String _id) {
|
||||
ProfileSwitch stored = findProfileSwitchById(_id);
|
||||
if (stored != null) {
|
||||
log.debug("PROFILESWITCH: Removing ProfileSwitch record from database: " + stored.toString());
|
||||
if (L.isEnabled(L.DATABASE))
|
||||
log.debug("PROFILESWITCH: Removing ProfileSwitch record from database: " + stored.toString());
|
||||
delete(stored);
|
||||
scheduleTemporaryTargetChange();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.utils;
|
||||
package info.nightscout.androidaps.logging;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
|
@ -6,19 +6,17 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 08.08.2017.
|
||||
*/
|
||||
|
||||
public class DetailedBolusInfoStorage {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMP);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMP);
|
||||
private static List<DetailedBolusInfo> store = new ArrayList<>();
|
||||
|
||||
public static synchronized void add(DetailedBolusInfo detailedBolusInfo) {
|
||||
|
@ -31,7 +29,7 @@ public class DetailedBolusInfoStorage {
|
|||
DetailedBolusInfo found = null;
|
||||
for (int i = 0; i < store.size(); i++) {
|
||||
long infoTime = store.get(i).date;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Existing bolus info: " + store.get(i));
|
||||
if (bolustime > infoTime - 60 * 1000 && bolustime < infoTime + 60 * 1000) {
|
||||
found = store.get(i);
|
||||
|
@ -45,7 +43,7 @@ public class DetailedBolusInfoStorage {
|
|||
for (int i = 0; i < store.size(); i++) {
|
||||
long infoTime = store.get(i).date;
|
||||
if (bolustime > infoTime - 60 * 1000 && bolustime < infoTime + 60 * 1000) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Removing bolus info: " + store.get(i));
|
||||
store.remove(i);
|
||||
break;
|
||||
|
|
|
@ -7,7 +7,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interfaces.Constraint;
|
||||
|
@ -16,6 +15,7 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
|||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.ConstraintsObjectives.events.EventObjectivesSaved;
|
||||
import info.nightscout.androidaps.plugins.ConstraintsObjectives.objectives.Objective;
|
||||
|
@ -33,7 +33,7 @@ import info.nightscout.utils.SP;
|
|||
* Created by mike on 05.08.2016.
|
||||
*/
|
||||
public class ObjectivesPlugin extends PluginBase implements ConstraintsInterface {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.OBJECTIVES);
|
||||
private static Logger log = LoggerFactory.getLogger(L.OBJECTIVES);
|
||||
|
||||
private static ObjectivesPlugin objectivesPlugin;
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class ObjectivesPlugin extends PluginBase implements ConstraintsInterface
|
|||
SP.putBoolean("Objectives" + "bgIsAvailableInNS", bgIsAvailableInNS);
|
||||
SP.putBoolean("Objectives" + "pumpStatusIsAvailableInNS", pumpStatusIsAvailableInNS);
|
||||
SP.putString("Objectives" + "manualEnacts", Integer.toString(manualEnacts));
|
||||
if (Config.logObjectives)
|
||||
if (L.isEnabled(L.OBJECTIVES))
|
||||
log.debug("Objectives stored");
|
||||
MainApp.bus().post(new EventObjectivesSaved());
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public class ObjectivesPlugin extends PluginBase implements ConstraintsInterface
|
|||
} catch (Exception e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
if (Config.logObjectives)
|
||||
if (L.isEnabled(L.OBJECTIVES))
|
||||
log.debug("Objectives loaded");
|
||||
}
|
||||
|
||||
|
|
|
@ -27,21 +27,20 @@ import java.util.concurrent.ScheduledExecutorService;
|
|||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||
import info.nightscout.androidaps.db.ICallback;
|
||||
import info.nightscout.androidaps.events.Event;
|
||||
import info.nightscout.androidaps.events.EventFoodDatabaseChanged;
|
||||
import info.nightscout.androidaps.events.EventNsFood;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 24.09.2017.
|
||||
*/
|
||||
|
||||
public class FoodService extends OrmLiteBaseService<DatabaseHelper> {
|
||||
private Logger log = LoggerFactory.getLogger(Constants.DATAFOOD);
|
||||
private Logger log = LoggerFactory.getLogger(L.DATAFOOD);
|
||||
|
||||
private static final ScheduledExecutorService foodEventWorker = Executors.newSingleThreadScheduledExecutor();
|
||||
private static ScheduledFuture<?> scheduledFoodEventPost = null;
|
||||
|
@ -112,7 +111,7 @@ public class FoodService extends OrmLiteBaseService<DatabaseHelper> {
|
|||
public void onCreate() {
|
||||
super.onCreate();
|
||||
try {
|
||||
if (Config.logDataFood)
|
||||
if (L.isEnabled(L.DATAFOOD))
|
||||
log.info("onCreate");
|
||||
TableUtils.createTableIfNotExists(this.getConnectionSource(), Food.class);
|
||||
} catch (SQLException e) {
|
||||
|
@ -125,7 +124,7 @@ public class FoodService extends OrmLiteBaseService<DatabaseHelper> {
|
|||
if (oldVersion == 7 && newVersion == 8) {
|
||||
log.debug("Upgrading database from v7 to v8");
|
||||
} else {
|
||||
if (Config.logDataFood)
|
||||
if (L.isEnabled(L.DATAFOOD))
|
||||
log.info("onUpgrade");
|
||||
// this.resetFood();
|
||||
}
|
||||
|
@ -165,7 +164,7 @@ public class FoodService extends OrmLiteBaseService<DatabaseHelper> {
|
|||
|
||||
class PostRunnable implements Runnable {
|
||||
public void run() {
|
||||
if (Config.logDataFood)
|
||||
if (L.isEnabled(L.DATAFOOD))
|
||||
log.debug("Firing EventFoodChange");
|
||||
MainApp.bus().post(event);
|
||||
callback.setPost(null);
|
||||
|
@ -276,7 +275,7 @@ public class FoodService extends OrmLiteBaseService<DatabaseHelper> {
|
|||
public void deleteByNSId(String _id) throws SQLException {
|
||||
Food stored = this.findByNSId(_id);
|
||||
if (stored != null) {
|
||||
if (Config.logDataFood)
|
||||
if (L.isEnabled(L.DATAFOOD))
|
||||
log.debug("Removing Food record from database: " + stored.toString());
|
||||
this.delete(stored);
|
||||
}
|
||||
|
@ -330,7 +329,7 @@ public class FoodService extends OrmLiteBaseService<DatabaseHelper> {
|
|||
public void createOrUpdate(Food food) {
|
||||
try {
|
||||
this.getDao().createOrUpdate(food);
|
||||
if (Config.logDataFood)
|
||||
if (L.isEnabled(L.DATAFOOD))
|
||||
log.debug("Created or Updated: " + food.toString());
|
||||
} catch (SQLException e) {
|
||||
log.error("Unable to createOrUpdate Food", e);
|
||||
|
@ -341,7 +340,7 @@ public class FoodService extends OrmLiteBaseService<DatabaseHelper> {
|
|||
public void create(Food food) {
|
||||
try {
|
||||
this.getDao().create(food);
|
||||
if (Config.logDataFood)
|
||||
if (L.isEnabled(L.DATAFOOD))
|
||||
log.debug("New record: " + food.toString());
|
||||
} catch (SQLException e) {
|
||||
log.error("Unable to create Food", e);
|
||||
|
|
|
@ -12,6 +12,7 @@ import info.nightscout.androidaps.MainApp;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSSMB.SMBDefaults;
|
||||
import info.nightscout.androidaps.plugins.Overview.graphExtensions.DataPointWithLabelInterface;
|
||||
import info.nightscout.androidaps.plugins.Overview.graphExtensions.PointsWithLabelGraphSeries;
|
||||
|
@ -26,7 +27,7 @@ import info.nightscout.utils.SP;
|
|||
*/
|
||||
|
||||
public class AutosensData implements DataPointWithLabelInterface {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.AUTOSENS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.AUTOSENS);
|
||||
|
||||
public void setChartTime(long chartTime) {
|
||||
this.chartTime = chartTime;
|
||||
|
@ -48,7 +49,8 @@ public class AutosensData implements DataPointWithLabelInterface {
|
|||
double sens = Profile.toMgdl(profile.getIsf(t.date), profile.getUnits());
|
||||
double ic = profile.getIc(t.date);
|
||||
min5minCarbImpact = t.carbs / (maxAbsorptionHours * 60 / 5) * sens / ic;
|
||||
log.debug("Min 5m carbs impact for " + carbs + "g @" + new Date(t.date).toLocaleString() + " for " + maxAbsorptionHours + "h calculated to " + min5minCarbImpact + " ISF: " + sens + " IC: " + ic);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Min 5m carbs impact for " + carbs + "g @" + new Date(t.date).toLocaleString() + " for " + maxAbsorptionHours + "h calculated to " + min5minCarbImpact + " ISF: " + sens + " IC: " + ic);
|
||||
} else {
|
||||
min5minCarbImpact = SP.getDouble(R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact);
|
||||
}
|
||||
|
@ -107,7 +109,8 @@ public class AutosensData implements DataPointWithLabelInterface {
|
|||
activeCarbsList.remove(i--);
|
||||
if (c.remaining > 0)
|
||||
cob -= c.remaining;
|
||||
log.debug("Removing carbs at " + new Date(toTime).toLocaleString() + " + after " + maxAbsorptionHours + "h :" + new Date(c.time).toLocaleString());
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Removing carbs at " + new Date(toTime).toLocaleString() + " + after " + maxAbsorptionHours + "h :" + new Date(c.time).toLocaleString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,13 +5,13 @@ import org.json.JSONObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 06.01.2017.
|
||||
*/
|
||||
public class AutosensResult {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.AUTOSENS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.AUTOSENS);
|
||||
|
||||
//default values to show when autosens algorithm is not called
|
||||
public double ratio = 1d;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.IobCobCalculator;
|
||||
|
||||
import android.os.SystemClock;
|
||||
import android.provider.SyncStateContract;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.util.LongSparseArray;
|
||||
|
@ -16,7 +15,6 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
|
@ -33,6 +31,7 @@ import info.nightscout.androidaps.events.EventPreferenceChange;
|
|||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventNewHistoryData;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSSMB.OpenAPSSMBPlugin;
|
||||
|
@ -49,7 +48,7 @@ import static info.nightscout.utils.DateUtil.now;
|
|||
*/
|
||||
|
||||
public class IobCobCalculatorPlugin extends PluginBase {
|
||||
private Logger log = LoggerFactory.getLogger(Constants.AUTOSENS);
|
||||
private Logger log = LoggerFactory.getLogger(L.AUTOSENS);
|
||||
|
||||
private static IobCobCalculatorPlugin plugin = null;
|
||||
|
||||
|
@ -112,13 +111,15 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
//log.debug("Locking getBucketedData");
|
||||
synchronized (dataLock) {
|
||||
if (bucketed_data == null) {
|
||||
log.debug("No bucketed data available");
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("No bucketed data available");
|
||||
return null;
|
||||
}
|
||||
int index = indexNewerThan(fromTime);
|
||||
if (index > -1) {
|
||||
List<BgReading> part = bucketed_data.subList(0, index);
|
||||
log.debug("Bucketed data striped off: " + part.size() + "/" + bucketed_data.size());
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Bucketed data striped off: " + part.size() + "/" + bucketed_data.size());
|
||||
return part;
|
||||
}
|
||||
}
|
||||
|
@ -144,7 +145,8 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
void loadBgData(long now) {
|
||||
long start = (long) (now - 60 * 60 * 1000L * (24 + dia));
|
||||
bgReadings = MainApp.getDbHelper().getBgreadingsDataFromTime(start, now, false);
|
||||
log.debug("BG data loaded. Size: " + bgReadings.size() + " Start date: " + DateUtil.dateAndTimeString(start) + " End date: " + DateUtil.dateAndTimeString(now));
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("BG data loaded. Size: " + bgReadings.size() + " Start date: " + DateUtil.dateAndTimeString(start) + " End date: " + DateUtil.dateAndTimeString(now));
|
||||
}
|
||||
|
||||
private boolean isAbout5minData() {
|
||||
|
@ -160,13 +162,15 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
totalDiff += diff;
|
||||
if (diff > 30 * 1000 && diff < 270 * 1000) { // 0:30 - 4:30
|
||||
log.debug("Interval detection: values: " + bgReadings.size() + " diff: " + (diff / 1000) + "sec is5minData: " + false);
|
||||
return false;
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
double intervals = totalDiff / (5 * 60 * 1000d);
|
||||
double variability = Math.abs(intervals - Math.round(intervals));
|
||||
boolean is5mindata = variability < 0.02;
|
||||
log.debug("Interval detection: values: " + bgReadings.size() + " variability: " + variability + " is5minData: " + is5mindata);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Interval detection: values: " + bgReadings.size() + " variability: " + variability + " is5minData: " + is5mindata);
|
||||
return is5mindata;
|
||||
}
|
||||
}
|
||||
|
@ -293,7 +297,8 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
//log.error("***** Average");
|
||||
}
|
||||
}
|
||||
log.debug("Bucketed data created. Size: " + bucketed_data.size());
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Bucketed data created. Size: " + bucketed_data.size());
|
||||
}
|
||||
|
||||
public long calculateDetectionStart(long from, boolean limitDataToOldestAvailable) {
|
||||
|
@ -306,7 +311,8 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
if (limitDataToOldestAvailable) {
|
||||
getBGDataFrom = Math.max(oldestDataAvailable, (long) (from - T.hours(1).msecs() * (24 + dia)));
|
||||
if (getBGDataFrom == oldestDataAvailable)
|
||||
log.debug("Limiting data to oldest available temps: " + new Date(oldestDataAvailable).toString());
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Limiting data to oldest available temps: " + new Date(oldestDataAvailable).toString());
|
||||
} else
|
||||
getBGDataFrom = (long) (from - T.hours(1).msecs() * (24 + dia));
|
||||
return getBGDataFrom;
|
||||
|
@ -413,12 +419,14 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
@Nullable
|
||||
public AutosensData getLastAutosensDataSynchronized(String reason) {
|
||||
if (thread != null && thread.isAlive()) {
|
||||
log.debug("AUTOSENSDATA is waiting for calculation thread: " + reason);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("AUTOSENSDATA is waiting for calculation thread: " + reason);
|
||||
try {
|
||||
thread.join(5000);
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
log.debug("AUTOSENSDATA finished waiting for calculation thread: " + reason);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("AUTOSENSDATA finished waiting for calculation thread: " + reason);
|
||||
}
|
||||
synchronized (dataLock) {
|
||||
return getLastAutosensData(reason);
|
||||
|
@ -456,7 +464,8 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
@Nullable
|
||||
public AutosensData getLastAutosensData(String reason) {
|
||||
if (autosensDataTable.size() < 1) {
|
||||
log.debug("AUTOSENSDATA null: autosensDataTable empty (" + reason + ")");
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("AUTOSENSDATA null: autosensDataTable empty (" + reason + ")");
|
||||
return null;
|
||||
}
|
||||
AutosensData data;
|
||||
|
@ -470,10 +479,12 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
return null;
|
||||
}
|
||||
if (data.time < System.currentTimeMillis() - 11 * 60 * 1000) {
|
||||
log.debug("AUTOSENSDATA null: data is old (" + reason + ") size()=" + autosensDataTable.size() + " lastdata=" + DateUtil.dateAndTimeString(data.time));
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("AUTOSENSDATA null: data is old (" + reason + ") size()=" + autosensDataTable.size() + " lastdata=" + DateUtil.dateAndTimeString(data.time));
|
||||
return null;
|
||||
} else {
|
||||
log.debug("AUTOSENSDATA (" + reason + ") " + data.toString());
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("AUTOSENSDATA (" + reason + ") " + data.toString());
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
@ -535,7 +546,8 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
@SuppressWarnings("unused")
|
||||
public void onEventAppInitialized(EventAppInitialized ev) {
|
||||
if (this != getPlugin()) {
|
||||
log.debug("Ignoring event for non default instance");
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Ignoring event for non default instance");
|
||||
return;
|
||||
}
|
||||
runCalculation("onEventAppInitialized", System.currentTimeMillis(), true, true, ev);
|
||||
|
@ -545,7 +557,8 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
@SuppressWarnings("unused")
|
||||
public void onEventNewBG(EventNewBG ev) {
|
||||
if (this != getPlugin()) {
|
||||
log.debug("Ignoring event for non default instance");
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Ignoring event for non default instance");
|
||||
return;
|
||||
}
|
||||
stopCalculation("onEventNewBG");
|
||||
|
@ -555,16 +568,19 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
public void stopCalculation(String from) {
|
||||
if (thread != null && thread.getState() != Thread.State.TERMINATED) {
|
||||
stopCalculationTrigger = true;
|
||||
log.debug("Stopping calculation thread: " + from);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Stopping calculation thread: " + from);
|
||||
while (thread.getState() != Thread.State.TERMINATED) {
|
||||
SystemClock.sleep(100);
|
||||
}
|
||||
log.debug("Calculation thread stopped: " + from);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Calculation thread stopped: " + from);
|
||||
}
|
||||
}
|
||||
|
||||
public void runCalculation(String from, long end, boolean bgDataReload, boolean limitDataToOldestAvailable, Event cause) {
|
||||
log.debug("Starting calculation thread: " + from + " to " + DateUtil.dateAndTimeString(end));
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Starting calculation thread: " + from + " to " + DateUtil.dateAndTimeString(end));
|
||||
if (thread == null || thread.getState() == Thread.State.TERMINATED) {
|
||||
if (SensitivityOref1Plugin.getPlugin().isEnabled(PluginType.SENSITIVITY))
|
||||
thread = new IobCobOref1Thread(this, from, end, bgDataReload, limitDataToOldestAvailable, cause);
|
||||
|
@ -577,7 +593,8 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
@Subscribe
|
||||
public void onNewProfile(EventNewBasalProfile ev) {
|
||||
if (this != getPlugin()) {
|
||||
log.debug("Ignoring event for non default instance");
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Ignoring event for non default instance");
|
||||
return;
|
||||
}
|
||||
if (MainApp.getConfigBuilder() == null)
|
||||
|
@ -591,7 +608,8 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
}
|
||||
stopCalculation("onNewProfile");
|
||||
synchronized (dataLock) {
|
||||
log.debug("Invalidating cached data because of new profile. IOB: " + iobTable.size() + " Autosens: " + autosensDataTable.size() + " records");
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Invalidating cached data because of new profile. IOB: " + iobTable.size() + " Autosens: " + autosensDataTable.size() + " records");
|
||||
iobTable = new LongSparseArray<>();
|
||||
autosensDataTable = new LongSparseArray<>();
|
||||
}
|
||||
|
@ -601,7 +619,8 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
@Subscribe
|
||||
public void onEventPreferenceChange(EventPreferenceChange ev) {
|
||||
if (this != getPlugin()) {
|
||||
log.debug("Ignoring event for non default instance");
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Ignoring event for non default instance");
|
||||
return;
|
||||
}
|
||||
if (ev.isChanged(R.string.key_openapsama_autosens_period) ||
|
||||
|
@ -614,7 +633,8 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
) {
|
||||
stopCalculation("onEventPreferenceChange");
|
||||
synchronized (dataLock) {
|
||||
log.debug("Invalidating cached data because of preference change. IOB: " + iobTable.size() + " Autosens: " + autosensDataTable.size() + " records");
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Invalidating cached data because of preference change. IOB: " + iobTable.size() + " Autosens: " + autosensDataTable.size() + " records");
|
||||
iobTable = new LongSparseArray<>();
|
||||
autosensDataTable = new LongSparseArray<>();
|
||||
}
|
||||
|
@ -625,12 +645,14 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
@Subscribe
|
||||
public void onEventConfigBuilderChange(EventConfigBuilderChange ev) {
|
||||
if (this != getPlugin()) {
|
||||
log.debug("Ignoring event for non default instance");
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Ignoring event for non default instance");
|
||||
return;
|
||||
}
|
||||
stopCalculation("onEventConfigBuilderChange");
|
||||
synchronized (dataLock) {
|
||||
log.debug("Invalidating cached data because of configuration change. IOB: " + iobTable.size() + " Autosens: " + autosensDataTable.size() + " records");
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Invalidating cached data because of configuration change. IOB: " + iobTable.size() + " Autosens: " + autosensDataTable.size() + " records");
|
||||
iobTable = new LongSparseArray<>();
|
||||
autosensDataTable = new LongSparseArray<>();
|
||||
}
|
||||
|
@ -641,7 +663,8 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
@Subscribe
|
||||
public void onEventNewHistoryData(EventNewHistoryData ev) {
|
||||
if (this != getPlugin()) {
|
||||
log.debug("Ignoring event for non default instance");
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Ignoring event for non default instance");
|
||||
return;
|
||||
}
|
||||
//log.debug("Locking onNewHistoryData");
|
||||
|
@ -649,10 +672,11 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
synchronized (dataLock) {
|
||||
// clear up 5 min back for proper COB calculation
|
||||
long time = ev.time - 5 * 60 * 1000L;
|
||||
log.debug("Invalidating cached data to: " + new Date(time).toLocaleString());
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Invalidating cached data to: " + new Date(time).toLocaleString());
|
||||
for (int index = iobTable.size() - 1; index >= 0; index--) {
|
||||
if (iobTable.keyAt(index) > time) {
|
||||
if (Config.logAutosensData)
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Removing from iobTable: " + new Date(iobTable.keyAt(index)).toLocaleString());
|
||||
iobTable.removeAt(index);
|
||||
} else {
|
||||
|
@ -661,7 +685,7 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
}
|
||||
for (int index = autosensDataTable.size() - 1; index >= 0; index--) {
|
||||
if (autosensDataTable.keyAt(index) > time) {
|
||||
if (Config.logAutosensData)
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Removing from autosensDataTable: " + new Date(autosensDataTable.keyAt(index)).toLocaleString());
|
||||
autosensDataTable.removeAt(index);
|
||||
} else {
|
||||
|
@ -670,7 +694,7 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
}
|
||||
for (int index = basalDataTable.size() - 1; index >= 0; index--) {
|
||||
if (basalDataTable.keyAt(index) > time) {
|
||||
if (Config.logAutosensData)
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Removing from basalDataTable: " + new Date(basalDataTable.keyAt(index)).toLocaleString());
|
||||
basalDataTable.removeAt(index);
|
||||
} else {
|
||||
|
@ -684,7 +708,8 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
|
||||
public void clearCache() {
|
||||
synchronized (dataLock) {
|
||||
log.debug("Clearing cached data.");
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Clearing cached data.");
|
||||
iobTable = new LongSparseArray<>();
|
||||
autosensDataTable = new LongSparseArray<>();
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.GregorianCalendar;
|
|||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.BuildConfig;
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
|
@ -26,6 +25,7 @@ import info.nightscout.androidaps.data.Profile;
|
|||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.db.TempTarget;
|
||||
import info.nightscout.androidaps.events.Event;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventAutosensCalculationFinished;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventIobCalculationProgress;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSSMB.SMBDefaults;
|
||||
|
@ -43,7 +43,7 @@ import static java.util.Calendar.MINUTE;
|
|||
*/
|
||||
|
||||
public class IobCobOref1Thread extends Thread {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.AUTOSENS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.AUTOSENS);
|
||||
private final Event cause;
|
||||
|
||||
private IobCobCalculatorPlugin iobCobCalculatorPlugin;
|
||||
|
@ -72,13 +72,16 @@ public class IobCobOref1Thread extends Thread {
|
|||
public final void run() {
|
||||
mWakeLock.acquire();
|
||||
try {
|
||||
log.debug("AUTOSENSDATA thread started: " + from);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("AUTOSENSDATA thread started: " + from);
|
||||
if (MainApp.getConfigBuilder() == null) {
|
||||
log.debug("Aborting calculation thread (ConfigBuilder not ready): " + from);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Aborting calculation thread (ConfigBuilder not ready): " + from);
|
||||
return; // app still initializing
|
||||
}
|
||||
if (!MainApp.getConfigBuilder().isProfileValid("IobCobThread")) {
|
||||
log.debug("Aborting calculation thread (No profile): " + from);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Aborting calculation thread (No profile): " + from);
|
||||
return; // app still initializing
|
||||
}
|
||||
//log.debug("Locking calculateSensitivityData");
|
||||
|
@ -94,12 +97,14 @@ public class IobCobOref1Thread extends Thread {
|
|||
LongSparseArray<AutosensData> autosensDataTable = iobCobCalculatorPlugin.getAutosensDataTable();
|
||||
|
||||
if (bucketed_data == null || bucketed_data.size() < 3) {
|
||||
log.debug("Aborting calculation thread (No bucketed data available): " + from);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Aborting calculation thread (No bucketed data available): " + from);
|
||||
return;
|
||||
}
|
||||
|
||||
long prevDataTime = IobCobCalculatorPlugin.roundUpTime(bucketed_data.get(bucketed_data.size() - 3).date);
|
||||
log.debug("Prev data time: " + new Date(prevDataTime).toLocaleString());
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Prev data time: " + new Date(prevDataTime).toLocaleString());
|
||||
AutosensData previous = autosensDataTable.get(prevDataTime);
|
||||
// start from oldest to be able sub cob
|
||||
for (int i = bucketed_data.size() - 4; i >= 0; i--) {
|
||||
|
@ -108,7 +113,8 @@ public class IobCobOref1Thread extends Thread {
|
|||
|
||||
if (iobCobCalculatorPlugin.stopCalculationTrigger) {
|
||||
iobCobCalculatorPlugin.stopCalculationTrigger = false;
|
||||
log.debug("Aborting calculation thread (trigger): " + from);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Aborting calculation thread (trigger): " + from);
|
||||
return;
|
||||
}
|
||||
// check if data already exists
|
||||
|
@ -125,11 +131,12 @@ public class IobCobOref1Thread extends Thread {
|
|||
|
||||
Profile profile = MainApp.getConfigBuilder().getProfile(bgTime);
|
||||
if (profile == null) {
|
||||
log.debug("Aborting calculation thread (no profile): " + from);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Aborting calculation thread (no profile): " + from);
|
||||
return; // profile not set yet
|
||||
}
|
||||
|
||||
if (Config.logAutosensData)
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Processing calculation thread: " + from + " (" + i + "/" + bucketed_data.size() + ")");
|
||||
|
||||
double sens = Profile.toMgdl(profile.getIsf(bgTime), profile.getUnits());
|
||||
|
@ -171,7 +178,7 @@ public class IobCobOref1Thread extends Thread {
|
|||
AutosensData hourAgoData = iobCobCalculatorPlugin.getAutosensData(hourago);
|
||||
if (hourAgoData != null) {
|
||||
int initialIndex = autosensDataTable.indexOfKey(hourAgoData.time);
|
||||
if (Config.logAutosensData)
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug(">>>>> bucketed_data.size()=" + bucketed_data.size() + " i=" + i + "hourAgoData=" + hourAgoData.toString());
|
||||
int past = 1;
|
||||
try {
|
||||
|
@ -187,7 +194,7 @@ public class IobCobOref1Thread extends Thread {
|
|||
minDeviation = ad.avgDeviation;
|
||||
}
|
||||
|
||||
//if (Config.logAutosensData)
|
||||
//if (Config.isEnabled(L.AUTOSENS))
|
||||
// log.debug("Deviations: " + new Date(bgTime) + new Date(ad.time) + " avgDeviation=" + avgDeviation + " deviationSlope=" + deviationSlope + " slopeFromMaxDeviation=" + slopeFromMaxDeviation + " slopeFromMinDeviation=" + slopeFromMinDeviation);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -340,13 +347,13 @@ public class IobCobOref1Thread extends Thread {
|
|||
previous = autosensData;
|
||||
if (bgTime < now())
|
||||
autosensDataTable.put(bgTime, autosensData);
|
||||
if (Config.logAutosensData)
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Running detectSensitivity from: " + DateUtil.dateAndTimeString(oldestTimeWithData) + " to: " + DateUtil.dateAndTimeString(bgTime) + " lastDataTime:" + iobCobCalculatorPlugin.lastDataTime());
|
||||
AutosensResult sensitivity = iobCobCalculatorPlugin.detectSensitivityWithLock(oldestTimeWithData, bgTime);
|
||||
if (Config.logAutosensData)
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Sensitivity result: " + sensitivity.toString());
|
||||
autosensData.autosensResult = sensitivity;
|
||||
if (Config.logAutosensData)
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug(autosensData.toString());
|
||||
}
|
||||
}
|
||||
|
@ -357,7 +364,8 @@ public class IobCobOref1Thread extends Thread {
|
|||
} finally {
|
||||
mWakeLock.release();
|
||||
MainApp.bus().post(new EventIobCalculationProgress(""));
|
||||
log.debug("AUTOSENSDATA thread ended: " + from);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("AUTOSENSDATA thread ended: " + from);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.BuildConfig;
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
|
@ -24,6 +23,7 @@ import info.nightscout.androidaps.data.Profile;
|
|||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.events.Event;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventAutosensCalculationFinished;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventIobCalculationProgress;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSSMB.SMBDefaults;
|
||||
|
@ -42,7 +42,7 @@ import static info.nightscout.utils.DateUtil.now;
|
|||
*/
|
||||
|
||||
public class IobCobThread extends Thread {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.AUTOSENS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.AUTOSENS);
|
||||
private final Event cause;
|
||||
|
||||
private IobCobCalculatorPlugin iobCobCalculatorPlugin;
|
||||
|
@ -71,13 +71,16 @@ public class IobCobThread extends Thread {
|
|||
public final void run() {
|
||||
mWakeLock.acquire();
|
||||
try {
|
||||
log.debug("AUTOSENSDATA thread started: " + from);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("AUTOSENSDATA thread started: " + from);
|
||||
if (MainApp.getConfigBuilder() == null) {
|
||||
log.debug("Aborting calculation thread (ConfigBuilder not ready): " + from);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Aborting calculation thread (ConfigBuilder not ready): " + from);
|
||||
return; // app still initializing
|
||||
}
|
||||
if (!MainApp.getConfigBuilder().isProfileValid("IobCobThread")) {
|
||||
log.debug("Aborting calculation thread (No profile): " + from);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Aborting calculation thread (No profile): " + from);
|
||||
return; // app still initializing
|
||||
}
|
||||
//log.debug("Locking calculateSensitivityData");
|
||||
|
@ -93,12 +96,14 @@ public class IobCobThread extends Thread {
|
|||
LongSparseArray<AutosensData> autosensDataTable = iobCobCalculatorPlugin.getAutosensDataTable();
|
||||
|
||||
if (bucketed_data == null || bucketed_data.size() < 3) {
|
||||
log.debug("Aborting calculation thread (No bucketed data available): " + from);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Aborting calculation thread (No bucketed data available): " + from);
|
||||
return;
|
||||
}
|
||||
|
||||
long prevDataTime = IobCobCalculatorPlugin.roundUpTime(bucketed_data.get(bucketed_data.size() - 3).date);
|
||||
log.debug("Prev data time: " + new Date(prevDataTime).toLocaleString());
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Prev data time: " + new Date(prevDataTime).toLocaleString());
|
||||
AutosensData previous = autosensDataTable.get(prevDataTime);
|
||||
// start from oldest to be able sub cob
|
||||
for (int i = bucketed_data.size() - 4; i >= 0; i--) {
|
||||
|
@ -107,7 +112,8 @@ public class IobCobThread extends Thread {
|
|||
|
||||
if (iobCobCalculatorPlugin.stopCalculationTrigger) {
|
||||
iobCobCalculatorPlugin.stopCalculationTrigger = false;
|
||||
log.debug("Aborting calculation thread (trigger): " + from);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Aborting calculation thread (trigger): " + from);
|
||||
return;
|
||||
}
|
||||
// check if data already exists
|
||||
|
@ -124,11 +130,12 @@ public class IobCobThread extends Thread {
|
|||
|
||||
Profile profile = MainApp.getConfigBuilder().getProfile(bgTime);
|
||||
if (profile == null) {
|
||||
log.debug("Aborting calculation thread (no profile): " + from);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Aborting calculation thread (no profile): " + from);
|
||||
return; // profile not set yet
|
||||
}
|
||||
|
||||
if (Config.logAutosensData)
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Processing calculation thread: " + from + " (" + i + "/" + bucketed_data.size() + ")");
|
||||
|
||||
double sens = Profile.toMgdl(profile.getIsf(bgTime), profile.getUnits());
|
||||
|
@ -170,7 +177,7 @@ public class IobCobThread extends Thread {
|
|||
AutosensData hourAgoData = iobCobCalculatorPlugin.getAutosensData(hourago);
|
||||
if (hourAgoData != null) {
|
||||
int initialIndex = autosensDataTable.indexOfKey(hourAgoData.time);
|
||||
if (Config.logAutosensData)
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug(">>>>> bucketed_data.size()=" + bucketed_data.size() + " i=" + i + "hourAgoData=" + hourAgoData.toString());
|
||||
int past = 1;
|
||||
try {
|
||||
|
@ -186,7 +193,7 @@ public class IobCobThread extends Thread {
|
|||
minDeviation = ad.avgDeviation;
|
||||
}
|
||||
|
||||
//if (Config.logAutosensData)
|
||||
//if (Config.isEnabled(L.AUTOSENS))
|
||||
// log.debug("Deviations: " + new Date(bgTime) + new Date(ad.time) + " avgDeviation=" + avgDeviation + " deviationSlope=" + deviationSlope + " slopeFromMaxDeviation=" + slopeFromMaxDeviation + " slopeFromMinDeviation=" + slopeFromMinDeviation);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -267,13 +274,13 @@ public class IobCobThread extends Thread {
|
|||
previous = autosensData;
|
||||
if (bgTime < now())
|
||||
autosensDataTable.put(bgTime, autosensData);
|
||||
if (Config.logAutosensData)
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Running detectSensitivity from: " + DateUtil.dateAndTimeString(oldestTimeWithData) + " to: " + DateUtil.dateAndTimeString(bgTime) + " lastDataTime:" + iobCobCalculatorPlugin.lastDataTime());
|
||||
AutosensResult sensitivity = iobCobCalculatorPlugin.detectSensitivityWithLock(oldestTimeWithData, bgTime);
|
||||
if (Config.logAutosensData)
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("Sensitivity result: " + sensitivity.toString());
|
||||
autosensData.autosensResult = sensitivity;
|
||||
if (Config.logAutosensData)
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug(autosensData.toString());
|
||||
}
|
||||
}
|
||||
|
@ -284,7 +291,8 @@ public class IobCobThread extends Thread {
|
|||
} finally {
|
||||
mWakeLock.release();
|
||||
MainApp.bus().post(new EventIobCalculationProgress(""));
|
||||
log.debug("AUTOSENSDATA thread ended: " + from);
|
||||
if (L.isEnabled(L.AUTOSENS))
|
||||
log.debug("AUTOSENSDATA thread ended: " + from);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,13 +12,13 @@ import org.slf4j.LoggerFactory;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.IobTotal;
|
||||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.interfaces.Constraint;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
|
||||
|
@ -26,7 +26,7 @@ import info.nightscout.utils.DecimalFormatter;
|
|||
* Created by mike on 09.06.2016.
|
||||
*/
|
||||
public class APSResult {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.APS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.APS);
|
||||
|
||||
public long date = 0;
|
||||
public String reason;
|
||||
|
|
|
@ -5,7 +5,7 @@ import org.json.JSONObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/*
|
||||
{
|
||||
|
@ -365,7 +365,7 @@ import info.nightscout.androidaps.Constants;
|
|||
*/
|
||||
|
||||
public class DeviceStatus {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.APS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.APS);
|
||||
|
||||
public String device = null;
|
||||
public JSONObject pump = null;
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainActivity;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
|
@ -38,6 +37,7 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
|||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventAutosensCalculationFinished;
|
||||
import info.nightscout.androidaps.plugins.Loop.events.EventLoopSetLastRunGui;
|
||||
|
@ -54,7 +54,7 @@ import info.nightscout.utils.SP;
|
|||
* Created by mike on 05.08.2016.
|
||||
*/
|
||||
public class LoopPlugin extends PluginBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.APS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.APS);
|
||||
|
||||
private static final String CHANNEL_ID = "AndroidAPS-Openloop";
|
||||
|
||||
|
@ -254,13 +254,13 @@ public class LoopPlugin extends PluginBase {
|
|||
|
||||
public synchronized void invoke(String initiator, boolean allowNotification, boolean tempBasalFallback) {
|
||||
try {
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("invoke from " + initiator);
|
||||
Constraint<Boolean> loopEnabled = MainApp.getConstraintChecker().isLoopInvokationAllowed();
|
||||
|
||||
if (!loopEnabled.value()) {
|
||||
String message = MainApp.gs(R.string.loopdisabled) + "\n" + loopEnabled.getReasons();
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug(message);
|
||||
MainApp.bus().post(new EventLoopSetLastRunGui(message));
|
||||
return;
|
||||
|
@ -274,7 +274,7 @@ public class LoopPlugin extends PluginBase {
|
|||
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||
|
||||
if (!MainApp.getConfigBuilder().isProfileValid("Loop")) {
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug(MainApp.gs(R.string.noprofileselected));
|
||||
MainApp.bus().post(new EventLoopSetLastRunGui(MainApp.gs(R.string.noprofileselected)));
|
||||
return;
|
||||
|
@ -305,7 +305,7 @@ public class LoopPlugin extends PluginBase {
|
|||
// safety check for multiple SMBs
|
||||
long lastBolusTime = TreatmentsPlugin.getPlugin().getLastBolusTime();
|
||||
if (lastBolusTime != 0 && lastBolusTime + 3 * 60 * 1000 > System.currentTimeMillis()) {
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("SMB requsted but still in 3 min interval");
|
||||
resultAfterConstraints.smb = 0;
|
||||
}
|
||||
|
@ -321,14 +321,14 @@ public class LoopPlugin extends PluginBase {
|
|||
NSUpload.uploadDeviceStatus();
|
||||
|
||||
if (isSuspended()) {
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug(MainApp.gs(R.string.loopsuspended));
|
||||
MainApp.bus().post(new EventLoopSetLastRunGui(MainApp.gs(R.string.loopsuspended)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (pump.isSuspended()) {
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug(MainApp.gs(R.string.pumpsuspended));
|
||||
MainApp.bus().post(new EventLoopSetLastRunGui(MainApp.gs(R.string.pumpsuspended)));
|
||||
return;
|
||||
|
@ -416,7 +416,7 @@ public class LoopPlugin extends PluginBase {
|
|||
|
||||
MainApp.bus().post(new EventLoopUpdateGui());
|
||||
} finally {
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("invoke end");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import info.nightscout.androidaps.events.EventPreferenceChange;
|
|||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientNewLog;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientStatus;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientUpdateGUI;
|
||||
|
@ -37,7 +38,7 @@ import info.nightscout.utils.SP;
|
|||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
public class NSClientPlugin extends PluginBase {
|
||||
private Logger log = LoggerFactory.getLogger(Constants.NSCLIENT);
|
||||
private Logger log = LoggerFactory.getLogger(L.NSCLIENT);
|
||||
|
||||
static NSClientPlugin nsClientPlugin;
|
||||
|
||||
|
@ -132,13 +133,13 @@ public class NSClientPlugin extends PluginBase {
|
|||
private ServiceConnection mConnection = new ServiceConnection() {
|
||||
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("Service is disconnected");
|
||||
nsClientService = null;
|
||||
}
|
||||
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("Service is connected");
|
||||
NSClientService.LocalBinder mLocalBinder = (NSClientService.LocalBinder) service;
|
||||
if (mLocalBinder != null) // is null when running in roboelectric
|
||||
|
@ -157,7 +158,7 @@ public class NSClientPlugin extends PluginBase {
|
|||
@Subscribe
|
||||
public void onStatusEvent(final EventNSClientNewLog ev) {
|
||||
addToLog(ev);
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug(ev.action + " " + ev.logText);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,10 +21,9 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.services.Intents;
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
|
@ -48,7 +47,7 @@ import info.nightscout.utils.SP;
|
|||
*/
|
||||
|
||||
public class NSUpload {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.NSCLIENT);
|
||||
private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
|
||||
|
||||
public static void uploadTempBasalStartAbsolute(TemporaryBasal temporaryBasal, Double originalExtendedAmount) {
|
||||
try {
|
||||
|
@ -237,7 +236,7 @@ public class NSUpload {
|
|||
deviceStatus.enacted.put("requested", requested);
|
||||
}
|
||||
} else {
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("OpenAPS data too old to upload");
|
||||
}
|
||||
deviceStatus.device = "openaps://" + Build.MANUFACTURER + " " + Build.MODEL;
|
||||
|
|
|
@ -13,18 +13,17 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||
import info.nightscout.androidaps.db.DbRequest;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.services.NSClientService;
|
||||
|
||||
/**
|
||||
* Created by mike on 21.02.2016.
|
||||
*/
|
||||
public class UploadQueue {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.NSCLIENT);
|
||||
private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
|
||||
|
||||
public static String status() {
|
||||
return "QUEUE: " + MainApp.getDbHelper().size(DatabaseHelper.DATABASE_DBREQUESTS);
|
||||
|
@ -46,7 +45,7 @@ public class UploadQueue {
|
|||
startService();
|
||||
if (NSClientService.handler != null) {
|
||||
NSClientService.handler.post(() -> {
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("Adding to queue: " + dbr.data);
|
||||
MainApp.getDbHelper().create(dbr);
|
||||
NSClientPlugin plugin = NSClientPlugin.getPlugin();
|
||||
|
@ -61,10 +60,10 @@ public class UploadQueue {
|
|||
startService();
|
||||
if (NSClientService.handler != null) {
|
||||
NSClientService.handler.post(() -> {
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("ClearQueue");
|
||||
MainApp.getDbHelper().deleteAllDbRequests();
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug(status());
|
||||
});
|
||||
}
|
||||
|
@ -82,7 +81,7 @@ public class UploadQueue {
|
|||
return;
|
||||
}
|
||||
if (MainApp.getDbHelper().deleteDbRequest(id) == 1) {
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("Removed item from UploadQueue. " + UploadQueue.status());
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
|
@ -99,7 +98,7 @@ public class UploadQueue {
|
|||
if (NSClientService.handler != null) {
|
||||
NSClientService.handler.post(() -> {
|
||||
MainApp.getDbHelper().deleteDbRequestbyMongoId(action, _id);
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("Removing " + _id + " from UploadQueue. " + UploadQueue.status());
|
||||
});
|
||||
}
|
||||
|
|
|
@ -5,10 +5,9 @@ import org.json.JSONObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.events.Event;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientRestart;
|
||||
import io.socket.client.Ack;
|
||||
|
||||
|
@ -16,7 +15,7 @@ import io.socket.client.Ack;
|
|||
* Created by mike on 29.12.2015.
|
||||
*/
|
||||
public class NSAddAck extends Event implements Ack {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.NSCLIENT);
|
||||
private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
|
||||
public String _id = null;
|
||||
public String nsClientID = null;
|
||||
public JSONObject json = null;
|
||||
|
@ -48,7 +47,7 @@ public class NSAddAck extends Event implements Ack {
|
|||
MainApp.bus().post(new EventNSClientRestart());
|
||||
return;
|
||||
}
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("DBACCESS " + response.getString("result"));
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -5,16 +5,16 @@ import org.json.JSONObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.events.Event;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import io.socket.client.Ack;
|
||||
|
||||
/**
|
||||
* Created by mike on 21.02.2016.
|
||||
*/
|
||||
public class NSUpdateAck extends Event implements Ack {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.NSCLIENT);
|
||||
private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
|
||||
public boolean result = false;
|
||||
public String _id;
|
||||
public String action;
|
||||
|
|
|
@ -9,9 +9,9 @@ import android.support.v4.content.LocalBroadcastManager;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.services.Intents;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSSettingsStatus;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.services.NSClientService;
|
||||
|
@ -21,7 +21,7 @@ import info.nightscout.utils.SP;
|
|||
* Created by mike on 24.02.2016.
|
||||
*/
|
||||
public class BroadcastStatus {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.NSCLIENT);
|
||||
private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
|
||||
|
||||
public static void handleNewStatus(NSSettingsStatus status, Context context, boolean isDelta) {
|
||||
LocalBroadcastManager.getInstance(MainApp.instance())
|
||||
|
|
|
@ -13,9 +13,9 @@ import org.slf4j.LoggerFactory;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.services.Intents;
|
||||
import info.nightscout.utils.SP;
|
||||
|
||||
|
@ -23,7 +23,7 @@ import info.nightscout.utils.SP;
|
|||
* Created by mike on 20.02.2016.
|
||||
*/
|
||||
public class BroadcastTreatment {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.NSCLIENT);
|
||||
private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
|
||||
|
||||
public static void handleNewTreatment(JSONObject treatment, boolean isDelta, boolean isLocalBypass) {
|
||||
|
||||
|
|
|
@ -8,25 +8,24 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
/**
|
||||
* Created by mike on 02.07.2016.
|
||||
*/
|
||||
public class DbLogger {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.NSCLIENT);
|
||||
private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
|
||||
|
||||
public static void dbAdd(Intent intent, String data) {
|
||||
List<ResolveInfo> q = MainApp.instance().getApplicationContext().getPackageManager().queryBroadcastReceivers(intent, 0);
|
||||
if (q.size() < 1) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.nsclientnotinstalled));
|
||||
log.error("DBADD No receivers");
|
||||
} else if (Config.logNsclient) {
|
||||
if (Config.logNsclient)
|
||||
} else if (L.isEnabled(L.NSCLIENT)) {
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("DBADD dbAdd " + q.size() + " receivers " + data);
|
||||
}
|
||||
}
|
||||
|
@ -36,8 +35,8 @@ public class DbLogger {
|
|||
if (q.size() < 1) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.nsclientnotinstalled));
|
||||
log.error("DBREMOVE No receivers");
|
||||
} else if (Config.logNsclient) {
|
||||
if (Config.logNsclient)
|
||||
} else if (L.isEnabled(L.NSCLIENT)) {
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("DBREMOVE dbRemove " + q.size() + " receivers " + data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,14 +5,14 @@ import org.json.JSONObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 11.06.2017.
|
||||
*/
|
||||
|
||||
public class NSAlarm {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.NSCLIENT);
|
||||
private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
|
||||
|
||||
JSONObject data;
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ import org.json.JSONObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
public class NSCal {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.NSCLIENT);
|
||||
private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
|
||||
public long date;
|
||||
public double slope;
|
||||
public double intercept;
|
||||
|
|
|
@ -15,12 +15,11 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConstraintsObjectives.ObjectivesPlugin;
|
||||
import info.nightscout.androidaps.plugins.Loop.APSResult;
|
||||
import info.nightscout.utils.BundleLogger;
|
||||
import info.nightscout.androidaps.logging.BundleLogger;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.Round;
|
||||
import info.nightscout.utils.SP;
|
||||
|
@ -80,7 +79,7 @@ import info.nightscout.utils.SP;
|
|||
}
|
||||
*/
|
||||
public class NSDeviceStatus {
|
||||
private Logger log = LoggerFactory.getLogger(Constants.NSCLIENT);
|
||||
private Logger log = LoggerFactory.getLogger(L.NSCLIENT);
|
||||
|
||||
private static NSDeviceStatus instance = null;
|
||||
|
||||
|
@ -99,7 +98,7 @@ public class NSDeviceStatus {
|
|||
Bundle bundle = intent.getExtras();
|
||||
if (bundle == null) return;
|
||||
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("Got NS devicestatus: " + BundleLogger.log(bundle));
|
||||
|
||||
try {
|
||||
|
|
|
@ -5,10 +5,10 @@ import org.json.JSONObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
public class NSMbg {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.NSCLIENT);
|
||||
private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
|
||||
public long date;
|
||||
public double mbg;
|
||||
public String json;
|
||||
|
|
|
@ -14,14 +14,14 @@ import java.util.Date;
|
|||
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.logging.L;
|
||||
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;
|
||||
import info.nightscout.androidaps.logging.BundleLogger;
|
||||
|
||||
/*
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ import info.nightscout.utils.BundleLogger;
|
|||
}
|
||||
*/
|
||||
public class NSSettingsStatus {
|
||||
private Logger log = LoggerFactory.getLogger(Constants.NSCLIENT);
|
||||
private Logger log = LoggerFactory.getLogger(L.NSCLIENT);
|
||||
|
||||
private static NSSettingsStatus instance = null;
|
||||
|
||||
|
@ -140,7 +140,7 @@ public class NSSettingsStatus {
|
|||
Bundle bundle = intent.getExtras();
|
||||
if (bundle == null) return;
|
||||
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("Got NS status: " + BundleLogger.log(bundle));
|
||||
|
||||
if (bundle.containsKey("nsclientversioncode")) {
|
||||
|
@ -149,7 +149,7 @@ public class NSSettingsStatus {
|
|||
nightscoutVersionName = bundle.getString("nightscoutversionname");
|
||||
Integer nsClientVersionCode = bundle.getInt("nsclientversioncode");
|
||||
String nsClientVersionName = bundle.getString("nsclientversionname");
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("Got versions: NSClient: " + nsClientVersionName + " Nightscout: " + nightscoutVersionName);
|
||||
try {
|
||||
if (nsClientVersionCode < MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionCode) {
|
||||
|
@ -175,7 +175,7 @@ public class NSSettingsStatus {
|
|||
try {
|
||||
JSONObject statusJson = new JSONObject(bundle.getString("status"));
|
||||
setData(statusJson);
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("Received status: " + statusJson.toString());
|
||||
Double targetHigh = getThreshold("bgTargetTop");
|
||||
Double targetlow = getThreshold("bgTargetBottom");
|
||||
|
|
|
@ -5,14 +5,14 @@ import org.json.JSONObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
*
|
||||
* {"mgdl":105,"mills":1455136282375,"device":"xDrip-BluetoothWixel","direction":"Flat","filtered":98272,"unfiltered":98272,"noise":1,"rssi":100}
|
||||
*/
|
||||
public class NSSgv {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.NSCLIENT);
|
||||
private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
|
||||
|
||||
private JSONObject data;
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
public class NSTreatment {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.NSCLIENT);
|
||||
private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
|
||||
|
||||
private JSONObject data;
|
||||
private String action = null; // "update", "remove" or null (add)
|
||||
|
|
|
@ -9,19 +9,17 @@ import android.os.PowerManager;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientPlugin;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.AlarmAck;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.services.NSClientService;
|
||||
import info.nightscout.utils.SP;
|
||||
|
||||
public class AckAlarmReceiver extends BroadcastReceiver {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.NSCLIENT);
|
||||
private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -34,7 +32,7 @@ public class AckAlarmReceiver extends BroadcastReceiver {
|
|||
return;
|
||||
}
|
||||
if (SP.getBoolean(R.string.key_ns_noupload, false)) {
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("Upload disabled. Message dropped");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -11,11 +11,11 @@ import org.json.JSONObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.db.DbRequest;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientPlugin;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.broadcasts.BroadcastTreatment;
|
||||
|
@ -23,7 +23,7 @@ import info.nightscout.utils.DateUtil;
|
|||
import info.nightscout.utils.SP;
|
||||
|
||||
public class DBAccessReceiver extends BroadcastReceiver {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.NSCLIENT);
|
||||
private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
|
||||
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.net.URISyntaxException;
|
|||
import java.sql.SQLException;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.ProfileStore;
|
||||
|
@ -33,6 +32,7 @@ import info.nightscout.androidaps.events.EventAppExit;
|
|||
import info.nightscout.androidaps.events.EventConfigBuilderChange;
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientPlugin;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.acks.NSAddAck;
|
||||
|
@ -69,7 +69,7 @@ import io.socket.client.Socket;
|
|||
import io.socket.emitter.Emitter;
|
||||
|
||||
public class NSClientService extends Service {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.NSCLIENT);
|
||||
private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
|
||||
|
||||
static public PowerManager.WakeLock mWakeLock;
|
||||
private IBinder mBinder = new NSClientService.LocalBinder();
|
||||
|
@ -155,13 +155,13 @@ public class NSClientService extends Service {
|
|||
|
||||
@Subscribe
|
||||
public void onStatusEvent(EventAppExit event) {
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("EventAppExit received");
|
||||
|
||||
destroy();
|
||||
|
||||
stopSelf();
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("EventAppExit finished");
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ public class NSClientService extends Service {
|
|||
private Emitter.Listener onDisconnect = new Emitter.Listener() {
|
||||
@Override
|
||||
public void call(Object... args) {
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("disconnect reason: {}", args);
|
||||
MainApp.bus().post(new EventNSClientNewLog("NSCLIENT", "disconnect event"));
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ public class NSClientService extends Service {
|
|||
log.error("Unhandled exception", e);
|
||||
}
|
||||
BroadcastAnnouncement.handleAnnouncement(data, getApplicationContext());
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug(data.toString());
|
||||
}
|
||||
};
|
||||
|
@ -392,7 +392,7 @@ public class NSClientService extends Service {
|
|||
return;
|
||||
}
|
||||
BroadcastAlarm.handleAlarm(data, getApplicationContext());
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug(data.toString());
|
||||
}
|
||||
};
|
||||
|
@ -423,7 +423,7 @@ public class NSClientService extends Service {
|
|||
}
|
||||
MainApp.bus().post(new EventNSClientNewLog("URGENTALARM", "received"));
|
||||
BroadcastUrgentAlarm.handleUrgentAlarm(data, getApplicationContext());
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug(data.toString());
|
||||
}
|
||||
};
|
||||
|
@ -449,7 +449,7 @@ public class NSClientService extends Service {
|
|||
}
|
||||
MainApp.bus().post(new EventNSClientNewLog("CLEARALARM", "received"));
|
||||
BroadcastClearAlarm.handleClearAlarm(data, getApplicationContext());
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug(data.toString());
|
||||
}
|
||||
};
|
||||
|
@ -759,7 +759,7 @@ public class NSClientService extends Service {
|
|||
if (mSocket == null || !mSocket.connected()) return;
|
||||
|
||||
if (lastResendTime > System.currentTimeMillis() - 10 * 1000L) {
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("Skipping resend by lastResendTime: " + ((System.currentTimeMillis() - lastResendTime) / 1000L) + " sec");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.slf4j.LoggerFactory;
|
|||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
|
@ -26,6 +25,7 @@ import info.nightscout.androidaps.data.IobTotal;
|
|||
import info.nightscout.androidaps.data.MealData;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
|
||||
import info.nightscout.androidaps.plugins.Loop.ScriptReader;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.LoggerCallback;
|
||||
|
@ -34,7 +34,7 @@ import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
|||
import info.nightscout.utils.SP;
|
||||
|
||||
public class DetermineBasalAdapterAMAJS {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.APS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.APS);
|
||||
|
||||
|
||||
private ScriptReader mScriptReader = null;
|
||||
|
@ -61,7 +61,7 @@ public class DetermineBasalAdapterAMAJS {
|
|||
|
||||
public DetermineBasalResultAMA invoke() {
|
||||
|
||||
if (Config.logAps) {
|
||||
if (L.isEnabled(L.APS)) {
|
||||
log.debug(">>> Invoking detemine_basal <<<");
|
||||
log.debug("Glucose status: " + (storedGlucoseStatus = mGlucoseStatus.toString()));
|
||||
log.debug("IOB data: " + (storedIobData = mIobData.toString()));
|
||||
|
@ -119,7 +119,7 @@ public class DetermineBasalAdapterAMAJS {
|
|||
|
||||
// Parse the jsResult object to a JSON-String
|
||||
String result = NativeJSON.stringify(rhino, scope, jsResult, null, null).toString();
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("Result: " + result);
|
||||
try {
|
||||
determineBasalResultAMA = new DetermineBasalResultAMA(jsResult, new JSONObject(result));
|
||||
|
|
|
@ -6,12 +6,12 @@ import org.mozilla.javascript.NativeObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.Loop.APSResult;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
|
||||
public class DetermineBasalResultAMA extends APSResult {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.APS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.APS);
|
||||
|
||||
private double eventualBG;
|
||||
private double snoozeBG;
|
||||
|
|
|
@ -16,9 +16,9 @@ import org.json.JSONException;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
|
||||
|
@ -26,7 +26,7 @@ import info.nightscout.utils.FabricPrivacy;
|
|||
import info.nightscout.utils.JSONFormatter;
|
||||
|
||||
public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnClickListener {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.APS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.APS);
|
||||
|
||||
Button run;
|
||||
TextView lastRunView;
|
||||
|
|
|
@ -6,8 +6,6 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
||||
|
@ -21,6 +19,7 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
|||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensData;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensResult;
|
||||
|
@ -39,7 +38,7 @@ import info.nightscout.utils.Round;
|
|||
* Created by mike on 05.08.2016.
|
||||
*/
|
||||
public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.APS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.APS);
|
||||
|
||||
private static OpenAPSAMAPlugin openAPSAMAPlugin;
|
||||
|
||||
|
@ -91,7 +90,7 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
|
|||
|
||||
@Override
|
||||
public void invoke(String initiator, boolean tempBasalFallback) {
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("invoke from " + initiator + " tempBasalFallback: " + tempBasalFallback);
|
||||
lastAPSResult = null;
|
||||
DetermineBasalAdapterAMAJS determineBasalAdapterAMAJS;
|
||||
|
@ -103,21 +102,21 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
|
|||
|
||||
if (profile == null) {
|
||||
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.noprofileselected)));
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug(MainApp.gs(R.string.noprofileselected));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isEnabled(PluginType.APS)) {
|
||||
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.openapsma_disabled)));
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug(MainApp.gs(R.string.openapsma_disabled));
|
||||
return;
|
||||
}
|
||||
|
||||
if (glucoseStatus == null) {
|
||||
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.openapsma_noglucosedata)));
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug(MainApp.gs(R.string.openapsma_noglucosedata));
|
||||
return;
|
||||
}
|
||||
|
@ -135,12 +134,12 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
|
|||
Date start = new Date();
|
||||
Date startPart = new Date();
|
||||
IobTotal[] iobArray = IobCobCalculatorPlugin.getPlugin().calculateIobArrayInDia(profile);
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
Profiler.log(log, "calculateIobArrayInDia()", startPart);
|
||||
|
||||
startPart = new Date();
|
||||
MealData mealData = TreatmentsPlugin.getPlugin().getMealData();
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
Profiler.log(log, "getMealData()", startPart);
|
||||
|
||||
double maxIob = MainApp.getConstraintChecker().getMaxIOBAllowed().value();
|
||||
|
@ -182,9 +181,9 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
|
|||
lastAutosensResult = new AutosensResult();
|
||||
lastAutosensResult.sensResult = "autosens disabled";
|
||||
}
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
Profiler.log(log, "detectSensitivityandCarbAbsorption()", startPart);
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
Profiler.log(log, "AMA data gathering", start);
|
||||
|
||||
start = new Date();
|
||||
|
@ -200,7 +199,7 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
|
|||
|
||||
|
||||
DetermineBasalResultAMA determineBasalResultAMA = determineBasalAdapterAMAJS.invoke();
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
Profiler.log(log, "AMA calculation", start);
|
||||
// Fix bug determine basal
|
||||
if (determineBasalResultAMA.rate == 0d && determineBasalResultAMA.duration == 0 && !TreatmentsPlugin.getPlugin().isTempBasalInProgress())
|
||||
|
|
|
@ -15,7 +15,6 @@ import org.slf4j.LoggerFactory;
|
|||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
||||
|
@ -23,12 +22,13 @@ import info.nightscout.androidaps.data.IobTotal;
|
|||
import info.nightscout.androidaps.data.MealData;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.Loop.ScriptReader;
|
||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||
import info.nightscout.utils.SP;
|
||||
|
||||
public class DetermineBasalAdapterMAJS {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.APS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.APS);
|
||||
|
||||
private ScriptReader mScriptReader;
|
||||
private JSONObject mProfile;
|
||||
|
@ -96,7 +96,7 @@ public class DetermineBasalAdapterMAJS {
|
|||
|
||||
// Parse the jsResult object to a JSON-String
|
||||
String result = NativeJSON.stringify(rhino, scope, jsResult, null, null).toString();
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("Result: " + result);
|
||||
try {
|
||||
determineBasalResultMA = new DetermineBasalResultMA(jsResult, new JSONObject(result));
|
||||
|
|
|
@ -6,11 +6,11 @@ import org.mozilla.javascript.NativeObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.Loop.APSResult;
|
||||
|
||||
public class DetermineBasalResultMA extends APSResult {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.APS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.APS);
|
||||
|
||||
public JSONObject json = new JSONObject();
|
||||
private double eventualBG;
|
||||
|
|
|
@ -4,8 +4,7 @@ import org.mozilla.javascript.ScriptableObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by adrian on 15/10/17.
|
||||
|
@ -14,7 +13,7 @@ import info.nightscout.androidaps.Constants;
|
|||
|
||||
public class LoggerCallback extends ScriptableObject {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.APS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.APS);
|
||||
|
||||
private static StringBuffer errorBuffer = new StringBuffer();
|
||||
private static StringBuffer logBuffer = new StringBuffer();
|
||||
|
@ -36,14 +35,14 @@ public class LoggerCallback extends ScriptableObject {
|
|||
}
|
||||
|
||||
public void jsFunction_log(Object obj1) {
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug(obj1.toString());
|
||||
logBuffer.append(obj1.toString());
|
||||
logBuffer.append(' ');
|
||||
}
|
||||
|
||||
public void jsFunction_error(Object obj1) {
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.error(obj1.toString());
|
||||
errorBuffer.append(obj1.toString());
|
||||
errorBuffer.append(' ');
|
||||
|
|
|
@ -6,8 +6,6 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
||||
|
@ -21,6 +19,7 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
|||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.Loop.APSResult;
|
||||
import info.nightscout.androidaps.plugins.Loop.ScriptReader;
|
||||
|
@ -39,7 +38,7 @@ import static info.nightscout.utils.HardLimits.verifyHardLimits;
|
|||
* Created by mike on 05.08.2016.
|
||||
*/
|
||||
public class OpenAPSMAPlugin extends PluginBase implements APSInterface {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.APS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.APS);
|
||||
|
||||
private static OpenAPSMAPlugin openAPSMAPlugin;
|
||||
|
||||
|
@ -90,7 +89,7 @@ public class OpenAPSMAPlugin extends PluginBase implements APSInterface {
|
|||
|
||||
@Override
|
||||
public void invoke(String initiator, boolean tempBasalFallback) {
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("invoke from " + initiator + " tempBasalFallback: " + tempBasalFallback);
|
||||
lastAPSResult = null;
|
||||
DetermineBasalAdapterMAJS determineBasalAdapterMAJS = null;
|
||||
|
@ -102,21 +101,21 @@ public class OpenAPSMAPlugin extends PluginBase implements APSInterface {
|
|||
|
||||
if (profile == null) {
|
||||
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.noprofileselected)));
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug(MainApp.gs(R.string.noprofileselected));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isEnabled(PluginType.APS)) {
|
||||
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.openapsma_disabled)));
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug(MainApp.gs(R.string.openapsma_disabled));
|
||||
return;
|
||||
}
|
||||
|
||||
if (glucoseStatus == null) {
|
||||
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.openapsma_noglucosedata)));
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug(MainApp.gs(R.string.openapsma_noglucosedata));
|
||||
return;
|
||||
}
|
||||
|
@ -143,7 +142,7 @@ public class OpenAPSMAPlugin extends PluginBase implements APSInterface {
|
|||
MealData mealData = TreatmentsPlugin.getPlugin().getMealData();
|
||||
|
||||
double maxIob = MainApp.getConstraintChecker().getMaxIOBAllowed().value();
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
Profiler.log(log, "MA data gathering", start);
|
||||
|
||||
minBg = verifyHardLimits(minBg, "minBg", HardLimits.VERY_HARD_LIMIT_MIN_BG[0], HardLimits.VERY_HARD_LIMIT_MIN_BG[1]);
|
||||
|
@ -174,7 +173,7 @@ public class OpenAPSMAPlugin extends PluginBase implements APSInterface {
|
|||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
Profiler.log(log, "MA calculation", start);
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.slf4j.LoggerFactory;
|
|||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
|
@ -26,6 +25,7 @@ import info.nightscout.androidaps.data.IobTotal;
|
|||
import info.nightscout.androidaps.data.MealData;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
|
||||
import info.nightscout.androidaps.plugins.Loop.ScriptReader;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.LoggerCallback;
|
||||
|
@ -34,7 +34,7 @@ import info.nightscout.utils.SP;
|
|||
import info.nightscout.utils.SafeParse;
|
||||
|
||||
public class DetermineBasalAdapterSMBJS {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.APS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.APS);
|
||||
|
||||
|
||||
private ScriptReader mScriptReader;
|
||||
|
@ -71,7 +71,7 @@ public class DetermineBasalAdapterSMBJS {
|
|||
public DetermineBasalResultSMB invoke() {
|
||||
|
||||
|
||||
if (Config.logAps) {
|
||||
if (L.isEnabled(L.APS)) {
|
||||
log.debug(">>> Invoking detemine_basal <<<");
|
||||
log.debug("Glucose status: " + (storedGlucoseStatus = mGlucoseStatus.toString()));
|
||||
log.debug("IOB data: " + (storedIobData = mIobData.toString()));
|
||||
|
@ -136,7 +136,7 @@ public class DetermineBasalAdapterSMBJS {
|
|||
|
||||
// Parse the jsResult object to a JSON-String
|
||||
String result = NativeJSON.stringify(rhino, scope, jsResult, null, null).toString();
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("Result: " + result);
|
||||
try {
|
||||
determineBasalResultSMB = new DetermineBasalResultSMB(new JSONObject(result));
|
||||
|
|
|
@ -5,12 +5,12 @@ import org.json.JSONObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.Loop.APSResult;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
|
||||
public class DetermineBasalResultSMB extends APSResult {
|
||||
private static final Logger log = LoggerFactory.getLogger(Constants.APS);
|
||||
private static final Logger log = LoggerFactory.getLogger(L.APS);
|
||||
|
||||
private double eventualBG;
|
||||
private double snoozeBG;
|
||||
|
|
|
@ -19,9 +19,9 @@ import org.slf4j.LoggerFactory;
|
|||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
|
||||
|
@ -29,7 +29,7 @@ import info.nightscout.utils.FabricPrivacy;
|
|||
import info.nightscout.utils.JSONFormatter;
|
||||
|
||||
public class OpenAPSSMBFragment extends SubscriberFragment {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.APS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.APS);
|
||||
|
||||
@BindView(R.id.openapsma_run)
|
||||
Button run;
|
||||
|
|
|
@ -6,8 +6,6 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
||||
|
@ -22,6 +20,7 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
|||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensData;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensResult;
|
||||
|
@ -42,7 +41,7 @@ import info.nightscout.utils.ToastUtils;
|
|||
* Created by mike on 05.08.2016.
|
||||
*/
|
||||
public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.APS);
|
||||
private static Logger log = LoggerFactory.getLogger(L.APS);
|
||||
|
||||
private static OpenAPSSMBPlugin openAPSSMBPlugin;
|
||||
|
||||
|
@ -94,7 +93,7 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
|
|||
|
||||
@Override
|
||||
public void invoke(String initiator, boolean tempBasalFallback) {
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug("invoke from " + initiator + " tempBasalFallback: " + tempBasalFallback);
|
||||
lastAPSResult = null;
|
||||
DetermineBasalAdapterSMBJS determineBasalAdapterSMBJS;
|
||||
|
@ -106,21 +105,21 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
|
|||
|
||||
if (profile == null) {
|
||||
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.noprofileselected)));
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug(MainApp.gs(R.string.noprofileselected));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isEnabled(PluginType.APS)) {
|
||||
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.openapsma_disabled)));
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug(MainApp.gs(R.string.openapsma_disabled));
|
||||
return;
|
||||
}
|
||||
|
||||
if (glucoseStatus == null) {
|
||||
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.openapsma_noglucosedata)));
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
log.debug(MainApp.gs(R.string.openapsma_noglucosedata));
|
||||
return;
|
||||
}
|
||||
|
@ -142,12 +141,12 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
|
|||
Date start = new Date();
|
||||
Date startPart = new Date();
|
||||
IobTotal[] iobArray = IobCobCalculatorPlugin.getPlugin().calculateIobArrayForSMB(profile);
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
Profiler.log(log, "calculateIobArrayInDia()", startPart);
|
||||
|
||||
startPart = new Date();
|
||||
MealData mealData = TreatmentsPlugin.getPlugin().getMealData();
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
Profiler.log(log, "getMealData()", startPart);
|
||||
|
||||
double maxIob = MainApp.getConstraintChecker().getMaxIOBAllowed().value();
|
||||
|
@ -198,9 +197,9 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
|
|||
MainApp.getConstraintChecker().isAdvancedFilteringEnabled(advancedFiltering);
|
||||
inputConstraints.copyReasons(advancedFiltering);
|
||||
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
Profiler.log(log, "detectSensitivityandCarbAbsorption()", startPart);
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
Profiler.log(log, "SMB data gathering", start);
|
||||
|
||||
start = new Date();
|
||||
|
@ -219,7 +218,7 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
|
|||
long now = System.currentTimeMillis();
|
||||
|
||||
DetermineBasalResultSMB determineBasalResultSMB = determineBasalAdapterSMBJS.invoke();
|
||||
if (Config.logAps)
|
||||
if (L.isEnabled(L.APS))
|
||||
Profiler.log(log, "SMB calculation", start);
|
||||
// TODO still needed with oref1?
|
||||
// Fix bug determine basal
|
||||
|
|
|
@ -80,6 +80,7 @@ import info.nightscout.androidaps.interfaces.Constraint;
|
|||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
||||
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||
|
@ -125,7 +126,7 @@ import info.nightscout.utils.ToastUtils;
|
|||
import static info.nightscout.utils.DateUtil.now;
|
||||
|
||||
public class OverviewFragment extends Fragment implements View.OnClickListener, View.OnLongClickListener {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.OVERVIEW);
|
||||
private static Logger log = LoggerFactory.getLogger(L.OVERVIEW);
|
||||
|
||||
TextView timeView;
|
||||
TextView bgView;
|
||||
|
@ -825,7 +826,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
builder.setPositiveButton(MainApp.gs(R.string.ok), (dialog, id) -> {
|
||||
synchronized (builder) {
|
||||
if (accepted) {
|
||||
if (Config.logOverview)
|
||||
if (L.isEnabled(L.OVERVIEW))
|
||||
log.debug("guarding: already accepted");
|
||||
return;
|
||||
}
|
||||
|
@ -1031,7 +1032,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
|
||||
@SuppressLint("SetTextI18n")
|
||||
public void updateGUI(final String from) {
|
||||
if (Config.logOverview)
|
||||
if (L.isEnabled(L.OVERVIEW))
|
||||
log.debug("updateGUI entered from: " + from);
|
||||
final Date updateGUIStart = new Date();
|
||||
|
||||
|
@ -1427,7 +1428,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
final long now = System.currentTimeMillis();
|
||||
|
||||
// ------------------ 1st graph
|
||||
if (Config.logOverview)
|
||||
if (L.isEnabled(L.OVERVIEW))
|
||||
Profiler.log(log, from + " - 1st graph - START", updateGUIStart);
|
||||
|
||||
final GraphData graphData = new GraphData(bgGraph, IobCobCalculatorPlugin.getPlugin());
|
||||
|
@ -1460,7 +1461,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
graphData.addNowLine(now);
|
||||
|
||||
// ------------------ 2nd graph
|
||||
if (Config.logOverview)
|
||||
if (L.isEnabled(L.OVERVIEW))
|
||||
Profiler.log(log, from + " - 2nd graph - START", updateGUIStart);
|
||||
|
||||
final GraphData secondGraphData = new GraphData(iobGraph, IobCobCalculatorPlugin.getPlugin());
|
||||
|
@ -1515,13 +1516,13 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
// finally enforce drawing of graphs
|
||||
graphData.performUpdate();
|
||||
secondGraphData.performUpdate();
|
||||
if (Config.logOverview)
|
||||
if (L.isEnabled(L.OVERVIEW))
|
||||
Profiler.log(log, from + " - onDataChanged", updateGUIStart);
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
|
||||
if (Config.logOverview)
|
||||
if (L.isEnabled(L.OVERVIEW))
|
||||
Profiler.log(log, from, updateGUIStart);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.json.JSONException;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
|
@ -16,6 +15,7 @@ import info.nightscout.androidaps.events.EventRefreshOverview;
|
|||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.notifications.NotificationStore;
|
||||
|
@ -25,7 +25,7 @@ import info.nightscout.utils.SP;
|
|||
* Created by mike on 05.08.2016.
|
||||
*/
|
||||
public class OverviewPlugin extends PluginBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.OVERVIEW);
|
||||
private static Logger log = LoggerFactory.getLogger(L.OVERVIEW);
|
||||
|
||||
private static OverviewPlugin overviewPlugin = new OverviewPlugin();
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
|
@ -28,6 +27,7 @@ import info.nightscout.androidaps.db.CareportalEvent;
|
|||
import info.nightscout.androidaps.db.ExtendedBolus;
|
||||
import info.nightscout.androidaps.db.ProfileSwitch;
|
||||
import info.nightscout.androidaps.db.TempTarget;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensData;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.BasalData;
|
||||
|
@ -51,7 +51,7 @@ import info.nightscout.utils.Round;
|
|||
*/
|
||||
|
||||
public class GraphData {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.OVERVIEW);
|
||||
private static Logger log = LoggerFactory.getLogger(L.OVERVIEW);
|
||||
|
||||
private GraphView graph;
|
||||
public double maxY = Double.MIN_VALUE;
|
||||
|
@ -75,7 +75,7 @@ public class GraphData {
|
|||
List<DataPointWithLabelInterface> bgListArray = new ArrayList<>();
|
||||
|
||||
if (bgReadingsArray == null || bgReadingsArray.size() == 0) {
|
||||
if (Config.logOverview)
|
||||
if (L.isEnabled(L.OVERVIEW))
|
||||
log.debug("No BG data.");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -15,10 +15,9 @@ import org.slf4j.LoggerFactory;
|
|||
import java.util.List;
|
||||
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.logging.L;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.broadcasts.BroadcastAckAlarm;
|
||||
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
||||
|
@ -26,7 +25,7 @@ import info.nightscout.utils.DateUtil;
|
|||
import info.nightscout.utils.SP;
|
||||
|
||||
public class NotificationRecyclerViewAdapter extends RecyclerView.Adapter<NotificationRecyclerViewAdapter.NotificationsViewHolder> {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.NOTIFICATION);
|
||||
private static Logger log = LoggerFactory.getLogger(L.NOTIFICATION);
|
||||
|
||||
private List<Notification> notificationsList;
|
||||
|
||||
|
@ -98,12 +97,12 @@ public class NotificationRecyclerViewAdapter extends RecyclerView.Adapter<Notifi
|
|||
BroadcastAckAlarm.handleClearAlarm(notification.nsAlarm, MainApp.instance().getApplicationContext(), 60 * 60 * 1000L);
|
||||
}
|
||||
// Adding current time to snooze if we got staleData
|
||||
if (Config.logNotification)
|
||||
if (L.isEnabled(L.NOTIFICATION))
|
||||
log.debug("Notification text is: " + notification.text);
|
||||
if (notification.text.equals(MainApp.gs(R.string.nsalarm_staledata))) {
|
||||
NotificationStore nstore = OverviewPlugin.getPlugin().notificationStore;
|
||||
long msToSnooze = SP.getInt("nsalarm_staledatavalue", 15) * 60 * 1000L;
|
||||
if (Config.logNotification)
|
||||
if (L.isEnabled(L.NOTIFICATION))
|
||||
log.debug("snooze nsalarm_staledatavalue in minutes is " + SP.getInt("nsalarm_staledatavalue", 15) + "\n in ms is: " + msToSnooze + " currentTimeMillis is: " + System.currentTimeMillis());
|
||||
nstore.snoozeTo(System.currentTimeMillis() + (SP.getInt("nsalarm_staledatavalue", 15) * 60 * 1000L));
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ import java.util.Comparator;
|
|||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.services.AlarmSoundService;
|
||||
import info.nightscout.utils.SP;
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class NotificationStore {
|
|||
|
||||
private static final String CHANNEL_ID = "AndroidAPS-Overview";
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.NOTIFICATION);
|
||||
private static Logger log = LoggerFactory.getLogger(L.NOTIFICATION);
|
||||
public List<Notification> store = new ArrayList<>();
|
||||
private boolean usesChannels;
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class NotificationStore {
|
|||
}
|
||||
|
||||
public synchronized boolean add(Notification n) {
|
||||
if (Config.logNotification)
|
||||
if (L.isEnabled(L.NOTIFICATION))
|
||||
log.debug("Notification received: " + n.text);
|
||||
for (Notification storeNotification : store) {
|
||||
if (storeNotification.id == n.id) {
|
||||
|
@ -108,7 +108,7 @@ public class NotificationStore {
|
|||
}
|
||||
|
||||
public void snoozeTo(long timeToSnooze) {
|
||||
if (Config.logNotification)
|
||||
if (L.isEnabled(L.NOTIFICATION))
|
||||
log.debug("Snoozing alarm until: " + timeToSnooze);
|
||||
SP.putLong("snoozedTo", timeToSnooze);
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ public class NotificationStore {
|
|||
Notification notification = new Notification(Notification.NSALARM, MainApp.gs(R.string.nsalarm_staledata), Notification.URGENT);
|
||||
SP.putLong("snoozedTo", System.currentTimeMillis());
|
||||
add(notification);
|
||||
if (Config.logNotification)
|
||||
if (L.isEnabled(L.NOTIFICATION))
|
||||
log.debug("Snoozed to current time and added back notification!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import info.nightscout.androidaps.Config;
|
|||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.services.Intents;
|
||||
import info.nightscout.androidaps.data.ProfileStore;
|
||||
import info.nightscout.androidaps.events.EventProfileStoreChanged;
|
||||
|
@ -77,7 +78,7 @@ public class NSProfilePlugin extends PluginBase implements ProfileInterface {
|
|||
MainApp.bus().post(new EventProfileStoreChanged());
|
||||
MainApp.bus().post(new EventNSProfileUpdateGUI());
|
||||
}
|
||||
if (Config.logNsclient)
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("Received profileStore: " + activeProfile + " " + profile);
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
|
|
|
@ -22,8 +22,6 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.BuildConfig;
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||
|
@ -42,6 +40,7 @@ import info.nightscout.androidaps.interfaces.PluginDescription;
|
|||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
||||
|
@ -71,7 +70,7 @@ import info.nightscout.utils.SP;
|
|||
* Created by mike on 05.08.2016.
|
||||
*/
|
||||
public class ComboPlugin extends PluginBase implements PumpInterface, ConstraintsInterface {
|
||||
private static final Logger log = LoggerFactory.getLogger(Constants.PUMP);
|
||||
private static final Logger log = LoggerFactory.getLogger(L.PUMP);
|
||||
static final String COMBO_TBRS_SET = "combo_tbrs_set";
|
||||
static final String COMBO_BOLUSES_DELIVERED = "combo_boluses_delivered";
|
||||
|
||||
|
@ -209,14 +208,14 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
public void onClick(DialogInterface dialog, int id) {
|
||||
pluginSwitcher.invoke();
|
||||
SP.putBoolean("allow_hardware_pump", true);
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("First time HW pump allowed!");
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
pluginSwitcher.cancel();
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("User does not allow switching to HW pump!");
|
||||
}
|
||||
});
|
||||
|
@ -264,7 +263,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
|
||||
@Override
|
||||
public void disconnect(String reason) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Disconnect called with reason: " + reason);
|
||||
ruffyScripter.disconnect();
|
||||
}
|
||||
|
@ -364,7 +363,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
*/
|
||||
@Override
|
||||
public synchronized void getPumpStatus() {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("getPumpStatus called");
|
||||
if (!pump.initialized) {
|
||||
initializePump();
|
||||
|
@ -377,11 +376,11 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
private synchronized void initializePump() {
|
||||
long maxWait = System.currentTimeMillis() + 15 * 1000;
|
||||
while (!ruffyScripter.isPumpAvailable()) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Waiting for ruffy service to come up ...");
|
||||
SystemClock.sleep(100);
|
||||
if (System.currentTimeMillis() > maxWait) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("ruffy service unavailable, wtf");
|
||||
return;
|
||||
}
|
||||
|
@ -401,7 +400,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
// note that since the history is checked upon every connect, the above already updated
|
||||
// the DB with any changed history records
|
||||
if (pumpHistoryChanged) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Pump history has changed and was imported");
|
||||
pumpHistoryChanged = false;
|
||||
}
|
||||
|
@ -551,7 +550,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
// within the last 1-2 minutes
|
||||
if (Math.abs(previousBolus.amount - detailedBolusInfo.insulin) < 0.01
|
||||
&& previousBolus.timestamp + 60 * 1000 > System.currentTimeMillis()) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Bolus request rejected, same bolus was successfully delivered very recently");
|
||||
return new PumpEnactResult().success(false).enacted(false)
|
||||
.comment(MainApp.gs(R.string.bolus_frequency_exceeded));
|
||||
|
@ -572,7 +571,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
return new PumpEnactResult().success(false).enacted(false)
|
||||
.comment(MainApp.gs(R.string.combo_error_no_connection_no_bolus_delivered));
|
||||
}
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Waiting for pump clock to advance for the next unused bolus record timestamp");
|
||||
SystemClock.sleep(2000);
|
||||
timeCheckResult = runCommand(null, 0, ruffyScripter::readPumpState);
|
||||
|
@ -584,7 +583,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION)
|
||||
.putCustomAttribute("waitTimeSecs", String.valueOf(waitDuration)));
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Waited " + waitDuration + "s for pump to switch to a fresh minute before bolusing");
|
||||
}
|
||||
|
||||
|
@ -747,12 +746,12 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
*/
|
||||
@Override
|
||||
public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, Profile profile, boolean force) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("setTempBasalAbsolute called with a rate of " + absoluteRate + " for " + durationInMinutes + " min.");
|
||||
int unroundedPercentage = Double.valueOf(absoluteRate / getBaseBasalRate() * 100).intValue();
|
||||
int roundedPercentage = (int) (Math.round(absoluteRate / getBaseBasalRate() * 10) * 10);
|
||||
if (unroundedPercentage != roundedPercentage) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Rounded requested rate " + unroundedPercentage + "% -> " + roundedPercentage + "%");
|
||||
}
|
||||
|
||||
|
@ -771,7 +770,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
}
|
||||
|
||||
private PumpEnactResult setTempBasalPercent(Integer percent, final Integer durationInMinutes) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("setTempBasalPercent called with " + percent + "% for " + durationInMinutes + "min");
|
||||
|
||||
if (pumpHistoryChanged && percent > 110) {
|
||||
|
@ -782,14 +781,14 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
int adjustedPercent = percent;
|
||||
|
||||
if (adjustedPercent > pumpDescription.maxTempPercent) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Reducing requested TBR to the maximum support by the pump: " + percent + " -> " + pumpDescription.maxTempPercent);
|
||||
adjustedPercent = pumpDescription.maxTempPercent;
|
||||
}
|
||||
|
||||
if (adjustedPercent % 10 != 0) {
|
||||
Long rounded = Math.round(adjustedPercent / 10d) * 10;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Rounded requested percentage:" + adjustedPercent + " -> " + rounded);
|
||||
adjustedPercent = rounded.intValue();
|
||||
}
|
||||
|
@ -839,7 +838,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
*/
|
||||
@Override
|
||||
public PumpEnactResult cancelTempBasal(boolean enforceNew) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("cancelTempBasal called");
|
||||
final TemporaryBasal activeTemp = TreatmentsPlugin.getPlugin().getTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (enforceNew) {
|
||||
|
@ -850,7 +849,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
if (!stateResult.state.tbrActive) {
|
||||
return new PumpEnactResult().success(true).enacted(false);
|
||||
}
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("cancelTempBasal: hard-cancelling TBR since force requested");
|
||||
CommandResult cancelResult = runCommand(MainApp.gs(R.string.combo_pump_action_cancelling_tbr), 2, ruffyScripter::cancelTbr);
|
||||
if (!cancelResult.success) {
|
||||
|
@ -872,7 +871,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
// Let fake neutral temp keep run (see below)
|
||||
// Note that since this runs on the queue a connection is opened regardless, but this
|
||||
// case doesn't occur all that often, so it's not worth optimizing (1.3k SetTBR vs 4 cancelTBR).
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("cancelTempBasal: skipping changing tbr since it already is at " + activeTemp.percentRate + "% and running for another " + activeTemp.getPlannedRemainingMinutes() + " mins.");
|
||||
return new PumpEnactResult().success(true).enacted(true)
|
||||
.comment("cancelTempBasal skipping changing tbr since it already is at "
|
||||
|
@ -882,7 +881,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
// Set a fake neutral temp to avoid TBR cancel alert. Decide 90% vs 110% based on
|
||||
// on whether the TBR we're cancelling is above or below 100%.
|
||||
final int percentage = (activeTemp.percentRate > 100) ? 110 : 90;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("cancelTempBasal: changing TBR to " + percentage + "% for 15 mins.");
|
||||
return setTempBasalPercent(percentage, 15);
|
||||
}
|
||||
|
@ -922,7 +921,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
|
||||
if (!commandResult.success && retries > 0) {
|
||||
for (int retryAttempts = 1; !commandResult.success && retryAttempts <= retries; retryAttempts++) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Command was not successful, retries requested, doing retry #" + retryAttempts);
|
||||
commandResult = commandExecution.execute();
|
||||
}
|
||||
|
@ -1004,7 +1003,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
long now = System.currentTimeMillis();
|
||||
TemporaryBasal aapsTbr = TreatmentsPlugin.getPlugin().getTempBasalFromHistory(now);
|
||||
if (aapsTbr == null || aapsTbr.percentRate != 0) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Creating 15m zero temp since pump is suspended");
|
||||
TemporaryBasal newTempBasal = new TemporaryBasal()
|
||||
.date(now)
|
||||
|
@ -1065,12 +1064,12 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
if (state.pumpTime == 0) {
|
||||
// time couldn't be read (e.g. a warning is displayed on the menu , hiding the time field)
|
||||
} else if (Math.abs(state.pumpTime - System.currentTimeMillis()) >= 10 * 60 * 1000) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Pump clock needs update, pump time: " + state.pumpTime + " (" + new Date(state.pumpTime) + ")");
|
||||
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_notification_check_time_date), Notification.URGENT);
|
||||
MainApp.bus().post(new EventNewNotification(notification));
|
||||
} else if (Math.abs(state.pumpTime - System.currentTimeMillis()) >= 3 * 60 * 1000) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Pump clock needs update, pump time: " + state.pumpTime + " (" + new Date(state.pumpTime) + ")");
|
||||
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_notification_check_time_date), Notification.NORMAL);
|
||||
MainApp.bus().post(new EventNewNotification(notification));
|
||||
|
@ -1133,7 +1132,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
long now = System.currentTimeMillis();
|
||||
TemporaryBasal aapsTbr = TreatmentsPlugin.getPlugin().getTempBasalFromHistory(now);
|
||||
if (aapsTbr == null && state.tbrActive && state.tbrRemainingDuration > 2) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Creating temp basal from pump TBR");
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboTbrMismatch")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
|
@ -1146,7 +1145,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
.source(Source.USER);
|
||||
TreatmentsPlugin.getPlugin().addToHistoryTempBasal(newTempBasal);
|
||||
} else if (aapsTbr != null && aapsTbr.getPlannedRemainingMinutes() > 2 && !state.tbrActive) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Ending AAPS-TBR since pump has no TBR active");
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboTbrMismatch")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
|
@ -1160,7 +1159,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
} else if (aapsTbr != null && state.tbrActive
|
||||
&& (aapsTbr.percentRate != state.tbrPercent ||
|
||||
Math.abs(aapsTbr.getPlannedRemainingMinutes() - state.tbrRemainingDuration) > 2)) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("AAPSs and pump-TBR differ; ending AAPS-TBR and creating new TBR based on pump TBR");
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboTbrMismatch")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
|
@ -1246,7 +1245,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
|
||||
// no history, nothing to check or complain about
|
||||
if (quickInfoResult.history == null || quickInfoResult.history.bolusHistory.isEmpty()) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Setting 'pumpHistoryChanged' false");
|
||||
pumpHistoryChanged = false;
|
||||
return null;
|
||||
|
@ -1256,14 +1255,14 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
List<Bolus> initialPumpBolusHistory = quickInfoResult.history.bolusHistory;
|
||||
if (recentBoluses.size() == 1 && initialPumpBolusHistory.size() >= 1
|
||||
&& recentBoluses.get(0).equals(quickInfoResult.history.bolusHistory.get(0))) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Setting 'pumpHistoryChanged' false");
|
||||
pumpHistoryChanged = false;
|
||||
return null;
|
||||
} else if (recentBoluses.size() == 2 && initialPumpBolusHistory.size() >= 2
|
||||
&& recentBoluses.get(0).equals(quickInfoResult.history.bolusHistory.get(0))
|
||||
&& recentBoluses.get(1).equals(quickInfoResult.history.bolusHistory.get(1))) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Setting 'pumpHistoryChanged' false");
|
||||
pumpHistoryChanged = false;
|
||||
return null;
|
||||
|
@ -1284,7 +1283,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
// for.
|
||||
HashSet<Bolus> bolusSet = new HashSet<>(historyResult.history.bolusHistory);
|
||||
if (bolusSet.size() != historyResult.history.bolusHistory.size()) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Bolus with same amount within the same minute imported. Only one will make it to the DB.");
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboBolusToDbError")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
|
@ -1298,7 +1297,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
|||
|
||||
pumpHistoryChanged = updateDbFromPumpHistory(historyResult.history);
|
||||
if (pumpHistoryChanged) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Setting 'pumpHistoryChanged' true");
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,6 @@ import org.slf4j.LoggerFactory;
|
|||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.BuildConfig;
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
|
@ -28,6 +26,7 @@ import info.nightscout.androidaps.interfaces.PluginType;
|
|||
import info.nightscout.androidaps.interfaces.ProfileInterface;
|
||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||
|
@ -45,7 +44,7 @@ import info.nightscout.utils.SP;
|
|||
*/
|
||||
|
||||
public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInterface, DanaRInterface, ConstraintsInterface, ProfileInterface {
|
||||
protected Logger log = LoggerFactory.getLogger(Constants.PUMP);
|
||||
protected Logger log = LoggerFactory.getLogger(L.PUMP);
|
||||
|
||||
protected AbstractDanaRExecutionService sExecutionService;
|
||||
|
||||
|
@ -135,7 +134,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
|
|||
Double profileValue = profile.getBasalTimeFromMidnight(h * basalIncrement);
|
||||
if (profileValue == null) return true;
|
||||
if (Math.abs(pumpValue - profileValue) > getPumpDescription().basalStep) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Diff found. Hour: " + h + " Pump: " + pumpValue + " Profile: " + profileValue);
|
||||
return false;
|
||||
}
|
||||
|
@ -186,7 +185,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
|
|||
result.duration = pump.tempBasalRemainingMin;
|
||||
result.percent = pump.tempBasalPercent;
|
||||
result.isPercent = true;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("setTempBasalPercent: Correct value already set");
|
||||
return result;
|
||||
}
|
||||
|
@ -200,7 +199,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
|
|||
result.duration = pump.tempBasalRemainingMin;
|
||||
result.percent = pump.tempBasalPercent;
|
||||
result.isPercent = true;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("setTempBasalPercent: OK");
|
||||
return result;
|
||||
}
|
||||
|
@ -228,7 +227,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
|
|||
result.absolute = pump.extendedBolusAbsoluteRate;
|
||||
result.isPercent = false;
|
||||
result.isTempCancel = false;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("setExtendedBolus: Correct extended bolus already set. Current: " + pump.extendedBolusAmount + " Asked: " + insulin);
|
||||
return result;
|
||||
}
|
||||
|
@ -243,7 +242,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
|
|||
if (!SP.getBoolean("danar_useextended", false))
|
||||
result.bolusDelivered = pump.extendedBolusAmount;
|
||||
result.isPercent = false;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("setExtendedBolus: OK");
|
||||
return result;
|
||||
}
|
||||
|
@ -266,7 +265,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
|
|||
if (!pump.isExtendedInProgress) {
|
||||
result.success = true;
|
||||
result.comment = MainApp.gs(R.string.virtualpump_resultok);
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("cancelExtendedBolus: OK");
|
||||
return result;
|
||||
} else {
|
||||
|
|
|
@ -23,8 +23,6 @@ import org.slf4j.LoggerFactory;
|
|||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.activities.TDDStatsActivity;
|
||||
|
@ -33,6 +31,7 @@ import info.nightscout.androidaps.events.EventExtendedBolusChange;
|
|||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||
import info.nightscout.androidaps.events.EventTempBasalChange;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.Dialogs.ProfileViewDialog;
|
||||
|
@ -47,7 +46,7 @@ import info.nightscout.utils.DecimalFormatter;
|
|||
import info.nightscout.utils.SetWarnColor;
|
||||
|
||||
public class DanaRFragment extends SubscriberFragment {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMP);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMP);
|
||||
|
||||
private Handler loopHandler = new Handler();
|
||||
private Runnable refreshLoop = new Runnable() {
|
||||
|
@ -146,7 +145,7 @@ public class DanaRFragment extends SubscriberFragment {
|
|||
|
||||
@OnClick(R.id.danar_btconnection)
|
||||
void onBtConnectionClick() {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Clicked connect to pump");
|
||||
DanaRPump.getInstance().lastConnection = 0;
|
||||
ConfigBuilderPlugin.getCommandQueue().readStatus("Clicked connect to pump", null);
|
||||
|
|
|
@ -11,9 +11,6 @@ import android.support.v7.app.AlertDialog;
|
|||
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||
|
@ -21,6 +18,7 @@ import info.nightscout.androidaps.data.Profile;
|
|||
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||
import info.nightscout.androidaps.db.ExtendedBolus;
|
||||
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgBolusStartWithSpeed;
|
||||
import info.nightscout.androidaps.plugins.Treatments.Treatment;
|
||||
|
@ -93,14 +91,14 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
public void onClick(DialogInterface dialog, int id) {
|
||||
pluginSwitcher.invoke();
|
||||
SP.putBoolean("allow_hardware_pump", true);
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("First time HW pump allowed!");
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
pluginSwitcher.cancel();
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("User does not allow switching to HW pump!");
|
||||
}
|
||||
});
|
||||
|
@ -128,13 +126,13 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
private ServiceConnection mConnection = new ServiceConnection() {
|
||||
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Service is disconnected");
|
||||
sExecutionService = null;
|
||||
}
|
||||
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Service is connected");
|
||||
DanaRExecutionService.LocalBinder mLocalBinder = (DanaRExecutionService.LocalBinder) service;
|
||||
sExecutionService = mLocalBinder.getServiceInstance();
|
||||
|
@ -198,7 +196,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
result.comment = String.format(MainApp.gs(R.string.boluserrorcode), detailedBolusInfo.insulin, t.insulin, MsgBolusStartWithSpeed.errorCode);
|
||||
else
|
||||
result.comment = MainApp.gs(R.string.virtualpump_resultok);
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered);
|
||||
detailedBolusInfo.insulin = t.insulin;
|
||||
detailedBolusInfo.date = System.currentTimeMillis();
|
||||
|
@ -240,13 +238,13 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
if (doTempOff) {
|
||||
// If extended in progress
|
||||
if (activeExtended != null && useExtendedBoluses) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("setTempBasalAbsolute: Stopping extended bolus (doTempOff)");
|
||||
return cancelExtendedBolus();
|
||||
}
|
||||
// If temp in progress
|
||||
if (activeTemp != null) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("setTempBasalAbsolute: Stopping temp basal (doTempOff)");
|
||||
return cancelRealTempBasal();
|
||||
}
|
||||
|
@ -255,7 +253,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
result.percent = 100;
|
||||
result.isPercent = true;
|
||||
result.isTempCancel = true;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("setTempBasalAbsolute: doTempOff OK");
|
||||
return result;
|
||||
}
|
||||
|
@ -267,12 +265,12 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
if (percentRate > getPumpDescription().maxTempPercent) {
|
||||
percentRate = getPumpDescription().maxTempPercent;
|
||||
}
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("setTempBasalAbsolute: Calculated percent rate: " + percentRate);
|
||||
|
||||
// If extended in progress
|
||||
if (activeExtended != null && useExtendedBoluses) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("setTempBasalAbsolute: Stopping extended bolus (doLowTemp || doHighTemp)");
|
||||
result = cancelExtendedBolus();
|
||||
if (!result.success) {
|
||||
|
@ -283,7 +281,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
// Check if some temp is already in progress
|
||||
if (activeTemp != null) {
|
||||
// Correct basal already set ?
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("setTempBasalAbsolute: currently running: " + activeTemp.toString());
|
||||
if (activeTemp.percentRate == percentRate) {
|
||||
if (enforceNew) {
|
||||
|
@ -295,21 +293,21 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
result.duration = activeTemp.getPlannedRemainingMinutes();
|
||||
result.isPercent = true;
|
||||
result.isTempCancel = false;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("setTempBasalAbsolute: Correct temp basal already set (doLowTemp || doHighTemp)");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Convert duration from minutes to hours
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("setTempBasalAbsolute: Setting temp basal " + percentRate + "% for " + durationInMinutes + " mins (doLowTemp || doHighTemp)");
|
||||
return setTempBasalPercent(percentRate, durationInMinutes, profile, false);
|
||||
}
|
||||
if (doExtendedTemp) {
|
||||
// Check if some temp is already in progress
|
||||
if (activeTemp != null) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("setTempBasalAbsolute: Stopping temp basal (doExtendedTemp)");
|
||||
result = cancelRealTempBasal();
|
||||
// Check for proper result
|
||||
|
@ -328,7 +326,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
extendedRateToSet = Round.roundTo(extendedRateToSet, pumpDescription.extendedBolusStep * 2); // *2 because of halfhours
|
||||
|
||||
// What is current rate of extended bolusing in u/h?
|
||||
if (Config.logPump) {
|
||||
if (L.isEnabled(L.PUMP)) {
|
||||
log.debug("setTempBasalAbsolute: Extended bolus in progress: " + (activeExtended != null) + " rate: " + pump.extendedBolusAbsoluteRate + "U/h duration remaining: " + pump.extendedBolusRemainingMinutes + "min");
|
||||
log.debug("setTempBasalAbsolute: Rate to set: " + extendedRateToSet + "U/h");
|
||||
}
|
||||
|
@ -342,21 +340,21 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
result.duration = pump.extendedBolusRemainingMinutes;
|
||||
result.isPercent = false;
|
||||
result.isTempCancel = false;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("setTempBasalAbsolute: Correct extended already set");
|
||||
return result;
|
||||
}
|
||||
|
||||
// Now set new extended, no need to to stop previous (if running) because it's replaced
|
||||
Double extendedAmount = extendedRateToSet / 2 * durationInHalfHours;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("setTempBasalAbsolute: Setting extended: " + extendedAmount + "U halfhours: " + durationInHalfHours);
|
||||
result = setExtendedBolus(extendedAmount, durationInMinutes);
|
||||
if (!result.success) {
|
||||
log.error("setTempBasalAbsolute: Failed to set extended bolus");
|
||||
return result;
|
||||
}
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("setTempBasalAbsolute: Extended bolus set ok");
|
||||
result.absolute = result.absolute + getBaseBasalRate();
|
||||
return result;
|
||||
|
@ -395,7 +393,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
result.success = true;
|
||||
result.isTempCancel = true;
|
||||
result.comment = MainApp.gs(R.string.virtualpump_resultok);
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("cancelRealTempBasal: OK");
|
||||
return result;
|
||||
} else {
|
||||
|
|
|
@ -9,18 +9,18 @@ import org.slf4j.LoggerFactory;
|
|||
import java.text.DecimalFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.data.ProfileStore;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.utils.SP;
|
||||
|
||||
/**
|
||||
* Created by mike on 04.07.2016.
|
||||
*/
|
||||
public class DanaRPump {
|
||||
private Logger log = LoggerFactory.getLogger(Constants.PUMP);
|
||||
private Logger log = LoggerFactory.getLogger(L.PUMP);
|
||||
|
||||
private static DanaRPump instance = null;
|
||||
|
||||
|
@ -242,7 +242,7 @@ public class DanaRPump {
|
|||
//Some values get truncated to the next lower one.
|
||||
// -> round them to two decimals and make sure we are a small delta larger (that will get truncated)
|
||||
double value = Math.round(100d * nsProfile.getBasalTimeFromMidnight((Integer) (hour * 60 * 60)))/100d + 0.00001;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("NS basal value for " + hour + ":00 is " + value);
|
||||
record[hour] = value;
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MessageBase;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MessageHashTable;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.services.AbstractSerialIOThread;
|
||||
|
@ -21,7 +20,7 @@ import info.nightscout.utils.CRC;
|
|||
* Created by mike on 17.07.2016.
|
||||
*/
|
||||
public class SerialIOThread extends AbstractSerialIOThread {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPBTCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPBTCOMM);
|
||||
|
||||
private InputStream mInputStream = null;
|
||||
private OutputStream mOutputStream = null;
|
||||
|
@ -72,7 +71,7 @@ public class SerialIOThread extends AbstractSerialIOThread {
|
|||
message = MessageHashTable.findMessage(command);
|
||||
}
|
||||
|
||||
if (Config.logPumpBtComm)
|
||||
if (L.isEnabled(L.PUMPBTCOMM))
|
||||
log.debug("<<<<< " + message.getMessageName() + " " + message.toHexString(extractedBuff));
|
||||
|
||||
// process the message content
|
||||
|
@ -148,7 +147,7 @@ public class SerialIOThread extends AbstractSerialIOThread {
|
|||
processedMessage = message;
|
||||
|
||||
byte[] messageBytes = message.getRawMessageBytes();
|
||||
if (Config.logPumpBtComm)
|
||||
if (L.isEnabled(L.PUMPBTCOMM))
|
||||
log.debug(">>>>> " + message.getMessageName() + " " + message.toHexString(messageBytes));
|
||||
|
||||
try {
|
||||
|
@ -170,7 +169,7 @@ public class SerialIOThread extends AbstractSerialIOThread {
|
|||
log.warn("Reply not received " + message.getMessageName());
|
||||
if (message.getCommand() == 0xF0F1) {
|
||||
DanaRPump.getInstance().isNewPump = false;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Old firmware detected");
|
||||
}
|
||||
}
|
||||
|
@ -182,28 +181,28 @@ public class SerialIOThread extends AbstractSerialIOThread {
|
|||
try {
|
||||
mInputStream.close();
|
||||
} catch (Exception e) {
|
||||
if (Config.logPumpBtComm)
|
||||
if (L.isEnabled(L.PUMPBTCOMM))
|
||||
log.debug(e.getMessage());
|
||||
}
|
||||
try {
|
||||
mOutputStream.close();
|
||||
} catch (Exception e) {
|
||||
if (Config.logPumpBtComm)
|
||||
if (L.isEnabled(L.PUMPBTCOMM))
|
||||
log.debug(e.getMessage());
|
||||
}
|
||||
try {
|
||||
mRfCommSocket.close();
|
||||
} catch (Exception e) {
|
||||
if (Config.logPumpBtComm)
|
||||
if (L.isEnabled(L.PUMPBTCOMM))
|
||||
log.debug(e.getMessage());
|
||||
}
|
||||
try {
|
||||
System.runFinalization();
|
||||
} catch (Exception e) {
|
||||
if (Config.logPumpBtComm)
|
||||
if (L.isEnabled(L.PUMPBTCOMM))
|
||||
log.debug(e.getMessage());
|
||||
}
|
||||
if (Config.logPumpBtComm)
|
||||
if (L.isEnabled(L.PUMPBTCOMM))
|
||||
log.debug("Disconnected: " + reason);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.slf4j.LoggerFactory;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
|
@ -32,6 +31,7 @@ import info.nightscout.androidaps.data.Profile;
|
|||
import info.nightscout.androidaps.db.DanaRHistoryRecord;
|
||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRSyncStatus;
|
||||
|
@ -43,7 +43,7 @@ import info.nightscout.utils.DecimalFormatter;
|
|||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
public class DanaRHistoryActivity extends Activity {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMP);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMP);
|
||||
|
||||
private Handler mHandler;
|
||||
|
||||
|
@ -349,7 +349,7 @@ public class DanaRHistoryActivity extends Activity {
|
|||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventDanaRSyncStatus s) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("EventDanaRSyncStatus: " + s.message);
|
||||
runOnUiThread(
|
||||
() -> statusView.setText(s.message));
|
||||
|
|
|
@ -8,13 +8,12 @@ import org.slf4j.LoggerFactory;
|
|||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.db.CareportalEvent;
|
||||
import info.nightscout.androidaps.db.DanaRHistoryRecord;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRSyncStatus;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
|
@ -25,7 +24,7 @@ import info.nightscout.androidaps.plugins.NSClientInternal.NSUpload;
|
|||
*/
|
||||
|
||||
public class DanaRNSHistorySync {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMP);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMP);
|
||||
private List<DanaRHistoryRecord> historyRecords;
|
||||
|
||||
public final static int SYNC_BOLUS = 0b00000001;
|
||||
|
@ -50,7 +49,7 @@ public class DanaRNSHistorySync {
|
|||
long records = historyRecords.size();
|
||||
long processing = 0;
|
||||
long uploaded = 0;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Database contains " + records + " records");
|
||||
EventDanaRSyncStatus ev = new EventDanaRSyncStatus();
|
||||
for (DanaRHistoryRecord record : historyRecords) {
|
||||
|
@ -64,7 +63,7 @@ public class DanaRNSHistorySync {
|
|||
if ((what & SYNC_BOLUS) == 0) break;
|
||||
switch (record.bolusType) {
|
||||
case "S":
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Syncing standard bolus record " + record.recordValue + "U " + DateUtil.toISOString(record.recordDate));
|
||||
nsrec.put(DANARSIGNATURE, record.bytes);
|
||||
nsrec.put("eventType", "Meal Bolus");
|
||||
|
@ -77,7 +76,7 @@ public class DanaRNSHistorySync {
|
|||
break;
|
||||
case "E":
|
||||
if (record.recordDuration > 0) {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Syncing extended bolus record " + record.recordValue + "U " + DateUtil.toISOString(record.recordDate));
|
||||
nsrec.put(DANARSIGNATURE, record.bytes);
|
||||
nsrec.put("eventType", CareportalEvent.COMBOBOLUS);
|
||||
|
@ -94,12 +93,12 @@ public class DanaRNSHistorySync {
|
|||
uploaded++;
|
||||
ev.message += MainApp.gs(R.string.danar_ebolus);
|
||||
} else {
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("NOT Syncing extended bolus record " + record.recordValue + "U " + DateUtil.toISOString(record.recordDate) + " zero duration");
|
||||
}
|
||||
break;
|
||||
case "DS":
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Syncing dual(S) bolus record " + record.recordValue + "U " + DateUtil.toISOString(record.recordDate));
|
||||
nsrec.put(DANARSIGNATURE, record.bytes);
|
||||
nsrec.put("eventType", CareportalEvent.COMBOBOLUS);
|
||||
|
@ -113,7 +112,7 @@ public class DanaRNSHistorySync {
|
|||
ev.message += MainApp.gs(R.string.danar_dsbolus);
|
||||
break;
|
||||
case "DE":
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Syncing dual(E) bolus record " + record.recordValue + "U " + DateUtil.toISOString(record.recordDate));
|
||||
nsrec.put(DANARSIGNATURE, record.bytes);
|
||||
nsrec.put("eventType", CareportalEvent.COMBOBOLUS);
|
||||
|
@ -136,7 +135,7 @@ public class DanaRNSHistorySync {
|
|||
break;
|
||||
case RecordTypes.RECORD_TYPE_ERROR:
|
||||
if ((what & SYNC_ERROR) == 0) break;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Syncing error record " + DateUtil.toISOString(record.recordDate));
|
||||
nsrec.put(DANARSIGNATURE, record.bytes);
|
||||
nsrec.put("eventType", "Note");
|
||||
|
@ -149,7 +148,7 @@ public class DanaRNSHistorySync {
|
|||
break;
|
||||
case RecordTypes.RECORD_TYPE_REFILL:
|
||||
if ((what & SYNC_REFILL) == 0) break;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Syncing refill record " + record.recordValue + " " + DateUtil.toISOString(record.recordDate));
|
||||
nsrec.put(DANARSIGNATURE, record.bytes);
|
||||
nsrec.put("eventType", "Insulin Change");
|
||||
|
@ -162,7 +161,7 @@ public class DanaRNSHistorySync {
|
|||
break;
|
||||
case RecordTypes.RECORD_TYPE_BASALHOUR:
|
||||
if ((what & SYNC_BASALHOURS) == 0) break;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Syncing basal hour record " + record.recordValue + " " + DateUtil.toISOString(record.recordDate));
|
||||
nsrec.put(DANARSIGNATURE, record.bytes);
|
||||
nsrec.put("eventType", CareportalEvent.TEMPBASAL);
|
||||
|
@ -179,7 +178,7 @@ public class DanaRNSHistorySync {
|
|||
break;
|
||||
case RecordTypes.RECORD_TYPE_GLUCOSE:
|
||||
if ((what & SYNC_GLUCOSE) == 0) break;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Syncing glucose record " + record.recordValue + " " + DateUtil.toISOString(record.recordDate));
|
||||
nsrec.put(DANARSIGNATURE, record.bytes);
|
||||
nsrec.put("eventType", "BG Check");
|
||||
|
@ -193,7 +192,7 @@ public class DanaRNSHistorySync {
|
|||
break;
|
||||
case RecordTypes.RECORD_TYPE_CARBO:
|
||||
if ((what & SYNC_CARBO) == 0) break;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Syncing carbo record " + record.recordValue + "g " + DateUtil.toISOString(record.recordDate));
|
||||
nsrec.put(DANARSIGNATURE, record.bytes);
|
||||
nsrec.put("eventType", "Meal Bolus");
|
||||
|
@ -206,7 +205,7 @@ public class DanaRNSHistorySync {
|
|||
break;
|
||||
case RecordTypes.RECORD_TYPE_ALARM:
|
||||
if ((what & SYNC_ALARM) == 0) break;
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("Syncing alarm record " + record.recordAlarm + " " + DateUtil.toISOString(record.recordDate));
|
||||
nsrec.put(DANARSIGNATURE, record.bytes);
|
||||
nsrec.put("eventType", "Note");
|
||||
|
|
|
@ -14,12 +14,12 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaRS.DanaRSPlugin;
|
||||
|
@ -31,7 +31,7 @@ import info.nightscout.utils.NumberPicker;
|
|||
*/
|
||||
|
||||
public class DanaRUserOptionsActivity extends Activity {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMP);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMP);
|
||||
|
||||
Switch timeFormat;
|
||||
Switch buttonScroll;
|
||||
|
@ -86,7 +86,7 @@ public class DanaRUserOptionsActivity extends Activity {
|
|||
|
||||
DanaRPump pump = DanaRPump.getInstance();
|
||||
//used for debugging
|
||||
if (Config.logPump)
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("UserOptionsLoaded:" + (System.currentTimeMillis() - pump.lastConnection) / 1000 + " s ago"
|
||||
+ "\ntimeDisplayType:" + pump.timeDisplayType
|
||||
+ "\nbuttonScroll:" + pump.buttonScrollOnOff
|
||||
|
|
|
@ -12,8 +12,7 @@ import java.util.Calendar;
|
|||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.utils.CRC;
|
||||
|
||||
/*
|
||||
|
@ -23,7 +22,7 @@ import info.nightscout.utils.CRC;
|
|||
*/
|
||||
|
||||
public class MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
protected byte[] buffer = new byte[512];
|
||||
private int position = 6;
|
||||
|
||||
|
@ -96,7 +95,7 @@ public class MessageBase {
|
|||
}
|
||||
|
||||
public void handleMessage(byte[] bytes) {
|
||||
if (Config.logPumpComm) {
|
||||
if (L.isEnabled(L.PUMPCOMM)) {
|
||||
if (bytes.length > 6) {
|
||||
int command = (bytes[5] & 0xFF) | ((bytes[4] << 8) & 0xFF00);
|
||||
log.debug("UNPROCESSED MSG: " + getMessageName() + " Command: " + String.format("%04X", command) + " Data: " + toHexString(bytes));
|
||||
|
|
|
@ -5,13 +5,13 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.util.HashMap;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 28.05.2016.
|
||||
*/
|
||||
public class MessageOriginalNames {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
private static HashMap<Integer, String> messageNames;
|
||||
|
||||
|
|
|
@ -3,15 +3,14 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
||||
import info.nightscout.androidaps.plugins.Treatments.Treatment;
|
||||
|
||||
public class MsgBolusProgress extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
private static Treatment t;
|
||||
private static double amount;
|
||||
|
@ -28,7 +27,7 @@ public class MsgBolusProgress extends MessageBase {
|
|||
this.amount = amount;
|
||||
this.t = t;
|
||||
lastReceive = System.currentTimeMillis();
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message: amount: " + amount + " treatment: " + t.toString());
|
||||
}
|
||||
|
||||
|
@ -43,7 +42,7 @@ public class MsgBolusProgress extends MessageBase {
|
|||
bolusingEvent.t = t;
|
||||
bolusingEvent.percent = Math.min((int) (done / amount * 100), 100);
|
||||
|
||||
if (Config.logPumpComm) {
|
||||
if (L.isEnabled(L.PUMPCOMM)) {
|
||||
log.debug("Bolus remaining: " + progress + " delivered: " + done);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,13 +3,12 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.interfaces.Constraint;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
public class MsgBolusStart extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public static int errorCode;
|
||||
|
||||
|
@ -25,7 +24,7 @@ public class MsgBolusStart extends MessageBase {
|
|||
|
||||
AddParamInt((int) (amount * 100));
|
||||
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Bolus start : " + amount);
|
||||
}
|
||||
|
||||
|
@ -34,10 +33,10 @@ public class MsgBolusStart extends MessageBase {
|
|||
errorCode = intFromBuff(bytes, 0, 1);
|
||||
if (errorCode != 2) {
|
||||
failed = true;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Messsage response: " + errorCode + " FAILED!!");
|
||||
} else {
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Messsage response: " + errorCode + " OK");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,13 +3,12 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.interfaces.Constraint;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
public class MsgBolusStartWithSpeed extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public static int errorCode;
|
||||
|
||||
|
@ -26,7 +25,7 @@ public class MsgBolusStartWithSpeed extends MessageBase {
|
|||
AddParamInt((int) (amount * 100));
|
||||
AddParamByte((byte) speed);
|
||||
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Bolus start : " + amount + " speed: " + speed);
|
||||
}
|
||||
|
||||
|
@ -35,10 +34,10 @@ public class MsgBolusStartWithSpeed extends MessageBase {
|
|||
errorCode = intFromBuff(bytes, 0, 1);
|
||||
if (errorCode != 2) {
|
||||
failed = true;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Messsage response: " + errorCode + " FAILED!!");
|
||||
} else {
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Messsage response: " + errorCode + " OK");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,15 +3,14 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
||||
import info.nightscout.androidaps.plugins.Treatments.Treatment;
|
||||
|
||||
public class MsgBolusStop extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
private static Treatment t;
|
||||
private static Double amount;
|
||||
|
||||
|
@ -28,13 +27,13 @@ public class MsgBolusStop extends MessageBase {
|
|||
this.t = t;
|
||||
this.amount = amount;
|
||||
forced = false;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Bolus stop: amount: " + amount + " treatment: " + t.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(byte[] bytes) {
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Messsage received");
|
||||
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
|
||||
stopped = true;
|
||||
|
|
|
@ -3,9 +3,8 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||
|
||||
|
@ -13,11 +12,11 @@ import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
|||
* Created by mike on 30.06.2016.
|
||||
*/
|
||||
public class MsgCheckValue extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgCheckValue() {
|
||||
SetCommand(0xF0F1);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
|
@ -26,7 +25,7 @@ public class MsgCheckValue extends MessageBase {
|
|||
DanaRPump pump = DanaRPump.getInstance();
|
||||
|
||||
pump.isNewPump = true;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New firmware confirmed");
|
||||
|
||||
pump.model = intFromBuff(bytes, 0, 1);
|
||||
|
@ -37,7 +36,7 @@ public class MsgCheckValue extends MessageBase {
|
|||
log.debug("Wrong model selected");
|
||||
}
|
||||
|
||||
if (Config.logPumpComm) {
|
||||
if (L.isEnabled(L.PUMPCOMM)) {
|
||||
log.debug("Model: " + String.format("%02X ", pump.model));
|
||||
log.debug("Protocol: " + String.format("%02X ", pump.protocol));
|
||||
log.debug("Product Code: " + String.format("%02X ", pump.productCode));
|
||||
|
|
|
@ -3,19 +3,18 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSUpload;
|
||||
|
||||
public class MsgError extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgError() {
|
||||
SetCommand(0x0601);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
|
@ -50,7 +49,7 @@ public class MsgError extends MessageBase {
|
|||
bolusingEvent.status = errorString;
|
||||
MainApp.bus().post(bolusingEvent);
|
||||
}
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Error detected: " + errorString);
|
||||
NSUpload.uploadError(errorString);
|
||||
}
|
||||
|
|
|
@ -3,17 +3,16 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 20.07.2016.
|
||||
*/
|
||||
public class MsgHistoryAlarm extends MsgHistoryAll {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
public MsgHistoryAlarm() {
|
||||
SetCommand(0x3105);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
// Handle message taken from MsgHistoryAll
|
||||
|
|
|
@ -5,19 +5,18 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.db.DanaRHistoryRecord;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRSyncStatus;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
|
||||
public class MsgHistoryAll extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgHistoryAll() {
|
||||
SetCommand(0x41F2);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
|
|
|
@ -3,24 +3,23 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
public class MsgHistoryAllDone extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
public static boolean received = false;
|
||||
|
||||
public MsgHistoryAllDone() {
|
||||
SetCommand(0x41F1);
|
||||
received = false;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(byte[] bytes) {
|
||||
received = true;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("History all done received");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,17 +3,16 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 20.07.2016.
|
||||
*/
|
||||
public class MsgHistoryBasalHour extends MsgHistoryAll {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
public MsgHistoryBasalHour() {
|
||||
SetCommand(0x310A);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
// Handle message taken from MsgHistoryAll
|
||||
|
|
|
@ -3,18 +3,17 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 20.07.2016.
|
||||
*/
|
||||
public class MsgHistoryBolus extends MsgHistoryAll {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgHistoryBolus() {
|
||||
SetCommand(0x3101);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
// Handle message taken from MsgHistoryAll
|
||||
|
|
|
@ -3,17 +3,16 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 20.07.2016.
|
||||
*/
|
||||
public class MsgHistoryCarbo extends MsgHistoryAll {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
public MsgHistoryCarbo() {
|
||||
SetCommand(0x3107);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
// Handle message taken from MsgHistoryAll
|
||||
|
|
|
@ -3,17 +3,16 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 20.07.2016.
|
||||
*/
|
||||
public class MsgHistoryDailyInsulin extends MsgHistoryAll {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
public MsgHistoryDailyInsulin() {
|
||||
SetCommand(0x3102);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
// Handle message taken from MsgHistoryAll
|
||||
|
|
|
@ -3,27 +3,26 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 20.07.2016.
|
||||
*/
|
||||
public class MsgHistoryDone extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
public static boolean received = false;
|
||||
|
||||
public MsgHistoryDone() {
|
||||
SetCommand(0x31F1);
|
||||
received = false;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(byte[] bytes) {
|
||||
received = true;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("History done received");
|
||||
|
||||
}
|
||||
|
|
|
@ -3,18 +3,17 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 20.07.2016.
|
||||
*/
|
||||
public class MsgHistoryError extends MsgHistoryAll {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgHistoryError() {
|
||||
SetCommand(0x3106);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
// Handle message taken from MsgHistoryAll
|
||||
|
|
|
@ -3,18 +3,17 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 20.07.2016.
|
||||
*/
|
||||
public class MsgHistoryGlucose extends MsgHistoryAll {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgHistoryGlucose() {
|
||||
SetCommand(0x3104);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
// Handle message taken from MsgHistoryAll
|
||||
|
|
|
@ -3,18 +3,17 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 20.07.2016.
|
||||
*/
|
||||
public class MsgHistoryNew extends MsgHistoryAll {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgHistoryNew() {
|
||||
SetCommand(0x42F2);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
// Handle message taken from MsgHistoryAll
|
||||
|
|
|
@ -3,27 +3,26 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 20.07.2016.
|
||||
*/
|
||||
public class MsgHistoryNewDone extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
public static boolean received = false;
|
||||
|
||||
public MsgHistoryNewDone() {
|
||||
SetCommand(0x42F1);
|
||||
received = false;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(byte[] bytes) {
|
||||
received = true;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("History new done received");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,18 +3,17 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 20.07.2016.
|
||||
*/
|
||||
public class MsgHistoryRefill extends MsgHistoryAll {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgHistoryRefill() {
|
||||
SetCommand(0x3108);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
// Handle message taken from MsgHistoryAll
|
||||
|
|
|
@ -3,18 +3,17 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* Created by mike on 20.07.2016.
|
||||
*/
|
||||
public class MsgHistorySuspend extends MsgHistoryAll {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgHistorySuspend() {
|
||||
SetCommand(0x3109);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
// Handle message taken from MsgHistoryAll
|
||||
|
|
|
@ -3,16 +3,15 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||
|
||||
public class MsgInitConnStatusBasic extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgInitConnStatusBasic() {
|
||||
SetCommand(0x0303);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
|
@ -42,7 +41,7 @@ public class MsgInitConnStatusBasic extends MessageBase {
|
|||
boolean deliveryStepBolus = (bolusConfig & DanaRPump.DELIVERY_STEP_BOLUS) != 0;
|
||||
boolean deliveryBasal = (bolusConfig & DanaRPump.DELIVERY_BASAL) != 0;
|
||||
boolean deliveryExtBolus = (bolusConfig & DanaRPump.DELIVERY_EXT_BOLUS) != 0;
|
||||
if (Config.logPumpComm) {
|
||||
if (L.isEnabled(L.PUMPCOMM)) {
|
||||
log.debug("Delivery prime: " + deliveryPrime);
|
||||
log.debug("Delivery step bolus: " + deliveryStepBolus);
|
||||
log.debug("Delivery basal: " + deliveryBasal);
|
||||
|
@ -52,7 +51,7 @@ public class MsgInitConnStatusBasic extends MessageBase {
|
|||
log.error("Unhadled exception", e);
|
||||
}
|
||||
|
||||
if (Config.logPumpComm) {
|
||||
if (L.isEnabled(L.PUMPCOMM)) {
|
||||
log.debug("Pump suspended: " + pump.pumpSuspended);
|
||||
log.debug("Calculator enabled: " + pump.calculatorEnabled);
|
||||
log.debug("Daily total units: " + pump.dailyTotalUnits);
|
||||
|
|
|
@ -3,10 +3,9 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||
|
@ -16,11 +15,11 @@ import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
|||
* Created by mike on 28.05.2016.
|
||||
*/
|
||||
public class MsgInitConnStatusBolus extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgInitConnStatusBolus() {
|
||||
SetCommand(0x0302);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
|
@ -37,7 +36,7 @@ public class MsgInitConnStatusBolus extends MessageBase {
|
|||
pump.maxBolus = intFromBuff(bytes, 2, 2) / 100d;
|
||||
//int bolusRate = intFromBuff(bytes, 4, 8);
|
||||
|
||||
if (Config.logPumpComm) {
|
||||
if (L.isEnabled(L.PUMPCOMM)) {
|
||||
log.debug("Is Extended bolus enabled: " + pump.isExtendedBolusEnabled);
|
||||
log.debug("Bolus increment: " + pump.bolusStep);
|
||||
log.debug("Bolus max: " + pump.maxBolus);
|
||||
|
|
|
@ -3,19 +3,18 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||
|
||||
/**
|
||||
* Created by mike on 28.05.2016.
|
||||
*/
|
||||
public class MsgInitConnStatusOption extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgInitConnStatusOption() {
|
||||
SetCommand(0x0304);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
|
@ -32,7 +31,7 @@ public class MsgInitConnStatusOption extends MessageBase {
|
|||
//int none = intFromBuff(bytes, 8, 1);
|
||||
if (bytes.length >= 21) {
|
||||
DanaRPump.getInstance().password = intFromBuff(bytes, 9, 2) ^ 0x3463;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Pump password: " + DanaRPump.getInstance().password);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,12 +5,11 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||
|
@ -19,11 +18,11 @@ import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
|||
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
|
||||
|
||||
public class MsgInitConnStatusTime extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgInitConnStatusTime() {
|
||||
SetCommand(0x0301);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
|
@ -56,7 +55,7 @@ public class MsgInitConnStatusTime extends MessageBase {
|
|||
Date time = dateTimeSecFromBuff(bytes, 0);
|
||||
int versionCode = intFromBuff(bytes, 6, 1);
|
||||
|
||||
if (Config.logPumpComm) {
|
||||
if (L.isEnabled(L.PUMPCOMM)) {
|
||||
log.debug("Pump time: " + time);
|
||||
log.debug("Version code: " + versionCode);
|
||||
}
|
||||
|
|
|
@ -3,21 +3,20 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
public class MsgPCCommStart extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgPCCommStart() {
|
||||
SetCommand(0x3001);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(byte[] bytes) {
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("PC comm start received");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,20 +3,19 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
public class MsgPCCommStop extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
public MsgPCCommStop() {
|
||||
SetCommand(0x3002);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(byte[] bytes) {
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("PC comm stop received");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,15 +3,14 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
public class MsgSetActivateBasalProfile extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgSetActivateBasalProfile() {
|
||||
SetCommand(0x330C);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
|
@ -19,7 +18,7 @@ public class MsgSetActivateBasalProfile extends MessageBase {
|
|||
public MsgSetActivateBasalProfile(byte index) {
|
||||
this();
|
||||
AddParamByte(index);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Activate basal profile: " + index);
|
||||
}
|
||||
|
||||
|
@ -28,10 +27,10 @@ public class MsgSetActivateBasalProfile extends MessageBase {
|
|||
int result = intFromBuff(bytes, 0, 1);
|
||||
if (result != 1) {
|
||||
failed = true;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Activate basal profile result: " + result + " FAILED!!!");
|
||||
} else {
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Activate basal profile result: " + result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,19 +3,18 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||
|
||||
public class MsgSetBasalProfile extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgSetBasalProfile() {
|
||||
SetCommand(0x3306);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
|
@ -26,7 +25,7 @@ public class MsgSetBasalProfile extends MessageBase {
|
|||
for (Integer i = 0; i < 24; i++) {
|
||||
AddParamInt((int) (values[i] * 100));
|
||||
}
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Set basal profile: " + index);
|
||||
}
|
||||
|
||||
|
@ -35,12 +34,12 @@ public class MsgSetBasalProfile extends MessageBase {
|
|||
int result = intFromBuff(bytes, 0, 1);
|
||||
if (result != 1) {
|
||||
failed = true;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Set basal profile result: " + result + " FAILED!!!");
|
||||
Notification reportFail = new Notification(Notification.PROFILE_SET_FAILED, MainApp.gs(R.string.profile_set_failed), Notification.URGENT);
|
||||
MainApp.bus().post(new EventNewNotification(reportFail));
|
||||
} else {
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Set basal profile result: " + result);
|
||||
Notification reportOK = new Notification(Notification.PROFILE_SET_OK, MainApp.gs(R.string.profile_set_ok), Notification.INFO, 60);
|
||||
MainApp.bus().post(new EventNewNotification(reportOK));
|
||||
|
|
|
@ -5,15 +5,14 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.util.Calendar;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
public class MsgSetCarbsEntry extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgSetCarbsEntry() {
|
||||
SetCommand(0x0402);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
|
@ -30,7 +29,7 @@ public class MsgSetCarbsEntry extends MessageBase {
|
|||
AddParamByte((byte) (calendar.get(Calendar.SECOND)));
|
||||
AddParamByte((byte) 0x43); //??
|
||||
AddParamInt(amount);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Set carb entry: " + amount + " date " + calendar.getTime().toString());
|
||||
}
|
||||
|
||||
|
@ -39,10 +38,10 @@ public class MsgSetCarbsEntry extends MessageBase {
|
|||
int result = intFromBuff(bytes, 0, 1);
|
||||
if (result != 1) {
|
||||
failed = true;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Set carb entry result: " + result + " FAILED!!!");
|
||||
} else {
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Set carb entry result: " + result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,17 +3,16 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.interfaces.Constraint;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
public class MsgSetExtendedBolusStart extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgSetExtendedBolusStart() {
|
||||
SetCommand(0x0407);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
|
@ -27,7 +26,7 @@ public class MsgSetExtendedBolusStart extends MessageBase {
|
|||
|
||||
AddParamInt((int) (amount * 100));
|
||||
AddParamByte(halfhours);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Set extended bolus start: " + (((int) (amount * 100)) / 100d) + "U halfhours: " + (int) halfhours);
|
||||
}
|
||||
|
||||
|
@ -36,10 +35,10 @@ public class MsgSetExtendedBolusStart extends MessageBase {
|
|||
int result = intFromBuff(bytes, 0, 1);
|
||||
if (result != 1) {
|
||||
failed = true;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Set extended bolus start result: " + result + " FAILED!!!");
|
||||
} else {
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Set extended bolus start result: " + result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,15 +3,14 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
public class MsgSetExtendedBolusStop extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgSetExtendedBolusStop() {
|
||||
SetCommand(0x0406);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
|
@ -20,10 +19,10 @@ public class MsgSetExtendedBolusStop extends MessageBase {
|
|||
int result = intFromBuff(bytes, 0, 1);
|
||||
if (result != 1) {
|
||||
failed = true;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Set extended bolus stop result: " + result + " FAILED!!!");
|
||||
} else {
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Set extended bolus stop result: " + result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,15 +3,14 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
|
||||
public class MsgSetSingleBasalProfile extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgSetSingleBasalProfile() {
|
||||
SetCommand(0x3302);
|
||||
|
@ -23,7 +22,7 @@ public class MsgSetSingleBasalProfile extends MessageBase {
|
|||
for (Integer i = 0; i < 24; i++) {
|
||||
AddParamInt((int) (values[i] * 100));
|
||||
}
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
|
@ -32,12 +31,12 @@ public class MsgSetSingleBasalProfile extends MessageBase {
|
|||
int result = intFromBuff(bytes, 0, 1);
|
||||
if (result != 1) {
|
||||
failed = true;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Set basal profile result: " + result + " FAILED!!!");
|
||||
Notification reportFail = new Notification(Notification.PROFILE_SET_FAILED, MainApp.gs(R.string.profile_set_failed), Notification.URGENT);
|
||||
MainApp.bus().post(new EventNewNotification(reportFail));
|
||||
} else {
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Set basal profile result: " + result);
|
||||
Notification reportOK = new Notification(Notification.PROFILE_SET_OK, MainApp.gs(R.string.profile_set_ok), Notification.INFO, 60);
|
||||
MainApp.bus().post(new EventNewNotification(reportOK));
|
||||
|
|
|
@ -3,11 +3,10 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
public class MsgSetTempBasalStart extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgSetTempBasalStart() {
|
||||
SetCommand(0x0401);
|
||||
|
@ -25,7 +24,7 @@ public class MsgSetTempBasalStart extends MessageBase {
|
|||
AddParamByte((byte) (percent & 255));
|
||||
AddParamByte((byte) (durationInHours & 255));
|
||||
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Temp basal start percent: " + percent + " duration hours: " + durationInHours);
|
||||
}
|
||||
|
||||
|
@ -33,10 +32,10 @@ public class MsgSetTempBasalStart extends MessageBase {
|
|||
int result = intFromBuff(bytes, 0, 1);
|
||||
if (result != 1) {
|
||||
failed = true;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Set temp basal start result: " + result + " FAILED!!!");
|
||||
} else {
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Set temp basal start result: " + result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,15 +3,14 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
public class MsgSetTempBasalStop extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public MsgSetTempBasalStop() {
|
||||
SetCommand(0x0403);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Temp basal stop");
|
||||
}
|
||||
|
||||
|
@ -19,10 +18,10 @@ public class MsgSetTempBasalStop extends MessageBase {
|
|||
int result = intFromBuff(bytes, 0, 1);
|
||||
if (result != 1) {
|
||||
failed = true;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Set temp basal stop result: " + result + " FAILED!!!");
|
||||
} else {
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Set temp basal stop result: " + result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
|
||||
/**
|
||||
|
@ -14,21 +13,21 @@ import info.nightscout.utils.DateUtil;
|
|||
*/
|
||||
|
||||
public class MsgSetTime extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
private static Date time;
|
||||
|
||||
public MsgSetTime(Date time) {
|
||||
SetCommand(0x330a);
|
||||
this.time = time;
|
||||
AddParamDateTime(time);
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message: time:" + DateUtil.dateAndTimeString(time));
|
||||
}
|
||||
|
||||
public void handleMessage(byte[] bytes) {
|
||||
int result = intFromBuff(bytes, 0, 1);
|
||||
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Result of setting time: " + time + " is " + result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,7 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||
|
||||
/**
|
||||
|
@ -12,7 +11,7 @@ import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
|||
*/
|
||||
public class MsgSetUserOptions extends MessageBase {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(Constants.PUMPCOMM);
|
||||
private static Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
public boolean done;
|
||||
|
||||
|
@ -36,7 +35,7 @@ public class MsgSetUserOptions extends MessageBase {
|
|||
for (int i = 0; i < pump.userOptionsFrompump.length; i++) {
|
||||
AddParamByte(pump.userOptionsFrompump[i]);
|
||||
}
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("New message");
|
||||
}
|
||||
|
||||
|
@ -44,10 +43,10 @@ public class MsgSetUserOptions extends MessageBase {
|
|||
int result = intFromBuff(bytes, 0, 1);
|
||||
if (result != 1) {
|
||||
failed = true;
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Setting user options: " + result + " FAILED!!!");
|
||||
} else {
|
||||
if (Config.logPumpComm)
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Setting user options: " + result);
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue