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

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

Children
  • BTLE spec 4.2, volume 0, Part B, Section 4.4 says GATT is mandatory when ATT is supported, ATT is mandatory when either GAP role is supported and to be LE compliant at least one GAP role must be supported. So I think that makes GATT mandatory.

  • Thanks. But where is it stated that the GATT Server must contain the Generic Attribute Service? It makes totally sense, but is it explicitly stated anywhere?

  • Ok, thank you.

    I'm still miffed that on [Vol 3, Part C] page 390 it specifically says that the GAP Service [which would be 0x1800] is mandatory, but in the already mentioned [Vol 3, Part G] page 577 there is only mention of the characteristic and the service itself is left hanging imo.

    AFAIK there is no other place with a clear indication that the service itself is mandatory in the specification. newdotcomintfe1.cloudapp.net/.../generic-attribute-profile also just references the two pages mentioned in the above paragraph. Even the test specifications I glanced over only mentioned testing for the characteristic (with mention of not being mandatory), not the service itself.

    If someone knows of explicit mention of the service being mandatory in the official spec, I'd still love to see it. :)

  • Just as a side question, would it be abhorrent to let the user break the specification if, uh, "needed"? Personally I have no need to ensure interoperability with anything but my own devices, however the "overhead" here is something I should probably not care about either way.

    This stems purely from the previous chip used which allowed to fully control the profile so I'm not saying I should be allowed to do whatever I want... :)

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

Related