Skip to content

Commit 0ee3dec

Browse files
committed
lib: add Peer Manager
Adds the Peer Manager. List of changes compared to nrf5 SDK: * Restructured and moved headers to dedicated folders * Applied `clang-format-15` to each file * Updated all licenses * Replaced `ret_code_t` with `uint32_t` * Connection state flags are not present in `ble_conn_state` so use the Kconfig `BLE_CONN_STATE_USER_FLAG_COUNT` instead. Convert the type `ble_conn_state_user_flag_id_t` to `int`. * The configurable values defined in `peer_manager.packsc` have been converted to Kconfig options with a python script, and replaced in the code. * Reformatted all Doxygen to fit NCS style * Removed nrf5 SDK logging in favor of Zephyr logging * DOS to unix line endings * Fix Checkpatch * Use Zephyr assert in `sdk_macros.h` * All includes of headers that do not exist in Bare Metal have been removed. * Changed `NRF_ERROR_RESOURCES` to `NRF_ERROR_DATA_SIZE`. This is in order to use `NRF_ERROR_RESOURCES` in stead of `NRF_ERROR_STORAGE_FULL`. * Changed `NRF_ERROR_STORAGE_FULL` to `NRF_ERROR_RESOURCES`. * Put central logic compilation behind Kconfig flag * Add some extra build dependencies * Update GATT Cache Manager by porting `nrf_mtx` logic * Update `peer_id` and `pm_buffer` to use `atomic_t` Signed-off-by: Mirko Covizzi <[email protected]>
1 parent f42ebda commit 0ee3dec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+11366
-0
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
/lib/bm_timer/ @nrfconnect/ncs-bm
5656
/lib/boot_banner/ @nrfconnect/ncs-bm
5757
/lib/event_scheduler/ @nrfconnect/ncs-bm
58+
/lib/peer_manager/ @nrfconnect/ncs-bm
5859
/lib/sensorsim/ @nrfconnect/ncs-bm
5960
/lib/zephyr_queue/ @nrfconnect/ncs-pluto
6061

include/ble_gatt_db.h

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* Copyright (c) 2015-2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/**
8+
* @file
9+
*
10+
* @defgroup ble_sdk_lib_gatt_db GATT Database Service Structure
11+
* @{
12+
* @ingroup ble_sdk_lib
13+
*/
14+
15+
#ifndef BLE_GATT_DB_H__
16+
#define BLE_GATT_DB_H__
17+
18+
#include <stdint.h>
19+
#include <ble.h>
20+
#include <ble_gattc.h>
21+
22+
#ifdef __cplusplus
23+
extern "C" {
24+
#endif
25+
26+
/** @brief The maximum number of characteristics present in a service record. */
27+
#define BLE_GATT_DB_MAX_CHARS 6
28+
29+
/**@brief Structure for holding the characteristic and the handle of its CCCD present on a server.
30+
*/
31+
typedef struct {
32+
/** @brief Structure containing information about the characteristic. */
33+
ble_gattc_char_t characteristic;
34+
/**
35+
* @brief CCCD Handle value for this characteristic. This will be set to
36+
* BLE_GATT_HANDLE_INVALID if a CCCD is not present at the server.
37+
*/
38+
uint16_t cccd_handle;
39+
/**
40+
* @brief Extended Properties Handle value for this characteristic.
41+
* This will be set to BLE_GATT_HANDLE_INVALID if an Extended
42+
* Properties descriptor is not present at the server.
43+
*/
44+
uint16_t ext_prop_handle;
45+
/**
46+
* @brief User Description Handle value for this characteristic. This
47+
* will be set to BLE_GATT_HANDLE_INVALID if a User Description
48+
* descriptor is not present at the server.
49+
*/
50+
uint16_t user_desc_handle;
51+
/**
52+
* @brief Report Reference Handle value for this characteristic. This
53+
* will be set to BLE_GATT_HANDLE_INVALID if a Report Reference
54+
* descriptor is not present at the server.
55+
*/
56+
uint16_t report_ref_handle;
57+
} ble_gatt_db_char_t;
58+
59+
/**
60+
* @brief Structure for holding information about the service and the characteristics present on a
61+
* server.
62+
*/
63+
typedef struct {
64+
/** @brief UUID of the service. */
65+
ble_uuid_t srv_uuid;
66+
/** @brief Number of characteristics present in the service. */
67+
uint8_t char_count;
68+
/** @brief Service Handle Range. */
69+
ble_gattc_handle_range_t handle_range;
70+
/**
71+
* @brief Array of information related to the characteristics present in the service.
72+
* This list can extend further than one.
73+
*/
74+
ble_gatt_db_char_t charateristics[BLE_GATT_DB_MAX_CHARS];
75+
} ble_gatt_db_srv_t;
76+
77+
#ifdef __cplusplus
78+
}
79+
#endif
80+
81+
#endif /* BLE_GATT_DB_H__ */
82+
83+
/** @} */

include/bluetooth/peer_manager/peer_manager.h

Lines changed: 825 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)