Cortex Android
 All Classes Namespaces Functions Variables
nl.sense_os.cortex.TimeActiveSensor Class Reference
Inheritance diagram for nl.sense_os.cortex.TimeActiveSensor:

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)
 

Static Public Attributes

static final long PERIOD_SECOND = 1000
 
static final long PERIOD_MINUTE = 60 * PERIOD_SECOND
 
static final long PERIOD_HOUR = 60 * PERIOD_MINUTE
 
static final long PERIOD_DAY = 24l * PERIOD_HOUR
 
static final long PERIOD_WEEK = 7l * PERIOD_DAY
 

Detailed Description

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.

Output:

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.

Input:

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);
Author
Pim

Member Function Documentation

void nl.sense_os.cortex.TimeActiveSensor.addSeconds ( double  seconds)

Add time active seconds to the total time

Parameters
secondsThe 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.

Parameters
resetDateThe date at which to align resets, e.g. 8 am
periodMillisThe 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.

Parameters
secondsThe new value of the current time active, specified in seconds.

The documentation for this class was generated from the following file: