2016-11-10 105 views
1

當我試圖使用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 
+0

您可以從此鏈接獲得一些信息:http://stackoverflow.com/questions/34271217/solved-connecting-to-a-bluetooth-smart-le-weight-scale-with-bluez-bluetoothctl-g – aksonlyaks

+0

我在Linux上有同樣的問題UBUNTU 17.04 bluetoothctl沒有問題,但gattool沒有連接 – Zibri

回答

0

解決方案:只需將-t隨機添加到gatttool命令行,它就會連接!