AIM
|
#include <TimeActive.h>
Public Member Functions | |
TimeActive (std::string name="time_active") | |
void | doTick () |
virtual void | addData (const AIMData &data) |
std::vector< AIMValue > | getRequirements () const |
bool | requirementsAreUpdated (bool reset=true) const |
Public Member Functions inherited from AIM | |
AIM (std::string name="") | |
AIM (const AIM &other) | |
AIM & | operator= (const AIM &rhs) |
virtual void | addDataSubscriber (const std::string &key, AIM *subscriber) |
virtual void | removeDataSubscriber (const std::string &key) |
virtual AIMValue | setProperty (const std::string &key, AIMValue value) |
virtual AIMValue | getProperty (std::string key) const |
virtual void | sendData () |
virtual std::string | exportProperties () |
virtual std::vector< std::pair < std::string, AIMValue > > | getOutputData (bool clear_output=false) |
virtual std::vector< std::pair < std::string, AIMValue > > | getInputData (bool clear_input=false) |
virtual AIM * | getDataSubscriber (std::string subscriber) |
virtual const std::map < std::string, AIMValue > & | getProperties () |
virtual std::string | getName () const |
virtual void | setProperties (const std::map< std::string, AIMValue > &properties) |
Static Public Attributes | |
static const std::string | PROPERTY_THRESHOLD = "activity_spm_threshold" |
static const std::string | PROPERTY_TOTAL = "total" |
static const std::string | PROPERTY_RESET_PERIOD = "reset_period" |
static const std::string | PROPERTY_RESET_DATE = "reset_date" |
static const double | DEFAULT_THRESHOLD = 45.0 |
Static Public Attributes inherited from AIM | |
static const std::string | VERSION = AIM_VERSION |
Additional Inherited Members | |
Public Types inherited from AIM | |
typedef std::pair< std::string, AIMValue > | AIMData |
typedef std::queue< AIMData > | AIMDataQueue |
typedef std::queue< AIMValue > | AIMValueQueue |
typedef std::map< std::string, AIMValueQueue > | InputDataQueue |
Protected Member Functions inherited from AIM | |
void | setDataSubscribers (const std::map< std::string, AIM * > &subscribers) |
void | setInputDataQueue (const InputDataQueue &inputDataQueue) |
void | setOutputDataQueue (const AIMDataQueue &outputDataQueue) |
Protected Attributes inherited from AIM | |
std::string | name |
std::vector< AIMValue > | requirements |
bool | requirementsUpdated |
std::map< std::string, AIM * > | dataSubscribers |
std::map< std::string, AIMValue > | properties |
InputDataQueue | inputDataQueue |
AIMDataQueue | outputDataQueue |
The TimeActive 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 being 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.
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 active. This property can be adjusted, e.g. to manually reset.
The property PROPERTY_THRESHOLD is an internal property that is now being exported for debugging and testing. Don't touch it.
|
virtual |
Add data
This method adds data to the input queue of the AI-module The AIMData object
AIMData | data The input data |
Reimplemented from AIM.
|
virtual |
Do an AIM tick
This method is called to tick the AI-module to do its processing. During this tick the AI module grabs it's input data, does its processing, and sends the data to its data receivers. This method can be used in combination with AIM priorities, to streamline the data flow and timers for timed AI modules.
Reimplemented from AIM.
|
virtual |
Get the requirements of the module.
Reimplemented from AIM.
|
virtual |
Return wether the requirements have been updated since the last call to this function.
reset | If false, don't reset wether the requirements have been updated. |
Reimplemented from AIM.
|
static |
The periodic reset interval.
|
static |
The date (in unix time) to align the periodic reset with.
|
static |
Internal property for testing, don't touch.
|
static |
The current total time active.