Attempting to publish a tree

Dependencies:   BLE_API mbed-dev-bin nRF51822

Fork of microbit-dal by Lancaster University

Embed: (wiki syntax)

« Back to documentation index

MicroBitListener Struct Reference

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:
idThe ID of the component you want to listen to.
valueThe event value you would like to listen to from that component
handlerA function pointer to call when the event is detected.
flagsUser specified, implementation specific flags, that allow behaviour of this events listener to be tuned.

Constructor.

Create a new Message Bus Listener.

Parameters:
idThe ID of the component you want to listen to.
valueThe event value you would like to listen to from that component
handlerA function pointer to call when the event is detected.
flagsUser 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:
idThe ID of the component you want to listen to.
valueThe event value you would like to listen to from that component
handlerA function pointer to call when the event is detected.
argA pointer to some data that will be given to the handler.
flagsUser 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:
idThe ID of the component you want to listen to.
valueThe event value you would like to listen to from that component
objectThe C++ object on which to call the event handler.
methodThe method within the C++ object to call.
flagsUser specified, implementation specific flags, that allow behaviour of this events listener to be tuned.

Definition at line 158 of file MicroBitListener.h.

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:
eThe event to queue

Definition at line 101 of file MicroBitListener.cpp.