Report
1 month ago.

BLE advertising data

Hello,

I wonder whether the implementation of GapAdvertisingData::addData() is correct - corresponding to the BLE standard ? In this implementation, it is not possible to add several AD Structures with the type SERVICE_DATA. It seems that it should be possible to provide service data for more than one service in the advertising data. The standard is not quite clear about it (section 11.1.10 of Core4.0). But the Nordic Semiconductor implementation allows for it. So what is the correct implementation ?

Thank you in advance for your answer.

Best regards,

Serge

Comment on this question

2 Answers

2 weeks, 6 days ago.

Hi Serge,

With mbed OS 5.11, we introduced some new API, we provide an advertising data builder https://github.com/ARMmbed/mbed-os/blob/master/features/FEATURE_BLE/ble/gap/AdvertisingDataBuilder.h that has less limitation than the previous one. With setAdvertisingPayload(), you can set any payload you want.

We will keep improving those APIs for better using on advertising packets.

Please feel free to ask me any questions!

- Desmond, team Mbed

1 month ago.

Hi Serge,

Just saw your post !! What a coincidence...I struggled for hours regarding this subjet:

See how I managed to make it work:

https://os.mbed.com/questions/83683/How-can-add-multiple-SERVICE_DATA/

Thank you for your post!!

Bye bye Fred

Hi Fred, Thank you for the update. Since I am using the online compiler, I believe that I cannot update the code... Also I am not sure to understand your suggested change in your post (it looks like twice the same code or did I miss something ?) Cheers, Serge

posted by Serge Ayer 19 Dec 2018

Hi Serge,

Of course, you do can update the BLE_API code from the online compiler. I am using the online compiler!

Below the altered function addData of GapAdvertisingData.h file

ble_error_t addData(DataType_t advDataType, const uint8_t *payload, uint8_t len) { return appendField(advDataType, payload, len); }

Have fun, Fred

posted by Frederic Guiet 19 Dec 2018

To post an answer, please log in.