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

Read/Write HCI communication channel. More...

#include <HCIComm.hpp>

Collaboration diagram for direct_bt::HCIComm:

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

 HCIComm (const HCIComm &)=delete
 
 HCIComm (const uint16_t dev_id, const uint16_t channel) noexcept
 Constructing a newly opened HCI communication channel instance. More...
 
 ~HCIComm () noexcept
 Releases this instance after issuing close(). More...
 
void close () noexcept
 Closing the HCI channel, locking mutex_write(). More...
 
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
 
std::recursive_mutex & mutex_write () noexcept
 Return the recursive write mutex for multithreading access. More...
 
void operator= (const HCIComm &)=delete
 
jau::snsize_t read (uint8_t *buffer, const jau::nsize_t capacity, const jau::fraction_i64 &timeout) noexcept
 Generic read w/ own timeout, w/o locking suitable for a unique ringbuffer sink. More...
 
void set_interrupted_query (get_boolean_callback_t is_interrupted_cb)
 The external is interrupted callback is used until close(), thereafter it is removed. More...
 
int socket () const noexcept
 Return this HCI socket descriptor. More...
 
jau::snsize_t write (const uint8_t *buffer, const jau::nsize_t size) noexcept
 Generic write, locking mutex_write(). More...
 

Static Public Member Functions

static void filter_all_events (hci_ufilter *f) noexcept
 
static void filter_all_ptypes (hci_ufilter *f) noexcept
 
static void filter_clear (hci_ufilter *f) noexcept
 
static void filter_clear_event (int e, hci_ufilter *f) noexcept
 
static void filter_clear_opcode (hci_ufilter *f) noexcept
 
static void filter_clear_ptype (int t, hci_ufilter *f) noexcept
 
static void filter_set_event (int e, hci_ufilter *f) noexcept
 
static void filter_set_opcode (uint16_t opcode, hci_ufilter *f) noexcept
 
static void filter_set_ptype (int t, hci_ufilter *f) noexcept
 
static uint32_t filter_test_event (int e, hci_ufilter *f) noexcept
 
static int filter_test_opcode (uint16_t opcode, hci_ufilter *f) noexcept
 
static uint32_t filter_test_ptype (int t, hci_ufilter *f) noexcept
 

Public Attributes

const uint16_t channel
 
const uint16_t dev_id
 

Detailed Description

Read/Write HCI communication channel.

Definition at line 61 of file HCIComm.hpp.

Member Typedef Documentation

◆ get_boolean_callback_t

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

Definition at line 64 of file HCIComm.hpp.

Constructor & Destructor Documentation

◆ HCIComm() [1/2]

direct_bt::HCIComm::HCIComm ( const uint16_t  dev_id,
const uint16_t  channel 
)
noexcept

Constructing a newly opened HCI communication channel instance.

Definition at line 111 of file HCIComm.cpp.

◆ HCIComm() [2/2]

direct_bt::HCIComm::HCIComm ( const HCIComm )
delete

◆ ~HCIComm()

direct_bt::HCIComm::~HCIComm ( )
inlinenoexcept

Releases this instance after issuing close().

Definition at line 89 of file HCIComm.hpp.

Member Function Documentation

◆ operator=()

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

◆ is_open()

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

Definition at line 91 of file HCIComm.hpp.

Here is the caller graph for this function:

◆ set_interrupted_query()

void direct_bt::HCIComm::set_interrupted_query ( get_boolean_callback_t  is_interrupted_cb)
inline

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

Definition at line 94 of file HCIComm.hpp.

◆ interrupted()

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

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

Definition at line 97 of file HCIComm.hpp.

◆ close()

void direct_bt::HCIComm::close ( )
noexcept

Closing the HCI channel, locking mutex_write().

Definition at line 118 of file HCIComm.cpp.

Here is the caller graph for this function:

◆ socket()

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

Return this HCI socket descriptor.

Definition at line 103 of file HCIComm.hpp.

◆ mutex_write()

std::recursive_mutex & direct_bt::HCIComm::mutex_write ( )
inlinenoexcept

Return the recursive write mutex for multithreading access.

Definition at line 106 of file HCIComm.hpp.

◆ read()

jau::snsize_t direct_bt::HCIComm::read ( uint8_t *  buffer,
const jau::nsize_t  capacity,
const jau::fraction_i64 timeout 
)
noexcept

Generic read w/ own timeout, w/o locking suitable for a unique ringbuffer sink.

Definition at line 148 of file HCIComm.cpp.

◆ write()

jau::snsize_t direct_bt::HCIComm::write ( const uint8_t *  buffer,
const jau::nsize_t  size 
)
noexcept

Generic write, locking mutex_write().

Definition at line 191 of file HCIComm.cpp.

◆ filter_clear()

static void direct_bt::HCIComm::filter_clear ( hci_ufilter *  f)
inlinestaticnoexcept

Definition at line 131 of file HCIComm.hpp.

Here is the caller graph for this function:

◆ filter_set_ptype()

static void direct_bt::HCIComm::filter_set_ptype ( int  t,
hci_ufilter *  f 
)
inlinestaticnoexcept

Definition at line 135 of file HCIComm.hpp.

Here is the caller graph for this function:

◆ filter_clear_ptype()

static void direct_bt::HCIComm::filter_clear_ptype ( int  t,
hci_ufilter *  f 
)
inlinestaticnoexcept

Definition at line 139 of file HCIComm.hpp.

◆ filter_test_ptype()

static uint32_t direct_bt::HCIComm::filter_test_ptype ( int  t,
hci_ufilter *  f 
)
inlinestaticnoexcept

Definition at line 143 of file HCIComm.hpp.

◆ filter_all_ptypes()

static void direct_bt::HCIComm::filter_all_ptypes ( hci_ufilter *  f)
inlinestaticnoexcept

Definition at line 147 of file HCIComm.hpp.

◆ filter_set_event()

static void direct_bt::HCIComm::filter_set_event ( int  e,
hci_ufilter *  f 
)
inlinestaticnoexcept

Definition at line 151 of file HCIComm.hpp.

Here is the caller graph for this function:

◆ filter_clear_event()

static void direct_bt::HCIComm::filter_clear_event ( int  e,
hci_ufilter *  f 
)
inlinestaticnoexcept

Definition at line 155 of file HCIComm.hpp.

◆ filter_test_event()

static uint32_t direct_bt::HCIComm::filter_test_event ( int  e,
hci_ufilter *  f 
)
inlinestaticnoexcept

Definition at line 159 of file HCIComm.hpp.

◆ filter_all_events()

static void direct_bt::HCIComm::filter_all_events ( hci_ufilter *  f)
inlinestaticnoexcept

Definition at line 163 of file HCIComm.hpp.

Here is the caller graph for this function:

◆ filter_set_opcode()

static void direct_bt::HCIComm::filter_set_opcode ( uint16_t  opcode,
hci_ufilter *  f 
)
inlinestaticnoexcept

Definition at line 167 of file HCIComm.hpp.

Here is the caller graph for this function:

◆ filter_clear_opcode()

static void direct_bt::HCIComm::filter_clear_opcode ( hci_ufilter *  f)
inlinestaticnoexcept

Definition at line 171 of file HCIComm.hpp.

◆ filter_test_opcode()

static int direct_bt::HCIComm::filter_test_opcode ( uint16_t  opcode,
hci_ufilter *  f 
)
inlinestaticnoexcept

Definition at line 175 of file HCIComm.hpp.

Member Data Documentation

◆ dev_id

const uint16_t direct_bt::HCIComm::dev_id

Definition at line 66 of file HCIComm.hpp.

◆ channel

const uint16_t direct_bt::HCIComm::channel

Definition at line 67 of file HCIComm.hpp.


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