BeoChip event listener. More...
#include <Devices/BeeSTEM.H>
Public Member Functions | |
virtual | ~BeeSTEMListener () |
Destructor. | |
virtual void | event (const BeeSTEMEventType t, const unsigned char dat1, const unsigned char dat2)=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 142 of file BeeSTEM.H.
BeeSTEMListener::~BeeSTEMListener | ( | ) | [virtual] |
virtual void BeeSTEMListener::event | ( | const BeeSTEMEventType | t, | |
const unsigned char | dat1, | |||
const unsigned char | dat2 | |||
) | [pure virtual] |
An event was received.
This function will be called by the BeeSTEM once you have registered your BeeSTEMListener derivative with the BeeSTEM using BeeSTEM::setListener(). Beware that the call to event() will be from a thread running in the BeeSTEM and thus will operate in parallel with your main thread and main loop. See test-BeeSTEM.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______________________dat1__________________dat2_ COMPASS_HEADING heading 0 COMPASS_PITCH pitch 0 COMPASS_ROLL roll 0 ACCEL_X x-acceleration 0 ACCEL_Y y-acceleration 0 INT_PRESS internal pressure 0 EXT_PRESS external pressure 0 TEMP1 temperature 1 0 TEMP2 temperature 2 0 TEMP3 temperature 3 0 DIG_IN digital input byte 0 ADC_IN spare adc value 0 MOTOR_CURR current motor number All Others 0 0
Implemented in MyBeeSTEMListener, MyBeeSTEMListener, BeeSTEM_PID_Listener, and BeeSTEM_PID_Listener.