Modules | |
Common | |
Gap | |
Gatt | |
Data Structures | |
struct | BLE::OnEventsToProcessCallbackContext |
Events to process event. More... | |
struct | BLE::InitializationCompleteCallbackContext |
Initialization complete event. More... | |
class | BLE |
Abstract away BLE-capable radio transceivers or SOCs. More... | |
Typedefs | |
typedef unsigned | InstanceID_t |
Opaque type used to store the ID of a BLE instance. More... | |
typedef FunctionPointerWithContext< OnEventsToProcessCallbackContext * > | OnEventsToProcessCallback_t |
Events to process event handler. More... | |
typedef void(* | InitializationCompleteCallback_t) (InitializationCompleteCallbackContext *context) |
Initialization complete event handler. More... | |
Functions | |
static BLE & | Instance () |
Get a reference to the BLE singleton. More... | |
static BLE & | Instance (InstanceID_t id) |
Get a reference to the BLE singleton corresponding to a given interface. More... | |
InstanceID_t | getInstanceID () const |
Fetch the ID of a BLE instance. More... | |
void | onEventsToProcess (const OnEventsToProcessCallback_t &on_event_cb) |
Register a callback called when the BLE stack has pending work. More... | |
void | processEvents () |
Process ALL pending events living in the BLE stack and return once all events have been consumed. More... | |
ble_error_t | init (InitializationCompleteCallback_t completion_cb=nullptr) |
Initialize the BLE controller/stack. More... | |
template<typename T > | |
ble_error_t | init (T *object, void(T::*completion_cb)(InitializationCompleteCallbackContext *context)) |
Initialize the BLE controller/stack. More... | |
bool | hasInitialized () const |
Indicate if the BLE instance has been initialized. More... | |
ble_error_t | shutdown () |
Shut down the underlying stack, and reset state of this BLE instance. More... | |
const char * | getVersion () |
This call allows the application to get the BLE stack version information. More... | |
ble::Gap & | gap () |
Accessor to Gap. More... | |
const ble::Gap & | gap () const |
A const alternative to gap(). More... | |
ble::GattServer & | gattServer () |
Accessor to GattServer. More... | |
const ble::GattServer & | gattServer () const |
A const alternative to gattServer(). More... | |
ble::GattClient & | gattClient () |
Accessors to GattClient. More... | |
const ble::GattClient & | gattClient () const |
A const alternative to gattClient(). More... | |
ble::SecurityManager & | securityManager () |
Accessors to SecurityManager. More... | |
const ble::SecurityManager & | securityManager () const |
A const alternative to securityManager(). More... | |
static const char * | errorToString (ble_error_t error) |
Translate error code into a printable string. More... | |
void | signalEventsToProcess () |
This function allows the BLE stack to signal that there is work to do and event processing should be done (BLE::processEvent()). More... | |
Variables | |
static const InstanceID_t | DEFAULT_INSTANCE = 0 |
The value of the BLE::InstanceID_t for the default BLE instance. More... | |
static const InstanceID_t | NUM_INSTANCES = 1 |
The number of permitted BLE instances for the application. More... | |
BLE & | ble |
The ble instance which have events to process. More... | |
BLE & | ble |
Reference to the BLE object that has been initialized. More... | |
ble_error_t | error |
Error status of the initialization. More... | |
typedef void(* InitializationCompleteCallback_t) (InitializationCompleteCallbackContext *context) |
typedef unsigned InstanceID_t |
Opaque type used to store the ID of a BLE instance.
typedef FunctionPointerWithContext<OnEventsToProcessCallbackContext *> OnEventsToProcessCallback_t |
|
static |
Translate error code into a printable string.
[in] | error | Error code returned by BLE functions. |
ble::Gap& gap | ( | ) |
const ble::Gap& gap | ( | ) | const |
ble::GattClient& gattClient | ( | ) |
Accessors to GattClient.
All GattClient related functionality requires going through this accessor.
const ble::GattClient& gattClient | ( | ) | const |
A const alternative to gattClient().
ble::GattServer& gattServer | ( | ) |
Accessor to GattServer.
All GattServer related functionality requires going through this accessor.
const ble::GattServer& gattServer | ( | ) | const |
A const alternative to gattServer().
InstanceID_t getInstanceID | ( | ) | const |
const char* getVersion | ( | ) |
bool hasInitialized | ( | ) | const |
ble_error_t init | ( | InitializationCompleteCallback_t | completion_cb = nullptr | ) |
Initialize the BLE controller/stack.
init() hands control to the underlying BLE module to accomplish initialization. This initialization may tacitly depend on other hardware setup (such as clocks or power-modes) that happens early on during system startup. It may not be safe to call init() from a global static context where ordering is compiler-specific and can't be guaranteed - it is safe to call BLE::init() from within main().
[in] | completion_cb | A callback for when initialization completes for a BLE instance. This is an optional parameter; if no callback is set up, the application can still determine the status of initialization using BLE::hasInitialized() (see below). |
ble_error_t init | ( | T * | object, |
void(T::*)(InitializationCompleteCallbackContext *context) | completion_cb | ||
) |
Initialize the BLE controller/stack.
This is an alternate declaration for init(). This one takes an <Object, member> pair as its callback target.
[in] | object | Object, which will be used to invoke the completion callback. |
[in] | completion_cb | Member function pointer, which will be invoked when initialization is complete. |
|
static |
Get a reference to the BLE singleton.
|
static |
Get a reference to the BLE singleton corresponding to a given interface.
There is a static array of BLE singletons.
[in] | id | BLE Instance ID to get. |
void onEventsToProcess | ( | const OnEventsToProcessCallback_t & | on_event_cb | ) |
Register a callback called when the BLE stack has pending work.
By registering a callback, application code can know when event processing has to be scheduled.
on_event_cb | Callback invoked when there are new events to process. |
void processEvents | ( | ) |
Process ALL pending events living in the BLE stack and return once all events have been consumed.
ble::SecurityManager& securityManager | ( | ) |
Accessors to SecurityManager.
All SecurityManager-related functionality requires going through this accessor.
const ble::SecurityManager& securityManager | ( | ) | const |
A const alternative to securityManager().
ble_error_t shutdown | ( | ) |
Shut down the underlying stack, and reset state of this BLE instance.
void signalEventsToProcess | ( | ) |
This function allows the BLE stack to signal that there is work to do and event processing should be done (BLE::processEvent()).
BLE& ble |
|
static |
The value of the BLE::InstanceID_t for the default BLE instance.
ble_error_t error |
|
static |
The number of permitted BLE instances for the application.