BeoChip event listener. More...
#include <Devices/BeoChip.H>
Public Member Functions | |
virtual | ~BeoChipListener () |
Destructor. | |
virtual void | event (const BeoChipEventType t, const int valint, const float valfloat)=0 |
An event was received. |
BeoChip event listener.
The BeoChipListener gets called each time an event is received from the BeoChip. The BeoChipEventType is passed to the listener, allowing the user to determine the type of event received and to then interpret the event data also passed to the listener. By default, there is no listener, and users can just asynchronously query the BeoChip for its current internal state. If those queries come in too slowly, however, they may miss some events (e.g., a briefly pressed key). So, production code should define a derived class for BeoChipListener and register it with the BeoChip object, so that it will take action as soon as an event is received.
Definition at line 67 of file BeoChip.H.
BeoChipListener::~BeoChipListener | ( | ) | [virtual] |
virtual void BeoChipListener::event | ( | const BeoChipEventType | t, | |
const int | valint, | |||
const float | valfloat | |||
) | [pure virtual] |
An event was received.
This function will be called by the BeoChip once you have registered your BeoChipListener derivative with the BeoChip using BeoChip::setListener(). Beware that the call to event() will ve from a thread running in the BeoChip and thus will operate in parallel with your main thread and main loop. See test-BeoChip.C for an example of how to synchronize a main loop with these asynchronous event calls. The following data will be passed along with the event type:
Type valint valfloat ---------------------------------------------------------------------- NONE 0 0.0F PWM0 pulse 0 width, 1.6us units calibrated width in [-1..1] PWM1 pulse 1 width, 1.6us units calibrated width in [-1..1] KBD 5 LSB show the 5 keys 0.0F ADC0 A/D 0 value calibrated value in [-1..1] ADC1 A/D 0 value calibrated value in [-1..1] all others 0 0.0F
Implemented in MyBeoChipListener, MyBeoChipListener, MyBeoChipListener, MyBeoChipListener, BeobotBeoChipListener, BeobotLauncherListener, BeoSubListener, BeoSubListener, BeoSubListener, MyBeoChipListener, LeakDetectorListener, MyBeoChipListener, and MyBeoChipListener.