NRF52840 BLE Generic Attribute Service and Generic Access Service, Usage Recommendations.

Hi There, 

I have implemented a BLE peripheral device using the NRF52840 and NCS 2.2.0, currently the device exposes: 

1. Custom service. 

2. Device information Service. 

3. SMP service for DFU-OTA.

4. Generic Attribute Service (By default).

5. Generic Access Services (By default).

I see that 4 and 5 are enabled and exposed by default. 

Are these two (4 and 5) mandatory to have in the implementation ? If so why ? and if not would I be able to remove them as I am not aware of any use from my application. 



Cheers, 

Parents
  • The relevant information about mandatory to implemented services can be found in the Bluetooth Core specification as follows.

    For the Generic Access Service GATT service, this is defined in Vol 3, Part C (GAP) chapter 12. It says: "The GATT Server shall contain the GAP service as defined in the GAP Service Requirements in Table 12.1. A device shall have only one instance of the GAP service in the GATT Server.". Table 12.1 shows that LE Centrals and LE Peripherals must implement this.

    The mandatory characteristics for this service for a BLE Peripheral are Device Name and Appearance. So even if your application doesn't really use these, your device must still be interoperable with other GAtTT clients that are interested in showing the device name for a user, e.g. in a settings UI of bonded devices.

    For the Generic Attribute Profile GATT service, this is defined in Vol 3, Part G (GATT) chapter 7. There is no mention here that the service itself is mandatory, but in some cases some characteristics are mandatory. If at least one characteristic turns out to be mandatory, then the service containing these (i.e. the Generic Attribute Profile GATT service) must of course be present.

    There are four defined characteristics for this service as of Bluetooth version 5.4: Service Changed, Client Supported Features, Database Hash, Server Supported Features. The Client Supported Features contains a bitfield (written by the client) of Robust Caching, Enhanced ATT Bearer, Multiple Handle Value Notifications. The Server Supported Features contains a bitfield of EATT Supported. Generally, each characteristic here is mandatory if the corresponding feature is implemented. The Service Changed characteristic is mandatory if services on the server can be added, changed or removed, otherwise optional.

    So, if you make a device that promises to never change its GATT database, you can exclude the Service Changed characteristic. If you also don't support any of the GATT features that would require any of the other characteristics to be present, you can exclude the Generic Attribute Profile GATT service entirely.

    From what I can see in Zephyr, the API/SDK does not seem to include a way to entirely remove the Generic Attribute Profile GATT service, except if you modify its source code. It however seems you can make it empty by setting the Kconfig option BT_GATT_SERVICE_CHANGED to n.

Reply
  • The relevant information about mandatory to implemented services can be found in the Bluetooth Core specification as follows.

    For the Generic Access Service GATT service, this is defined in Vol 3, Part C (GAP) chapter 12. It says: "The GATT Server shall contain the GAP service as defined in the GAP Service Requirements in Table 12.1. A device shall have only one instance of the GAP service in the GATT Server.". Table 12.1 shows that LE Centrals and LE Peripherals must implement this.

    The mandatory characteristics for this service for a BLE Peripheral are Device Name and Appearance. So even if your application doesn't really use these, your device must still be interoperable with other GAtTT clients that are interested in showing the device name for a user, e.g. in a settings UI of bonded devices.

    For the Generic Attribute Profile GATT service, this is defined in Vol 3, Part G (GATT) chapter 7. There is no mention here that the service itself is mandatory, but in some cases some characteristics are mandatory. If at least one characteristic turns out to be mandatory, then the service containing these (i.e. the Generic Attribute Profile GATT service) must of course be present.

    There are four defined characteristics for this service as of Bluetooth version 5.4: Service Changed, Client Supported Features, Database Hash, Server Supported Features. The Client Supported Features contains a bitfield (written by the client) of Robust Caching, Enhanced ATT Bearer, Multiple Handle Value Notifications. The Server Supported Features contains a bitfield of EATT Supported. Generally, each characteristic here is mandatory if the corresponding feature is implemented. The Service Changed characteristic is mandatory if services on the server can be added, changed or removed, otherwise optional.

    So, if you make a device that promises to never change its GATT database, you can exclude the Service Changed characteristic. If you also don't support any of the GATT features that would require any of the other characteristics to be present, you can exclude the Generic Attribute Profile GATT service entirely.

    From what I can see in Zephyr, the API/SDK does not seem to include a way to entirely remove the Generic Attribute Profile GATT service, except if you modify its source code. It however seems you can make it empty by setting the Kconfig option BT_GATT_SERVICE_CHANGED to n.

Children
No Data
Related