BLE "Generic Access Service"


Laurence Pasteau
 

Hi everyone,


I am trying to write an application that offers BLE connectable services with zephyr.

In this application, we would like to have the "Device name" caracteristics of the "generic access service" with Read and Write property.

This service, mandatory with Read property, is registered automatically in the bt_conn_init() during bt_gatt_init(). If I correctly understood, the write property, in the standard, is optional but available.

https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.service.generic_access.xml


Does anybody know how I can add the write property for this service ? I don't know how it is possible to unregister mandatory services and then register the same service but with the write property, or if there is a cleaner way.


Thanks in advance for any help,

Laurence Pasteau


Johan Hedberg
 

Hi Laurence,

On Tue, Jul 10, 2018, Laurence Pasteau wrote:
I am trying to write an application that offers BLE connectable
services with zephyr.

In this application, we would like to have the "Device name"
caracteristics of the "generic access service" with Read and Write
property.

This service, mandatory with Read property, is registered
automatically in the bt_conn_init() during bt_gatt_init(). If I
correctly understood, the write property, in the standard, is optional
but available.
That's correct.

Does anybody know how I can add the write property for this service ?
I don't know how it is possible to unregister mandatory services and
then register the same service but with the write property, or if
there is a cleaner way.
Currently it's not possible in a clean way. I would consider adding a
new build-time Kconfig variable to request making the name runtime
changable. There is also a related github issue open for changing the
name from the application (rather than over GATT):

https://github.com/zephyrproject-rtos/zephyr/issues/8357

I think it'd make sense to solve both issues when implementing the
change. There is also the option of a Kconfig variable to disable the
internal services, but considering their simplicity I think we should be
able to make the internal implementation good enough to satisfy
everyones needs.

I suppose we'll also want to store the name in flash, so that it get
restored from there when you power cycle the device. Most likely it'd be
stored similarly to the local IRK and static address, under the settings
path "bt/name". See how it's done for the IRK and static address in
subsys/bluetooth/host/settings.c.

I'd suggest to start off by filing a github issue to track your feature
request. I think it might be possible to get it done for Zephyr 1.13.
You're also welcome to contribute the actual implementation for it (if
you need more details, feel free to ask!).

Johan