Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

Smart Bluetooth Forum Discussions

Anonymous
Not applicable

Hi Sir,

I compare the code difference between hello_sensor and ota_firmware_upgrade samples.

The following three parameters are different.

After I check the definition, it shows the GATT related stuffs and define the max number is 5.

    UINT16 hdl[HANDLE_NUM_MAX];         // GATT HANDLE number

    UINT16 serv[HANDLE_NUM_MAX];        // GATT service UUID

    UINT16 cha[HANDLE_NUM_MAX];         // GATT characteristic UUID

In hello sensor,

    /*.hdl                            =*/ {0x00, 0x0063, 0x00, 0x00, 0x00}, // [HANDLE_NUM_MAX];

    /*.serv                           =*/ {0x00, UUID_SERVICE_BATTERY, 0x00, 0x00, 0x00},

    /*.cha                            =*/ {0x00, UUID_CHARACTERISTIC_BATTERY_LEVEL, 0x00, 0x00, 0x00},

In OTA firmware upgrade,

    /*.hdl                            =*/ {0x00, 0x00, 0x00, 0x00, 0x00}, // [HANDLE_NUM_MAX];

    /*.serv                           =*/ {0x00, 0x00, 0x00, 0x00, 0x00},

    /*.cha                            =*/ {0x00, 0x00, 0x00, 0x00, 0x00},

My question is how to define the contents of them?

Thanks,

Fran

0 Likes
1 Solution

These are not really related to advertisements. These three arrays are there only for convenience if you want to use it to map handles, services and characteristics in your GATT database for later use. You can always use other methods like #defines or variables to do the same.

View solution in original post

4 Replies
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

Within the API documentation, I found that inside of bleprofile.h (this file provides definitions and function prototypes for the BLE GATT profiles), there is a macro: #define HANDLE_NUM_MAX 5, so you are correct in that the max value is 5.

There is also a series of Typedefs (listed under GATT Profile functions), including one named BLE_ADV_FIELD where the following fields use HANDLE_NUM_MAX as a parameter:

UINT16 hdl [HANDLE_NUM_MAX]
UINT16 serv [HANDLE_NUM_MAX]
UINT16 cha [HANDLE_NUM_MAX]


Are you asking for a profile or example that uses HANDLE_NUM_MAX?

0 Likes
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

I conformed with the developers that HANDLE_NUM_MAX is 5 in the ROM.

Currently, the only value which may be used by the stack is serv[0].  If application does not define the advertisement, by default the stack will use serv[0] to indicate that the service with that UUID is supported.  All other variables of hdl, serv and cha are for the application to use.  Hello_sensor does not use that area of the API.

0 Likes
Anonymous
Not applicable

if I have two or more advertisements, is the HANDLE_NUM_MAX the limitation? I mean if except the serv[0], serv[1]~serv[4] are total for 4 advertisements?

0 Likes

These are not really related to advertisements. These three arrays are there only for convenience if you want to use it to map handles, services and characteristics in your GATT database for later use. You can always use other methods like #defines or variables to do the same.