|
| 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 | +/** @} */ |
0 commit comments