fork
Dependencies: BLE_API mbed-dev-bin nRF51822
Fork of microbit-dal by
MicroBitListener Struct Reference
This structure defines a MicroBitListener used to invoke functions, or member functions if an instance of EventModel receives an event whose id and value match this MicroBitListener's id and value. More...
#include <MicroBitListener.h>
Public Member Functions | |
MicroBitListener (uint16_t id, uint16_t value, void(*handler)(MicroBitEvent), uint16_t flags=EVENT_LISTENER_DEFAULT_FLAGS) | |
Constructor. | |
MicroBitListener (uint16_t id, uint16_t value, void(*handler)(MicroBitEvent, void *), void *arg, uint16_t flags=EVENT_LISTENER_DEFAULT_FLAGS) | |
Constructor. | |
template<typename T > | |
MicroBitListener (uint16_t id, uint16_t value, T *object, void(T::*method)(MicroBitEvent), uint16_t flags=EVENT_LISTENER_DEFAULT_FLAGS) | |
Constructor. | |
~MicroBitListener () | |
Destructor. | |
void | queue (MicroBitEvent e) |
Queues and event up to be processed. |
Detailed Description
This structure defines a MicroBitListener used to invoke functions, or member functions if an instance of EventModel receives an event whose id and value match this MicroBitListener's id and value.
Definition at line 53 of file MicroBitListener.h.
Constructor & Destructor Documentation
MicroBitListener | ( | uint16_t | id, |
uint16_t | value, | ||
void(*)(MicroBitEvent) | handler, | ||
uint16_t | flags = EVENT_LISTENER_DEFAULT_FLAGS |
||
) |
Constructor.
This structure defines a MicroBitListener used to invoke functions, or member functions if an instance of EventModel receives an event whose id and value match this MicroBitListener's id and value.
Create a new Message Bus Listener.
- Parameters:
-
id The ID of the component you want to listen to. value The event value you would like to listen to from that component handler A function pointer to call when the event is detected. flags User specified, implementation specific flags, that allow behaviour of this events listener to be tuned.
Constructor.
Create a new Message Bus Listener.
- Parameters:
-
id The ID of the component you want to listen to. value The event value you would like to listen to from that component handler A function pointer to call when the event is detected. flags User specified, implementation specific flags, that allow behaviour of this events listener to be tuned.
Definition at line 48 of file MicroBitListener.cpp.
MicroBitListener | ( | uint16_t | id, |
uint16_t | value, | ||
void(*)(MicroBitEvent, void *) | handler, | ||
void * | arg, | ||
uint16_t | flags = EVENT_LISTENER_DEFAULT_FLAGS |
||
) |
Constructor.
Create a new Message Bus Listener, this constructor accepts an additional parameter "arg", which is passed to the handler.
- Parameters:
-
id The ID of the component you want to listen to. value The event value you would like to listen to from that component handler A function pointer to call when the event is detected. arg A pointer to some data that will be given to the handler. flags User specified, implementation specific flags, that allow behaviour of this events listener to be tuned.
Definition at line 76 of file MicroBitListener.cpp.
MicroBitListener | ( | uint16_t | id, |
uint16_t | value, | ||
T * | object, | ||
void(T::*)(MicroBitEvent) | method, | ||
uint16_t | flags = EVENT_LISTENER_DEFAULT_FLAGS |
||
) |
Constructor.
Create a new Message Bus Listener, with a callback to a C++ member function.
- Parameters:
-
id The ID of the component you want to listen to. value The event value you would like to listen to from that component object The C++ object on which to call the event handler. method The method within the C++ object to call. flags User specified, implementation specific flags, that allow behaviour of this events listener to be tuned.
Definition at line 158 of file MicroBitListener.h.
~MicroBitListener | ( | ) |
Destructor.
Ensures all resources used by this listener are freed.
Definition at line 90 of file MicroBitListener.cpp.
Member Function Documentation
void queue | ( | MicroBitEvent | e ) |
Queues and event up to be processed.
- Parameters:
-
e The event to queue
Definition at line 101 of file MicroBitListener.cpp.
Generated on Tue Jul 12 2022 19:47:36 by 1.7.2