Mistake on this page?
Report an issue in GitHub or email us
Modules | Data Structures | Typedefs | Functions | Variables
Ble

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 BLEInstance ()
 Get a reference to the BLE singleton. More...
 
static BLEInstance (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::Gapgap ()
 Accessor to Gap. More...
 
const ble::Gapgap () const
 A const alternative to gap(). More...
 
ble::GattServergattServer ()
 Accessor to GattServer. More...
 
const ble::GattServergattServer () const
 A const alternative to gattServer(). More...
 
ble::GattClientgattClient ()
 Accessors to GattClient. More...
 
const ble::GattClientgattClient () const
 A const alternative to gattClient(). More...
 
ble::SecurityManagersecurityManager ()
 Accessors to SecurityManager. More...
 
const ble::SecurityManagersecurityManager () 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...
 
BLEble
 The ble instance which have events to process. More...
 
BLEble
 Reference to the BLE object that has been initialized. More...
 
ble_error_t error
 Error status of the initialization. More...
 

Detailed Description

Typedef Documentation

typedef void(* InitializationCompleteCallback_t) (InitializationCompleteCallbackContext *context)

Initialization complete event handler.

Note
There are two versions of init(). In addition to the function-pointer, init() can also take an <Object, member> tuple as its callback target. In case of the latter, the following declaration doesn't apply.

Definition at line 271 of file BLE.h.

typedef unsigned InstanceID_t

Opaque type used to store the ID of a BLE instance.

Deprecated:
BLE singleton supports one instance. You may create multiple instances by using the constructor.

Definition at line 143 of file BLE.h.

typedef FunctionPointerWithContext<OnEventsToProcessCallbackContext *> OnEventsToProcessCallback_t

Events to process event handler.

Definition at line 222 of file BLE.h.

Function Documentation

static const char* errorToString ( ble_error_t  error)
static

Translate error code into a printable string.

Parameters
[in]errorError code returned by BLE functions.
Returns
A pointer to a const string describing the error.
ble::Gap& gap ( )

Accessor to Gap.

All Gap-related functionality requires going through this accessor.

Returns
A reference to a Gap object associated to this BLE instance.
const ble::Gap& gap ( ) const

A const alternative to gap().

Returns
A const reference to a Gap object associated to this BLE instance.
ble::GattClient& gattClient ( )

Accessors to GattClient.

All GattClient related functionality requires going through this accessor.

Returns
A reference to a GattClient object associated to this BLE instance.
const ble::GattClient& gattClient ( ) const

A const alternative to gattClient().

Returns
A const reference to a GattClient object associated to this BLE instance.
ble::GattServer& gattServer ( )

Accessor to GattServer.

All GattServer related functionality requires going through this accessor.

Returns
A reference to a GattServer object associated to this BLE instance.
const ble::GattServer& gattServer ( ) const

A const alternative to gattServer().

Returns
A const reference to a GattServer object associated to this BLE instance.
InstanceID_t getInstanceID ( ) const

Fetch the ID of a BLE instance.

Returns
Instance id of this BLE instance.

Definition at line 200 of file BLE.h.

const char* getVersion ( )

This call allows the application to get the BLE stack version information.

Returns
A pointer to a const string representing the version.
Note
The BLE API owns the string returned.
bool hasInitialized ( ) const

Indicate if the BLE instance has been initialized.

Returns
true if initialization has completed for the underlying BLE transport.
Note
The application should set up a callback to signal completion of initialization when using init().
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().

Parameters
[in]completion_cbA 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).
Returns
BLE_ERROR_NONE if the initialization procedure started successfully.
Note
If init() returns BLE_ERROR_NONE, the underlying stack must invoke the initialization completion callback at some point.
Nearly all BLE APIs would return BLE_ERROR_INITIALIZATION_INCOMPLETE if used on an instance before the corresponding transport is initialized.
There are two versions of init(). In addition to the function-pointer, init() can also take an <Object, member> pair as its callback target.
Attention
This should be called before using anything else in the BLE API.

Definition at line 306 of file BLE.h.

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.

Parameters
[in]objectObject, which will be used to invoke the completion callback.
[in]completion_cbMember function pointer, which will be invoked when initialization is complete.

Definition at line 323 of file BLE.h.

static BLE& Instance ( )
static

Get a reference to the BLE singleton.

Note
Calling Instance() is preferred over constructing a BLE object directly because it returns a reference to singleton.
Returns
A reference to a single object.
static BLE& Instance ( InstanceID_t  id)
static

Get a reference to the BLE singleton corresponding to a given interface.

There is a static array of BLE singletons.

Note
Calling Instance() is preferred over constructing a BLE object directly because it returns references to singletons.
Parameters
[in]idBLE Instance ID to get.
Returns
A reference to a single object.
Precondition
id shall be less than NUM_INSTANCES.

Definition at line 188 of file BLE.h.

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.

Parameters
on_event_cbCallback 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.

See also
onEventsToProcess()
ble::SecurityManager& securityManager ( )

Accessors to SecurityManager.

All SecurityManager-related functionality requires going through this accessor.

Returns
A reference to a SecurityManager object associated to this BLE instance.
const ble::SecurityManager& securityManager ( ) const

A const alternative to securityManager().

Returns
A const reference to a SecurityManager object associated to this BLE instance.
ble_error_t shutdown ( )

Shut down the underlying stack, and reset state of this BLE instance.

Returns
BLE_ERROR_NONE if the instance was shut down without error or the appropriate error code.
Attention
init() must be called afterward to reinstate services and GAP state. This API offers a way to repopulate the GATT database with new services and characteristics.
void signalEventsToProcess ( )

This function allows the BLE stack to signal that there is work to do and event processing should be done (BLE::processEvent()).

Note
This function should be called by the port of BLE_API. It is not meant to be used by end users.

Variable Documentation

BLE& ble

The ble instance which have events to process.

Definition at line 215 of file BLE.h.

BLE& ble

Reference to the BLE object that has been initialized.

Definition at line 252 of file BLE.h.

const InstanceID_t DEFAULT_INSTANCE = 0
static

The value of the BLE::InstanceID_t for the default BLE instance.

Deprecated:
BLE singleton supports one instance. You may create multiple instances by using the constructor.

Definition at line 149 of file BLE.h.

ble_error_t error

Error status of the initialization.

That value is set to BLE_ERROR_NONE if initialization completed successfully or the appropriate error code otherwise.

Definition at line 260 of file BLE.h.

const InstanceID_t NUM_INSTANCES = 1
static

The number of permitted BLE instances for the application.

Deprecated:
BLE singleton supports one instance. You may create multiple instances by using the constructor.

Definition at line 155 of file BLE.h.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.