Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::BLEGattClients Class Reference

Singleton container of all the BLE Gatt Clients. More...

#include <BLEGattClient.hxx>

Inheritance diagram for openlcb::BLEGattClients:
Singleton< BLEGattClients >

Public Member Functions

 BLEGattClients ()
 Constructor.
 
BLEGattClientregister_client (ble::Connection *conn, ble::Defs::AttHandle out_bound, ble::Defs::AttHandle in_bound)
 Register an active client.
 
BLEGattClientfind_client_by_out (ble::Connection *conn, ble::Defs::AttHandle out_handle)
 
BLEGattClientfind_client_by_in (ble::Connection *conn, ble::Defs::AttHandle in_handle)
 
void for_each_call (std::function< void(BLEGattClient *)> callback)
 Invoke a callback method on each of the registered clients.
 

Private Member Functions

void disconnect_callback (ble::Connection *conn)
 Callback for when a connection disconnect occurs.
 

Private Attributes

std::vector< std::unique_ptr< BLEGattClient > > clients_
 All the BLE Gatt clients managed by the container.
 

Additional Inherited Members

- Static Public Member Functions inherited from Singleton< BLEGattClients >
static BLEGattClients * instance ()
 
static bool exists ()
 

Detailed Description

Singleton container of all the BLE Gatt Clients.

Definition at line 110 of file BLEGattClient.hxx.

Constructor & Destructor Documentation

◆ BLEGattClients()

openlcb::BLEGattClients::BLEGattClients ( )
inline

Constructor.

Definition at line 114 of file BLEGattClient.hxx.

Member Function Documentation

◆ disconnect_callback()

void openlcb::BLEGattClients::disconnect_callback ( ble::Connection conn)
inlineprivate

Callback for when a connection disconnect occurs.

Parameters
connBLE device connection

Remove any clients using the given connection from the container.

Definition at line 178 of file BLEGattClient.hxx.

◆ find_client_by_in()

BLEGattClient * openlcb::BLEGattClients::find_client_by_in ( ble::Connection conn,
ble::Defs::AttHandle  in_handle 
)
inline
Returns
the first client for the given connection ID.

Definition at line 151 of file BLEGattClient.hxx.

◆ find_client_by_out()

BLEGattClient * openlcb::BLEGattClients::find_client_by_out ( ble::Connection conn,
ble::Defs::AttHandle  out_handle 
)
inline
Returns
the first client for the given connection ID.

Definition at line 136 of file BLEGattClient.hxx.

◆ for_each_call()

void openlcb::BLEGattClients::for_each_call ( std::function< void(BLEGattClient *)>  callback)
inline

Invoke a callback method on each of the registered clients.

Parameters
callbackcallback to invoke.

Definition at line 167 of file BLEGattClient.hxx.

◆ register_client()

BLEGattClient * openlcb::BLEGattClients::register_client ( ble::Connection conn,
ble::Defs::AttHandle  out_bound,
ble::Defs::AttHandle  in_bound 
)
inline

Register an active client.

Parameters
connBLE device connection
out_boundhandle to out bound data characteristic
in_boundhandle to in bound data characteristic
Returns
newly created client instance. Ownership is retained, and this object will be deleted at an unspecified time.

Definition at line 126 of file BLEGattClient.hxx.

Member Data Documentation

◆ clients_

std::vector<std::unique_ptr<BLEGattClient> > openlcb::BLEGattClients::clients_
private

All the BLE Gatt clients managed by the container.

Definition at line 193 of file BLEGattClient.hxx.


The documentation for this class was generated from the following file: