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

How to detect service change of ANCS gatt server

Hi,

I would like to know how to detect the service change of the ANCS gatt server.

Thank you! Joseph

Parents
  • @Joseph: According to the spec of ANCS " the NC (notification consumer) should look for and subscribe to the Service Changed characteristic of the GATT service in order to monitor for the potential publishing and unpublishing of the ANCS at any time."

    What it means is the client should enable indication on the service changed characteristic. And it will receive an indication (BLE_GATTC_EVT_HVX event) when there's a service change.

    [EDIT] changed from "need to" to "should"

  • @Joseph: I'm sorry for misleading you. The spec tells the NC "should" not "shall" so it's optional. I edited my answer.

    In our example, unfortunatelly, we don't subsrcribe to service changed indication but to a service discovery every time we get connected. If we don't see the ANCS service we will disconnect.

    I guess this something you would need to implement on your own, to enable service change CCCD, and wait for the indication event to do either a disconnect and reconnect, or another service discovery. Another option is to add a timer and do service discovery to look for ANCS to be available for several time, and disconnect after a timeout.

Reply
  • @Joseph: I'm sorry for misleading you. The spec tells the NC "should" not "shall" so it's optional. I edited my answer.

    In our example, unfortunatelly, we don't subsrcribe to service changed indication but to a service discovery every time we get connected. If we don't see the ANCS service we will disconnect.

    I guess this something you would need to implement on your own, to enable service change CCCD, and wait for the indication event to do either a disconnect and reconnect, or another service discovery. Another option is to add a timer and do service discovery to look for ANCS to be available for several time, and disconnect after a timeout.

Children
No Data
Related