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.

  • I would not use such a strong word for breaking something that seems to not even be written in the specification, but I also have limited knowledge regarding what is actually being enforced. From a technical point of view the answer is simple, but there are legal stuff out there which may prevent you from using BLE technology without proper qualification.

    I guess the best option would be to post your question as a new question. Questions in comments are generally not read, so I would not expect too many answers here.

  • If you are happy with the answer then please accept it by clicking the grey circle with a white checkmark (up there by the top of the answer). This would make the answer easier to find for others with similar questions.

  • 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?

  • I think at this point if you want a definitive answer you'll have to ask the Bluetooth SIG for one.

  • For the specification part, maybe. However why I'm here is more about why the SoftDevice adds the service and the BT SIG does not have control over that.

Related