AndroidAPS/app/src/main/java/info/nightscout/androidaps/events/EventNewBG.java

27 lines
808 B
Java
Raw Normal View History

2016-06-05 14:53:03 +02:00
package info.nightscout.androidaps.events;
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.
*/
public class EventNewBG extends EventLoop {
@Nullable
public final BgReading bgReading;
2018-03-13 15:03:12 +01:00
public final boolean isNew;
public final boolean isFromActiveBgSource;
/** Whether the BgReading is current (enough to use for treatment decisions). */
public boolean isCurrent() {
return bgReading != null && bgReading.date + 9 * 60 * 1000 > System.currentTimeMillis();
}
public EventNewBG(@Nullable BgReading bgReading, boolean isNew, boolean isFromActiveBgSource) {
this.bgReading = bgReading;
2018-03-13 15:03:12 +01:00
this.isNew = isNew;
this.isFromActiveBgSource = isFromActiveBgSource;
}
2016-06-05 14:53:03 +02:00
}