Mbed OS Reference
Loading...
Searching...
No Matches
ChainableGapEventHandler Class Reference

Gap::EventHandler implementation that allows the application to register multiple separate EventHandlers to be called when Gap events happen. More...

#include <ChainableGapEventHandler.h>

Inheritance diagram for ChainableGapEventHandler:
Gap::EventHandler ChainableEventHandler< ble::Gap::EventHandler >

Public Member Functions

void onScanRequestReceived (const ble::ScanRequestEvent &event) override
 Called when an advertising device receive a scan request. More...
 
void onAdvertisingStart (const ble::AdvertisingStartEvent &event) override
 Called when advertising starts. More...
 
void onAdvertisingEnd (const ble::AdvertisingEndEvent &event) override
 Called when advertising ends. More...
 
void onAdvertisingReport (const ble::AdvertisingReportEvent &event) override
 Called when a scanner receives an advertising or a scan response packet. More...
 
void onScanTimeout (const ble::ScanTimeoutEvent &event) override
 Called when scan times out. More...
 
void onPeriodicAdvertisingSyncEstablished (const ble::PeriodicAdvertisingSyncEstablishedEvent &event) override
 Called when first advertising packet in periodic advertising is received. More...
 
void onPeriodicAdvertisingReport (const ble::PeriodicAdvertisingReportEvent &event) override
 Called when a periodic advertising packet is received. More...
 
void onPeriodicAdvertisingSyncLoss (const ble::PeriodicAdvertisingSyncLoss &event) override
 Called when a periodic advertising sync has been lost. More...
 
void onConnectionComplete (const ble::ConnectionCompleteEvent &event) override
 Called when connection attempt ends. More...
 
void onUpdateConnectionParametersRequest (const ble::UpdateConnectionParametersRequestEvent &event) override
 Called when the peer request connection parameters updates. More...
 
void onConnectionParametersUpdateComplete (const ble::ConnectionParametersUpdateCompleteEvent &event) override
 Called when connection parameters have been updated. More...
 
void onDisconnectionComplete (const ble::DisconnectionCompleteEvent &event) override
 Called when a connection has been disconnected. More...
 
void onReadPhy (ble_error_t status, ble::connection_handle_t connectionHandle, ble::phy_t txPhy, ble::phy_t rxPhy) override
 Function invoked when the current transmitter and receiver PHY have been read for a given connection. More...
 
void onPhyUpdateComplete (ble_error_t status, ble::connection_handle_t connectionHandle, ble::phy_t txPhy, ble::phy_t rxPhy) override
 Function invoked when the update process of the PHY has been completed. More...
 
void onDataLengthChange (ble::connection_handle_t connectionHandle, uint16_t txSize, uint16_t rxSize) override
 Function invoked when the connections changes the maximum number of octets that can be sent or received by the controller in a single packet. More...
 
void onPrivacyEnabled () override
 Function invoked when the privacy subsystem has been enabled and is ready to be used. More...
 
bool addEventHandler (ble::Gap::EventHandler *event_handler)
 Add an EventHandler to be notified of events sent to this ChainableEventHandler. More...
 
void removeEventHandler (ble::Gap::EventHandler *event_handler)
 Remove an EventHandler previously added with addEventHandler. More...
 
bool isEventHandlerPresent (ble::Gap::EventHandler *event_handler)
 Test if an event handler is present in the chain or not. More...
 

Detailed Description

Gap::EventHandler implementation that allows the application to register multiple separate EventHandlers to be called when Gap events happen.

Definition at line 30 of file ChainableGapEventHandler.h.

Member Function Documentation

◆ onScanRequestReceived()

void onScanRequestReceived ( const ble::ScanRequestEvent event)
overridevirtual

Called when an advertising device receive a scan request.

Parameters
eventScan request event.
Version
: 5+.
See also
AdvertisingParameters::setScanRequestNotification().

Reimplemented from Gap::EventHandler.

Definition at line 40 of file ChainableGapEventHandler.h.

◆ onAdvertisingStart()

void onAdvertisingStart ( const ble::AdvertisingStartEvent event)
overridevirtual

Called when advertising starts.

Parameters
eventAdvertising start event.
Note
Check event.getStatus() to see if advertising started successfully
See also
startAdvertising()

Reimplemented from Gap::EventHandler.

Definition at line 44 of file ChainableGapEventHandler.h.

◆ onAdvertisingEnd()

void onAdvertisingEnd ( const ble::AdvertisingEndEvent event)
overridevirtual

Called when advertising ends.

Advertising ends when the process timeout or if it is stopped by the application or if the local device accepts a connection request.

Parameters
eventAdvertising end event.
Note
Check event.getStatus() to see if advertising ended successfully
See also
stopAdvertising()
onConnectionComplete()

Reimplemented from Gap::EventHandler.

Definition at line 48 of file ChainableGapEventHandler.h.

◆ onAdvertisingReport()

void onAdvertisingReport ( const ble::AdvertisingReportEvent event)
overridevirtual

Called when a scanner receives an advertising or a scan response packet.

Parameters
eventAdvertising report.
See also
startScan()

Reimplemented from Gap::EventHandler.

Definition at line 52 of file ChainableGapEventHandler.h.

◆ onScanTimeout()

void onScanTimeout ( const ble::ScanTimeoutEvent event)
overridevirtual

Called when scan times out.

Parameters
eventAssociated event.
See also
startScan()

Reimplemented from Gap::EventHandler.

Definition at line 56 of file ChainableGapEventHandler.h.

◆ onPeriodicAdvertisingSyncEstablished()

void onPeriodicAdvertisingSyncEstablished ( const ble::PeriodicAdvertisingSyncEstablishedEvent event)
overridevirtual

Called when first advertising packet in periodic advertising is received.

Parameters
eventPeriodic advertising sync event.
Version
: 5+.
See also
createSync()

Reimplemented from Gap::EventHandler.

Definition at line 60 of file ChainableGapEventHandler.h.

◆ onPeriodicAdvertisingReport()

void onPeriodicAdvertisingReport ( const ble::PeriodicAdvertisingReportEvent event)
overridevirtual

Called when a periodic advertising packet is received.

Parameters
eventPeriodic advertisement event.
Version
: 5+.
See also
createSync()

Reimplemented from Gap::EventHandler.

Definition at line 65 of file ChainableGapEventHandler.h.

◆ onPeriodicAdvertisingSyncLoss()

void onPeriodicAdvertisingSyncLoss ( const ble::PeriodicAdvertisingSyncLoss event)
overridevirtual

Called when a periodic advertising sync has been lost.

Parameters
eventDetails of the event.
Version
: 5+.
See also
createSync()

Reimplemented from Gap::EventHandler.

Definition at line 70 of file ChainableGapEventHandler.h.

◆ onConnectionComplete()

void onConnectionComplete ( const ble::ConnectionCompleteEvent event)
overridevirtual

Called when connection attempt ends.

Check event.getStatus() to see if connection was established. If this device is the peripheral and it was advertising this will end the advertising set which will also create the onAdvertisingEnd event.

See also
startAdvertising()
connect()
Parameters
eventConnection event.

Reimplemented from Gap::EventHandler.

Definition at line 75 of file ChainableGapEventHandler.h.

◆ onUpdateConnectionParametersRequest()

void onUpdateConnectionParametersRequest ( const ble::UpdateConnectionParametersRequestEvent event)
overridevirtual

Called when the peer request connection parameters updates.

Application must accept the update with acceptConnectionParametersUpdate() or reject it with rejectConnectionParametersUpdate().

Parameters
eventThe connection parameters requested by the peer.
Version
4.1+.
Note
This event will only be produced if manageConnectionParametersUpdateRequest() was called with true. Otherwise the stack will handle the request and no event will be generated.
See also
manageConnectionParametersUpdateRequest()
acceptConnectionParametersUpdate()
rejectConnectionParametersUpdate()

Reimplemented from Gap::EventHandler.

Definition at line 79 of file ChainableGapEventHandler.h.

◆ onConnectionParametersUpdateComplete()

void onConnectionParametersUpdateComplete ( const ble::ConnectionParametersUpdateCompleteEvent event)
overridevirtual

Called when connection parameters have been updated.

Parameters
eventThe new connection parameters.
See also
updateConnectionParameters()
acceptConnectionParametersUpdate()

Reimplemented from Gap::EventHandler.

Definition at line 84 of file ChainableGapEventHandler.h.

◆ onDisconnectionComplete()

void onDisconnectionComplete ( const ble::DisconnectionCompleteEvent event)
overridevirtual

Called when a connection has been disconnected.

Parameters
eventDetails of the event.
See also
disconnect()

Reimplemented from Gap::EventHandler.

Definition at line 89 of file ChainableGapEventHandler.h.

◆ onReadPhy()

void onReadPhy ( ble_error_t  status,
ble::connection_handle_t  connectionHandle,
ble::phy_t  txPhy,
ble::phy_t  rxPhy 
)
overridevirtual

Function invoked when the current transmitter and receiver PHY have been read for a given connection.

Parameters
statusStatus of the operation: BLE_ERROR_NONE in case of success or an appropriate error code.
connectionHandleThe handle of the connection for which the PHYs have been read.
txPhyPHY used by the transmitter.
rxPhyPHY used by the receiver.
See also
readPhy().
Version
: 5+.

Reimplemented from Gap::EventHandler.

Definition at line 93 of file ChainableGapEventHandler.h.

◆ onPhyUpdateComplete()

void onPhyUpdateComplete ( ble_error_t  status,
ble::connection_handle_t  connectionHandle,
ble::phy_t  txPhy,
ble::phy_t  rxPhy 
)
overridevirtual

Function invoked when the update process of the PHY has been completed.

The process can be initiated by a call to the function setPhy, the local bluetooth subsystem or the peer.

Parameters
statusStatus of the operation: BLE_ERROR_NONE in case of success or an appropriate error code.
connectionHandleThe handle of the connection on which the operation was made.
txPhyPHY used by the transmitter.
rxPhyPHY used by the receiver.
Note
Success doesn't mean the PHY has been updated it means both ends have negotiated the best PHY according to their configuration and capabilities. The PHY currently used are present in the txPhy and rxPhy parameters.
See also
setPhy()
Version
: 5+.

Reimplemented from Gap::EventHandler.

Definition at line 102 of file ChainableGapEventHandler.h.

◆ onDataLengthChange()

void onDataLengthChange ( ble::connection_handle_t  connectionHandle,
uint16_t  txSize,
uint16_t  rxSize 
)
overridevirtual

Function invoked when the connections changes the maximum number of octets that can be sent or received by the controller in a single packet.

A single L2CAP packet can be fragmented across many such packets.

Note
This only triggers if controller supports data length extension and negotiated data length is longer than the default 23.
Parameters
connectionHandleThe handle of the connection that changed the size.
txSizeNumber of octets we can send on this connection in a single packet.
rxSizeNumber of octets we can receive on this connection in a single packet.

Reimplemented from Gap::EventHandler.

Definition at line 111 of file ChainableGapEventHandler.h.

◆ onPrivacyEnabled()

void onPrivacyEnabled ( )
overridevirtual

Function invoked when the privacy subsystem has been enabled and is ready to be used.

See also
enablePrivacy()

Reimplemented from Gap::EventHandler.

Definition at line 119 of file ChainableGapEventHandler.h.

◆ addEventHandler()

bool addEventHandler ( ble::Gap::EventHandler event_handler)
inherited

Add an EventHandler to be notified of events sent to this ChainableEventHandler.

Parameters
[in]event_handlerHandler to add to chain
Return values
trueif adding EventHandler was successful, false otherwise

Definition at line 54 of file ChainableEventHandler.h.

◆ removeEventHandler()

void removeEventHandler ( ble::Gap::EventHandler event_handler)
inherited

Remove an EventHandler previously added with addEventHandler.

Parameters
[in]event_handlerPointer to event handler to remove

Definition at line 74 of file ChainableEventHandler.h.

◆ isEventHandlerPresent()

bool isEventHandlerPresent ( ble::Gap::EventHandler event_handler)
inherited

Test if an event handler is present in the chain or not.

Parameters
[in]event_handlerPointer to event handler to check

Definition at line 102 of file ChainableEventHandler.h.