不同的连接结果在gatttool和bluetoothctl与覆盆子pi 3蓝牙
问题描述:
当我试图使用gatttool和bluetoothctl连接到蓝牙设备时,gatttool得到了“连接被拒绝”,但bluetoothctl成功连接到它。不同的连接结果在gatttool和bluetoothctl与覆盆子pi 3蓝牙
bluetoothctl和gatttool有什么区别?
如何使gatttool工作,因为我需要在gatttool中使用char-write-cmd命令?
$ ./gatttool -b 00:13:04:0C:6C:26 -I
[00:13:04:0C:6C:26][LE]> connect
Attempting to connect to 00:13:04:0C:6C:26
Error: connect error: Connection refused (111)
[00:13:04:0C:6C:26][LE]> exit
$ bluetoothctl
[NEW] Controller B8:27:EB:07:26:C8 raspberrypi [default]
[NEW] Device 00:13:04:0C:6C:26 MEDXING-NIBP
[bluetooth]# connect 00:13:04:0C:6C:26
Attempting to connect to 00:13:04:0C:6C:26
[CHG] Device 00:13:04:0C:6C:26 Connected: yes
Connection successful
[bluetooth]# info 00:13:04:0C:6C:26
Device 00:13:04:0C:6C:26
Name: MEDXING-NIBP
Alias: MEDXING-NIBP
Paired: no
Trusted: no
Blocked: no
Connected: yes
LegacyPairing: no
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
UUID: Unknown (0000ffb0-0000-1000-8000-00805f9b34fb)
[bluetooth]# exit
答
解决方案:只需将-t随机添加到gatttool命令行,它就会连接!
您可以从此链接获得一些信息:http://stackoverflow.com/questions/34271217/solved-connecting-to-a-bluetooth-smart-le-weight-scale-with-bluez-bluetoothctl-g – aksonlyaks
我在Linux上有同样的问题UBUNTU 17.04 bluetoothctl没有问题,但gattool没有连接 – Zibri