3 Replies Latest reply on Jun 1, 2017 12:18 AM by sujayy_46

    How do I use the Service Changed characteristic effectively?

      I am using two projects to reference from when writing my BLE application on the PRoC CYBLE 02201-00. The first is the BLE Heart Rate Sensor example project, and the second is the creating a custom ble profile project.


      I am now able to check an individual CCCD to see if notify has been set and can use the notify or non-notify versions of the write value function. However, on both example projects when I use Enable All Notifications from the CySmart windows app it will flip the bit on the Service Changed CCCD and then update all the other CCCDs. However, I can not find the function that handles this in either project. I am not even sure of the Service Changed CCCD Handle.


      Can anyone show me how these projects accomplish that so I can use it in my application?

        • 1. Re: How do I use the Service Changed characteristic effectively?

          Are you asking how to Enable All Notifications using a function in the CyBle_ library? I don't think there is a specific one that does that. If you look at the CySmart log output (bottom of screen, or saved in file) I bet it is sending multiple packets to change each CCCD individually, and then changing the Service Changed CCCD as well.


          CCCD's have a specific UUID value that you can look for/compare with to find all CCCD values in a BLE profile, and thus enable/disable all CCCD values.

          • 2. Re: How do I use the Service Changed characteristic effectively?

            I see. The log indicates it is writing a '2' to service changed CCCD and then reading back to ensure that it was received correctly. It then writes to the notification flag for each CCCD.




            I was unsure if Service Changed was intended to act as some mega switch that turned everything on, but it seems that no such mega switch was intended and everything is self contained.




            If I wanted to check Service Changed would I use 0x000Au or 0x000Bu while operating in a server role based on this section of code in CYBLE_gatt.c? Or am I looking in the wrong place?




                const CYBLE_GATTS_T cyBle_gatts =
                0x0008u,    /* Handle of the GATT service */
                0x000Au,    /* Handle of the Service Changed characteristic */
                0x000Bu,    /* Handle of the Client Characteristic Configuration descriptor */

            • 3. Re: How do I use the Service Changed characteristic effectively?

              Hi Nate,


              The 'Service Changed' characteristic is used by the GATT server to indicate to the GATT client if there was any change in the GATT DB when the two are connected. 


              On CySmart, when you click ' Enable All Notifications', as e.pratt_1639216 rightly said, CySmart sends a write request to every CCCD one after the other.


              The 'Service Changed' characteristic has a CCCD which is used to enable/disable Indications. When you 'Enable All Notifications', CySmart sends a 0x02, which is the value to enable indications.


              The Service Changed characteristic, whose handle is 0x000Au in your case will have the starting handle and ending handle of the affected attribute range.

              1 of 1 people found this helpful