pkg/nimble/netif: add nimble_netif_l2cap_ping()

This commit is contained in:
Hauke Petersen 2021-07-01 16:46:35 +02:00
parent b4de70e9d8
commit 3878096cce
2 changed files with 28 additions and 0 deletions

View File

@ -288,6 +288,24 @@ int nimble_netif_update(int handle,
*/
int nimble_netif_used_chanmap(int handle, uint8_t map[5]);
/**
* @brief Trigger a L2CAP ping procedure for the specified connection
*
* This is a convenience wrapper around the NimBLE ble_l2cap_ping() function.
*
* @param[in] handle connection handle
* @param[in] cb callback triggered when the PING_RSP is received,
* executed in the NimBLE host thread context
* @param[in] data payload included in the PING_REQ and PING_RSP
* messages
* @param[in] data_len length of @p data in bytes
*
* @return 0 on success
* @return <0 on error
*/
int nimble_netif_l2cap_ping(int handle, ble_l2cap_ping_fn cb,
const void *data, uint16_t data_len);
#ifdef __cplusplus
}
#endif

View File

@ -736,3 +736,13 @@ int nimble_netif_used_chanmap(int handle, uint8_t map[5])
return 0;
}
int nimble_netif_l2cap_ping(int handle, ble_l2cap_ping_fn cb,
const void *data, uint16_t data_len)
{
nimble_netif_conn_t *conn = nimble_netif_conn_get(handle);
if (conn == NULL) {
return -1;
}
return ble_l2cap_ping(conn->gaphandle, cb, data, data_len);
}