10 Replies Latest reply on Feb 2, 2019 9:41 AM by JeCr_2235141

    Read an array of ADC readings as a bluetooth characteristic:  ANDROID




      I have a question regarding PSOC4 BLE data transmission to Android App developed in Android Studio. 


      I configure analog pin in PSOC Creator to connect with an ADC converter and then transmit this value to Android App.  For the initial single integer data, this works well, and I receive the data in the Android App and can plot very well.


      The bandwidth is a bit low (~100Hz), so I increased the number of samples transmitted with each read request (increasing MTU to 512).  The analog in integer becomes an array, and I run a loop to fill up the array before updating the data transmission.  I have connected with Cypress CYSmart Dongle and I can see my data showing up on the console when I enable notifications.

      After enabling notifications in Android, and trying to read the AnalogIn characteristic, the data is always displaying Null.  I try different offsets, but doesnt change.  I have read many forums on this, but I cannot seem to find the issue.


      Enabling Bluetooth characteristic Notification in Android (Bluetooth Low Energy ) Not Working - Stack Overflow




      This is code in Android for enabling notifications to BLE.  The CAPSENSE in project still works, and seems to provide some data, however the array only returns null.


      public boolean setCharacteristicNotification(BluetoothGattCharacteristic characteristic,boolean enable,BluetoothGattDescriptor descriptor)


         mBluetoothGatt.setCharacteristicNotification(characteristic, enable);

        descriptor.setValue(enable ? BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE : new byte[]{0x00, 0x00});


         return mBluetoothGatt.writeDescriptor(descriptor); }//descriptor write operation successfully started?



      Thanks for any help you can provide.