Service Change on BLE GATT Table

This blog is to describe about the Service Change handling on the BLE GATT. For example, there is a GATT Server at the BLE Peripheral Side. By using the service change indicator approach, it can force the host side to re-do the service discovery.

Flow Diagram on the GATT Server with service discovery

Service Change Indications

Background: Attribute Caching is a mechanism of caching attribute handles which allows clients to avoid the process of rediscovering services upon consecutive connections with paired and bonded devices. This saves power, time and reduces the packet size.

Problem: If the client caches attribute handles and the values change then it can lead to unpredictable values from those handles. This can happen when you add or remove characteristics in run time or between firmware updates. So the question arises of how do we notify the client to rediscover services upon a change in GATT server?

For more details about how Android, iOS behaves and implements this, refer this article.

Solution

The Generic Attribute Service includes a characteristic called Service Changed which can be used by the client to let the server know that the client wants to be indicated for any changes in GATT Server. The Service Changed Indication with UUID 0x2A05 has the range of handles which have been changed. This can help the client to rediscover that range of handles.

If the database has a Generic Attribute Service and Service Changed characteristic, the stack will monitor local database change status and manage service changed indications for a GATT client that has enabled the indication configuration of the Service Changed characteristic.

Nordic SDK for Service Change

GATT Database change : Service Change indicator
Example how to enable the service change inside the generic attribute

For example, if user can notice the host side that the local database has changed,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.