Public Member Functions | Protected Attributes

wosh::bundles::HeyuBundle Class Reference
[WOSH Bundles]

Control and monitor X-10 devices through heyu software. More...

#include <H:/WOSH/win32_vc2010/src/bundles/Heyu/HeyuBundle.h>

List of all members.

Public Member Functions

 HeyuBundle ()
 Empty constructor, init bundle and vars, Properties and Methods.
virtual ~HeyuBundle ()
 Empty destructor, may (synch) stop bundle and internal threads when still running.
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.
IHeyuWorkerListener interface
void device_event (Fact *fact, DeviceHeyu::MODULE_EVENT mevent, int arg_value, DeviceHeyu::MODULE_EVENT_SOURCE event_source, const DeviceHeyu *device, HeyuWorker *source)
 Raised on device events (asynch)
void heyu_event (int event_id, const char *description, HeyuWorker *source)
 Raised on heyu engine events (asynch)

Protected Attributes

HeyuWorkermyWorker
 thread monitoring heyu, hosting devices (cache) and executing commands
BusConnector BusDevices
 connector to 'Device' Bus

Detailed Description

Control and monitor X-10 devices through heyu software.

HeyuBundle acts as adapter between WOSH and X-10 network (protocol), using heyu software as bridge.

In short, it allows WOSH system, its component and its users to control X-10 devices and receive their notifications (events) in realtime.

X-10 is a simple communication protocol developed to control appliaces through powerline without wireless and extra-wires. In last years, wireless X-10 devices are also available (such as Motion Sensors). X-10 devices are installed in-wall or plugged between applicance and powerline, they are available in USA and Europe both. A well known vendor is Marmitek.

This was of controlling/monitoring appliances is honestly kind of out-of-date against current technology and data-rates, but it is still usefull for many reasons, especially when upgrading old houses.

This bundle is compatible with POSIX systems only (since heyu is so).

Requirements:
Heyu software (http://www.heyu.org) have to be properly installed and tested on the system. Build for Heyu 2.7.0, tested (compatible) with version 2.9.0.
Heyu and WOSH
Reader may ask himself how devices are integrated (registered) into WOSH system, first you should read Devices. On initialization (when devices' information and aliases are available), HeyuBundle registers them into local wosh::DeviceManager module, which acts as publisher of their features.
Todo:
write doc [..]
Heyu setup
You may download heyu from the official website and build it as explained in the README, don't mind about compilation, it's trivial (no external dependencies). Once sofware and hardware is installed, you may test it. A sample heyu configuration file is provided.
Heyu configuration (aliases)
HeyuBundle parses real-time configuration of heyu for gathering devices' information, aliases and module-type are parsed from heyu show aliases command. Sample output:
 [Aliases]
  alias  light_stairs_office          C2   LM12  
  alias  light_office                 C3
  alias  light_office_desktop         C4   LM12  
  alias  tm13_bedroom_sud             D1   LM12  
  alias  light_bedroom_sud            D2   AM12  
Heyu commands (control devices)
When a WOSH component (or user) controls a device, HeyuBundle will identify its X10 code and execute the mapped heyu operation, such as:
alex@linbox:/home/alex# heyu on C4
alex@linbox:/home/alex# heyu dim C4 5
alex@linbox:/home/alex# heyu off C4
Heyu events (monitor devices)
Device's (cached) state is updated asynchronously by an internal thread which monitors heyu events, you should first verify heyu is listening (power-line) and intepreting its x-10 commands. Sample output:
alex@linbox:/home/alex# heyu monitor
09/25 11:32:53  Monitor started
09/25 11:32:55  sndc addr unit       4 : hu C4  (light_office_desktop)
09/25 11:32:55  sndc func           On : hc C
09/25 11:33:04  sndc addr unit       4 : hu C4  (light_office_desktop)
09/25 11:33:04  sndc func          Off : hc C
09/25 11:33:28  rcvi addr unit       4 : hu H4  (sensor_m_stairs_up)
09/25 11:33:28  rcvi func           On : hc H
09/25 11:33:30  rcvi addr unit       8 : hu H8  (sensor_m_living)
09/25 11:33:30  rcvi func           On : hc H
09/25 11:33:36  rcvi addr unit       2 : hu H2  (sensor_m_corridoio)
09/25 11:33:37  rcvi func           On : hc H
09/25 11:33:40  rcvi addr unit      12 : hu H12 (sensor_m_bathroom_sud)
09/25 11:33:41  rcvi func           On : hc H
09/25 11:33:43  rcvi addr unit       2 : hu H2  (sensor_m_corridoio)
09/25 11:33:43  rcvi func           On : hc H
09/25 11:33:46  rcvi addr unit       8 : hu H8  (sensor_m_living)
09/25 11:33:47  rcvi func           On : hc H
Todo:
HANDLE Extended codeS
Bug:

Bright/Dim values are fixed (step=5)

filter heyu info (properties)

See also:
http://www.heyu.org
WOSH Bundles, wosh::interfaces::building::Heyu
HeyuWorker, DeviceHeyu
Version:
0.8.558
Id:
HeyuBundle.h 3775 2011-01-01 16:38:17Z alex
Date:
Released stable on 2010-09-25
Author:
Alessandro Polo

Definition at line 162 of file HeyuBundle.h.


Constructor & Destructor Documentation

wosh::bundles::HeyuBundle::HeyuBundle (  )

Empty constructor, init bundle and vars, Properties and Methods.

Definition at line 46 of file HeyuBundle.cpp.

References wosh::LOG_DEBUG, wosh::Permission::Read, and wosh::Permission::RX.

wosh::bundles::HeyuBundle::~HeyuBundle (  ) [virtual]

Empty destructor, may (synch) stop bundle and internal threads when still running.

Definition at line 93 of file HeyuBundle.cpp.


Member Function Documentation

void wosh::bundles::HeyuBundle::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!

Reimplemented from wosh::BundleGeneric.

Definition at line 141 of file HeyuBundle.cpp.

void wosh::bundles::HeyuBundle::device_event ( Fact fact,
DeviceHeyu::MODULE_EVENT  mevent,
int  arg_value,
DeviceHeyu::MODULE_EVENT_SOURCE  event_source,
const DeviceHeyu device,
HeyuWorker source 
) [virtual]

Raised on device events (asynch)

Parameters:
fact[in] the fact (related to the event) to be broadcasted
mevent[in] the raised (standardized) event category
arg_value[in] the integer value (data) of the event (binary state of device)
event_source[in] source of the event (such as: command-line, power-line, ..)
device[in] instance of the mapped device
source[in] instance of JabberGlooxImpl which raised the callback

Implements IHeyuWorkerListener.

Definition at line 304 of file HeyuBundle.cpp.

void wosh::bundles::HeyuBundle::heyu_event ( int  event_id,
const char *  description,
HeyuWorker source 
) [virtual]

Raised on heyu engine events (asynch)

Parameters:
event_id[in] event raised by heyu engine (see HeyuWorker::HEYU_EVENT)
description[in] optiona description of the event
source[in] instance of HeyuWorker which raised the callback

Implements IHeyuWorkerListener.

Definition at line 245 of file HeyuBundle.cpp.

References myWorker.


Member Data Documentation

connector to 'Device' Bus

Definition at line 226 of file HeyuBundle.h.

thread monitoring heyu, hosting devices (cache) and executing commands

Definition at line 225 of file HeyuBundle.h.

Referenced by heyu_event().


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

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