The BTLE specification does allow user/custom data to be added to the advertising packets. Which field in the advertising data structure is the right place for adding such data? I'd like to avoid hacks, so prefer to do it only where appropriate.
The BTLE specification does allow user/custom data to be added to the advertising packets. Which field in the advertising data structure is the right place for adding such data? I'd like to avoid hacks, so prefer to do it only where appropriate.
The best place to add user/custom data is in the field Service Data (GAP 11.1.10) if you have a 16bit UUID service or in the Manufacturer Specific (Data GAP 11.1.4) if you have a 16 bit company identifier
Please note that Pål is a stack developer, and doesn't know the SDK very well. :-) He therefore focuses on how the softdevice API is made.
If you use the SDK, you're most likely better off looking at Torbjørn's answer below, as the SDK wraps up the setting of advertisement data quite nicely. By using it, you can set the data up in C structs instead of pure data arrays. Take a look at the ble_advdata_t type, and especially its p_service_data_array and p_manuf_specific_data fields.
Please note that Pål is a stack developer, and doesn't know the SDK very well. :-) He therefore focuses on how the softdevice API is made.
If you use the SDK, you're most likely better off looking at Torbjørn's answer below, as the SDK wraps up the setting of advertisement data quite nicely. By using it, you can set the data up in C structs instead of pure data arrays. Take a look at the ble_advdata_t type, and especially its p_service_data_array and p_manuf_specific_data fields.