Definition of customized event classes

Description:

In some case the predefined events or event codes might not fit perfect to the system event.

 

Solution:

The preferable way is to map such events to the predefined user key events "User0"..."User19" or the special key events "F1"..."F10". New event classes or derived event classes have the big disadvantage that they cannot be simulated in the EmWi Prototyper, which requires the target development environment for test and debugging.

 

If you want to implement your own event class nevertheless, you need to derive your class from Core::Event or Core::KeyEvent e.g.: Example::UsrEvent. You can create, initialize and dispatch the new event in the same way like the key events. Additional parameters can be passed as arguments to a initialization method e.g.: Initialize(a, b, c,…). In the objects that should react on a customized event type, the code of the HandleEvent() method need to typecast the event e.g.:

 

var Example::UsrEvent event = ( Example::UsrEvent )aEvent;
if ( event != null )
{ …
 

Note: It is nearly impossible to support you in case of troubles, if your application is not running in the Prototyper.

 

See also:

1. HT-012-Exchange_data_with_EmWi.pdf

 

Keywords:

Event, Core::Event, DispatchEvent, Broadcast, HandleEvent, Custom Event

 

Last update on 2010-08-19 by Mario Stefanutti.

Go back