Is there a way to get the characteristic.value
in onCharacteristicChanged
as a byteArray of size 64 in binary?
I successfully subscribe to a notify-characteristic of a BLE Service (in Android/Kotlin). I know, that the data sent by the Bluetooth device consists of 64 bits (a UInt32 followed by two UInt16's). However, when I look at the value in onCharacteristicChanged
, I get a byteArray of size 8 with values like this: [-120, -106, -57, 0, -1, -1, 20, 0]
It should be a byteArray of size 64 with 0's and 1's. How can I achieve that?
This is the code that gives me the byteArray of size 8:
override fun onCharacteristicChanged(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic) {
with(characteristic) {
Log.d(TAG, "value: ${Arrays.toString(value)}") //[-120, -106, -57, 0, -1, -1, 20, 0]
Log.d(TAG,"value.size: ${value.size}") //8
}
}