this is using the mbed os version 5-13-1

Dependencies:   mbed-http

Embed: (wiki syntax)

« Back to documentation index

SMDevice Class Reference

SMDevice Class Reference

Base class for both peripheral and central. More...

#include <BleManager.h>

Inherited by SMDeviceCentral, and SMDevicePeripheral.

Public Member Functions

 SMDevice (BLE &ble, events::EventQueue &event_queue, BLEProtocol::AddressBytes_t &peer_address, MemoryPool< at_ble_msg_t, PQDSZ_BLE > *aT2BleDatamPool, Queue< at_ble_msg_t, PQDSZ_BLE > *aT2BleDataQueue, MemoryPool< ble_at_msg_t, PQDSZ_BLE > *ble2ATDatamPool, Queue< ble_at_msg_t, PQDSZ_BLE > *ble2ATDataQueue, ble_config_t *ble_config)
 This example demonstrates all the basic setup required for pairing and setting up link security both as a central and peripheral.
void run ()
 Start BLE interface initialisation.
virtual void pairingRequest (ble::connection_handle_t connectionHandle)
 Respond to a pairing request.
virtual void pairingResult (ble::connection_handle_t connectionHandle, SecurityManager::SecurityCompletionStatus_t result)
 Inform the application of a successful pairing.
virtual void linkEncryptionResult (ble::connection_handle_t connectionHandle, ble::link_encryption_t result)
 Inform the application of change in encryption status.
void sendBLEUartData (const uint8_t *buf, int len)
 Send data aynchronously using BLE.

Detailed Description

Base class for both peripheral and central.

The same class that provides the logic for the application also implements the SecurityManagerEventHandler which is the interface used by the Security Manager to communicate events back to the applications. You can provide overrides for a selection of events your application is interested in.

Definition at line 53 of file BleManager.h.


Constructor & Destructor Documentation

SMDevice ( BLE &  ble,
events::EventQueue &  event_queue,
BLEProtocol::AddressBytes_t &  peer_address,
MemoryPool< at_ble_msg_t, PQDSZ_BLE > *  aT2BleDatamPool,
Queue< at_ble_msg_t, PQDSZ_BLE > *  aT2BleDataQueue,
MemoryPool< ble_at_msg_t, PQDSZ_BLE > *  ble2ATDatamPool,
Queue< ble_at_msg_t, PQDSZ_BLE > *  ble2ATDataQueue,
ble_config_t ble_config 
)

This example demonstrates all the basic setup required for pairing and setting up link security both as a central and peripheral.

The example is implemented as two classes, one for the peripheral and one for central inheriting from a common base. They are run in sequence and require a peer device to connect to. During the peripheral device demonstration a peer device is required to connect. In the central device demonstration this peer device will be scanned for and connected to - therefore it should be advertising with the same address as when it connected.

During the test output is written on the serial connection to monitor its progress. Base class for both peripheral and central. The same class that provides the logic for the application also implements the SecurityManagerEventHandler which is the interface used by the Security Manager to communicate events back to the applications. You can provide overrides for a selection of events your application is interested in.

Definition at line 63 of file BleManager.cpp.


Member Function Documentation

void linkEncryptionResult ( ble::connection_handle_t  connectionHandle,
ble::link_encryption_t  result 
) [virtual]

Inform the application of change in encryption status.

This will be communicated through the serial port

Definition at line 174 of file BleManager.cpp.

void pairingRequest ( ble::connection_handle_t  connectionHandle ) [virtual]

Respond to a pairing request.

This will be called by the stack when a pairing request arrives and expects the application to call acceptPairingRequest or cancelPairingRequest

Definition at line 153 of file BleManager.cpp.

void pairingResult ( ble::connection_handle_t  connectionHandle,
SecurityManager::SecurityCompletionStatus_t  result 
) [virtual]

Inform the application of a successful pairing.

Terminate the demonstration.

Definition at line 161 of file BleManager.cpp.

void run (  )

Start BLE interface initialisation.

Definition at line 93 of file BleManager.cpp.

void sendBLEUartData ( const uint8_t *  buf,
int  len 
)

Send data aynchronously using BLE.

Definition at line 319 of file BleManager.cpp.