Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 5 months ago.
How should i define several GattService using MBED 5.12 BLE API
Hello, i am try to upgrade a BLE project from MBED 5.10 to MBED 5.12. I get confused with the setLocalServiceList() from the AdvertisingDataBuilder Class.
I follow the battery service example from here https://os.mbed.com/docs/mbed-os/v5.12/apis/batteryservice.html
As described, we have to use this to handled your GattService
_adv_data_builder.setLocalServiceList(mbed::make_Span(&_battery_uuid, 1));
With
_battery_uuid(GattService::UUID_BATTERY_SERVICE), defined above.
The example works just fine. The point is I need also to handle a Environmental Gatt Service on the same device So, i declared it the same way
_environmental_uuid(GattService::UUID_ENVIRONMENTAL_SERVICE ),
But, I can't find a way to build my add_data_builder to handle the both Gatt Service.
I tried several things without any success... Like this !
_adv_data_builder.setLocalServiceList(mbed::make_Span(&_battery_uuid, 1)); _adv_data_builder.setLocalServiceList(mbed::make_Span(&_environmental_uuid, 1));
I must have miss something with the Span object....
Any help welcome !
Regards, Sébastien