This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to use sd_ble_gatts_service_changed?

In our product we have both a DFU profile and an application profile which is confusing Mac OS X 10.9 "Mavericks" since it caches device services unless it receives a service changed indication.

The sd_ble_gatts_service_changed requires a start and end service handle, is there a way to determine what the max used service handle is? Passing 0xFF as max causes the routine to return an error.

Parents
  • Hi Pål,

    I’m working with John on this problem. We’ve tried setting the start_handle/end_handle for the function to 0x000C-0xFFFF and it now returns a different error code: NRF_ERROR_INVALID_STATE “Invalid state to perform operation, notifications or indications must be enabled in the CCCD.”

    Presumably this means that indications/notifications must be enabled on the CCCD for the Service Changed characteristic itself (UUID 0x2A05). However, I don’t know how to access the handle for Service Changed CCCD to enable indications.

    As far as I know, the Service Changed Characteristic is UUID 0x2A05, and should be added to the Generic Attribute Service (UUID 0x1801). However, I cannot use sd_ble_gatts_service_add() to add a service with UUID 0x1801. If I do, I get an error code of NRF_ERROR_FORBIDDEN: “Forbidden value supplied, certain UUIDs are reserved for the stack.”

    I’m now at a bit of a loss what to do. Is it possible to send us some sample code that simply (1) waits for a connection from a client, and then (2) sends a service changed indication?

    Thanks!

Reply
  • Hi Pål,

    I’m working with John on this problem. We’ve tried setting the start_handle/end_handle for the function to 0x000C-0xFFFF and it now returns a different error code: NRF_ERROR_INVALID_STATE “Invalid state to perform operation, notifications or indications must be enabled in the CCCD.”

    Presumably this means that indications/notifications must be enabled on the CCCD for the Service Changed characteristic itself (UUID 0x2A05). However, I don’t know how to access the handle for Service Changed CCCD to enable indications.

    As far as I know, the Service Changed Characteristic is UUID 0x2A05, and should be added to the Generic Attribute Service (UUID 0x1801). However, I cannot use sd_ble_gatts_service_add() to add a service with UUID 0x1801. If I do, I get an error code of NRF_ERROR_FORBIDDEN: “Forbidden value supplied, certain UUIDs are reserved for the stack.”

    I’m now at a bit of a loss what to do. Is it possible to send us some sample code that simply (1) waits for a connection from a client, and then (2) sends a service changed indication?

    Thanks!

Children
No Data
Related