Hello.
I just found here: https://nordicsemiconductor.github.io/Nordic-Thingy52-FW/documentation/firmware_architecture.html
something like this:
"To turn on sensor reading, enable notifications from the desired characteristic by writing 0x0001 to the Client Characteristic Configuration Descriptor (CCCD) for that characteristic."
but I don know how to do that.
Here is my code:
@Override
public void onServicesDiscovered(BluetoothGatt gatt, int status) {
super.onServicesDiscovered(gatt, status);
UUID SERVICE_UUID=UUID.fromString ("EF680200-9B35-4933-9B10-52FFA9740042");
UUID CHARACTERISTIC_UUID=UUID.fromString ("EF680201-9B35-4933-9B10-52FFA9740042");
BluetoothGattService service = gatt.getService(SERVICE_UUID);
BluetoothGattCharacteristic characteristic = service.getCharacteristic(CHARACTERISTIC_UUID);
gatt.readCharacteristic(characteristic);
gatt.setCharacteristicNotification(characteristic,true);
bluetoothLeScanner.stopScan(scanCallback);
}
@Override
public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
super.onCharacteristicRead(gatt, characteristic, status);
byte[] moja_tablica = new byte[3];
gatt.setCharacteristicNotification(characteristic,true);
moja_tablica= characteristic.getValue();
}
How to writie 0x0001 to the Client Characteristic Configuration Descriptor (CCCD) for that characteristic?