ARMmbed / mbed-os-example-ble

BLE demos using mbed OS and mbed cli
Apache License 2.0
134 stars 118 forks source link

BLE_GattServer does not appear to advertise its service UUID #319

Closed Gerriko closed 3 years ago

Gerriko commented 4 years ago

I noticed when testing the BLE_GattServer example with a BLE utility app, like nRFConnect or Bluetooth LE Scanner, that the service UUID is not advertised.

It is more common than not for a service UUID to be advertised.

Gerriko commented 4 years ago

Thanks. It appears that within the function void start_advertising() the GAP advertising parameters have not been defined (EDIT - OK my mistake. It uses the default params) as this is also empty ble::AdvertisingParameters adv_params; and there's quite a bit missing in the _startadvertising() function through the _adv_data_builder not including much.

ciarmcom commented 3 years ago

Thank you for raising this detailed GitHub issue. I am now notifying our internal issue triagers. Internal Jira reference: https://jira.arm.com/browse/IOTOSM-2047

pan- commented 3 years ago

@Gerriko The application is supposed to set in the advertising payload the services UUIDs it wants to advertise.

Gerriko commented 3 years ago

@pan- Not sure why this is closed as whilst you are correct that an application is supposed to set up payload and service UUID, as far as I could make out, it is currently NOT possible to define and then advertise a 128 bit service UUID with the Mbed BLE library. You can readily do it using a 16bit UUID but not 128bit. Maybe this can be clarified, otherwise I plan to reopen the issue. Thank you.

pan- commented 3 years ago

@Gerriko

The goal of that example is to demonstrate basic functionalities of the GattServer API. That is the reason why advertising is not seen in the main file we don't want to expose too many unrelated details in the example.

However I agree it would be valuable for the community to have a blueprint of what is possible with BLE API from A to Z.

To set local service UUID in the advertising payload you can use the function AdvertisingDataBuilder::setLocalServiceList. It is here.

If you have issues with this function, I encourage you to open an issue in mbed OS.