Cortex Android
|
Public Member Functions | |
TimeActiveSensor (String name, SensePlatform sensePlatform) | |
TimeActiveSensor (SensePlatform sensePlatform) | |
void | resetTime () |
void | setPeriodicReset (Calendar resetDate, long periodMillis) |
void | clearPeriodicReset () |
void | testingSetTime (long seconds) |
void | addSeconds (double seconds) |
The wrapper for the TimeActiveSensor module.
The TimeActiveSensor module registers how much time a user has been physically active (e.g. walking, running or cycling). It accumulates in real-time the number of seconds the user has been physically active since the last reset. The time can be manually reset, or a periodic reset can be used, e.g. to reset every day at 00:00.
The number of seconds the user has been physically active since the last reset. Between resets this value is monotonically non-decreasing.
Each time an input is received, the module produces an output. The output is a DataPoint with the value a double.
The linear accelerometer (burst-mode) sensor is used as input. It works with a sample rate of at least once per five minutes. This is the absolute minimum and produces bad estimates. The higher the sample frequency the faster the estimate converges to the correct value. For good a good estimate sampling at least once per minute is recommended.
Following is an example to set it up with a periodic reset every day at 20:00
Code:
TimeActiveSensor ta = new TimeActiveSensor("time active", sensePlatform); //reset every day at 20:00, the date is only used to align the period with Calendar resetDate = new GregorianCalendar(2013, 1, 1, 20, 0); ta.setPeriodicReset(resetDate, TimeActiveSensor.PERIOD_DAY);
void nl.sense_os.cortex.TimeActiveSensor.addSeconds | ( | double | seconds | ) |
Add time active seconds to the total time
seconds | The amount of seconds to add |
void nl.sense_os.cortex.TimeActiveSensor.clearPeriodicReset | ( | ) |
Clear the periodic reset. After calling this method the time won't be reset automatically.
void nl.sense_os.cortex.TimeActiveSensor.resetTime | ( | ) |
Reset time active to zero.
void nl.sense_os.cortex.TimeActiveSensor.setPeriodicReset | ( | Calendar | resetDate, |
long | periodMillis | ||
) |
Start a periodic reset.
resetDate | The date at which to align resets, e.g. 8 am |
periodMillis | The time interval between resets in milliseconds. |
void nl.sense_os.cortex.TimeActiveSensor.testingSetTime | ( | long | seconds | ) |
For testing purposes, set the time to a specified value. This method should only be used for testing. It sets the current time of the module to the specified time. This won't trigger a new data point, it just sets the time so the next data point will increment on top of this new value.
seconds | The new value of the current time active, specified in seconds. |