Adding BLE service at runtime #46155
Unanswered
projecta98
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am using Zephyr BLE central_multilink example (for the Nordic board) and can get it with the discovery and battery services (which are included in the example). I am also able to add custom service using the macro BT_GATT_SERVICE_DEFINE to add the service at the compile time.
Question: What is the best way to register and/or unregister services at the run-time?
I have tried the following:
Defined a custom services (which should be enabled only on run-time based on the device configuration).
static struct bt_gatt_service sensor_service = BT_GATT_SERVICE(attr_sensor_service);
And then called
err = bt_gatt_service_register(&sensor_service);
beforebt_le_adv_start(...)
, but the service add at the run time does not show up when connected to the central from a mobile.Any idea, what is missing?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions