mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-25 14:40:55 +01:00
Add disconnect overload to take NimBLEConnInfo reference. (#162)
* NimBLEConnInfo - Note that the connection handle is the same as the connection id in the comment for getConnHandle() * NimBLEServer - int disconnect(const NimBLEConnInfo&) helper method
This commit is contained in:
parent
2447af6a4d
commit
f36929963d
3 changed files with 12 additions and 1 deletions
|
@ -22,7 +22,7 @@ public:
|
||||||
/** @brief Gets the ID address of the connected peer */
|
/** @brief Gets the ID address of the connected peer */
|
||||||
NimBLEAddress getIdAddress() const { return NimBLEAddress(m_desc.peer_id_addr); }
|
NimBLEAddress getIdAddress() const { return NimBLEAddress(m_desc.peer_id_addr); }
|
||||||
|
|
||||||
/** @brief Gets the connection handle of the connected peer */
|
/** @brief Gets the connection handle (also known as the connection id) of the connected peer */
|
||||||
uint16_t getConnHandle() const { return m_desc.conn_handle; }
|
uint16_t getConnHandle() const { return m_desc.conn_handle; }
|
||||||
|
|
||||||
/** @brief Gets the connection interval for this connection (in 1.25ms units) */
|
/** @brief Gets the connection interval for this connection (in 1.25ms units) */
|
||||||
|
|
|
@ -252,6 +252,15 @@ int NimBLEServer::disconnect(uint16_t connId, uint8_t reason) {
|
||||||
return rc;
|
return rc;
|
||||||
} // disconnect
|
} // disconnect
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disconnect the specified client with optional reason.
|
||||||
|
* @param [in] connInfo Connection of the client to disconnect.
|
||||||
|
* @param [in] reason code for disconnecting.
|
||||||
|
* @return NimBLE host return code.
|
||||||
|
*/
|
||||||
|
int NimBLEServer::disconnect(const NimBLEConnInfo &connInfo, uint8_t reason) {
|
||||||
|
return disconnect(connInfo.getConnHandle(), reason);
|
||||||
|
} // disconnect
|
||||||
|
|
||||||
#if !CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_)
|
#if !CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_)
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -69,6 +69,8 @@ public:
|
||||||
NimBLEService* getServiceByHandle(uint16_t handle);
|
NimBLEService* getServiceByHandle(uint16_t handle);
|
||||||
int disconnect(uint16_t connID,
|
int disconnect(uint16_t connID,
|
||||||
uint8_t reason = BLE_ERR_REM_USER_CONN_TERM);
|
uint8_t reason = BLE_ERR_REM_USER_CONN_TERM);
|
||||||
|
int disconnect(const NimBLEConnInfo &connInfo,
|
||||||
|
uint8_t reason = BLE_ERR_REM_USER_CONN_TERM);
|
||||||
void updateConnParams(uint16_t conn_handle,
|
void updateConnParams(uint16_t conn_handle,
|
||||||
uint16_t minInterval, uint16_t maxInterval,
|
uint16_t minInterval, uint16_t maxInterval,
|
||||||
uint16_t latency, uint16_t timeout);
|
uint16_t latency, uint16_t timeout);
|
||||||
|
|
Loading…
Reference in a new issue