- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Labels:
-
BLE_PROFILE_CFG
-
SDK 1.X
- Tags:
- ble_profile_cfg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.