You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by na...@apache.org on 2019/09/13 13:32:41 UTC
[mynewt-nimble] 11/32: apps/bttester: Add a dummy CCC descriptor
definition
This is an automated email from the ASF dual-hosted git repository.
naraj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit 309b93e66b74f1fb64b01c2b57e00a809e4b813d
Author: MichaĆ Narajowski <mi...@codecoup.pl>
AuthorDate: Mon May 27 13:54:56 2019 +0200
apps/bttester: Add a dummy CCC descriptor definition
This is used in add_descriptor method, when verifying that
the descriptor that the Upper Tester wants to add is indeed present
in the GATT database (since we are not able to add attributes dynamically).
---
apps/bttester/src/gatt.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/apps/bttester/src/gatt.c b/apps/bttester/src/gatt.c
index c6f7fd4..6209154 100644
--- a/apps/bttester/src/gatt.c
+++ b/apps/bttester/src/gatt.c
@@ -41,6 +41,9 @@
#define CONTROLLER_INDEX 0
#define MAX_BUFFER_SIZE 2048
+static const ble_uuid_t *uuid_ccc =
+ BLE_UUID16_DECLARE(BLE_GATT_DSC_CLT_CFG_UUID16);
+
static int gatt_chr_perm_map[] = {
BLE_GATT_CHR_F_READ,
BLE_GATT_CHR_F_WRITE,
@@ -137,6 +140,10 @@ static void *gatt_buf_add(const void *data, size_t len)
return ptr;
}
+static const struct ble_gatt_dsc_def cccd_def = {
+ .att_flags = BLE_ATT_F_READ | BLE_ATT_F_WRITE,
+};
+
static void *gatt_buf_reserve(size_t len)
{
return gatt_buf_add(NULL, len);
@@ -461,6 +468,11 @@ static void find_attr_by_uuid_cb(const struct ble_gatt_svc_def *svc,
if ((chr->flags & BLE_GATT_CHR_F_NOTIFY) ||
(chr->flags & BLE_GATT_CHR_F_INDICATE)) {
+ if (foreach->attr_type == BLE_GATT_ATTR_DSC &&
+ ble_uuid_cmp(&foreach->uuid->u, uuid_ccc) == 0) {
+ foreach->ptr = (void *) &cccd_def;
+ foreach->handle = handle;
+ }
handle += 1;
}