7002DK BLE MESSAGE SEQUENCE & HANDLE

below is my develop environment .

TOOL : VSC - NRF CONNECT SDK 2.6.99
DEV : NRF7002DK


I am currently looking into the BLE GATT structure in NCS.

Since I need to use many characteristics within a BLE SERVICE,
I need to manage HANDLES efficiently. Therefore, I manage the VALUE_HANDLE among the CHARACTERISTICS within the SERVICE as follows:

Reference/

typedef struct {
void *1_data;
uint16_t 1_handle;
} ud_t;

struct ud_t m_ud;
If we declare the BT_GATT_SERVICE_DEFINE using USER_DATA and consider the srv structure as srv and the structure that goes into the user_data position as m_ud.1_data, then:


if (srv.attrs[i].user_data == &m_ud.1_data) {
m_ud.1_handle = bt_gatt_attr_get_handle(srv.attrs[i]);
}

This is how I plan to manage it. However, this method seems unsuitable for managing the cccd handle.
I would like to ask how I can organize the cccd_handle.
Please help me!

Parents
  • Hi Heavyjo,

    This is how I plan to manage it. However, this method seems unsuitable for managing the cccd handle.

    You are right and there is no simple trick for this. Since the service structure in your application is unique to your application, it makes it necessary that you application knows the attribute table and hence the handle values. You might have already seen this but my colleague have tried to explain how this works here. Based on the code that you are writing, you most likely know this.

    You need to remember the index of those attributes with CCCD in your app, there is no easy way to do this.

Reply
  • Hi Heavyjo,

    This is how I plan to manage it. However, this method seems unsuitable for managing the cccd handle.

    You are right and there is no simple trick for this. Since the service structure in your application is unique to your application, it makes it necessary that you application knows the attribute table and hence the handle values. You might have already seen this but my colleague have tried to explain how this works here. Based on the code that you are writing, you most likely know this.

    You need to remember the index of those attributes with CCCD in your app, there is no easy way to do this.

Children
No Data
Related