Direct-BT  2.3.1
Direct-BT - Direct Bluetooth Programming.
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
direct_bt::SMPHandler Class Reference

A thread safe SMP handler associated to one device via one L2CAP connection. More...

#include <SMPHandler.hpp>

Collaboration diagram for direct_bt::SMPHandler:

Public Types

enum  Defaults : int32_t { Defaults::MIN_SMP_MTU = 23, Defaults::LE_SECURE_SMP_MTU = 65, Defaults::SMP_MTU_BUFFER_SZ = 128 }
 

Public Member Functions

 SMPHandler (const std::shared_ptr< BTDevice > &device) noexcept
 
 SMPHandler (const SMPHandler &)=delete
 
void operator= (const SMPHandler &)=delete
 
 ~SMPHandler () noexcept
 Destructor closing this instance including L2CAP channel, see disconnect(). More...
 
std::shared_ptr< BTDevicegetDeviceUnchecked () const noexcept
 
std::shared_ptr< BTDevicegetDeviceChecked () const
 
bool isConnected () const noexcept
 
bool hasIOError () const noexcept
 
std::string getStateString () const noexcept
 
bool establishSecurity (const BTSecurityLevel sec_level)
 If sec_level > BTSecurityLevel::UNSET, change security level per L2CAP connection. More...
 
bool disconnect (const bool disconnectDevice, const bool ioErrorCause) noexcept
 Disconnect this GATTHandler and optionally the associated device. More...
 
void addSMPSecurityReqCallback (const SMPSecurityReqCallback &l)
 
int removeSMPSecurityReqCallback (const SMPSecurityReqCallback &l)
 

Static Public Member Functions

static constexpr int number (const Defaults d)
 

Static Public Attributes

static bool IS_SUPPORTED_BY_OS = false
 Linux/BlueZ prohibits access to the existing SMP implementation via L2CAP (socket). More...
 

Detailed Description

A thread safe SMP handler associated to one device via one L2CAP connection.

Implementation utilizes a lock free ringbuffer receiving data within its separate thread.

Controlling Environment variables, see SMPEnv.

See

Definition at line 169 of file SMPHandler.hpp.

Member Enumeration Documentation

◆ Defaults

enum direct_bt::SMPHandler::Defaults : int32_t
strong
Enumerator
MIN_SMP_MTU 
LE_SECURE_SMP_MTU 
SMP_MTU_BUFFER_SZ 

Definition at line 176 of file SMPHandler.hpp.

Constructor & Destructor Documentation

◆ SMPHandler() [1/2]

SMPHandler::SMPHandler ( const std::shared_ptr< BTDevice > &  device)
noexcept

Definition at line 158 of file SMPHandler.cpp.

Here is the call graph for this function:

◆ SMPHandler() [2/2]

direct_bt::SMPHandler::SMPHandler ( const SMPHandler )
delete

◆ ~SMPHandler()

SMPHandler::~SMPHandler ( )
noexcept

Destructor closing this instance including L2CAP channel, see disconnect().

Definition at line 198 of file SMPHandler.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ addSMPSecurityReqCallback()

void SMPHandler::addSMPSecurityReqCallback ( const SMPSecurityReqCallback l)

Definition at line 325 of file SMPHandler.cpp.

Here is the call graph for this function:

◆ disconnect()

bool SMPHandler::disconnect ( const bool  disconnectDevice,
const bool  ioErrorCause 
)
noexcept

Disconnect this GATTHandler and optionally the associated device.

Parameters
disconnectDeviceif true, associated device will also be disconnected, otherwise not.
ioErrorCauseif true, reason for disconnection is an IO error
Returns
true if successful, otherwise false

Definition at line 210 of file SMPHandler.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ establishSecurity()

bool SMPHandler::establishSecurity ( const BTSecurityLevel  sec_level)

If sec_level > BTSecurityLevel::UNSET, change security level per L2CAP connection.

Parameters
sec_levelsec_level < BTSecurityLevel::NONE will not set security level and returns false.
Returns
true if a security level > BTSecurityLevel::UNSET has been set successfully, false if no security level has been set or if it failed.

Definition at line 203 of file SMPHandler.cpp.

◆ getDeviceChecked()

std::shared_ptr< BTDevice > SMPHandler::getDeviceChecked ( ) const

Definition at line 75 of file SMPHandler.cpp.

◆ getDeviceUnchecked()

std::shared_ptr<BTDevice> direct_bt::SMPHandler::getDeviceUnchecked ( ) const
inlinenoexcept

Definition at line 231 of file SMPHandler.hpp.

◆ getStateString()

std::string direct_bt::SMPHandler::getStateString ( ) const
inlinenoexcept

Definition at line 236 of file SMPHandler.hpp.

Here is the call graph for this function:

◆ hasIOError()

bool direct_bt::SMPHandler::hasIOError ( ) const
inlinenoexcept

Definition at line 235 of file SMPHandler.hpp.

◆ isConnected()

bool direct_bt::SMPHandler::isConnected ( ) const
inlinenoexcept

Definition at line 234 of file SMPHandler.hpp.

◆ number()

static constexpr int direct_bt::SMPHandler::number ( const Defaults  d)
inlinestaticconstexpr

Definition at line 185 of file SMPHandler.hpp.

◆ operator=()

void direct_bt::SMPHandler::operator= ( const SMPHandler )
delete

◆ removeSMPSecurityReqCallback()

int SMPHandler::removeSMPSecurityReqCallback ( const SMPSecurityReqCallback l)

Definition at line 328 of file SMPHandler.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ IS_SUPPORTED_BY_OS

bool SMPHandler::IS_SUPPORTED_BY_OS = false
static

Linux/BlueZ prohibits access to the existing SMP implementation via L2CAP (socket).

Definition at line 174 of file SMPHandler.hpp.


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