Please sign in to comment.
Bluetooth: gatt: Reuse existing handles from a previously added service
When removing a service using bt_gatt_service_unregister, its attributes handles will keep their value which can cause a problem when adding the service again to the GATT database. When re-adding, the gatt_register routine is taking the last handle of the GATT database to compare it with the handles of the service to be added. If a service has handles with a lower value than the last handle of the database an error will occur. If we add/remove/add the last service, no error will occur as its handles are always greater than the last one of the database. Instead of resetting the handles when unregistering a service and reassign new ones we make sure that the handles of the services are not in use in the GATT database in order to place the service back where it used to be. Signed-off-by: Arthur Crepin-Leblond <email@example.com>
- Loading branch information...