26#ifndef SMP_HANDLER_HPP_
27#define SMP_HANDLER_HPP_
175 LE_SECURE_SMP_MTU = 65,
177 SMP_MTU_BUFFER_SZ = 128
189 std::weak_ptr<BTDevice> wbr_device;
191 const std::string deviceString;
192 std::recursive_mutex mtx_command;
206 bool validateConnected() noexcept;
208 void smpReaderWork(
jau::service_runner& sr) noexcept;
209 void smpReaderEndLocked(
jau::service_runner& sr) noexcept;
214 void clearAllCallbacks() noexcept;
246 bool disconnect(
const bool disconnectDevice,
const bool ioErrorCause)
noexcept;
BTDevice represents one remote Bluetooth device.
L2CAP read/write communication channel to remote device.
virtual std::string getStateString() const noexcept=0
SMP Singleton runtime environment properties.
const int32_t SMP_WRITE_COMMAND_REPLY_TIMEOUT
Timeout for SMP write command replies, defaults to 500ms.
static SMPEnv & get() noexcept
const bool DEBUG_DATA
Debug all SMP Data communication.
const int32_t SMP_READ_COMMAND_REPLY_TIMEOUT
Timeout for SMP read command replies, defaults to 500ms.
const int32_t SMPPDU_RING_CAPACITY
Medium ringbuffer capacity, defaults to 128 messages.
A thread safe SMP handler associated to one device via one L2CAP connection.
static constexpr int number(const Defaults d)
void addSMPSecurityReqCallback(const SMPSecurityReqCallback &l)
static bool IS_SUPPORTED_BY_OS
Linux/BlueZ prohibits access to the existing SMP implementation via L2CAP (socket).
bool isConnected() const noexcept
size_type removeSMPSecurityReqCallback(const SMPSecurityReqCallback &l)
bool hasIOError() const noexcept
std::shared_ptr< BTDevice > getDeviceChecked() const
jau::cow_darray< SMPSecurityReqCallback, size_type > SMPSecurityReqCallbackList
jau::function< void(const SMPPDUMsg &)> SMPSecurityReqCallback
bool establishSecurity(const BTSecurityLevel sec_level)
If sec_level > BTSecurityLevel::UNSET, change security level per L2CAP connection.
std::shared_ptr< BTDevice > getDeviceUnchecked() const noexcept
std::string getStateString() const noexcept
bool disconnect(const bool disconnectDevice, const bool ioErrorCause) noexcept
Disconnect this GATTHandler and optionally the associated device.
Handles the Security Manager Protocol (SMP) using Protocol Data Unit (PDU) encoded messages over L2CA...
Persistent endian aware octet data, i.e.
Class template jau::function is a general-purpose static-polymorphic function wrapper.
Ring buffer implementation, a.k.a circular buffer, exposing lock-free get*(..) and put*(....
Base jau environment class, merely to tag all environment settings by inheritance and hence documenta...
Service runner, a reusable dedicated thread performing custom user services.
BTSecurityLevel
Bluetooth Security Level.
fraction< int64_t > fraction_i64
fraction using int64_t as integral type
uint_fast32_t nsize_t
Natural 'size_t' alternative using uint_fast32_t as its natural sized type.
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.