我正在使用 Pymakr 从 SiPy 板上执行蓝牙扫描。控制台在解码返回的广告时返回意外的值。
from network import Bluetooth
bluetooth = Bluetooth()
bluetooth.start_scan(30)
while bluetooth.isscanning():
adv = bluetooth.get_adv()
if adv:
print(adv)
print(adv[4].decode())
广告返回:
(mac=b'\xd0O~\x07\xc0.', addr_type=0, adv_type=0, rssi=-53, data=b'\x02\x01\x1a\x0b\xffL\x00\t\x06\x03\x04\xc0\xa8\x01!\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
在解码 [4] 上的“数据”时,我得到:
STX SOH SUB VT ÿL
我很难理解最后两个字符。为什么是口音?为什么大写L?这段数据字符串是怎么回事:
\xffL
对我来说看起来像是坏的十六进制。
我正在使用 MicroPython,所以我的解决方法有点有限。