public static void CreateStaticAlerts() { if(get_alert(LOW_ALERT_55) == null) { add_alert(LOW_ALERT_55, "low alert ", false, 55, true, 1, null, 0, 0, true, 20, true, true); } }
public static void CreateStaticAlerts() { if(get_alert(LOW_ALERT_55) == null) { add_alert(LOW_ALERT_55, "low alert ", false, 55, true, 1, null, 0, 0, true, 20, true, true); } }
public static void remove_alert(String uuid) { AlertType alert = get_alert(uuid); if(alert != null) { alert.delete(); } }
public static void CreateStaticAlerts() { if(get_alert(LOW_ALERT_55) == null) { add_alert(LOW_ALERT_55, "low alert ", false, 55, true, 1, null, 0, 0, true, 20, true, true); } }
public static void remove_alert(String uuid) { AlertType alert = get_alert(uuid); if(alert != null) { alert.delete(); } }
public static void remove_alert(String uuid) { AlertType alert = get_alert(uuid); if(alert != null) { alert.delete(); } }
private long calcuatleArmTimeBg(long now) { Long wakeTimeBg = Long.MAX_VALUE; ActiveBgAlert activeBgAlert = ActiveBgAlert.getOnly(); if (activeBgAlert != null) { AlertType alert = AlertType.get_alert(activeBgAlert.alert_uuid); if (alert != null) { wakeTimeBg = activeBgAlert.next_alert_at ; Log.d(TAG , "ArmTimer BG alert -waking at: "+ new Date(wakeTimeBg) +" in " + (wakeTimeBg - now)/60000d + " minutes"); if (wakeTimeBg < now) { // next alert should be at least one minute from now. wakeTimeBg = now + 60000; Log.w(TAG , "setting next alert to 1 minute from now (no problem right now, but needs a fix someplace else)"); } } } Log.d("Notifications" , "calcuatleArmTimeBg returning: "+ new Date(wakeTimeBg) +" in " + (wakeTimeBg - now)/60000d + " minutes"); return wakeTimeBg; }
private long calcuatleArmTimeBg(long now) { Long wakeTimeBg = Long.MAX_VALUE; ActiveBgAlert activeBgAlert = ActiveBgAlert.getOnly(); if (activeBgAlert != null) { AlertType alert = AlertType.get_alert(activeBgAlert.alert_uuid); if (alert != null) { wakeTimeBg = activeBgAlert.next_alert_at ; Log.d(TAG , "ArmTimer BG alert -waking at: "+ new Date(wakeTimeBg) +" in " + (wakeTimeBg - now)/60000d + " minutes"); if (wakeTimeBg < now) { // next alert should be at least one minute from now. wakeTimeBg = now + 60000; Log.w(TAG , "setting next alert to 1 minute from now (no problem right now, but needs a fix someplace else)"); } } } Log.d("Notifications" , "calcuatleArmTimeBg returning: "+ new Date(wakeTimeBg) +" in " + (wakeTimeBg - now)/60000d + " minutes"); return wakeTimeBg; }
private long calcuatleArmTimeBg(long now) { Long wakeTimeBg = Long.MAX_VALUE; ActiveBgAlert activeBgAlert = ActiveBgAlert.getOnly(); if (activeBgAlert != null) { AlertType alert = AlertType.get_alert(activeBgAlert.alert_uuid); if (alert != null) { wakeTimeBg = activeBgAlert.next_alert_at ; Log.d(TAG , "ArmTimer BG alert -waking at: "+ new Date(wakeTimeBg) +" in " + (wakeTimeBg - now)/60000d + " minutes"); if (wakeTimeBg < now) { // next alert should be at least one minute from now. wakeTimeBg = now + 60000; Log.w(TAG , "setting next alert to 1 minute from now (no problem right now, but needs a fix someplace else)"); } } } Log.d("Notifications" , "calcuatleArmTimeBg returning: "+ new Date(wakeTimeBg) +" in " + (wakeTimeBg - now)/60000d + " minutes"); return wakeTimeBg; }
public static AlertType alertTypegetOnly(final ActiveBgAlert aba) { if (aba == null) { Log.v(TAG, "ActiveBgAlert: alertTypegetOnly returning null"); return null; } AlertType alert = AlertType.get_alert(aba.alert_uuid); if(alert == null) { Log.d(TAG, "alertTypegetOnly did not find the active alert as part of existing alerts. returning null"); // removing the alert to be in a better state. ClearData(); return null; } if(!alert.uuid.equals(aba.alert_uuid)) { Log.wtf(TAG, "AlertType.get_alert did not return the correct alert"); } return alert; }
public static AlertType alertTypegetOnly(final ActiveBgAlert aba) { if (aba == null) { Log.v(TAG, "ActiveBgAlert: alertTypegetOnly returning null"); return null; } AlertType alert = AlertType.get_alert(aba.alert_uuid); if(alert == null) { Log.d(TAG, "alertTypegetOnly did not find the active alert as part of existing alerts. returning null"); // removing the alert to be in a better state. ClearData(); return null; } if(!alert.uuid.equals(aba.alert_uuid)) { Log.wtf(TAG, "AlertType.get_alert did not return the correct alert"); } return alert; }
public static AlertType alertTypegetOnly() { ActiveBgAlert aba = getOnly(); if (aba == null) { Log.v(TAG, "ActiveBgAlert: alertTypegetOnly returning null"); return null; } AlertType alert = AlertType.get_alert(aba.alert_uuid); if(alert == null) { Log.d(TAG, "alertTypegetOnly did not find the active alert as part of existing alerts. returning null"); // removing the alert to be in a better state. ClearData(); return null; } if(!alert.uuid.equals(aba.alert_uuid)) { Log.wtf(TAG, "AlertType.get_alert did not return the correct alert"); } return alert; }
final AlertType at = get_alert(uuid); if (at == null) { Log.e(TAG, "Alert Type null during update");
final AlertType at = get_alert(uuid); if (at == null) { Log.e(TAG, "Alert Type null during update");
public void ClockTick(Context ctx, boolean trendingToAlertEnd, String bgValue) { if (trendingToAlertEnd) { Log.d(TAG,"ClockTick: This alert is trending to it's end will not do anything"); return; } ActiveBgAlert activeBgAlert = ActiveBgAlert.getOnly(); if (activeBgAlert == null) { // Nothing to do ... return; } if(activeBgAlert.ready_to_alarm()) { stopAlert(ctx, false, false, false); // also don't cancel notification int timeFromStartPlaying = activeBgAlert.getUpdatePlayTime(); AlertType alert = AlertType.get_alert(activeBgAlert.alert_uuid); if (alert == null) { Log.d(TAG, "ClockTick: The alert was already deleted... will not play"); ActiveBgAlert.ClearData(); return; } Log.d(TAG,"ClockTick: Playing the alert again"); long nextAlertTime = alert.getNextAlertTime(ctx); activeBgAlert.updateNextAlertAt(nextAlertTime); Vibrate(ctx, alert, bgValue, alert.override_silent_mode, timeFromStartPlaying); } }
public void ClockTick(Context ctx, boolean trendingToAlertEnd, String bgValue) { if (trendingToAlertEnd) { Log.d(TAG,"ClockTick: This alert is trending to it's end will not do anything"); return; } ActiveBgAlert activeBgAlert = ActiveBgAlert.getOnly(); if (activeBgAlert == null) { // Nothing to do ... return; } if(activeBgAlert.ready_to_alarm()) { stopAlert(ctx, false, false, false); // also don't cancel notification final int minutesFromStartPlaying = activeBgAlert.getAndUpdateAlertingMinutes(); final AlertType alert = AlertType.get_alert(activeBgAlert.alert_uuid); if (alert == null) { Log.d(TAG, "ClockTick: The alert was already deleted... will not play"); ActiveBgAlert.ClearData(); return; } Log.d(TAG,"ClockTick: Playing the alert again"); long nextAlertTime = alert.getNextAlertTime(ctx); activeBgAlert.updateNextAlertAt(nextAlertTime); VibrateNotifyMakeNoise(ctx, alert, bgValue, alert.override_silent_mode, minutesFromStartPlaying); AlertTracker.evaluate(); } }
public void ClockTick(Context ctx, boolean trendingToAlertEnd, String bgValue) { if (trendingToAlertEnd) { Log.d(TAG,"ClockTick: This alert is trending to it's end will not do anything"); return; } ActiveBgAlert activeBgAlert = ActiveBgAlert.getOnly(); if (activeBgAlert == null) { // Nothing to do ... return; } if(activeBgAlert.ready_to_alarm()) { stopAlert(ctx, false, false, false); // also don't cancel notification final int minutesFromStartPlaying = activeBgAlert.getAndUpdateAlertingMinutes(); final AlertType alert = AlertType.get_alert(activeBgAlert.alert_uuid); if (alert == null) { Log.d(TAG, "ClockTick: The alert was already deleted... will not play"); ActiveBgAlert.ClearData(); return; } Log.d(TAG,"ClockTick: Playing the alert again"); long nextAlertTime = alert.getNextAlertTime(ctx); activeBgAlert.updateNextAlertAt(nextAlertTime); VibrateNotifyMakeNoise(ctx, alert, bgValue, alert.override_silent_mode, minutesFromStartPlaying); AlertTracker.evaluate(); } }
public static void testAll(Context context) { remove_all(); add_alert(null, "high alert 1", true, 180, true, 10, null, 0, 0, true, 20, true, true); add_alert(null, "high alert 2", true, 200, true, 10, null, 0, 0, true, 20, true, true); add_alert(null, "high alert 3", true, 220, true, 10, null, 0, 0, true, 20, true, true); print_all(); AlertType a1 = get_highest_active_alert(context, 190); Log.d(TAG, "a1 = " + a1.toString()); AlertType a2 = get_highest_active_alert(context, 210); Log.d(TAG, "a2 = " + a2.toString()); AlertType a3 = get_alert(a1.uuid); Log.d(TAG, "a1 == a3 ? need to see true " + (a1==a3) + a1 + " " + a3); add_alert(null, "low alert 1", false, 80, true, 10, null, 0, 0, true, 20, true, true); add_alert(null, "low alert 2", false, 60, true, 10, null, 0, 0, true, 20, true, true); AlertType al1 = get_highest_active_alert(context, 90); Log.d(TAG, "al1 should be null " + al1); al1 = get_highest_active_alert(context, 80); Log.d(TAG, "al1 = " + al1.toString()); AlertType al2 = get_highest_active_alert(context, 50); Log.d(TAG, "al2 = " + al2.toString()); Log.d(TAG, "HigherAlert(a1, a2) = a1?" + (HigherAlert(a1,a2) == a2)); Log.d(TAG, "HigherAlert(al1, al2) = al1?" + (HigherAlert(al1,al2) == al2)); Log.d(TAG, "HigherAlert(a1, al1) = al1?" + (HigherAlert(a1,al1) == al1)); Log.d(TAG, "HigherAlert(al1, a2) = al1?" + (HigherAlert(al1,a2) == al1)); // Make sure we do not influance on real data... remove_all(); }
public static void testAll(Context context) { remove_all(); add_alert(null, "high alert 1", true, 180, true, 10, null, 0, 0, true, 20, true, true); add_alert(null, "high alert 2", true, 200, true, 10, null, 0, 0, true, 20, true, true); add_alert(null, "high alert 3", true, 220, true, 10, null, 0, 0, true, 20, true, true); print_all(); AlertType a1 = get_highest_active_alert(context, 190); Log.d(TAG, "a1 = " + a1.toString()); AlertType a2 = get_highest_active_alert(context, 210); Log.d(TAG, "a2 = " + a2.toString()); AlertType a3 = get_alert(a1.uuid); Log.d(TAG, "a1 == a3 ? need to see true " + (a1==a3) + a1 + " " + a3); add_alert(null, "low alert 1", false, 80, true, 10, null, 0, 0, true, 20, true, true); add_alert(null, "low alert 2", false, 60, true, 10, null, 0, 0, true, 20, true, true); AlertType al1 = get_highest_active_alert(context, 90); Log.d(TAG, "al1 should be null " + al1); al1 = get_highest_active_alert(context, 80); Log.d(TAG, "al1 = " + al1.toString()); AlertType al2 = get_highest_active_alert(context, 50); Log.d(TAG, "al2 = " + al2.toString()); Log.d(TAG, "HigherAlert(a1, a2) = a1?" + (HigherAlert(a1,a2) == a2)); Log.d(TAG, "HigherAlert(al1, al2) = al1?" + (HigherAlert(al1,al2) == al2)); Log.d(TAG, "HigherAlert(a1, al1) = al1?" + (HigherAlert(a1,al1) == al1)); Log.d(TAG, "HigherAlert(al1, a2) = al1?" + (HigherAlert(al1,a2) == al1)); // Make sure we do not influance on real data... remove_all(); }
public static void testAll(Context context) { remove_all(); add_alert(null, "high alert 1", true, 180, true, 10, null, 0, 0, true, 20, true, true); add_alert(null, "high alert 2", true, 200, true, 10, null, 0, 0, true, 20, true, true); add_alert(null, "high alert 3", true, 220, true, 10, null, 0, 0, true, 20, true, true); print_all(); AlertType a1 = get_highest_active_alert(context, 190); Log.d(TAG, "a1 = " + a1.toString()); AlertType a2 = get_highest_active_alert(context, 210); Log.d(TAG, "a2 = " + a2.toString()); AlertType a3 = get_alert(a1.uuid); Log.d(TAG, "a1 == a3 ? need to see true " + (a1==a3) + a1 + " " + a3); add_alert(null, "low alert 1", false, 80, true, 10, null, 0, 0, true, 20, true, true); add_alert(null, "low alert 2", false, 60, true, 10, null, 0, 0, true, 20, true, true); AlertType al1 = get_highest_active_alert(context, 90); Log.d(TAG, "al1 should be null " + al1); al1 = get_highest_active_alert(context, 80); Log.d(TAG, "al1 = " + al1.toString()); AlertType al2 = get_highest_active_alert(context, 50); Log.d(TAG, "al2 = " + al2.toString()); Log.d(TAG, "HigherAlert(a1, a2) = a1?" + (HigherAlert(a1,a2) == a2)); Log.d(TAG, "HigherAlert(al1, al2) = al1?" + (HigherAlert(al1,al2) == al2)); Log.d(TAG, "HigherAlert(a1, al1) = al1?" + (HigherAlert(a1,al1) == al1)); Log.d(TAG, "HigherAlert(al1, a2) = al1?" + (HigherAlert(al1,a2) == al1)); // Make sure we do not influance on real data... remove_all(); }