Java Code Examples for com.eveningoutpost.dexdrip.Home#get_follower()
The following examples show how to use
com.eveningoutpost.dexdrip.Home#get_follower() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DesertComms.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
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; }
Example 2
Source File: DoNothingService.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
public static SpannableString nanoStatus() { SpannableString pingStatus = null; if (lastMessageReceived > 0) { long pingSince = JoH.msSince(lastMessageReceived); if (pingSince > Constants.MINUTE_IN_MS * 30) { pingStatus = Span.colorSpan("No follower sync for: " + JoH.niceTimeScalar(pingSince), BAD.color()); } } if (Home.get_follower()) { updateLastBg(); final SpannableString remoteStatus = NanoStatus.getRemote(); if (last_bg != null) { if (JoH.msSince(last_bg.timestamp) > Constants.MINUTE_IN_MS * 15) { final SpannableString lastBgStatus = Span.colorSpan("Last from master: " + JoH.niceTimeSince(last_bg.timestamp) + " ago", NOTICE.color()); return Span.join(true, remoteStatus, pingStatus, lastBgStatus); } } else { return Span.join(true, pingStatus, new SpannableString(gs(R.string.no_data_received_from_master_yet))); } } else { return Span.join(true, pingStatus); } return null; }
Example 3
Source File: DoNothingService.java From xDrip with GNU General Public License v3.0 | 6 votes |
public static SpannableString nanoStatus() { SpannableString pingStatus = null; if (lastMessageReceived > 0) { long pingSince = JoH.msSince(lastMessageReceived); if (pingSince > Constants.MINUTE_IN_MS * 30) { pingStatus = Span.colorSpan("No follower sync for: " + JoH.niceTimeScalar(pingSince), BAD.color()); } } if (Home.get_follower()) { updateLastBg(); final SpannableString remoteStatus = NanoStatus.getRemote(); if (last_bg != null) { if (JoH.msSince(last_bg.timestamp) > Constants.MINUTE_IN_MS * 15) { final SpannableString lastBgStatus = Span.colorSpan("Last from master: " + JoH.niceTimeSince(last_bg.timestamp) + " ago", NOTICE.color()); return Span.join(true, remoteStatus, pingStatus, lastBgStatus); } } else { return Span.join(true, pingStatus, new SpannableString(gs(R.string.no_data_received_from_master_yet))); } } else { return Span.join(true, pingStatus); } return null; }
Example 4
Source File: DesertComms.java From xDrip with GNU General Public License v3.0 | 6 votes |
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; }
Example 5
Source File: DesertSync.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public static void pullAsEnabled() { if (Home.get_follower()) { if (isEnabled()) { // TODO check if no data received? or maybe we don't - should this instead be called from do nothing service?? DesertComms.pullFromOasis(getTopic(), getHighestPullTimeStamp()); } } }
Example 6
Source File: DesertComms.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public static boolean probeOasis(final String topic, final String hint) { if (emptyString(hint)) return false; if (Home.get_follower()) { final String url = HttpUrl.parse(getInitialUrl(hint)).newBuilder().addPathSegment("sync").addPathSegment("id") .addPathSegment(topic) .build().toString(); UserError.Log.d(TAG, "PROBE: " + url); queue.add(new QueueItem(url).setHandler(MasterPing)); runInBackground(); } else { UserError.Log.e(TAG, "Probe cancelled as not follower"); } return true; }
Example 7
Source File: DoNothingService.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
private void setFailOverTimer() { if (Home.get_follower()) { final long retry_in = (5 * 60 * 1000); UserError.Log.d(TAG, "setFailoverTimer: Restarting in: " + (retry_in / (60 * 1000)) + " minutes"); nextWakeUpTime = JoH.tsl() + retry_in; //final PendingIntent wakeIntent = PendingIntent.getService(this, 0, new Intent(this, this.getClass()), 0); final PendingIntent wakeIntent = WakeLockTrampoline.getPendingIntent(this.getClass()); JoH.wakeUpIntent(this, retry_in, wakeIntent); } else { stopSelf(); } }
Example 8
Source File: DesertSync.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public static List<StatusItem> megaStatus() { final List<StatusItem> l = new ArrayList<>(); if (isEnabled()) { if (Home.get_follower()) { l.addAll(DesertComms.megaStatus()); } } return l; }
Example 9
Source File: DesertSync.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public static void masterIdReply(final String result, final String host) { if (result == null) return; if (Home.get_follower()) { final RollCall rc = RollCall.fromJson(result); if (rc == null) return; if (rc.role.equals("Master")) { DesertComms.setOasisIP(host); pullAsEnabled(); } } else { UserError.Log.e(TAG, "Refusing to process id reply as we are not a follower"); } }
Example 10
Source File: DesertSync.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static void pullAsEnabled() { if (Home.get_follower()) { if (isEnabled()) { // TODO check if no data received? or maybe we don't - should this instead be called from do nothing service?? DesertComms.pullFromOasis(getTopic(), getHighestPullTimeStamp()); } } }
Example 11
Source File: DesertComms.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static boolean probeOasis(final String topic, final String hint) { if (emptyString(hint)) return false; if (Home.get_follower()) { final String url = HttpUrl.parse(getInitialUrl(hint)).newBuilder().addPathSegment("sync").addPathSegment("id") .addPathSegment(topic) .build().toString(); UserError.Log.d(TAG, "PROBE: " + url); queue.add(new QueueItem(url).setHandler(MasterPing)); runInBackground(); } else { UserError.Log.e(TAG, "Probe cancelled as not follower"); } return true; }
Example 12
Source File: DoNothingService.java From xDrip with GNU General Public License v3.0 | 5 votes |
private void setFailOverTimer() { if (Home.get_follower()) { final long retry_in = (5 * 60 * 1000); UserError.Log.d(TAG, "setFailoverTimer: Restarting in: " + (retry_in / (60 * 1000)) + " minutes"); nextWakeUpTime = JoH.tsl() + retry_in; //final PendingIntent wakeIntent = PendingIntent.getService(this, 0, new Intent(this, this.getClass()), 0); final PendingIntent wakeIntent = WakeLockTrampoline.getPendingIntent(this.getClass()); JoH.wakeUpIntent(this, retry_in, wakeIntent); } else { stopSelf(); } }
Example 13
Source File: DesertSync.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static List<StatusItem> megaStatus() { final List<StatusItem> l = new ArrayList<>(); if (isEnabled()) { if (Home.get_follower()) { l.addAll(DesertComms.megaStatus()); } } return l; }
Example 14
Source File: DesertSync.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static void masterIdReply(final String result, final String host) { if (result == null) return; if (Home.get_follower()) { final RollCall rc = RollCall.fromJson(result); if (rc == null) return; if (rc.role.equals("Master")) { DesertComms.setOasisIP(host); pullAsEnabled(); } } else { UserError.Log.e(TAG, "Refusing to process id reply as we are not a follower"); } }
Example 15
Source File: CollectionServiceStarter.java From xDrip with GNU General Public License v3.0 | 4 votes |
private void startFollowerThread() { Log.d(TAG, "starting follower service"); startServiceCompat(new Intent(this.mContext, DoNothingService.class)); if (Home.get_follower()) GcmActivity.requestPing(); }
Example 16
Source File: ForegroundServiceStarter.java From xDrip with GNU General Public License v3.0 | 4 votes |
public static boolean shouldRunCollectorInForeground() { // Force foreground with Oreo and above return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !Home.get_follower()) || Pref.getBoolean("run_service_in_foreground", true); }
Example 17
Source File: NanoStatus.java From xDrip with GNU General Public License v3.0 | 4 votes |
private static SpannableString getLocalOrRemoteSensorExpiry() { if (Home.get_follower()) { return getRemote("sensor-expiry"); } return SensorDays.get().getSpannable(); }
Example 18
Source File: NanoStatus.java From xDrip-plus with GNU General Public License v3.0 | 4 votes |
private static SpannableString getLocalOrRemoteSensorExpiry() { if (Home.get_follower()) { return getRemote("sensor-expiry"); } return SensorDays.get().getSpannable(); }
Example 19
Source File: ForegroundServiceStarter.java From xDrip-plus with GNU General Public License v3.0 | 4 votes |
public static boolean shouldRunCollectorInForeground() { // Force foreground with Oreo and above return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !Home.get_follower()) || Pref.getBoolean("run_service_in_foreground", true); }
Example 20
Source File: CollectionServiceStarter.java From xDrip-plus with GNU General Public License v3.0 | 4 votes |
private void startFollowerThread() { Log.d(TAG, "starting follower service"); startServiceCompat(new Intent(this.mContext, DoNothingService.class)); if (Home.get_follower()) GcmActivity.requestPing(); }