use of com.eveningoutpost.dexdrip.UtilityModels.StatusItem in project xDrip-plus by jamorham.
the class TidepoolStatus method megaStatus.
// data for MegaStatus
public static List<StatusItem> megaStatus() {
final KeyStore keyStore = FastStore.getInstance();
final List<StatusItem> l = new ArrayList<>();
// TODO needs generic message format string
l.add(new StatusItem("Tidepool Synced to", niceTimeScalar(msSince(UploadChunk.getLastEnd())) + " ago"));
final String status = keyStore.getS(TidepoolUploader.STATUS_KEY);
if (!JoH.emptyString(status)) {
l.add(new StatusItem("Tidepool Status", status));
}
return l;
}
use of com.eveningoutpost.dexdrip.UtilityModels.StatusItem in project xDrip-plus by jamorham.
the class DesertComms method megaStatus.
// megastatus
// data for MegaStatus
public static List<StatusItem> megaStatus() {
final List<StatusItem> l = new ArrayList<>();
if (Home.get_follower()) {
if (emptyString(getOasisIP())) {
l.add(new StatusItem("Desert Master", "Not known yet - needs QR code scan?"));
} else {
l.add(new StatusItem("Desert Master", getOasisIP(), RouteTools.reachable(getOasisIP()) ? StatusItem.Highlight.NORMAL : StatusItem.Highlight.BAD));
}
if (Home.get_engineering_mode()) {
l.add(new StatusItem("Desert Backup", getOasisBackupIP()));
l.add(new StatusItem("Our IP", RouteTools.getBestInterfaceAddress()));
}
}
return l;
}
use of com.eveningoutpost.dexdrip.UtilityModels.StatusItem in project xDrip-plus by jamorham.
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;
}
use of com.eveningoutpost.dexdrip.UtilityModels.StatusItem in project xDrip-plus by jamorham.
the class G5CollectionService method megaStatus.
/* public static void setWatchStatus(DataMap dataMap) {
lastStateWatch = dataMap.getString("lastState", "");
static_last_timestamp_watch = dataMap.getLong("timestamp", 0);
}
public static DataMap getWatchStatus() {
DataMap dataMap = new DataMap();
dataMap.putString("lastState", lastState);
dataMap.putLong("timestamp", static_last_timestamp);
return dataMap;
}*/
// data for MegaStatus
public static List<StatusItem> megaStatus() {
final List<StatusItem> l = new ArrayList<>();
l.add(new StatusItem("Phone Service State", lastState));
if (static_last_timestamp > 0) {
l.add(new StatusItem("Phone got Glucose", JoH.niceTimeSince(static_last_timestamp) + " ago"));
}
if (Pref.getBooleanDefaultFalse("wear_sync") && Pref.getBooleanDefaultFalse("enable_wearG5")) {
l.add(new StatusItem("Watch Service State", lastStateWatch));
if (static_last_timestamp_watch > 0) {
l.add(new StatusItem("Watch got Glucose", JoH.niceTimeSince(static_last_timestamp_watch) + " ago"));
}
}
final String tx_id = Pref.getStringDefaultBlank("dex_txid");
l.add(new StatusItem("Transmitter ID", tx_id));
// get firmware details
VersionRequestRxMessage vr = getFirmwareDetails(tx_id);
if ((vr != null) && (vr.firmware_version_string.length() > 0)) {
l.add(new StatusItem("Firmware Version", vr.firmware_version_string));
l.add(new StatusItem("Bluetooth Version", vr.bluetooth_firmware_version_string));
l.add(new StatusItem("Other Version", vr.other_firmware_version));
l.add(new StatusItem("Hardware Version", vr.hardwarev));
// TODO color code
if (vr.asic != 61440)
l.add(new StatusItem("ASIC", vr.asic, StatusItem.Highlight.NOTICE));
}
BatteryInfoRxMessage bt = getBatteryDetails(tx_id);
long last_battery_query = PersistentStore.getLong(G5_BATTERY_FROM_MARKER + tx_id);
if (getBatteryStatusNow) {
l.add(new StatusItem("Battery Status Request Queued", "Will attempt to read battery status on next sensor reading", StatusItem.Highlight.NOTICE, "long-press", new Runnable() {
@Override
public void run() {
getBatteryStatusNow = false;
}
}));
}
if ((bt != null) && (last_battery_query > 0)) {
l.add(new StatusItem("Battery Last queried", JoH.niceTimeSince(last_battery_query) + " " + "ago", StatusItem.Highlight.NORMAL, "long-press", new Runnable() {
@Override
public void run() {
getBatteryStatusNow = true;
}
}));
l.add(new StatusItem("Transmitter Status", TransmitterStatus.getBatteryLevel(vr.status).toString()));
l.add(new StatusItem("Transmitter Days", bt.runtime + ((last_transmitter_timestamp > 0) ? " / " + JoH.qs((double) last_transmitter_timestamp / 86400, 1) : "")));
l.add(new StatusItem("Voltage A", bt.voltagea, bt.voltagea < 300 ? StatusItem.Highlight.BAD : StatusItem.Highlight.NORMAL));
l.add(new StatusItem("Voltage B", bt.voltageb, bt.voltageb < 290 ? StatusItem.Highlight.BAD : StatusItem.Highlight.NORMAL));
l.add(new StatusItem("Resistance", bt.resist, bt.resist > 1400 ? StatusItem.Highlight.BAD : (bt.resist > 1000 ? StatusItem.Highlight.NOTICE : (bt.resist > 750 ? StatusItem.Highlight.NORMAL : StatusItem.Highlight.GOOD))));
l.add(new StatusItem("Temperature", bt.temperature + " \u2103"));
}
return l;
}
Aggregations