Public Types | Public Member Functions | Protected Attributes

wosh::automations::Automation Class Reference

Interface for home automations, holds properties and basic methods. Messages are evaluated by isTrigger() function, when the call returns true, the manager will run execute(). More...

#include <H:/WOSH/win32_vc2010/src/framework/automations/Automation.h>

List of all members.

Public Types

enum  AUTOMATION_STATE { , STATE_INITIALIZED = 0x06, STATE_DEINITIALIZED = 0x10 }
 

state of the kernel

More...
enum  MODE_EFFECT_MAPPING { MAPPING_UNKNOWN = 0x00, MAPPING_ANY_TRIGGER = 0x01, MAPPING_INDEX_TRIGGER = 0x02 }
 

state of the kernel

More...

Public Member Functions

 Automation ()
 Empty constructor.
 Automation (const Automation &m)
 Copy constructor.
virtual ~Automation ()
 Empty destructor.
virtual WRESULT preinit ()
 register properties, methods. once in instance's life
virtual WRESULT init ()
 initiatialize state and connect to bus(ses)
virtual WRESULT deinit ()
 de-initiatialize state and disconnect bus(ses)
virtual void evaluateMessageTrigger (const Message &message)
virtual void evaluateMessageEnablers (const Message &message)
Message Events (incoming message)
virtual void busMessage (const Message &message, const Bus *source)
 Method raised by the Bus when it processes a new message. Implementations will probably analyze the message and perform actions.
Setters
void setID (int64 value)
virtual void setName (const std::string &name)
 Set the name (string) associated with the object, it will also update URI's name.
virtual void setName (const std::string &basename, long id)
 Set the name of the object joining basename and id parameters. Provided for convenience.
virtual void setEnabled (bool value, bool skip_effects=false)
virtual void setSimulation (bool value)
virtual void setMonitoredBusses (const std::vector< std::string > &busses)
virtual void setModeMapping (MODE_EFFECT_MAPPING mode_mapping)
void setDescription (const std::string &value)
void setPriority (int priority)
virtual WRESULT clear ()
IPropertiesProviderListener interface
virtual bool readingProperty (Property *, const PropertiesProvider *)
virtual bool updatingProperty (bool &doUpdate, const Variant &value_proposed, Property &property_current, const PropertiesProvider *source)
Operators Overloading
virtual Automationoperator= (const Automation &m)
virtual bool operator== (const Automation &other) const
Serialization interface
virtual std::string toString () const
virtual bool updateHash (DataHashContext *hash_context) const

Protected Attributes

int64 uid
 unique ID of
bool enabled
 flag indicating if Automation is enabled
bool simulation
 simulation mode, effect won't be really executed
int priority
 automation's priority
AUTOMATION_STATE state
 automation's state
BusConnector BusAutomation
 Automation bus connector.
PropertiesProvider Properties
 my configuration
MethodsProvider Methods
 my methods
LogContext Log
 my logger
tMessageFilterList triggers
 triggers
tMessageList effects
 effects
MODE_EFFECT_MAPPING mode_mapping
 define how triggers and effects are mapped
tMessageFilterList enablers
 triggers which enable the automation
tMessageFilterList disablers
 triggers which disable the automation
tMessageList on_enabled
 message posted when automation is enabled
tMessageList on_disabled
 message posted when automation is disabled
int64 lastExecutedTime
 timestamp (epoch) of last execution

Getters

int64 getID () const
bool isEnabled () const
bool isSimulation () const
bool isPreInitialized () const
bool isInitialized () const
bool isDeInitialized () const
AUTOMATION_STATE getState () const
MODE_EFFECT_MAPPING getModeMapping () const
virtual void getMonitoredBusses (std::vector< std::string > &busses) const
int getPriority () const
std::string getDescription () const
int64 getLastExecutedTime () const
int64 getLastTrigger () const
const tMessageFilterListgetTriggers () const
tMessageFilterListgetTriggers ()
const tMessageListgetEffects () const
tMessageListgetEffects ()
const tMessageFilterListgetEnablers () const
tMessageFilterListgetEnablers ()
const tMessageFilterListgetDisablers () const
tMessageFilterListgetDisablers ()
const tMessageListgetEffectsOnEnabled () const
tMessageListgetEffectsOnEnabled ()
const tMessageListgetEffectsOnDisabled () const
tMessageListgetEffectsOnDisabled ()
const PropertiesProvidergetProperties () const
PropertiesProvidergetProperties ()
const MethodsProvidergetMethods () const
MethodsProvidergetMethods ()
static struct
EnumerationDescription
< AUTOMATION_STATE > * 
getStateEnum ()
static const char * getStateAsString (AUTOMATION_STATE state)
static AUTOMATION_STATE getStateFromString (const char *state)
static std::string getStateSetAsString (long state_mask)

Detailed Description

Interface for home automations, holds properties and basic methods. Messages are evaluated by isTrigger() function, when the call returns true, the manager will run execute().

See also:
wosh::interfaces::automations::TaskManager
Version:
0.8.013
Id:
Automation.h 3775 2011-01-01 16:38:17Z alex
Author:
Alessandro Polo

Definition at line 74 of file Automation.h.


Member Enumeration Documentation

state of the kernel

Enumerator:
STATE_INITIALIZED 

2+4

STATE_DEINITIALIZED 

8+2

Definition at line 89 of file Automation.h.

state of the kernel

Enumerator:
MAPPING_UNKNOWN 

unknown mode

MAPPING_ANY_TRIGGER 

any of the triggers will generate ALL effects

MAPPING_INDEX_TRIGGER 

Nth trigger raises Nth effect (index based)

Definition at line 99 of file Automation.h.


Constructor & Destructor Documentation

wosh::automations::Automation::Automation (  )

Empty constructor.

Definition at line 57 of file Automation.cpp.

References wosh::getLogLevelAsString(), wosh::LOG_DEBUG, and wosh::LOG_INFO.

wosh::automations::Automation::Automation ( const Automation m )

Copy constructor.

Parameters:
m[in] the source object to be copied

Definition at line 90 of file Automation.cpp.

References Log, wosh::LOG_INFO, wosh::LogContext::setIndent(), and wosh::LogContext::setLevel().

wosh::automations::Automation::~Automation (  ) [virtual]

Empty destructor.

Definition at line 98 of file Automation.cpp.

References effects, Log, wosh::LOG_DEBUG, and triggers.


Member Function Documentation

void wosh::automations::Automation::busMessage ( const Message message,
const Bus source 
) [virtual]

Method raised by the Bus when it processes a new message. Implementations will probably analyze the message and perform actions.

Parameters:
[in]messagethe incoming message
[in]sourcethe source Bus of the incoming message
Warning:
The current thread is own and managed by the caller Bus. Heavy, dangerous or time expensive operations should be executed asynchronously and not inline!

Implements wosh::IBusListener.

Definition at line 506 of file Automation.cpp.

References BusAutomation, evaluateMessageEnablers(), evaluateMessageTrigger(), wosh::Message::getContent(), wosh::Object::getEntityID(), wosh::Message::getSourceUUID(), wosh::Message::hasSecurityToken(), wosh::Message::isEmpty(), wosh::MessageContent::isRequest(), Log, Methods, wosh::BusConnector::postMessage(), and wosh::Bus::postMessage().

WRESULT wosh::automations::Automation::deinit (  ) [virtual]

de-initiatialize state and disconnect bus(ses)

Reimplemented in wosh::automations::CronJob, and wosh::automations::StateMachine.

Definition at line 183 of file Automation.cpp.

References Log, wosh::LOG_CRITICAL, wosh::LOG_INFO, state, STATE_DEINITIALIZED, and WRET_ERR_WRONG_STATE.

void wosh::automations::Automation::evaluateMessageEnablers ( const Message message ) [virtual]
void wosh::automations::Automation::evaluateMessageTrigger ( const Message message ) [virtual]
WRESULT wosh::automations::Automation::init (  ) [virtual]
WRESULT wosh::automations::Automation::preinit (  ) [virtual]
void wosh::automations::Automation::setName ( const std::string &  value ) [virtual]

Set the name (string) associated with the object, it will also update URI's name.

Parameters:
value[in] the name of the object as STL string

Reimplemented from wosh::Object.

Definition at line 225 of file Automation.cpp.

References wosh::Object::getName(), wosh::Object::getURI(), Log, wosh::LOG_INFO, Properties, and wosh::LogContext::setContext().

Referenced by setName().

void wosh::automations::Automation::setName ( const std::string &  basename,
long  id 
) [virtual]

Set the name of the object joining basename and id parameters. Provided for convenience.

Parameters:
basename[in] the name of the object as STL string
id[in] the id to be set
See also:
String::printf("%s#%ld", id)

Reimplemented from wosh::Object.

Definition at line 235 of file Automation.cpp.

References wosh::Object::getName(), wosh::Object::getURI(), Log, Properties, wosh::LogContext::setContext(), and setName().


Member Data Documentation

Automation bus connector.

Definition at line 259 of file Automation.h.

Referenced by busMessage(), and init().

triggers which disable the automation

Definition at line 269 of file Automation.h.

Referenced by evaluateMessageEnablers().

effects

Definition at line 265 of file Automation.h.

Referenced by evaluateMessageTrigger(), and ~Automation().

flag indicating if Automation is enabled

Definition at line 254 of file Automation.h.

triggers which enable the automation

Definition at line 268 of file Automation.h.

Referenced by evaluateMessageEnablers().

timestamp (epoch) of last execution

Definition at line 277 of file Automation.h.

define how triggers and effects are mapped

Definition at line 266 of file Automation.h.

message posted when automation is disabled

Definition at line 272 of file Automation.h.

message posted when automation is enabled

Definition at line 271 of file Automation.h.

automation's priority

Definition at line 256 of file Automation.h.

simulation mode, effect won't be really executed

Definition at line 255 of file Automation.h.

automation's state

Definition at line 257 of file Automation.h.

Referenced by deinit(), init(), and preinit().

triggers

Definition at line 264 of file Automation.h.

Referenced by evaluateMessageTrigger(), and ~Automation().

unique ID of

Definition at line 253 of file Automation.h.


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

Generated on Tue Feb 8 2011 09:33:33 for WOSH system 0.8.888 [wolf] by Alessandro Polo, using DoxyGen 1.7.2 hosted by WOSH Framework