Skip to content

Commit c6e3115

Browse files
softdevice_handler: add nrf_sdh_ble_conn_handle_get function
Add nrf_sdh_ble_conn_handle_get(). Signed-off-by: Eivind Jølsgard <[email protected]>
1 parent d3b5232 commit c6e3115

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

doc/nrf-bm/release_notes/release_notes_changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ No changes since the latest nRF Connect SDK Bare Metal release.
2727
SoftDevice Handler
2828
==================
2929

30+
* Added the :c:func:`nrf_sdh_ble_conn_handle_get` function.
3031
* Updated the system initialization to initialize on application level.
3132

3233
Boards

include/nrf_sdh_ble.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,15 @@ static inline int nrf_sdh_ble_idx_get(uint16_t conn_handle)
106106
return _nrf_sdh_ble_idx_get(conn_handle);
107107
}
108108

109+
/**
110+
* @brief Get the connection handle for an assigned index.
111+
*
112+
* @param[in] idx Assigned index.
113+
*
114+
* @returns The connection handle for the given index or @c BLE_CONN_HANDLE_INVALID if not found.
115+
*/
116+
uint16_t nrf_sdh_ble_conn_handle_get(int idx);
117+
109118
#ifdef __cplusplus
110119
}
111120
#endif

subsys/softdevice_handler/nrf_sdh_ble.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,15 @@ int _nrf_sdh_ble_idx_get(uint16_t conn_handle)
224224
return -1;
225225
}
226226

227+
uint16_t nrf_sdh_ble_conn_handle_get(int idx)
228+
{
229+
if (idx >= 0 && idx < ARRAY_SIZE(conn_handles)) {
230+
return conn_handles[idx];
231+
}
232+
233+
return BLE_CONN_HANDLE_INVALID;
234+
}
235+
227236
static void idx_assign(uint16_t conn_handle)
228237
{
229238
__ASSERT(conn_handle != BLE_CONN_HANDLE_INVALID, "Got invalid conn_handle from SoftDevice");

0 commit comments

Comments
 (0)