AIM
 All Classes Functions Variables Typedefs Enumerations
CarryDevice Class Reference

#include <CarryDevice.h>

Inheritance diagram for CarryDevice:
AIM

Public Member Functions

 CarryDevice (std::string name=MODULE_NAME)
 
void doTick ()
 
void addData (const AIMData &data)
 
AIMValue setProperty (const std::string &key, AIMValue value)
 
void setProperties (const std::map< std::string, AIMValue > &properties)
 
std::map< std::string, AIMValue > & getProperties ()
 
- Public Member Functions inherited from AIM
 AIM (std::string name="")
 
 AIM (const AIM &other)
 
AIMoperator= (const AIM &rhs)
 
virtual void addDataSubscriber (const std::string &key, AIM *subscriber)
 
virtual void removeDataSubscriber (const std::string &key)
 
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 AIMgetDataSubscriber (std::string subscriber)
 
virtual std::string getName () const
 
virtual std::vector< AIMValuegetRequirements () const
 
virtual bool requirementsAreUpdated (bool reset=true) const
 

Static Public Attributes

static const std::string SENSOR_ACCELEROMETER_EVENT = "accelerometer event"
 
static const std::string PROP_SENSOREVENT_ACC = "SensorEvent Accelerometer"
 
static const std::string PROP_TIME_WINDOW = "time window"
 
static const std::string PROP_LAST_VALUES = "last values"
 
static const std::string PROP_MAX_LAST_ACTION_TIME = "max last action time"
 
static const std::string PROP_LAST_ACTION_TIME = "last action time"
 
static const std::string PROP_LAST_OUTPUT = "last output"
 
static const std::string PROP_CAMERA0_LIMITS = "camera 0 limits"
 
static const std::string PROP_CAMERA1_LIMITS = "camera 1 limits"
 
static const std::string PROP_FEATURE_NORMALIZATION = "normalization feature"
 
static const std::string FEATURE_NORMALIZATION_STD = "standard score normalization"
 
static const std::string FEATURE_NORMALIZATION_MINMAX = "min max normalization"
 
static const std::string MODULE_NAME = "carry_device"
 
- 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< AIMDataAIMDataQueue
 
typedef std::queue< AIMValueAIMValueQueue
 
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< AIMValuerequirements
 
bool requirementsUpdated
 
std::map< std::string, AIM * > dataSubscribers
 
std::map< std::string, AIMValueproperties
 
InputDataQueue inputDataQueue
 
AIMDataQueue outputDataQueue
 

Detailed Description

CarryDevice.h

Created on: March 20, 2013 Author: Ted Schmidt

This is wrapper class for the Carry Device Module
This module recognizes whether the device is being carried by the user or not.
This module returns a value with:
{"carried":true} when the device is recently:
used, moved or has a proximity change.
{"carried":true, "in hand":true} when the device is recently:
used
{"carried":true, "on body":true} when the device is recently:
moved, has low proximity, has low light
else it returns:
{"carried":false}
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

Constructor & Destructor Documentation

CarryDevice::CarryDevice ( std::string  name = MODULE_NAME)

CarryDevice constructor

By default it sets the time window of this module to 60 seconds. The time window for the sensor event module used for triggering on motion events is set to 60*5 seconds. The threshold value of the sensor event module is set to 0.005, it can have a value between 0-1. Where 0 is the lowest variance encountered for the sensor and 1 the highest. The maximum time it will return the on body state when no new events have occurred is set to PROP_MAX_LAST_ACTION_TIME = 60*15 seconds.

Member Function Documentation

void CarryDevice::addData ( const AIMData data)
virtual

Add data

This method adds data to the input queue of the AI-module The AIMData object

Parameters
AIMDatadata The input data

Reimplemented from AIM.

void CarryDevice::doTick ( )
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.

std::map< std::string, AIMValue > & CarryDevice::getProperties ( )
virtual

Return the module and submodule properties

Reimplemented from AIM.

void CarryDevice::setProperties ( const std::map< std::string, AIMValue > &  properties)
virtual

Set the module properties

Set the defined properties. Old property values will remain if no new values are specified for a property.

Parameters
mapproperties The properties to set

Set the properties for this module and for each submodule

Reimplemented from AIM.

AIMValue CarryDevice::setProperty ( const std::string &  key,
AIMValue  value 
)
virtual

Set a property value

To set a property value for the sensor event module use the key PROP_SENSOREVENT_ACC.

Set the properties

Reimplemented from AIM.

Member Data Documentation

const std::string CarryDevice::FEATURE_NORMALIZATION_MINMAX = "min max normalization"
static

Feature type for the normalization feature: min max

const std::string CarryDevice::FEATURE_NORMALIZATION_STD = "standard score normalization"
static

Feature type for the normalization feature: standard score / z-score

const std::string CarryDevice::MODULE_NAME = "carry_device"
static

Name of the this module

const std::string CarryDevice::PROP_CAMERA0_LIMITS = "camera 0 limits"
static

Property key for the measured limits of camera 0

const std::string CarryDevice::PROP_CAMERA1_LIMITS = "camera 1 limits"
static

Property key for the measured limits of camera 1

const std::string CarryDevice::PROP_FEATURE_NORMALIZATION = "normalization feature"
static

Property key for the normalization feature

property for the normalization feature

const std::string CarryDevice::PROP_LAST_ACTION_TIME = "last action time"
static

Property key for the timestamp of the last action/state change

const std::string CarryDevice::PROP_LAST_OUTPUT = "last output"
static

Property key for the last output action/state

const std::string CarryDevice::PROP_LAST_VALUES = "last values"
static

Property key for the last values

const std::string CarryDevice::PROP_MAX_LAST_ACTION_TIME = "max last action time"
static

Property key for the max time to return on body if there's no state change

const std::string CarryDevice::PROP_SENSOREVENT_ACC = "SensorEvent Accelerometer"
static

Property key of the sensor event module

const std::string CarryDevice::PROP_TIME_WINDOW = "time window"
static

Property key for the time window

const std::string CarryDevice::SENSOR_ACCELEROMETER_EVENT = "accelerometer event"
static

Input name of the accelerometer event sensor


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