5 Replies Latest reply on Jul 6, 2018 3:46 AM by DheerajK_81

    Android BLE 101 Capsense notify not working



      I followed the available tutorial and used the PSoC BLE and Android code available at GitHub - cypresssemiconductorco/bleapp.


      In the BLE100 app, I'm able to turn on/off the red LED, but the Capsense is not working. When I enable "Notify" the "Capsense value" becomes "No Touch", but the app doesn't show values when I slide the finger in the sensor. However, the Capsense works with the Cysmart app.


      The only changes I made were in the PSoCCapSenseLedService.java file, to be able to search for devices and discover services and characteristics.


      What can be the problem?

        • 1. Re: Android BLE 101 Capsense notify not working

          Hello Jose,

                            UUID values of service and characteristics should not be changed. Because this will effect while discovering the services and characteristics in the BLE101 app when device is connected. Please refer the below image where the service and characteristics UUID values are changed in Java file.











          • 2. Re: Android BLE 101 Capsense notify not working

            Dear psyu,


            I had to change the UUIDs in the Java code for them to be the same values given by PSoC Creator. Before I made the change the app could not discover the services and characteristics.


            My problem occurs after the services and characteristics are discovered, since I can write the red LED. The problem is that I cannot receive the Capsense notifications.

            • 3. Re: Android BLE 101 Capsense notify not working

              Hello Jose,

              I checked by running the Github Source code and by changing the UUIDs as provided by PSoC Creator. Yes, what you said is true, the LED works, but the Capsense Values aren't getting updated. I checked the code and here is the solution. Change the following function in PSoCCapSenseLedService.java file:


                public void onCharacteristicChanged(BluetoothGatt gatt,

                BluetoothGattCharacteristic characteristic) {


                String uuid = characteristic.getUuid().toString();



              // In this case, the only notification the apps gets is the CapSense value.
                // If the application had additional notifications we could
                // use a switch statement here to operate on each one separately.

              if(uuid.equalsIgnoreCase(capsenseCharacteristicUUID)) {
              mCapSenseValue = characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_SINT16,0).toString();

                // Notify the main activity that new data is available



              So the UUID stored on GATT Database is converted to lower case and the one you provide in the java code if it is in upper case, the .equals() function returns false and hence it doesn't enter the if condition and update the capsense value. Just change .equals() to .equalsIgnoreCase() as highlighted in bold and it will work.




              • 4. Re: Android BLE 101 Capsense notify not working

                Hello Dheeraj,


                Thanks for you answer. The app is working now.


                I used the UUID in upper case in the Java code because it was the format provided by PSoC Creator. It is good to know that the GATT database converts it to lower case.


                Best regards,


                José Afonso

                • 5. Re: Android BLE 101 Capsense notify not working

                  Yes, PSoC Creator gives it in an uppercase format, no fault of yours, I understand. The catch is with the format it is stored in the GATT Database, which results in mismatch. Glad to know it is working now.