use of com.eveningoutpost.dexdrip.UtilityModels.StatusItem in project xDrip by NightscoutFoundation.
the class LibreReceiver method megaStatus.
public static List<StatusItem> megaStatus() {
final List<StatusItem> l = new ArrayList<>();
final Sensor sensor = Sensor.currentSensor();
if (sensor != null) {
l.add(new StatusItem("Libre2 Sensor", sensor.uuid + "\nStart: " + DateFormat.format("dd.MM.yyyy kk:mm", sensor.started_at)));
}
String lastReading = "";
try {
lastReading = DateFormat.format("dd.MM.yyyy kk:mm:ss", last_reading).toString();
l.add(new StatusItem("Last Reading", lastReading));
} catch (Exception e) {
Log.e(TAG, "Error readlast: " + e);
}
if (get_engineering_mode()) {
l.add(new StatusItem("Last Calc.", libre_calc_doku));
}
if (Pref.getBooleanDefaultFalse("Libre2_showSensors")) {
l.add(new StatusItem("Sensors", Libre2Sensors()));
}
return l;
}
use of com.eveningoutpost.dexdrip.UtilityModels.StatusItem in project xDrip by NightscoutFoundation.
the class ShareFollowService method megaStatus.
/**
* MegaStatus for Nightscout Follower
*/
public static List<StatusItem> megaStatus() {
final BgReading lastBg = BgReading.lastNoSenssor();
// 30 seconds
long hightlightGrace = Constants.SECOND_IN_MS * 30;
// Status for BG receive delay (time from bg was recorded till received in xdrip)
String ageOfBgLastPoll = "n/a";
StatusItem.Highlight ageOfLastBgPollHighlight = StatusItem.Highlight.NORMAL;
if (bgReceiveDelay > 0) {
ageOfBgLastPoll = JoH.niceTimeScalar(bgReceiveDelay);
if (bgReceiveDelay > SAMPLE_PERIOD / 2) {
ageOfLastBgPollHighlight = StatusItem.Highlight.BAD;
}
if (bgReceiveDelay > SAMPLE_PERIOD * 2) {
ageOfLastBgPollHighlight = StatusItem.Highlight.CRITICAL;
}
}
// Status for time since latest BG
String ageLastBg = "n/a";
StatusItem.Highlight bgAgeHighlight = StatusItem.Highlight.NORMAL;
if (lastBg != null) {
long age = JoH.msSince(lastBg.timestamp);
ageLastBg = JoH.niceTimeScalar(age);
if (age > SAMPLE_PERIOD + hightlightGrace) {
bgAgeHighlight = StatusItem.Highlight.BAD;
}
}
List<StatusItem> megaStatus = new ArrayList<>();
megaStatus.add(new StatusItem("Latest BG", ageLastBg + (lastBg != null ? " ago" : ""), bgAgeHighlight));
megaStatus.add(new StatusItem("BG receive delay", ageOfBgLastPoll, ageOfLastBgPollHighlight));
megaStatus.add(new StatusItem());
megaStatus.add(new StatusItem("Last poll", lastPoll > 0 ? JoH.niceTimeScalar(JoH.msSince(lastPoll)) + " ago" : "n/a"));
megaStatus.add(new StatusItem("Last wakeup", last_wakeup > 0 ? JoH.niceTimeScalar(JoH.msSince(last_wakeup)) + " ago" : "n/a"));
megaStatus.add(new StatusItem("Next poll in", JoH.niceTimeScalar(wakeup_time - JoH.tsl())));
if (lastBg != null) {
megaStatus.add(new StatusItem("Last BG time", JoH.dateTimeText(lastBg.timestamp)));
}
megaStatus.add(new StatusItem("Next poll time", JoH.dateTimeText(wakeup_time)));
megaStatus.add(new StatusItem());
megaStatus.add(new StatusItem("Buggy Samsung", JoH.buggy_samsung ? gs(R.string.yes) : gs(R.string.no)));
return megaStatus;
}
use of com.eveningoutpost.dexdrip.UtilityModels.StatusItem in project xDrip by NightscoutFoundation.
the class MiBandService method megaStatus.
// Mega Status
public static List<StatusItem> megaStatus() {
final List<StatusItem> l = new ArrayList<>();
final Inst II = Inst.get(MiBandService.class.getSimpleName());
l.add(new StatusItem("Model", MiBand.getModel()));
l.add(new StatusItem("Software version", MiBand.getVersion()));
l.add(new StatusItem("Mac address", MiBand.getMac()));
l.add(new StatusItem("Connected", II.isConnected ? gs(R.string.yes) : gs(R.string.no)));
l.add(new StatusItem("Is authenticated", MiBand.isAuthenticated() ? gs(R.string.yes) : gs(R.string.no)));
if (II.isConnected) {
int levelInPercent = batteryInfo.getLevelInPercent();
String levelInPercentText;
if (levelInPercent == 1000)
levelInPercentText = "Unknown";
else
levelInPercentText = levelInPercent + "%";
l.add(new StatusItem("Battery", levelInPercentText));
}
if (II.wakeup_time != 0) {
final long till = msTill(II.wakeup_time);
if (till > 0)
l.add(new StatusItem("Wake Up", niceTimeScalar(till)));
}
if (bgWakeupTime != 0) {
final long till = msTill(bgWakeupTime);
if (till > 0)
l.add(new StatusItem("Next time update", niceTimeScalar(till)));
}
l.add(new StatusItem("State", II.state));
final int qsize = II.getQueueSize();
if (qsize > 0) {
l.add(new StatusItem("Queue", qsize + " items"));
}
return l;
}
use of com.eveningoutpost.dexdrip.UtilityModels.StatusItem in project xDrip by NightscoutFoundation.
the class LeFunService method megaStatus.
// Mega Status
public static List<StatusItem> megaStatus() {
final List<StatusItem> l = new ArrayList<>();
final Inst II = Inst.get(LeFunService.class.getSimpleName());
l.add(new StatusItem("Model", LeFun.getModel()));
l.add(new StatusItem("Mac address", LeFun.getMac()));
l.add(new StatusItem("Connected", II.isConnected ? gs(R.string.yes) : gs(R.string.no)));
if (II.wakeup_time != 0) {
final long till = msTill(II.wakeup_time);
if (till > 0)
l.add(new StatusItem("Wake Up", niceTimeScalar(till)));
}
// if (II.retry_time != 0) {
// l.add(new StatusItem("Retry", niceTimeScalar(msTill(II.retry_time))));
// }
l.add(new StatusItem("State", II.state));
final int qsize = II.getQueueSize();
if (qsize > 0) {
l.add(new StatusItem("Queue", qsize + " items"));
}
return l;
}
use of com.eveningoutpost.dexdrip.UtilityModels.StatusItem in project xDrip by NightscoutFoundation.
the class BlueJayService method megaStatus.
// Mega Status
public static List<StatusItem> megaStatus() {
final List<StatusItem> l = new ArrayList<>();
final Inst II = Inst.get(BlueJayService.class.getSimpleName());
val info = BlueJayInfo.getInfo(II.address);
l.add(new StatusItem("Mac address", II.address));
if (BlueJay.getAuthKey(II.address) == null) {
l.add(new StatusItem("Pairing", "Not Paired! Tap to pair", CRITICAL, "long-press", () -> ThinJamActivity.requestQrCode()));
} else if (BlueJay.getIdentityKey(II.address) == null) {
l.add(new StatusItem("Identity", "Not Identified! Tap to pair", CRITICAL, "long-press", () -> ThinJamActivity.requestQrCode()));
}
l.add(new StatusItem("Connected", II.isConnected ? gs(R.string.yes) : gs(R.string.no)));
if (II.wakeup_time != 0 && !II.isConnected) {
final long till = msTill(II.wakeup_time);
if (till > 0)
l.add(new StatusItem("Retry Wake Up", niceTimeScalar(till)));
}
if (Home.get_engineering_mode()) {
val totalConnections = (int) connectionTracker.totalRecords();
l.add(new StatusItem("Connections", totalConnections + " last 20 min"));
if (info.buildNumber >= 2092 && info.fragmentationLevel > 0) {
l.add(new StatusItem("Fragmentation", info.fragmentationLevel + "% (" + info.fragmentationCounter + "," + (info.fragmentationIndex - 4096) + ")", info.fragmentationLevel > 0 ? StatusItem.Highlight.NOTICE : StatusItem.Highlight.NORMAL));
}
}
l.add(new StatusItem("State", II.state));
final int qsize = II.getQueueSize();
final int tjQueueSize = commandQueue.size();
if (tjQueueSize > 0 || qsize > 0) {
if (tjQueueSize > 0) {
l.add(new StatusItem("Queue", "(" + tjQueueSize + ") " + qsize + " items"));
} else {
l.add(new StatusItem("Queue", qsize + " items"));
}
}
if (info.hasCoreModule()) {
l.add(new StatusItem("xDrip Core", "Installed", GOOD));
} else {
l.add(new StatusItem("xDrip Core", "Not Installed", BAD, "long-press", new Runnable() {
@Override
public void run() {
ThinJamActivity.installCorePrompt();
}
}));
}
val successPercent = info.captureSuccessPercent();
if (successPercent > -1) {
l.add(new StatusItem("Capture Rate", String.format(Locale.US, "%d%% (%d)", successPercent, info.successfulReplies)));
}
if (info.thinJamVersion != 2) {
l.add(new StatusItem("ThinJam Version", info.thinJamVersion, NOTICE));
}
val lastReadingTime = info.getTimestamp();
if (lastReadingTime > 0) {
l.add(new StatusItem("Last Reading", String.format("%s ago", JoH.niceTimeScalar(msSince(info.getTimestamp())))));
}
l.add(new StatusItem("Charger", (info.isChargerConnected() ? "Connected" : "Not connected") + (Home.get_engineering_mode() ? (info.batteryPercent != -1 ? (" " + info.batteryPercent + "%") : "") : "")));
l.add(new StatusItem("Uptime", niceTimeScalar(info.getUptimeTimeStamp())));
val latestMainVersion = FirmwareInfo.getLatestMainFirmware();
l.add(new StatusItem("Firmware Version", "" + info.buildNumber, info.buildNumber < info.coreNumber ? NOTICE : NORMAL, "long-press", new Runnable() {
@Override
public void run() {
// prompt update for main?
}
}));
if (latestMainVersion > info.buildNumber && II.isConnected && qsize == 0) {
l.add(new StatusItem("Update Available", "Tap to update " + latestMainVersion, NOTICE, "long-press", new Runnable() {
@Override
public void run() {
ThinJamActivity.updateMainPrompt();
}
}));
}
if (info.coreNumber > 0 && II.isConnected) {
val latestCoreVersion = FirmwareInfo.getLatestCoreFirmware();
l.add(new StatusItem("Core Module", "xDrip v" + info.coreNumber, info.coreNumber < info.buildNumber ? NOTICE : NORMAL, "long-press", new Runnable() {
@Override
public void run() {
// prompt upgrade for core?
}
}));
if (latestCoreVersion > info.coreNumber && qsize == 0) {
l.add(new StatusItem("Core Update Available", "Tap to update " + latestCoreVersion, NOTICE, "long-press", new Runnable() {
@Override
public void run() {
ThinJamActivity.updateCorePrompt();
}
}));
}
}
l.add(new StatusItem("Admin Panel", "Tap to open", NORMAL, "long-press", new Runnable() {
@Override
public void run() {
JoH.startActivity(ThinJamActivity.class);
}
}));
return l;
}
Aggregations