mbed.org local branch of microbit-dal. The real version lives in git at https://github.com/lancaster-university/microbit-dal

Dependencies:   BLE_API nRF51822 mbed-dev-bin

Dependents:   microbit Microbit IoTChallenge1 microbit ... more

Embed: (wiki syntax)

« Back to documentation index

MicroBitEventService Class Reference

MicroBitEventService Class Reference

Class definition for a MicroBit BLE Event Service. More...

#include <MicroBitEventService.h>

Inherits MicroBitComponent.

Public Member Functions

 MicroBitEventService (BLEDevice &_ble, EventModel &_messageBus)
 Constructor.
virtual void idleTick ()
 Periodic callback from MicroBit scheduler.
void onDataWritten (const GattWriteCallbackParams *params)
 Callback.
void onMicroBitEvent (MicroBitEvent evt)
 Callback.
void onRequirementsRead (GattReadAuthCallbackParams *params)
 Read callback on microBitRequirements characteristic.
virtual void systemTick ()
 The system timer will call this member function once the component has been added to the array of system components using system_timer_add_component.

Detailed Description

Class definition for a MicroBit BLE Event Service.

Provides a BLE gateway onto an Event Model.

Definition at line 52 of file MicroBitEventService.h.


Constructor & Destructor Documentation

MicroBitEventService ( BLEDevice &  _ble,
EventModel _messageBus 
)

Constructor.

Class definition for a MicroBit BLE Event Service.

Create a representation of the EventService

Parameters:
_bleThe instance of a BLE device that we're running on.
_messageBusAn instance of an EventModel which events will be mirrored from.

Provides a BLE gateway onto an Event Model. Constructor. Create a representation of the EventService

Parameters:
_bleThe instance of a BLE device that we're running on.
_messageBusAn instance of an EventModel which events will be mirrored from.

Definition at line 43 of file MicroBitEventService.cpp.


Member Function Documentation

void idleTick (  ) [virtual]

Periodic callback from MicroBit scheduler.

If we're no longer connected, remove any registered Message Bus listeners.

Reimplemented from MicroBitComponent.

Definition at line 138 of file MicroBitEventService.cpp.

void onDataWritten ( const GattWriteCallbackParams *  params )

Callback.

Invoked when any of our attributes are written via BLE.

Definition at line 89 of file MicroBitEventService.cpp.

void onMicroBitEvent ( MicroBitEvent  evt )

Callback.

Invoked when any events are sent on the microBit message bus.

Definition at line 122 of file MicroBitEventService.cpp.

void onRequirementsRead ( GattReadAuthCallbackParams *  params )

Read callback on microBitRequirements characteristic.

Used to iterate through the events that the code on this micro:bit is interested in.

Definition at line 151 of file MicroBitEventService.cpp.

virtual void systemTick (  ) [virtual, inherited]

The system timer will call this member function once the component has been added to the array of system components using system_timer_add_component.

This callback will be in interrupt context.

Reimplemented in MicroBitSystemTimerCallback, MicroBitButton, and MicroBitDisplay.

Definition at line 125 of file MicroBitComponent.h.