4 Replies Latest reply on Aug 11, 2017 2:04 AM by pema_2491131

    Enable notifications on client

      I have set up a gatt server with a custom profile (gatt server, gap peripheral) which I can connect to CySmart and can read a temperature value every time I press a button. I am now working on the client side - I have established the connection and discovered the attributes successfully but I am struggling with enabling the notifications. My aim is to mimic the function of CySmart, I need to read the temperature value in the client. How do I enable notifications on the client side?

        • 1. Re: Enable notifications on client

          The flags for notifications and indications are stored in the associated client characteristic configuration (descriptor) (CCCD). Note that you will need to check the flags before sending notifications/indications for it to work properly, as I believe the BLE stack does not prevent notifications/indications based on the flag status itself.


          I've attached images of what the attribute you are looking for should look like.

          • 2. Re: Enable notifications on client

            Thanks for the response. Are there API's in PSoC Creator that can be called to check/set these flags? I'm using custom uuid's which seems to make the whole job a lot harder...

            • 3. Re: Enable notifications on client

              I do not believe there are APIs specific to the client characteristic configuration values, but if you use the CyBle_GattsWriteAttributeValue(CYBLE_GATT_HANDLE_VALUE_PAIR_T, 0,cyBle_connHandle,flags);, CyBle_GattsReadAttributeValue(cyble_gatt_handle_value_pair_t,cyBle_connHandle,flags);


              Then, all you need to do is define the CYBLE_GATT_HANDLE_VALUE_PAIR_T structure, and change the associated buffer value when you want to write to the server value. You will generally want to use the UUID to get the handle from the server, otherwise changes to one side of the BLE connection software will cause mismatching handle-to-UUID mapping. For my own code, I declare the UUIDs as a constant in code, and then refer to the constant when checking responses from the BLE or when writing values to the service.


              The only "easy" way to set them is with the TopDesign.cysch, but that is initialization, not runtime.

              • 4. Re: Enable notifications on client

                Thanks for you assistance. I've got the system up and running using the custom UUID's that I set in the server side. Having read some other posts and looking at various projects from the 100 projects in 100 days, I have used the CyBle_GattcDiscoverAllPrimaryServices(), CyBle_GattcDiscoverAllCharacteristics() and CyBle_GattcWriteCharacteristicDescriptors() APIs to gather all info and set the flags needed to enable notifications and hence send data from the server to the client.