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

Unable to read Sensor info from Thingy 52

Hello Team,

I have developed a sample Android application to use and control Nordic Thingy 52. I am able to control LED (Constant, Blink, Intensity). But I am not getting notifications about sensor info. Using the TX I am writing following into Bridge :

byte[] sensor_info = {0x00, 0x01, 0x02};
mWriteCharacteristic.setValue(sensor_info);
mBTGattInst.writeCharacteristic(mWriteCharacteristic);

before writing this command, in my onServicesDiscovered I am enabling notifications for TX as :

mBleUARTService = mBTGattInst.getService(UUID_UART);
            if (mBleUARTService == null) {
                Log.e("onServicesDiscovered", CHARACTERISTIC_RX.toString() + " is not supported");
                return;
            } else {
                mReadCharacteristic = mBleUARTService.getCharacteristic(CHARACTERISTIC_RX);
                mWriteCharacteristic = mBleUARTService.getCharacteristic(CHARACTERISTIC_TX);
            }


            mBTGattInst.setCharacteristicNotification(mWriteCharacteristic, true);

my project is available in Git : github.com/.../Thingy52AndroidApp

Parents Reply
  • Hey

    I am now writing CCCD to RX Descriptor but still not getting the Sensor Reading Notification from TX. Please find the code

    mBleUARTService = mBTGattInst.getService(UUID_UART);
                Log.d("UUIDS from UART", mBleUARTService.getCharacteristics().toString());
    
                if (mBleUARTService == null) {
                    Log.e("onServicesDiscovered", CHARACTERISTIC_RX.toString() + " is not supported");
                    return;
                } else {
                    mReadCharacteristic = mBleUARTService.getCharacteristic(CHARACTERISTIC_RX);
                    mWriteCharacteristic = mBleUARTService.getCharacteristic(CHARACTERISTIC_TX);
                }
    
    
                mBTGattInst.setCharacteristicNotification(mWriteCharacteristic, true);
                mBTGattInst.setCharacteristicNotification(mReadCharacteristic, true);
    
                BluetoothGattDescriptor desc = mReadCharacteristic.getDescriptor(UUID.fromString(CLIENT_CHARACTERISTIC_CONFIG));
                if (null != desc){
                    desc.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
                    mBTGattInst.writeDescriptor(desc);
                }

Children
Related