Direct-BT
2.3.1
Direct-BT - Direct Bluetooth Programming.
|
Go to the documentation of this file.
26 #ifndef SMP_HANDLER_HPP_
27 #define SMP_HANDLER_HPP_
52 #define SMP_SUPPORTED_BY_OS 0
53 #define USE_LINUX_BT_SECURITY 1
55 #define SMP_SUPPORTED_BY_OS 1
56 #define USE_LINUX_BT_SECURITY 0
100 const bool exploding;
191 std::weak_ptr<BTDevice> wbr_device;
193 const std::string deviceString;
194 std::recursive_mutex mtx_command;
204 std::mutex mtx_l2capReaderLifecycle;
205 std::condition_variable cv_l2capReaderInit;
206 pthread_t l2capReaderThreadId;
213 bool validateConnected() noexcept;
215 void l2capReaderThreadImpl();
218 std::unique_ptr<const
SMPPDUMsg> sendWithReply(const
SMPPDUMsg & msg, const
int timeout);
220 void clearAllCallbacks() noexcept;
252 bool disconnect(
const bool disconnectDevice,
const bool ioErrorCause) noexcept;
const int32_t SMP_WRITE_COMMAND_REPLY_TIMEOUT
Timeout for SMP write command replies, defaults to 500ms.
bool disconnect(const bool disconnectDevice, const bool ioErrorCause) noexcept
Disconnect this GATTHandler and optionally the associated device.
const int32_t SMP_READ_COMMAND_REPLY_TIMEOUT
Timeout for SMP read command replies, defaults to 500ms.
void addSMPSecurityReqCallback(const SMPSecurityReqCallback &l)
std::string getStateString() const noexcept
A thread safe SMP handler associated to one device via one L2CAP connection.
int removeSMPSecurityReqCallback(const SMPSecurityReqCallback &l)
Base jau environment class, merely to tag all environment settings by inheritance and hence documenta...
Read/Write L2CAP communication channel.
static bool IS_SUPPORTED_BY_OS
Linux/BlueZ prohibits access to the existing SMP implementation via L2CAP (socket).
BTSecurityLevel
Bluetooth Security Level.
std::string getStateString() const
bool isConnected() const noexcept
Handles the Security Manager Protocol (SMP) using Protocol Data Unit (PDU) encoded messages over L2CA...
std::shared_ptr< BTDevice > getDeviceUnchecked() const noexcept
Ring buffer implementation, a.k.a circular buffer, exposing lock-free get*(..) and put*(....
jau::cow_darray< SMPSecurityReqCallback > SMPSecurityReqCallbackList
static constexpr int number(const Defaults d)
static SMPEnv & get() noexcept
uint_fast32_t nsize_t
Natural 'size_t' alternative using uint_fast32_t as its natural sized type.
SMP Singleton runtime environment properties.
std::shared_ptr< BTDevice > getDeviceChecked() const
bool hasIOError() const noexcept
const bool DEBUG_DATA
Debug all SMP Data communication.
jau::FunctionDef< bool, const SMPPDUMsg & > SMPSecurityReqCallback
bool establishSecurity(const BTSecurityLevel sec_level)
If sec_level > BTSecurityLevel::UNSET, change security level per L2CAP connection.
Persistent octet data, i.e.
const int32_t SMPPDU_RING_CAPACITY
Medium ringbuffer capacity, defaults to 128 messages.