bluetooth: host: Rename bt_conn_get_id and make it public.
There is not an easy way to relate an application's user_data to a connection. One way is to save a pointer to bt_conn in the application's user_data array upon connection establishment. Each connection related callback function will have to loop for all user_data and compare the saved pointer to the passed bt_conn pointer. This is inefficient if there are many callback activations during the connection. This change makes the internal bt_conn mapping function accessible to applications in conn.h. The function name is changed to bt_conn_index() to clearly indicate that the function returns an index of an array. Add an ASSERT to catch illegal parameter. Signed-off-by: Kim Sekkelund <ksek@oticon.com>
This commit is contained in:
parent
c1f4d677f2
commit
bf11698ed9
5 changed files with 22 additions and 7 deletions
|
@ -100,6 +100,18 @@ struct bt_conn *bt_conn_lookup_addr_le(u8_t id, const bt_addr_le_t *peer);
|
|||
*/
|
||||
const bt_addr_le_t *bt_conn_get_dst(const struct bt_conn *conn);
|
||||
|
||||
/** @brief Get array index of a connection
|
||||
*
|
||||
* This function is used to map bt_conn to index of an array of
|
||||
* connections. The array has CONFIG_BT_MAX_CONN elements.
|
||||
*
|
||||
* @param conn Connection object.
|
||||
*
|
||||
* @return Index of the connection object.
|
||||
* The range of the returned value is 0..CONFIG_BT_MAX_CONN-1
|
||||
*/
|
||||
u8_t bt_conn_index(struct bt_conn *conn);
|
||||
|
||||
/** Connection Type */
|
||||
enum {
|
||||
/** LE Connection Type */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue