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

Public Member Functions

 TimeCarriedSensor (String name, SensePlatform sensePlatform)
 
 TimeCarriedSensor (SensePlatform sensePlatform)
 
void resetTime ()
 
void setPeriodicReset (Calendar resetDate, long periodMillis)
 
void clearPeriodicReset ()
 
void testingSetTime (long 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
 

Protected Member Functions

void setup ()
 

Detailed Description

The TimeCarried module registers how much time a user has been carrying the device. It accumulates in real-time the number of seconds the user has been carrying the device 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 carrying the device 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 being a double.

Input:
As AIMData input it needs the key:values
{"accelerometer":{"value":{"x-axis":9.81, "y-axis":0.1, "z-axis":9.81}, "date":12345678.11}} float acceleration value
{"accelerometer_burst":{"value":{"header": "x,y,z","hz": 50,"values": [[9.81,0.1,9.81],[9.80,0,9.80]]}, "date":12345678.11}} float acceleration values
{"light":{"value":{"lux":11}, "date":12345678.11}} integer lux
{"screen activity":{"value":{"screen":"on"}, "date":12345678.11}} string can either be on or off
{"proximity":{"value":0.06, "date":12345678.11}} integer in meters
{"call state":{"value":{"state":"idle"}, "date":12345678.11}} string can either be calling, ringing, idle, dialing
{"battery":{"value":{"status":"charging ac"}, "date":12345678.11}} string can either be charging ac, charging usb, discharging, full

Properties:
The properties PROPERTY_RESET_DATE and PROPERTY_RESET_PERIOD can be used to set a periodic reset. The PROPERTY_RESET_DATE is the unix timestamp at which resets are aligned, and the PROPERTY_RESET_PERIOD is the period in seconds at which the reset is performed.

The property PROPERTY_TOTAL is the current value of the total time that the user was carrying the device. This property can be adjusted, e.g. to manually reset.

Following is an example to set it up with a periodic reset every day at 20:00

Code:

 TimeCarriedSensor ta = new TimeCarriedSensor("time carried", 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, TimeCarriedSensor.PERIOD_DAY);
Author
Pim

Member Function Documentation

void nl.sense_os.cortex.TimeCarriedSensor.clearPeriodicReset ( )

Clear the periodic reset. After calling this method the time won't be reset automatically.

void nl.sense_os.cortex.TimeCarriedSensor.resetTime ( )

Reset time carried to zero.

void nl.sense_os.cortex.TimeCarriedSensor.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.TimeCarriedSensor.setup ( )
protected

Setup the sensor

This method sets the input sensor and the initial settings

void nl.sense_os.cortex.TimeCarriedSensor.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 carried, specified in seconds.

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