无法连接到Raspberry Pi上的BLE设备

pal*_*dor 12 bluetooth raspberry-pi bluetooth-lowenergy bluez

我正在尝试连接到Raspberry Pi 2上的BLE设备(心率传感器,Polar H7).我使用的是上一版本的bluez(5.35):http://www.bluez.org/download/ 但是,当我尝试连接使用时gatttool,我总是有"连接被拒绝"错误.

这是我做的:

pi@raspberrypi ~ $ sudo su
root@raspberrypi:/home/pi# hciconfig dev
hci0:   Type: BR/EDR  Bus: USB
        BD Address: 5C:F3:70:69:54:3D  ACL MTU: 1021:8 SCO MTU: 64:1
        DOWN
        RX bytes:616 acl:0 sco:0 events:34 errors:0
        TX bytes:380 acl:0 sco:0 commands:34 errors:0

root@raspberrypi:/home/pi# hciconfig dev up
root@raspberrypi:/home/pi# hcitool lescan
LE Scan ...
00:22:D0:6D:E0:E6 (unknown)
00:22:D0:6D:E0:E6 Polar H7 6DE0E61C
^Croot@raspberrypi:/home/pi# hcitool lecc 00:22:D0:6D:E0:E6
Connection handle 64
root@raspberrypi:/home/pi# gatttool -b 00:22:D0:6D:E0:E6 -I
[00:22:D0:6D:E0:E6][LE]> connect
Attempting to connect to 00:22:D0:6D:E0:E6
Error connect: Connection refused (111)
[00:22:D0:6D:E0:E6][LE]> 
Run Code Online (Sandbox Code Playgroud)

我试着遵循这个主题:BLE gatttool无法连接即使设备可以用hcitool lescan发现, 但它对我不起作用.

Ped*_*ito 22

我能够通过连接BluetoothRaspberry使用我的设备:

sudo gatttool -t random -b DD:9D:0B:43:A1:77 -I
connect
Run Code Online (Sandbox Code Playgroud)

  • 这工作......但为什么呢?你能详细说说吗? (4认同)

小智 6

默认情况下 GATT 未启用。将以下行添加到 /etc/bluetooth/main.conf

EnableLE = true           // Enable Low Energy support. Default is false.
AttributeServer = true    // Enable the GATT attribute server. Default is false.
Run Code Online (Sandbox Code Playgroud)


Tee*_*emm 0

我必须pnat/etc/bluetooth/main.conf->中禁用该插件DisablePlugins=pnat。我读到它不稳定,但我对这个插件不太了解。