AIM
 All Classes Functions Variables Typedefs Enumerations
CoachingEngine::SleepDurationTask Class Reference

#include <SleepDurationTask.h>

Inheritance diagram for CoachingEngine::SleepDurationTask:
CoachingEngine::Task AIM CoachingEngine::TaskDescription

Public Member Functions

 SleepDurationTask (double startDate, double endDate, AIMValue target)
 
- Public Member Functions inherited from CoachingEngine::Task
 Task (TaskDescription::Type taskType, double startDate, double endDate, AIMValue target)
 
virtual ~Task ()
 
virtual void doTick ()
 
virtual std::vector< AIMValuegetRequirements () const
 
virtual bool requirementsAreUpdated (bool reset=true) const
 
virtual void addTrigger (std::function< bool(double, AIMValue)> triggerFunction)
 
virtual void sendMessage (double timestamp, MsgType msgType)
 
virtual void setFinalStatus (Status finalStatus)
 
virtual void finishTask ()
 
virtual const std::map
< std::string, AIMValue > & 
getProperties ()
 
virtual void setProperties (const std::map< std::string, AIMValue > &properties)
 
virtual void setValueManually (const AIMValue &data)
 
virtual void setTarget (const AIMValue &data)
 
- 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 setProperty (const std::string &key, AIMValue value)
 
virtual AIMValue getProperty (std::string key) const
 
virtual void sendData ()
 
virtual void addData (const AIMData &data)
 
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
 
- Public Member Functions inherited from CoachingEngine::TaskDescription
 TaskDescription (Type taskTypeId, double startDate, double endDate, std::string description, AIMValue target)
 
 TaskDescription (const TaskDescription &other)
 
 TaskDescription ()
 
virtual double getStartDate () const
 
virtual double getEndDate () const
 
virtual std::string getDescription () const
 
virtual AIMValue getTarget () const
 
virtual AIMValue getCurrentValue () const
 
virtual Status getStatus () const
 
virtual Type getTaskType () const
 
virtual bool isCompleted ()
 
virtual AIMValue aimValueRepresentation ()
 

Static Public Attributes

static const std::string DESCRIPTION_STRING = "Sleep for at least %target% hours today."
 
static const std::string PROP_IS_ESTIMATE = "is_estimate"
 
- Static Public Attributes inherited from CoachingEngine::Task
static const std::string MSG_FIELD_TASK_TYPE = "task_type"
 
static const std::string MSG_FIELD_TASK_START_TIME = "task_start_time"
 
static const std::string MSG_FIELD_TYPE = "msg_type"
 
static const std::string MSG_FIELD_VALUE = "value"
 
static const std::string MSG_FIELD_TARGET = "target"
 
static const std::string MSG_FIELD_GENERATION_TIME = "generation_time"
 
static const std::string MSG_FIELD_TRIGGER_TIME = "trigger_time"
 
static const std::string PROP_TASK_TYPE = "task_type"
 
static const std::string PROP_START_TIME = "start_time"
 
static const std::string PROP_END_TIME = "end_time"
 
static const std::string PROP_DESCRIPTION = "description"
 
static const std::string PROP_TARGET = "target"
 
static const std::string PROP_VALUE = "value"
 
static const std::string PROP_STATUS = "status"
 
static const std::string PROP_COMPLETED = "completed"
 
static const std::string PROP_LAST_DATA = "last_data"
 
static const std::string PROP_HAS_MANUAL_VALUE = "has_manual_value"
 
- Static Public Attributes inherited from AIM
static const std::string VERSION = AIM_VERSION
 

Protected Member Functions

virtual void processDateValue (const std::string &sensor, const AIMValue &dateValue)
 
virtual void initializeTriggers ()
 
- Protected Member Functions inherited from CoachingEngine::Task
virtual void evaluateTriggers (double time, AIMValue data)
 
- 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)
 

Additional Inherited Members

- Public Types inherited from CoachingEngine::Task
enum  MsgType {
  TASK_START = 0, TASK_COMPLETE, TASK_SUCCESS, TASK_FAIL,
  TASK_ENCOURAGEMENT, TASK_REMINDER, TASK_STATUS_UNKNOWN
}
 
- 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
 
- Public Types inherited from CoachingEngine::TaskDescription
enum  Status { UNKNOWN, SUCCEEDED, FAILED }
 
enum  Type {
  NONE = 0, BE_ACTIVE, SLEEP, BE_RESILIENT,
  CALIBRATING, SLEEP_PERIOD_STAY_AWAKE, SLEEP_PERIOD_GO_TO_SLEEP, TAKE_MELATONIN,
  SLEEPY, UNWINDING, WAKING_UP, ACTIVE,
  BRIGHT_LIGHT, DIMMED_LIGHT, EXERCISE, TAKE_CAFFEINE,
  HAVE_BREAKFAST, HAVE_LUNCH, HAVE_DINNER, HAVE_SNACK,
  EAT_EXTRA_TODAY, FIRST_NIGHT_MELATONIN, FULLY_ADJUSTED, TASK_MR_WORRIES,
  TASK_MR_CONTROL, TASK_MR_SUPPORT, TASK_MR_FLEXIBILITY, TASK_MR_CONFIDENCE,
  TASK_MR_MOTIVATION, TASK_MR_RELAXATION
}
 
- Static Public Member Functions inherited from CoachingEngine::TaskDescription
static std::string taskTypeToString (Type taskType)
 
static Type stringToTaskType (std::string taskType)
 
- Public Attributes inherited from CoachingEngine::Task
Clock clock
 
- Protected Attributes inherited from CoachingEngine::Task
std::vector< std::function
< bool(double, AIMValue)> > 
triggers
 
bool triggersInitialized
 
- 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
 
- Protected Attributes inherited from CoachingEngine::TaskDescription
Type taskType
 
double startDate
 
double endDate
 
std::string description
 
AIMValue target
 
AIMValue currentValue
 
Status status
 
bool completed
 

Detailed Description

A task to sleep enough. This task is measured using the sleep_time sensor.

Member Function Documentation

void CoachingEngine::SleepDurationTask::initializeTriggers ( )
protectedvirtual

Function to initialize the triggers Will be called after the clock has been initialized in the doTick function.

Implements CoachingEngine::Task.

void CoachingEngine::SleepDurationTask::processDateValue ( const std::string &  sensor,
const AIMValue dateValue 
)
protectedvirtual

Function to process date value. This function should be implemented by the Task implementation.

Reimplemented from CoachingEngine::Task.

Member Data Documentation

const string CoachingEngine::SleepDurationTask::PROP_IS_ESTIMATE = "is_estimate"
static

The property name of the bool value which indicates whether an estimation is used instead of the measured sleep


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