This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Removing the Generic Attribute (0x1801) primary service if the Service Changed characteristic is not present

Setting the gatts_enable_params.service_changed to 0 when enabling softdevice removes (or rather doesn't add) the Service Changed characteristic. That's what I want. However it still leaves behind (adds) the Generic Attribute service which is now empty and left me wondering why it's there although I don't explicitly add it anywhere. Searching the forums yielded some results:


devzone.nordicsemi.com/.../ unanswered

devzone.nordicsemi.com/.../

Generic Attribute Service is mandatory to have, so you are not able to remove this.

however

devzone.nordicsemi.com/.../

so removing this will be possible, most likely in the next softdevice release.


The included links in those answers and additional google searches didn't provide any clear answers. Reading the BLUETOOTH SPECIFICATION Version 4.2 [Vol 3, Part G] page 577 says thus:

7 DEFINED GENERIC ATTRIBUTE PROFILE SERVICE

All characteristics defined within this section shall be contained in a primary service with the service UUID set to «GATT Service» as defined in Section 3.1. Only one instance of the GATT service shall be exposed on a GATT server.

Table 7.1

Table 7.1 lists characteristics that may be present in the server and the characteristics that may be supported by the client.

C1: Mandatory if service definitions on the server can be added, changed or removed; otherwise optional

This is the only reference I can find to Generic Attribute [Profile] Service and anything mandatory. The way I'm reading this is that

  1. The Service Changed characteristic is only mandatory to be supported by any client
  2. The Service Changed characteristic is not mandatory on the server if the service definitions can't be changed
  3. Although the characteristic shall be contained in the [[GATT Service]], it says nothing about requiring the service if the characteristic is not present.

I admit that I'm not the smartest chip on the board and my specification-reading skills might not be up to par, so maybe I'm wrong. However I just want to understand if it really is mandatory to have the empty service and why. Especially since there are answers from Nordic employees to support either view.

Parents
  • Hi,

    • The Service Changed characteristic is optional
    • The SoftDevice handles the Generic Attribute Service as if mandatory

    Regarding the second question you linked to, what was planned for removal was the Service Changed characteristic.

    Unfortunately I am unable to find where in the specification or related documents the Generic Attribute Service is described as being mandatory, so my only source is Getting Started with Bluetooth Low Energy by Townsend, Cufí, Akiba and Davidson, chapter 4 GATT (Services and Characteristics), section GATT Service:

    Just as GAP has its own SIG-specified service that is mandatory for all devices (described extensively in "GAP Service" on page 50), GATT also has its own service (containing up to one characteristic) that must be included in all GATT servers.

    Regards, Terje

  • Initially I was happy about the answer and marked it as accepted but now I changed my mind, sorry. :(

    Looking at the SIG Profile Specs, they don't contain the Generic Attribute Service. The same profile specs included in their own Bluetooth Developer Studio (.\XmlFiles\Profiles) tell the same tale - the service is not included. If 0x1801 were required by the specification, they would be breaking their own standard in the profile specs. Having not found any clear reference in the specification, the only mention being the quote from the book, I don't believe it is mandatory and as such the SoftDevice should not enforce the service in the profile unless the Service Changed characteristic is needed.

    Could I get a definitive answer as to why the service is always present in the profile and if it could be removed?

Reply
  • Initially I was happy about the answer and marked it as accepted but now I changed my mind, sorry. :(

    Looking at the SIG Profile Specs, they don't contain the Generic Attribute Service. The same profile specs included in their own Bluetooth Developer Studio (.\XmlFiles\Profiles) tell the same tale - the service is not included. If 0x1801 were required by the specification, they would be breaking their own standard in the profile specs. Having not found any clear reference in the specification, the only mention being the quote from the book, I don't believe it is mandatory and as such the SoftDevice should not enforce the service in the profile unless the Service Changed characteristic is needed.

    Could I get a definitive answer as to why the service is always present in the profile and if it could be removed?

Children
No Data
Related