2016-06-05 14:53:03 +02:00
|
|
|
package info.nightscout.androidaps.events;
|
|
|
|
|
2017-10-21 16:36:46 +02:00
|
|
|
import android.support.annotation.Nullable;
|
|
|
|
|
|
|
|
import info.nightscout.androidaps.db.BgReading;
|
|
|
|
|
2016-06-05 14:53:03 +02:00
|
|
|
/**
|
|
|
|
* Created by mike on 05.06.2016.
|
|
|
|
*/
|
2017-10-14 16:19:36 +02:00
|
|
|
public class EventNewBG extends EventLoop {
|
2017-10-21 16:36:46 +02:00
|
|
|
@Nullable
|
|
|
|
public final BgReading bgReading;
|
2018-03-13 15:03:12 +01:00
|
|
|
public final boolean isNew;
|
2018-03-17 13:36:52 +01:00
|
|
|
public final boolean isFromActiveBgSource;
|
2017-10-21 16:36:46 +02:00
|
|
|
|
2018-03-18 11:26:15 +01:00
|
|
|
/** Whether the BgReading is current (enough to use for treatment decisions). */
|
|
|
|
public boolean isCurrent() {
|
|
|
|
return bgReading != null && bgReading.date + 9 * 60 * 1000 > System.currentTimeMillis();
|
|
|
|
}
|
|
|
|
|
2018-03-17 13:36:52 +01:00
|
|
|
public EventNewBG(@Nullable BgReading bgReading, boolean isNew, boolean isFromActiveBgSource) {
|
2017-10-21 16:36:46 +02:00
|
|
|
this.bgReading = bgReading;
|
2018-03-13 15:03:12 +01:00
|
|
|
this.isNew = isNew;
|
2018-03-17 13:36:52 +01:00
|
|
|
this.isFromActiveBgSource = isFromActiveBgSource;
|
2017-10-21 16:36:46 +02:00
|
|
|
}
|
2016-06-05 14:53:03 +02:00
|
|
|
}
|