Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
direct_bt::L2CAPComm Class Referenceabstract

L2CAP client/server socket abstract base class to listen for connecting remote devices. More...

#include <L2CAPComm.hpp>

Inheritance diagram for direct_bt::L2CAPComm:
Collaboration diagram for direct_bt::L2CAPComm:

Public Types

typedef jau::function< bool(int)> get_boolean_callback_t
 Utilized to query for external interruption, whether device is still connected etc. More...
 

Public Member Functions

 L2CAPComm (const L2CAPComm &)=delete
 
 L2CAPComm (const uint16_t adev_id, BDAddressAndType localAddressAndType, const L2CAP_PSM psm, const L2CAP_CID cid) noexcept
 
virtual ~L2CAPComm () noexcept=default
 Destructor specialization shall close the L2CAP socket, see close(). More...
 
virtual bool close () noexcept=0
 Closing the L2CAP socket, see specializations. More...
 
virtual std::string getStateString () const noexcept=0
 
bool interrupted () const noexcept
 Returns true if interrupted by internal or external cause, hence shall stop connecting and reading. More...
 
bool is_open () const noexcept
 
void operator= (const L2CAPComm &)=delete
 
void set_interrupted_query (get_boolean_callback_t is_interrupted_cb) noexcept
 The external is interrupted callback is used until close(), thereafter it is removed. More...
 
int socket () const noexcept
 Return this L2CAP socket descriptor. More...
 
virtual std::string toString () const noexcept=0
 

Static Public Member Functions

static std::string getStateString (bool isOpen, bool hasIOError) noexcept
 
static std::string getStateString (bool isOpen, bool irqed_int, bool irqed_ext, bool hasIOError) noexcept
 
static std::string getStateString (bool isOpen, bool isInterrupted, bool hasIOError) noexcept
 

Public Attributes

const uint16_t adev_id
 Corresponding BTAdapter device id. More...
 
const L2CAP_CID cid
 Corresponding L2CAP_CID for the channel. More...
 
const BDAddressAndType localAddressAndType
 Corresponding BTAdapter local BTAddressAndType. More...
 
const L2CAP_PSM psm
 Corresponding L2CAP_PSM for the channel. More...
 

Protected Member Functions

BTSecurityLevel getBTSecurityLevelImpl (const BDAddressAndType &remoteAddressAndType) noexcept
 
bool interrupted_ext () const noexcept
 Returns true if interrupted by external cause. More...
 
bool interrupted_int () const noexcept
 Returns true if interrupted by internal cause. More...
 
bool setBTSecurityLevelImpl (const BTSecurityLevel sec_level, const BDAddressAndType &remoteAddressAndType) noexcept
 

Static Protected Member Functions

static int l2cap_close_dev (int dd) noexcept
 
static int l2cap_open_dev (const BDAddressAndType &adapterAddressAndType, const L2CAP_PSM psm, const L2CAP_CID cid) noexcept
 

Protected Attributes

const L2CAPEnvenv
 
jau::sc_atomic_bool interrupted_intern
 
get_boolean_callback_t is_interrupted_extern
 
jau::sc_atomic_bool is_open_
 
std::recursive_mutex mtx_open
 
jau::relaxed_atomic_int socket_
 

Detailed Description

L2CAP client/server socket abstract base class to listen for connecting remote devices.

Definition at line 123 of file L2CAPComm.hpp.

Member Typedef Documentation

◆ get_boolean_callback_t

Utilized to query for external interruption, whether device is still connected etc.

Definition at line 130 of file L2CAPComm.hpp.

Constructor & Destructor Documentation

◆ L2CAPComm() [1/2]

L2CAPComm::L2CAPComm ( const uint16_t  adev_id,
BDAddressAndType  localAddressAndType,
const L2CAP_PSM  psm,
const L2CAP_CID  cid 
)
noexcept

Definition at line 147 of file L2CAPComm.cpp.

◆ ~L2CAPComm()

virtual direct_bt::L2CAPComm::~L2CAPComm ( )
virtualdefaultnoexcept

Destructor specialization shall close the L2CAP socket, see close().

◆ L2CAPComm() [2/2]

direct_bt::L2CAPComm::L2CAPComm ( const L2CAPComm )
delete

Member Function Documentation

◆ getStateString() [1/4]

std::string L2CAPComm::getStateString ( bool  isOpen,
bool  hasIOError 
)
staticnoexcept

Definition at line 84 of file L2CAPComm.cpp.

◆ getStateString() [2/4]

static std::string direct_bt::L2CAPComm::getStateString ( bool  isOpen,
bool  isInterrupted,
bool  hasIOError 
)
staticnoexcept

◆ getStateString() [3/4]

std::string L2CAPComm::getStateString ( bool  isOpen,
bool  irqed_int,
bool  irqed_ext,
bool  hasIOError 
)
staticnoexcept

Definition at line 90 of file L2CAPComm.cpp.

◆ l2cap_open_dev()

int L2CAPComm::l2cap_open_dev ( const BDAddressAndType adapterAddressAndType,
const L2CAP_PSM  psm,
const L2CAP_CID  cid 
)
staticprotectednoexcept

Definition at line 97 of file L2CAPComm.cpp.

Here is the caller graph for this function:

◆ l2cap_close_dev()

int L2CAPComm::l2cap_close_dev ( int  dd)
staticprotectednoexcept

Definition at line 142 of file L2CAPComm.cpp.

◆ setBTSecurityLevelImpl()

bool L2CAPComm::setBTSecurityLevelImpl ( const BTSecurityLevel  sec_level,
const BDAddressAndType remoteAddressAndType 
)
protectednoexcept

Definition at line 156 of file L2CAPComm.cpp.

◆ getBTSecurityLevelImpl()

BTSecurityLevel L2CAPComm::getBTSecurityLevelImpl ( const BDAddressAndType remoteAddressAndType)
protectednoexcept

Definition at line 208 of file L2CAPComm.cpp.

Here is the caller graph for this function:

◆ interrupted_int()

bool direct_bt::L2CAPComm::interrupted_int ( ) const
inlineprotectednoexcept

Returns true if interrupted by internal cause.

Definition at line 159 of file L2CAPComm.hpp.

Here is the caller graph for this function:

◆ interrupted_ext()

bool direct_bt::L2CAPComm::interrupted_ext ( ) const
inlineprotectednoexcept

Returns true if interrupted by external cause.

Definition at line 162 of file L2CAPComm.hpp.

Here is the caller graph for this function:

◆ operator=()

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

◆ is_open()

bool direct_bt::L2CAPComm::is_open ( ) const
inlinenoexcept

Definition at line 173 of file L2CAPComm.hpp.

◆ set_interrupted_query()

void direct_bt::L2CAPComm::set_interrupted_query ( get_boolean_callback_t  is_interrupted_cb)
inlinenoexcept

The external is interrupted callback is used until close(), thereafter it is removed.

Definition at line 176 of file L2CAPComm.hpp.

◆ interrupted()

bool direct_bt::L2CAPComm::interrupted ( ) const
inlinenoexcept

Returns true if interrupted by internal or external cause, hence shall stop connecting and reading.

Definition at line 179 of file L2CAPComm.hpp.

Here is the caller graph for this function:

◆ close()

virtual bool direct_bt::L2CAPComm::close ( )
pure virtualnoexcept

Closing the L2CAP socket, see specializations.

Implemented in direct_bt::L2CAPClient, and direct_bt::L2CAPServer.

◆ socket()

int direct_bt::L2CAPComm::socket ( ) const
inlinenoexcept

Return this L2CAP socket descriptor.

Definition at line 185 of file L2CAPComm.hpp.

◆ getStateString() [4/4]

virtual std::string direct_bt::L2CAPComm::getStateString ( ) const
pure virtualnoexcept

Implemented in direct_bt::L2CAPClient, and direct_bt::L2CAPServer.

Here is the caller graph for this function:

◆ toString()

virtual std::string direct_bt::L2CAPComm::toString ( ) const
pure virtualnoexcept

Member Data Documentation

◆ env

const L2CAPEnv& direct_bt::L2CAPComm::env
protected

Definition at line 136 of file L2CAPComm.hpp.

◆ adev_id

const uint16_t direct_bt::L2CAPComm::adev_id

Corresponding BTAdapter device id.

Definition at line 140 of file L2CAPComm.hpp.

◆ localAddressAndType

const BDAddressAndType direct_bt::L2CAPComm::localAddressAndType

Corresponding BTAdapter local BTAddressAndType.

Definition at line 142 of file L2CAPComm.hpp.

◆ psm

const L2CAP_PSM direct_bt::L2CAPComm::psm

Corresponding L2CAP_PSM for the channel.

Definition at line 144 of file L2CAPComm.hpp.

◆ cid

const L2CAP_CID direct_bt::L2CAPComm::cid

Corresponding L2CAP_CID for the channel.

Definition at line 146 of file L2CAPComm.hpp.

◆ mtx_open

std::recursive_mutex direct_bt::L2CAPComm::mtx_open
protected

Definition at line 149 of file L2CAPComm.hpp.

◆ socket_

jau::relaxed_atomic_int direct_bt::L2CAPComm::socket_
protected

Definition at line 150 of file L2CAPComm.hpp.

◆ is_open_

jau::sc_atomic_bool direct_bt::L2CAPComm::is_open_
protected

Definition at line 151 of file L2CAPComm.hpp.

◆ interrupted_intern

jau::sc_atomic_bool direct_bt::L2CAPComm::interrupted_intern
protected

Definition at line 152 of file L2CAPComm.hpp.

◆ is_interrupted_extern

get_boolean_callback_t direct_bt::L2CAPComm::is_interrupted_extern
protected

Definition at line 153 of file L2CAPComm.hpp.


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