0

Experimenting with sample kotlin program, trying to read/write BLE device with channels from 0-7

When reading it gives me value like this: (0x06)

onCharacteristicRead(), status=0, value=[uuid='ba7e7814-5b67-43d3-bd80-e72cc83ae801', hexValue=[06]]

but when trying to write same output it gives me, it gives me error GATT 255, out of range:

CharacteristicWriteOperation{MAC='00:A0:50:E8:78:86', characteristic=[uuid='ba7e7814-5b67-43d3-bd80-e72cc83ae801', hexValue=[30, 36]]}

onCharacteristicWrite(), status=255, value=[uuid='ba7e7814-5b67-43d3-bd80-e72cc83ae801']
Dariusz Seweryn
  • 3,212
  • 2
  • 14
  • 21

1 Answers1

0

What you read: [0x06]

onCharacteristicRead(), status=0, value=[uuid='ba7e7814-5b67-43d3-bd80-e72cc83ae801', hexValue=[06]]

What you wrote: [0x30, 0x36] (which may correspond to String "06" as ASCII hex value for '0' is 0x30 and for '6' is 0x36)

CharacteristicWriteOperation{MAC='00:A0:50:E8:78:86', characteristic=[uuid='ba7e7814-5b67-43d3-bd80-e72cc83ae801', hexValue=[30, 36]]}

You probably want to write back hexadecimal value 0x06, not the string "06"

Status 255 is GATT_OUT_OF_RANGE which means that the written value is outside of range accepted by your peripheral.

Dariusz Seweryn
  • 3,212
  • 2
  • 14
  • 21