在 Android 上写入 BLE gatt 特性 — 错误状态 255
Write BLE gatt characteristic on Android — error status 255
正在使用示例 kotlin 程序进行实验,尝试 read/write 通道为 0-7 的 BLE 设备
阅读时它给我这样的值:(0x06)
onCharacteristicRead(), status=0, value=[uuid='ba7e7814-5b67-43d3-bd80-e72cc83ae801', hexValue=[06]]
但是当我尝试写入相同的输出时,它给了我错误 GATT 255,超出范围:
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']
您阅读的内容:[0x06]
onCharacteristicRead(), status=0, value=[uuid='ba7e7814-5b67-43d3-bd80-e72cc83ae801', hexValue=[06]]
您写的内容:[0x30, 0x36]
(可能对应于字符串“06”,因为 '0'
的 ASCII 十六进制值是 0x30
,'6'
是 0x36
)
CharacteristicWriteOperation{MAC='00:A0:50:E8:78:86', characteristic=[uuid='ba7e7814-5b67-43d3-bd80-e72cc83ae801', hexValue=[30, 36]]}
您可能想写回十六进制值 0x06
,而不是字符串 "06"
正在使用示例 kotlin 程序进行实验,尝试 read/write 通道为 0-7 的 BLE 设备
阅读时它给我这样的值:(0x06)
onCharacteristicRead(), status=0, value=[uuid='ba7e7814-5b67-43d3-bd80-e72cc83ae801', hexValue=[06]]
但是当我尝试写入相同的输出时,它给了我错误 GATT 255,超出范围:
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']
您阅读的内容:[0x06]
onCharacteristicRead(), status=0, value=[uuid='ba7e7814-5b67-43d3-bd80-e72cc83ae801', hexValue=[06]]
您写的内容:[0x30, 0x36]
(可能对应于字符串“06”,因为 '0'
的 ASCII 十六进制值是 0x30
,'6'
是 0x36
)
CharacteristicWriteOperation{MAC='00:A0:50:E8:78:86', characteristic=[uuid='ba7e7814-5b67-43d3-bd80-e72cc83ae801', hexValue=[30, 36]]}
您可能想写回十六进制值 0x06
,而不是字符串 "06"