18#ifndef NIMBLE_CPP_CONNINFO_H_
19#define NIMBLE_CPP_CONNINFO_H_
21#if defined(CONFIG_NIMBLE_CPP_IDF)
22# include "host/ble_gap.h"
24# include "nimble/nimble/host/include/host/ble_gap.h"
27#include "NimBLEAddress.h"
54 uint16_t
getMTU()
const {
return ble_att_mtu(m_desc.conn_handle); }
57 bool isMaster()
const {
return (m_desc.role == BLE_GAP_ROLE_MASTER); }
60 bool isSlave()
const {
return (m_desc.role == BLE_GAP_ROLE_SLAVE); }
63 bool isBonded()
const {
return (m_desc.sec_state.bonded == 1); }
66 bool isEncrypted()
const {
return (m_desc.sec_state.encrypted == 1); }
84 " Connection Handle: %u\n"
85 " Connection Interval: %.1f ms\n"
86 " Connection Timeout: %u ms\n"
87 " Connection Latency: %u\n"
92 " Authenticated: %s\n"
93 " Security Key Size: %u\n",
115 ble_gap_conn_desc m_desc{};
A BLE device address.
Definition NimBLEAddress.h:42
The model of a BLE Characteristic.
Definition NimBLECharacteristic.h:41
A model of a BLE client.
Definition NimBLEClient.h:49
Connection information.
Definition NimBLEConnInfo.h:33
uint16_t getConnLatency() const
Gets the allowable latency for this connection (unit = number of intervals)
Definition NimBLEConnInfo.h:51
NimBLEAddress getAddress() const
Gets the over-the-air address of the connected peer.
Definition NimBLEConnInfo.h:36
uint16_t getMTU() const
Gets the maximum transmission unit size for this connection (in bytes)
Definition NimBLEConnInfo.h:54
NimBLEAddress getIdAddress() const
Gets the ID address of the connected peer.
Definition NimBLEConnInfo.h:39
bool isEncrypted() const
Check if the connection in encrypted.
Definition NimBLEConnInfo.h:66
uint8_t getSecKeySize() const
Gets the key size used to encrypt the connection.
Definition NimBLEConnInfo.h:72
bool isMaster() const
Check if we are in the master role in this connection.
Definition NimBLEConnInfo.h:57
std::string toString() const
Get a string representation of the connection info, useful for debugging.
Definition NimBLEConnInfo.h:75
bool isAuthenticated() const
Check if the the connection has been authenticated.
Definition NimBLEConnInfo.h:69
uint16_t getConnHandle() const
Gets the connection handle (also known as the connection id) of the connected peer.
Definition NimBLEConnInfo.h:42
uint16_t getConnTimeout() const
Gets the supervision timeout for this connection (in 10ms units)
Definition NimBLEConnInfo.h:48
uint16_t getConnInterval() const
Gets the connection interval for this connection (in 1.25ms units)
Definition NimBLEConnInfo.h:45
bool isSlave() const
Check if we are in the slave role in this connection.
Definition NimBLEConnInfo.h:60
bool isBonded() const
Check if we are connected to a bonded peer.
Definition NimBLEConnInfo.h:63
A model of a BLE descriptor.
Definition NimBLEDescriptor.h:33
The model of a BLE server.
Definition NimBLEServer.h:62