public class GedderReceiver
extends android.content.BroadcastReceiver
Serves as the entry point for the Gedder algorithm.
After gathering data from the intent that was broadcast, it starts up the
GedderEngine
. The GedderEngine
sends back some of the relevant data after flowing
through its pipeline.
It then analyzes the response from the GedderEngine
.
During and after the analysis of the result data, it determines what action to take. It may do one of the following:
GedderEngine
for some default set time in the
future.GedderEngine
for some adjusted time in the
future.In the first case, the algorithm sees no reason for concern, and just carries on rescheduling itself for future analysis at some default rate.
Case 2In the second case, the algorithm picks up a possible delay, but it is not urgent enough that the user needs to wake up right now. It'll reschedule itself for future analysis, but at a tighter bound (how much tighter depends on the severity of the delay relative to the "wish" alarm time).
Case 3In the last case, the algorithm makes the decision to wake the user up right away: it caught a delay significant enough that if the user doesn't take action now, they'll be late to their destination.
Each time the algorithm sets itself up for a future flow through the pipeline, it checks how close it is to the currently planned alarm time. The closer it gets, the more often it queries for updates on traffic and possible delays. This carries on until the algorithm notices that now the user must wake up as soon as possible, otherwise the delay can be detrimental to reaching the destination at the planned arrival time.
To sum, the algorithm can either reschedule itself for a default rate of analysis, or a tighter rate, or trigger the alarm, all depending on information it has previously received and analyzed.
In this way, the algorithm ensures it's awake and aware of any delays at all times, and becomes increasingly active when there's a concern, i.e. when delays are present.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ANALYSIS_CONSECUTIVE_DELAY_COUNT |
static java.lang.String |
PARAM_ARRIVAL_TIME |
static java.lang.String |
PARAM_DESTINATION |
static java.lang.String |
PARAM_ID |
static java.lang.String |
PARAM_ORIGIN |
static java.lang.String |
PARAM_PREP_TIME |
static java.lang.String |
PARAM_UPPER_BOUND_TIME |
Constructor and Description |
---|
GedderReceiver() |
Modifier and Type | Method and Description |
---|---|
protected long |
getFrequencyDependendingOn(long dependent)
Returns a requery frequency depending upon some time.
|
void |
onReceive(android.content.Context context,
android.content.Intent intent) |
abortBroadcast, clearAbortBroadcast, getAbortBroadcast, getDebugUnregister, getResultCode, getResultData, getResultExtras, goAsync, isInitialStickyBroadcast, isOrderedBroadcast, peekService, setDebugUnregister, setOrderedHint, setResult, setResultCode, setResultData, setResultExtras
public static final java.lang.String PARAM_ORIGIN
public static final java.lang.String PARAM_DESTINATION
public static final java.lang.String PARAM_ARRIVAL_TIME
public static final java.lang.String PARAM_PREP_TIME
public static final java.lang.String PARAM_UPPER_BOUND_TIME
public static final java.lang.String PARAM_ID
public static final java.lang.String ANALYSIS_CONSECUTIVE_DELAY_COUNT
public void onReceive(android.content.Context context, android.content.Intent intent)
onReceive
in class android.content.BroadcastReceiver
protected long getFrequencyDependendingOn(long dependent)
Interval | Return |
---|---|
Hour > 5 | 1 hour 30 minutes |
1 < Hour ≤ 5 | 30 minutes |
30 < Minutes ≤ 60 | 10 minutes |
15 < Minutes ≤ 30 | 5 minutes |
10 < Minutes ≤ 15 | 2 minutes |
Minutes ≤ 10 | 1 minute |
dependent
- The time to base the heuristics off of.