Rtos API example

Embed: (wiki syntax)

« Back to documentation index

BLEInstanceBase Class Reference

BLEInstanceBase Class Reference
[Porting]

Private interface used to implement the BLE class. More...

#include <BLEInstanceBase.h>

Public Member Functions

 BLEInstanceBase ()
 Base constructor.
virtual ~BLEInstanceBase ()
 Virtual destructor of the interface.
virtual void processEvents ()=0
 Process ALL pending events living in the vendor BLE subsystem.
void signalEventsToProcess (BLE::InstanceID_t id)
 Signal to BLE that events needing processing are available.
virtual ble_error_t init (BLE::InstanceID_t instanceID, FunctionPointerWithContext< BLE::InitializationCompleteCallbackContext * > initCallback)=0
 Start the initialization of the vendor BLE subsystem.
virtual bool hasInitialized (void) const =0
 Check whether the vendor BLE subsystem has been initialized or not.
virtual ble_error_t shutdown (void)=0
 Shutdown the vendor BLE subsystem.
virtual const char * getVersion (void)=0
 Fetches a NULL terminated string representation of the underlying BLE vendor subsystem.
virtual GapgetGap (void)=0
 Accessor to the vendor implementation of the Gap interface.
virtual const GapgetGap (void) const =0
 Const alternative to getGap().
virtual GattServergetGattServer (void)=0
 Accessor to the vendor implementation of the GattServer interface.
virtual const GattServergetGattServer (void) const =0
 A const alternative to getGattServer().
virtual GattClientgetGattClient (void)=0
 Accessor to the vendor implementation of the GattClient interface.
virtual SecurityManager & getSecurityManager (void)=0
 Accessor to the vendor implementation of the SecurityManager interface.
virtual const SecurityManager & getSecurityManager (void) const =0
 A const alternative to getSecurityManager().
virtual void waitForEvent (void)=0
 Process pending events present in the vendor subsystem; then, put the MCU to sleep until an external source wakes it up.

Detailed Description

Private interface used to implement the BLE class.

The BLE class delegates all its abstract operations to an instance of this abstract class, which every vendor port of Mbed BLE shall implement.

The vendor port shall also define an implementation of the freestanding function createBLEInstance(). The BLE API uses this singleton function to gain access to a concrete implementation of this class defined in the vendor port.

This class is part of the porting API and is not meant to be used by end users of BLE API.

See also:
BLE

Definition at line 54 of file BLEInstanceBase.h.


Constructor & Destructor Documentation

Base constructor.

Definition at line 60 of file BLEInstanceBase.h.

~BLEInstanceBase (  ) [virtual]

Virtual destructor of the interface.

Definition at line 20 of file BLEInstanceBase.cpp.


Member Function Documentation

virtual Gap& getGap ( void   ) [pure virtual]

Accessor to the vendor implementation of the Gap interface.

Returns:
A reference to a Gap object associated to this BLEInstanceBase instance.
See also:
BLE::gap() Gap
virtual const Gap& getGap ( void   ) const [pure virtual]

Const alternative to getGap().

Returns:
A const reference to a Gap object associated to this BLEInstanceBase instance.
See also:
BLE::gap() Gap
virtual GattClient& getGattClient ( void   ) [pure virtual]

Accessor to the vendor implementation of the GattClient interface.

Returns:
A reference to a GattClient object associated to this BLEInstanceBase instance.
See also:
BLE::gattClient() GattClient
virtual GattServer& getGattServer ( void   ) [pure virtual]

Accessor to the vendor implementation of the GattServer interface.

Returns:
A reference to a GattServer object associated to this BLEInstanceBase instance.
See also:
BLE::gattServer() GattServer
virtual const GattServer& getGattServer ( void   ) const [pure virtual]

A const alternative to getGattServer().

Returns:
A const reference to a GattServer object associated to this BLEInstanceBase instance.
See also:
BLE::gattServer() GattServer
virtual SecurityManager& getSecurityManager ( void   ) [pure virtual]

Accessor to the vendor implementation of the SecurityManager interface.

Returns:
A reference to a SecurityManager object associated to this BLEInstanceBase instance.
See also:
BLE::securityManager() SecurityManager
virtual const SecurityManager& getSecurityManager ( void   ) const [pure virtual]

A const alternative to getSecurityManager().

Returns:
A const reference to a SecurityManager object associated to this BLEInstancebase instance.
See also:
BLE::securityManager() SecurityManager
virtual const char* getVersion ( void   ) [pure virtual]

Fetches a NULL terminated string representation of the underlying BLE vendor subsystem.

Returns:
A pointer to the NULL terminated string representation of the underlying BLE stack's version.
See also:
BLE::getVersion()
virtual bool hasInitialized ( void   ) const [pure virtual]

Check whether the vendor BLE subsystem has been initialized or not.

Returns:
true if the initialization has completed for the vendor BLE subsystem.
Note:
this function is invoked by BLE::hasInitialized()
See also:
BLE::init() BLE::hasInitialized()
virtual ble_error_t init ( BLE::InstanceID_t  instanceID,
FunctionPointerWithContext< BLE::InitializationCompleteCallbackContext * >  initCallback 
) [pure virtual]

Start the initialization of the vendor BLE subsystem.

Calls to this function are initiated by BLE::init, instanceID identify the BLE instance which issue that call while the initCallback is used to signal asynchronously the completion of the initialization process.

Parameters:
[in]instanceIDIdentifier of the BLE instance requesting initialization.
[in]initCallbackCallback which the vendor port shall invoke when the initialization completes.

This is an optional parameter set to NULL when not supplied.

Returns:
BLE_ERROR_NONE if the initialization procedure started successfully.
Postcondition:
initCallback shall be invoked upon completion of the initialization process.
hasInitialized() shall return false until the initialization is complete, and it shall return true after succesful completion of the initialization process.
See also:
BLE::init()
virtual void processEvents (  ) [pure virtual]

Process ALL pending events living in the vendor BLE subsystem.

Return once all pending events have been consumed.

See also:
BLE::processEvents()
virtual ble_error_t shutdown ( void   ) [pure virtual]

Shutdown the vendor BLE subsystem.

This operation includes purging the stack of GATT and GAP state and clearing all state from other BLE components, such as the SecurityManager. Clearing all states may be realized by a call to Gap::reset(), GattClient::reset(), GattServer::reset() and SecurityManager::reset().

BLE::init() must be called afterward to reinstantiate services and GAP state.

Returns:
BLE_ERROR_NONE if the underlying stack and all other services of the BLE API were shut down correctly.
Postcondition:
hasInitialized() shall return false.
Note:
This function is invoked by BLE::shutdown().
See also:
BLE::shutdown() BLE::init() BLE::hasInitialized() Gap::reset() GattClient::reset() GattServer::reset() SecurityManager::reset() .
void signalEventsToProcess ( BLE::InstanceID_t  id )

Signal to BLE that events needing processing are available.

The vendor port shall call this function whenever there are events ready to be processed in the internal stack or BLE subsystem. As a result of this call, the callback registered by the end user via BLE::onEventsToProcess will be invoked.

Parameters:
[in]id,:Identifier of the BLE instance, which does have events to ready to be processed.

Definition at line 25 of file BLEInstanceBase.cpp.

virtual void waitForEvent ( void   ) [pure virtual]

Process pending events present in the vendor subsystem; then, put the MCU to sleep until an external source wakes it up.

This function is deprecated in the BLE class. It will be removed from this interface once it is removed from BLE.

See also:
BLE::waitForEvent() BLE::processEvents()