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.
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.
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
For example, if user can notice the host side that the local database has changed,