Bluetooth: HCI: Add function to get connection handle of connection
Add public API function to get the connection handle of the connection. The connection handle is needed by applications that intend to send vendor specific commands for a given connection. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
e53ee2d383
commit
0f06c7d8e4
|
@ -16,6 +16,7 @@
|
|||
#include <net/buf.h>
|
||||
#include <bluetooth/addr.h>
|
||||
#include <bluetooth/hci_err.h>
|
||||
#include <bluetooth/conn.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -1768,6 +1769,15 @@ int bt_hci_cmd_send(u16_t opcode, struct net_buf *buf);
|
|||
int bt_hci_cmd_send_sync(u16_t opcode, struct net_buf *buf,
|
||||
struct net_buf **rsp);
|
||||
|
||||
/** @brief Get connection handle for a connection.
|
||||
*
|
||||
* @param conn Connection object.
|
||||
* @param conn_handle Place to store the Connection handle.
|
||||
*
|
||||
* @return 0 on success or negative error value on failure.
|
||||
*/
|
||||
int bt_hci_get_conn_handle(const struct bt_conn *conn, u16_t *conn_handle);
|
||||
|
||||
/** @typedef bt_hci_vnd_evt_cb_t
|
||||
* @brief Callback type for vendor handling of HCI Vendor-Specific Events.
|
||||
*
|
||||
|
|
|
@ -3607,6 +3607,16 @@ static void le_adv_report(struct net_buf *buf)
|
|||
}
|
||||
#endif /* CONFIG_BT_OBSERVER */
|
||||
|
||||
int bt_hci_get_conn_handle(const struct bt_conn *conn, u16_t *conn_handle)
|
||||
{
|
||||
if (conn->state != BT_CONN_CONNECTED) {
|
||||
return -ENOTCONN;
|
||||
}
|
||||
|
||||
*conn_handle = conn->handle;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_HCI_VS_EVT_USER)
|
||||
int bt_hci_register_vnd_evt_cb(bt_hci_vnd_evt_cb_t cb)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue