commit
440be77de0
55 changed files with 213 additions and 99 deletions
|
@ -149,6 +149,7 @@ dependencies {
|
||||||
compile('com.github.tony19:logback-android-classic:1.1.1-6') {
|
compile('com.github.tony19:logback-android-classic:1.1.1-6') {
|
||||||
exclude group: 'com.google.android', module: 'android'
|
exclude group: 'com.google.android', module: 'android'
|
||||||
}
|
}
|
||||||
|
compile 'org.apache.commons:commons-lang3:3.6'
|
||||||
compile 'org.slf4j:slf4j-api:1.7.12'
|
compile 'org.slf4j:slf4j-api:1.7.12'
|
||||||
compile 'com.jjoe64:graphview:4.0.1'
|
compile 'com.jjoe64:graphview:4.0.1'
|
||||||
compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.1'
|
compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.1'
|
||||||
|
|
87
app/src/main/java/com/squareup/otto/LoggingBus.java
Normal file
87
app/src/main/java/com/squareup/otto/LoggingBus.java
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
package com.squareup.otto;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
|
|
||||||
|
/** Logs events has they're being posted to and dispatched from the event bus.
|
||||||
|
*
|
||||||
|
* A summary of event-receiver calls that occurred so far is logged
|
||||||
|
* after 10s (after startup) and then again every 60s.
|
||||||
|
* */
|
||||||
|
public class LoggingBus extends Bus {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(LoggingBus.class);
|
||||||
|
|
||||||
|
private static long everyMinute = System.currentTimeMillis() + 10 * 1000;
|
||||||
|
private Map<String, Set<String>> event2Receiver = new HashMap<>();
|
||||||
|
|
||||||
|
public LoggingBus(ThreadEnforcer enforcer) {
|
||||||
|
super(enforcer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void post(Object event) {
|
||||||
|
if (event instanceof DeadEvent) {
|
||||||
|
log.debug("Event has no receiver: " + ((DeadEvent) event).event + ", source: " + ((DeadEvent) event).source);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(event instanceof Event)) {
|
||||||
|
log.error("Posted event not an event class: " + event.getClass());
|
||||||
|
}
|
||||||
|
|
||||||
|
log.debug("<<< " + event);
|
||||||
|
try {
|
||||||
|
StackTraceElement caller = new Throwable().getStackTrace()[1];
|
||||||
|
String className = caller.getClassName();
|
||||||
|
className = className.substring(className.lastIndexOf(".") + 1);
|
||||||
|
log.debug(" source: " + className + "." + caller.getMethodName() + ":" + caller.getLineNumber());
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
log.debug(" source: <unknown>");
|
||||||
|
}
|
||||||
|
|
||||||
|
super.post(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatch(Object event, EventHandler wrapper) {
|
||||||
|
try {
|
||||||
|
log.debug(">>> " + event);
|
||||||
|
Field methodField = wrapper.getClass().getDeclaredField("method");
|
||||||
|
methodField.setAccessible(true);
|
||||||
|
Method targetMethod = (Method) methodField.get(wrapper);
|
||||||
|
String className = targetMethod.getDeclaringClass().getSimpleName();
|
||||||
|
String methodName = targetMethod.getName();
|
||||||
|
String receiverMethod = className + "." + methodName;
|
||||||
|
log.debug(" receiver: " + receiverMethod);
|
||||||
|
|
||||||
|
String key = event.getClass().getSimpleName();
|
||||||
|
if (!event2Receiver.containsKey(key)) event2Receiver.put(key, new HashSet<String>());
|
||||||
|
event2Receiver.get(key).add(receiverMethod);
|
||||||
|
} catch (ReflectiveOperationException e) {
|
||||||
|
log.debug(" receiver: <unknown>");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (everyMinute < System.currentTimeMillis()) {
|
||||||
|
log.debug("***************** Event -> receiver pairings seen so far ****************");
|
||||||
|
for (Map.Entry<String, Set<String>> stringSetEntry : event2Receiver.entrySet()) {
|
||||||
|
log.debug(" " + stringSetEntry.getKey());
|
||||||
|
for (String s : stringSetEntry.getValue()) {
|
||||||
|
log.debug(" -> " + s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.debug("*************************************************************************");
|
||||||
|
everyMinute = System.currentTimeMillis() + 60 * 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
super.dispatch(event, wrapper);
|
||||||
|
}
|
||||||
|
}
|
|
@ -40,6 +40,7 @@ public class Config {
|
||||||
public static final boolean logPumpActions = true;
|
public static final boolean logPumpActions = true;
|
||||||
public static final boolean logCongigBuilderActions = true;
|
public static final boolean logCongigBuilderActions = true;
|
||||||
public static final boolean logAutosensData = false;
|
public static final boolean logAutosensData = false;
|
||||||
|
public static final boolean logEvents = false;
|
||||||
|
|
||||||
// DanaR specific
|
// DanaR specific
|
||||||
public static final boolean logDanaBTComm = true;
|
public static final boolean logDanaBTComm = true;
|
||||||
|
|
|
@ -13,6 +13,7 @@ import com.crashlytics.android.answers.Answers;
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
import com.crashlytics.android.answers.CustomEvent;
|
||||||
import com.j256.ormlite.android.apptools.OpenHelperManager;
|
import com.j256.ormlite.android.apptools.OpenHelperManager;
|
||||||
import com.squareup.otto.Bus;
|
import com.squareup.otto.Bus;
|
||||||
|
import com.squareup.otto.LoggingBus;
|
||||||
import com.squareup.otto.ThreadEnforcer;
|
import com.squareup.otto.ThreadEnforcer;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -104,7 +105,8 @@ public class MainApp extends Application {
|
||||||
log.info("Version: " + BuildConfig.VERSION_NAME);
|
log.info("Version: " + BuildConfig.VERSION_NAME);
|
||||||
log.info("BuildVersion: " + BuildConfig.BUILDVERSION);
|
log.info("BuildVersion: " + BuildConfig.BUILDVERSION);
|
||||||
|
|
||||||
sBus = new Bus(ThreadEnforcer.ANY);
|
sBus = Config.logEvents ? new LoggingBus(ThreadEnforcer.ANY) : new Bus(ThreadEnforcer.ANY);
|
||||||
|
|
||||||
sInstance = this;
|
sInstance = this;
|
||||||
sResources = getResources();
|
sResources = getResources();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package info.nightscout.androidaps.events;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
/** Base class for all events posted on the event bus. */
|
||||||
|
public abstract class Event {
|
||||||
|
static {
|
||||||
|
ReflectionToStringBuilder.setDefaultStyle(ToStringStyle.SHORT_PREFIX_STYLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return ReflectionToStringBuilder.toString(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,5 +3,5 @@ package info.nightscout.androidaps.events;
|
||||||
/**
|
/**
|
||||||
* Created by mike on 07.07.2016.
|
* Created by mike on 07.07.2016.
|
||||||
*/
|
*/
|
||||||
public class EventAppExit {
|
public class EventAppExit extends Event {
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ package info.nightscout.androidaps.events;
|
||||||
* Created by adrian on 07/02/17.
|
* Created by adrian on 07/02/17.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventBolusRequested {
|
public class EventBolusRequested extends Event {
|
||||||
private double amount;
|
private double amount;
|
||||||
|
|
||||||
public EventBolusRequested (double amount){
|
public EventBolusRequested (double amount){
|
||||||
|
|
|
@ -4,5 +4,5 @@ package info.nightscout.androidaps.events;
|
||||||
* Created by mike on 25.05.2017.
|
* Created by mike on 25.05.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventCareportalEventChange {
|
public class EventCareportalEventChange extends Event {
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,5 +4,5 @@ package info.nightscout.androidaps.events;
|
||||||
* Created by mike on 17.02.2017.
|
* Created by mike on 17.02.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventConfigBuilderChange {
|
public class EventConfigBuilderChange extends Event {
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,5 +4,5 @@ package info.nightscout.androidaps.events;
|
||||||
* Created by mike on 15.05.2017.
|
* Created by mike on 15.05.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventExtendedBolusChange {
|
public class EventExtendedBolusChange extends Event {
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,5 +4,5 @@ package info.nightscout.androidaps.events;
|
||||||
* Created by mike on 20.09.2017.
|
* Created by mike on 20.09.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventFoodDatabaseChanged {
|
public class EventFoodDatabaseChanged extends Event {
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,5 +4,5 @@ package info.nightscout.androidaps.events;
|
||||||
* Created by mike on 13.12.2016.
|
* Created by mike on 13.12.2016.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventInitializationChanged {
|
public class EventInitializationChanged extends Event {
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package info.nightscout.androidaps.events;
|
||||||
|
|
||||||
|
/** Supeclass for all events concerned with input or output into or from the LoopPlugin. */
|
||||||
|
public abstract class EventLoop extends Event {
|
||||||
|
}
|
|
@ -3,5 +3,5 @@ package info.nightscout.androidaps.events;
|
||||||
/**
|
/**
|
||||||
* Created by mike on 05.06.2016.
|
* Created by mike on 05.06.2016.
|
||||||
*/
|
*/
|
||||||
public class EventNewBG {
|
public class EventNewBG extends EventLoop {
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,5 @@ package info.nightscout.androidaps.events;
|
||||||
/**
|
/**
|
||||||
* Created by mike on 04.06.2016.
|
* Created by mike on 04.06.2016.
|
||||||
*/
|
*/
|
||||||
public class EventNewBasalProfile {
|
public class EventNewBasalProfile extends Event {
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import info.nightscout.androidaps.MainApp;
|
||||||
/**
|
/**
|
||||||
* Created by mike on 19.06.2016.
|
* Created by mike on 19.06.2016.
|
||||||
*/
|
*/
|
||||||
public class EventPreferenceChange {
|
public class EventPreferenceChange extends Event {
|
||||||
public String changedKey;
|
public String changedKey;
|
||||||
public EventPreferenceChange(String key) {
|
public EventPreferenceChange(String key) {
|
||||||
changedKey = key;
|
changedKey = key;
|
||||||
|
|
|
@ -4,5 +4,5 @@ package info.nightscout.androidaps.events;
|
||||||
* Created by mike on 02.06.2017.
|
* Created by mike on 02.06.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventProfileSwitchChange {
|
public class EventProfileSwitchChange extends Event {
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import info.nightscout.androidaps.R;
|
||||||
* Created by mike on 19.02.2017.
|
* Created by mike on 19.02.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventPumpStatusChanged {
|
public class EventPumpStatusChanged extends Event {
|
||||||
public static final int CONNECTING = 0;
|
public static final int CONNECTING = 0;
|
||||||
public static final int CONNECTED = 1;
|
public static final int CONNECTED = 1;
|
||||||
public static final int PERFORMING = 2;
|
public static final int PERFORMING = 2;
|
||||||
|
|
|
@ -3,5 +3,5 @@ package info.nightscout.androidaps.events;
|
||||||
/**
|
/**
|
||||||
* Created by mike on 13.06.2016.
|
* Created by mike on 13.06.2016.
|
||||||
*/
|
*/
|
||||||
public class EventRefreshGui {
|
public class EventRefreshGui extends Event {
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ package info.nightscout.androidaps.events;
|
||||||
* Created by mike on 16.06.2017.
|
* Created by mike on 16.06.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventRefreshOverview {
|
public class EventRefreshOverview extends Event {
|
||||||
public String from;
|
public String from;
|
||||||
|
|
||||||
public EventRefreshOverview(String from) {
|
public EventRefreshOverview(String from) {
|
||||||
|
|
|
@ -4,5 +4,5 @@ package info.nightscout.androidaps.events;
|
||||||
* Created by mike on 12.06.2017.
|
* Created by mike on 12.06.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventReloadProfileSwitchData {
|
public class EventReloadProfileSwitchData extends Event {
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,5 +4,5 @@ package info.nightscout.androidaps.events;
|
||||||
* Created by mike on 29.05.2017.
|
* Created by mike on 29.05.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventReloadTempBasalData {
|
public class EventReloadTempBasalData extends Event {
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ package info.nightscout.androidaps.events;
|
||||||
* Created by mike on 29.05.2017.
|
* Created by mike on 29.05.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventReloadTreatmentData {
|
public class EventReloadTreatmentData extends Event {
|
||||||
public Object next;
|
public Object next;
|
||||||
|
|
||||||
public EventReloadTreatmentData(Object next) {
|
public EventReloadTreatmentData(Object next) {
|
||||||
|
|
|
@ -3,5 +3,5 @@ package info.nightscout.androidaps.events;
|
||||||
/**
|
/**
|
||||||
* Created by mike on 05.06.2016.
|
* Created by mike on 05.06.2016.
|
||||||
*/
|
*/
|
||||||
public class EventTempBasalChange {
|
public class EventTempBasalChange extends EventLoop {
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,5 +4,5 @@ package info.nightscout.androidaps.events;
|
||||||
* Created by mike on 13.01.2017.
|
* Created by mike on 13.01.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventTempTargetChange {
|
public class EventTempTargetChange extends Event {
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,5 @@ package info.nightscout.androidaps.events;
|
||||||
/**
|
/**
|
||||||
* Created by mike on 04.06.2016.
|
* Created by mike on 04.06.2016.
|
||||||
*/
|
*/
|
||||||
public class EventTreatmentChange {
|
public class EventTreatmentChange extends EventLoop {
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package info.nightscout.androidaps.events;
|
||||||
|
|
||||||
|
/** Base class for events to update the UI, mostly a specific tab. */
|
||||||
|
public abstract class EventUpdateGui extends Event {
|
||||||
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
package info.nightscout.androidaps.plugins.IobCobCalculator.events;
|
package info.nightscout.androidaps.plugins.IobCobCalculator.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.EventLoop;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 30.04.2017.
|
* Created by mike on 30.04.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventAutosensCalculationFinished {
|
public class EventAutosensCalculationFinished extends EventLoop {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package info.nightscout.androidaps.plugins.IobCobCalculator.events;
|
package info.nightscout.androidaps.plugins.IobCobCalculator.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 26.04.2017.
|
* Created by mike on 26.04.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventNewHistoryData {
|
public class EventNewHistoryData extends Event {
|
||||||
public long time = 0;
|
public long time = 0;
|
||||||
|
|
||||||
public EventNewHistoryData(long time) {
|
public EventNewHistoryData(long time) {
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package info.nightscout.androidaps.plugins.Loop.events;
|
package info.nightscout.androidaps.plugins.Loop.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.EventUpdateGui;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 05.08.2016.
|
* Created by mike on 05.08.2016.
|
||||||
*/
|
*/
|
||||||
public class EventLoopSetLastRunGui {
|
public class EventLoopSetLastRunGui extends EventUpdateGui {
|
||||||
public String text = null;
|
public String text = null;
|
||||||
|
|
||||||
public EventLoopSetLastRunGui(String text) {
|
public EventLoopSetLastRunGui(String text) {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.Loop.events;
|
package info.nightscout.androidaps.plugins.Loop.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.EventUpdateGui;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 05.08.2016.
|
* Created by mike on 05.08.2016.
|
||||||
*/
|
*/
|
||||||
public class EventLoopUpdateGui {
|
public class EventLoopUpdateGui extends EventUpdateGui {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.Loop.events;
|
package info.nightscout.androidaps.plugins.Loop.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 07.08.2016.
|
* Created by mike on 07.08.2016.
|
||||||
*/
|
*/
|
||||||
public class EventNewOpenLoopNotification {
|
public class EventNewOpenLoopNotification extends Event {
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,14 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientRestart;
|
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientRestart;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.services.NSClientService;
|
|
||||||
import io.socket.client.Ack;
|
import io.socket.client.Ack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 29.12.2015.
|
* Created by mike on 29.12.2015.
|
||||||
*/
|
*/
|
||||||
public class NSAddAck implements Ack {
|
public class NSAddAck extends Event implements Ack {
|
||||||
private static Logger log = LoggerFactory.getLogger(NSAddAck.class);
|
private static Logger log = LoggerFactory.getLogger(NSAddAck.class);
|
||||||
public String _id = null;
|
public String _id = null;
|
||||||
public String nsClientID = null;
|
public String nsClientID = null;
|
||||||
|
|
|
@ -3,13 +3,14 @@ package info.nightscout.androidaps.plugins.NSClientInternal.acks;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientNewLog;
|
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientNewLog;
|
||||||
import io.socket.client.Ack;
|
import io.socket.client.Ack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 02.01.2016.
|
* Created by mike on 02.01.2016.
|
||||||
*/
|
*/
|
||||||
public class NSAuthAck implements Ack{
|
public class NSAuthAck extends Event implements Ack{
|
||||||
public boolean read = false;
|
public boolean read = false;
|
||||||
public boolean write = false;
|
public boolean write = false;
|
||||||
public boolean write_treatment = false;
|
public boolean write_treatment = false;
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.NSClientInternal.acks;
|
|
||||||
|
|
||||||
import android.os.SystemClock;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import io.socket.client.Ack;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mike on 29.12.2015.
|
|
||||||
*/
|
|
||||||
public class NSPingAck implements Ack {
|
|
||||||
private static Logger log = LoggerFactory.getLogger(NSPingAck.class);
|
|
||||||
|
|
||||||
public long mills = 0;
|
|
||||||
public boolean received = false;
|
|
||||||
public boolean auth_received = false;
|
|
||||||
public boolean read = false;
|
|
||||||
public boolean write = false;
|
|
||||||
public boolean write_treatment = false;
|
|
||||||
|
|
||||||
public void call(Object...args) {
|
|
||||||
JSONObject response = (JSONObject)args[0];
|
|
||||||
mills = response.optLong("mills");
|
|
||||||
if (response.has("authorization")) {
|
|
||||||
auth_received = true;
|
|
||||||
try {
|
|
||||||
JSONObject authorization = response.getJSONObject("authorization");
|
|
||||||
read = authorization.optBoolean("read");
|
|
||||||
write = authorization.optBoolean("write");
|
|
||||||
write_treatment = authorization.optBoolean("write_treatment");
|
|
||||||
} catch (JSONException e) {
|
|
||||||
log.error("Unhandled exception", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
received = true;
|
|
||||||
synchronized(this) {
|
|
||||||
this.notify();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,12 +6,13 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
import io.socket.client.Ack;
|
import io.socket.client.Ack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 21.02.2016.
|
* Created by mike on 21.02.2016.
|
||||||
*/
|
*/
|
||||||
public class NSUpdateAck implements Ack {
|
public class NSUpdateAck extends Event implements Ack {
|
||||||
private static Logger log = LoggerFactory.getLogger(NSUpdateAck.class);
|
private static Logger log = LoggerFactory.getLogger(NSUpdateAck.class);
|
||||||
public boolean result = false;
|
public boolean result = false;
|
||||||
public String _id = null;
|
public String _id = null;
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
package info.nightscout.androidaps.plugins.NSClientInternal.events;
|
package info.nightscout.androidaps.plugins.NSClientInternal.events;
|
||||||
|
|
||||||
import android.text.Html;
|
|
||||||
import android.text.Spanned;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 15.02.2017.
|
* Created by mike on 15.02.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventNSClientNewLog {
|
public class EventNSClientNewLog extends Event {
|
||||||
public Date date = new Date();
|
public Date date = new Date();
|
||||||
public String action;
|
public String action;
|
||||||
public String logText;
|
public String logText;
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package info.nightscout.androidaps.plugins.NSClientInternal.events;
|
package info.nightscout.androidaps.plugins.NSClientInternal.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 15.02.2017.
|
* Created by mike on 15.02.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventNSClientRestart {
|
public class EventNSClientRestart extends Event {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package info.nightscout.androidaps.plugins.NSClientInternal.events;
|
package info.nightscout.androidaps.plugins.NSClientInternal.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 02.01.2016.
|
* Created by mike on 02.01.2016.
|
||||||
*/
|
*/
|
||||||
public class EventNSClientStatus {
|
public class EventNSClientStatus extends Event {
|
||||||
public String status = "";
|
public String status = "";
|
||||||
|
|
||||||
public EventNSClientStatus(String status) {
|
public EventNSClientStatus(String status) {
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package info.nightscout.androidaps.plugins.NSClientInternal.events;
|
package info.nightscout.androidaps.plugins.NSClientInternal.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.EventUpdateGui;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 17.02.2017.
|
* Created by mike on 17.02.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventNSClientUpdateGUI {
|
public class EventNSClientUpdateGUI extends EventUpdateGui {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.OpenAPSMA.events;
|
package info.nightscout.androidaps.plugins.OpenAPSMA.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.EventUpdateGui;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 05.08.2016.
|
* Created by mike on 05.08.2016.
|
||||||
*/
|
*/
|
||||||
public class EventOpenAPSUpdateGui {
|
public class EventOpenAPSUpdateGui extends EventUpdateGui {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package info.nightscout.androidaps.plugins.OpenAPSMA.events;
|
package info.nightscout.androidaps.plugins.OpenAPSMA.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.EventUpdateGui;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 05.08.2016.
|
* Created by mike on 05.08.2016.
|
||||||
*/
|
*/
|
||||||
public class EventOpenAPSUpdateResultGui {
|
public class EventOpenAPSUpdateResultGui extends EventUpdateGui {
|
||||||
public String text = null;
|
public String text = null;
|
||||||
|
|
||||||
public EventOpenAPSUpdateResultGui(String text) {
|
public EventOpenAPSUpdateResultGui(String text) {
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package info.nightscout.androidaps.plugins.Overview.events;
|
package info.nightscout.androidaps.plugins.Overview.events;
|
||||||
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by adrian on 20/02/17.
|
* Created by adrian on 20/02/17.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventDismissBolusprogressIfRunning {
|
public class EventDismissBolusprogressIfRunning extends Event {
|
||||||
public final PumpEnactResult result;
|
public final PumpEnactResult result;
|
||||||
|
|
||||||
public EventDismissBolusprogressIfRunning(PumpEnactResult result) {
|
public EventDismissBolusprogressIfRunning(PumpEnactResult result) {
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package info.nightscout.androidaps.plugins.Overview.events;
|
package info.nightscout.androidaps.plugins.Overview.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 03.12.2016.
|
* Created by mike on 03.12.2016.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventDismissNotification {
|
public class EventDismissNotification extends Event {
|
||||||
public int id;
|
public int id;
|
||||||
|
|
||||||
public EventDismissNotification(int did) {
|
public EventDismissNotification(int did) {
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package info.nightscout.androidaps.plugins.Overview.events;
|
package info.nightscout.androidaps.plugins.Overview.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
import info.nightscout.androidaps.plugins.Overview.Notification;
|
import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 03.12.2016.
|
* Created by mike on 03.12.2016.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventNewNotification {
|
public class EventNewNotification extends Event {
|
||||||
public Notification notification;
|
public Notification notification;
|
||||||
|
|
||||||
public EventNewNotification(Notification n) {
|
public EventNewNotification(Notification n) {
|
||||||
|
|
|
@ -4,8 +4,9 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.db.Treatment;
|
import info.nightscout.androidaps.db.Treatment;
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
|
|
||||||
public class EventOverviewBolusProgress {
|
public class EventOverviewBolusProgress extends Event {
|
||||||
private static Logger log = LoggerFactory.getLogger(EventOverviewBolusProgress.class);
|
private static Logger log = LoggerFactory.getLogger(EventOverviewBolusProgress.class);
|
||||||
public String status = "";
|
public String status = "";
|
||||||
public Treatment t = null;
|
public Treatment t = null;
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package info.nightscout.androidaps.plugins.Overview.events;
|
package info.nightscout.androidaps.plugins.Overview.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 20.10.2016.
|
* Created by mike on 20.10.2016.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventQuickWizardChange {
|
public class EventQuickWizardChange extends Event {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package info.nightscout.androidaps.plugins.Overview.events;
|
package info.nightscout.androidaps.plugins.Overview.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 02.07.2017.
|
* Created by mike on 02.07.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventSetWakeLock {
|
public class EventSetWakeLock extends Event {
|
||||||
public boolean lock = false;
|
public boolean lock = false;
|
||||||
|
|
||||||
public EventSetWakeLock(boolean val) {
|
public EventSetWakeLock(boolean val) {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.ProfileNS.events;
|
package info.nightscout.androidaps.plugins.ProfileNS.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.EventUpdateGui;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 05.08.2016.
|
* Created by mike on 05.08.2016.
|
||||||
*/
|
*/
|
||||||
public class EventNSProfileUpdateGUI {
|
public class EventNSProfileUpdateGUI extends EventUpdateGui {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpDanaR.events;
|
package info.nightscout.androidaps.plugins.PumpDanaR.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 03.08.2016.
|
* Created by mike on 03.08.2016.
|
||||||
*/
|
*/
|
||||||
public class EventDanaRBolusStart {
|
public class EventDanaRBolusStart extends Event {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpDanaR.events;
|
package info.nightscout.androidaps.plugins.PumpDanaR.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 08.07.2016.
|
* Created by mike on 08.07.2016.
|
||||||
*/
|
*/
|
||||||
public class EventDanaRNewStatus {
|
public class EventDanaRNewStatus extends Event {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpDanaR.events;
|
package info.nightscout.androidaps.plugins.PumpDanaR.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 20.07.2016.
|
* Created by mike on 20.07.2016.
|
||||||
*/
|
*/
|
||||||
public class EventDanaRSyncStatus {
|
public class EventDanaRSyncStatus extends Event {
|
||||||
public String message;
|
public String message;
|
||||||
|
|
||||||
public EventDanaRSyncStatus() {
|
public EventDanaRSyncStatus() {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpVirtual.events;
|
package info.nightscout.androidaps.plugins.PumpVirtual.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.EventUpdateGui;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 05.08.2016.
|
* Created by mike on 05.08.2016.
|
||||||
*/
|
*/
|
||||||
public class EventVirtualPumpUpdateGui {
|
public class EventVirtualPumpUpdateGui extends EventUpdateGui {
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,12 @@ package info.nightscout.androidaps.plugins.SmsCommunicator.events;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 13.07.2016.
|
* Created by mike on 13.07.2016.
|
||||||
*/
|
*/
|
||||||
public class EventNewSMS {
|
public class EventNewSMS extends Event {
|
||||||
public Bundle bundle;
|
public Bundle bundle;
|
||||||
public EventNewSMS(Bundle bundle) {
|
public EventNewSMS(Bundle bundle) {
|
||||||
this.bundle = bundle;
|
this.bundle = bundle;
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.SmsCommunicator.events;
|
package info.nightscout.androidaps.plugins.SmsCommunicator.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.EventUpdateGui;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 05.08.2016.
|
* Created by mike on 05.08.2016.
|
||||||
*/
|
*/
|
||||||
public class EventSmsCommunicatorUpdateGui {
|
public class EventSmsCommunicatorUpdateGui extends EventUpdateGui {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue