Bluez 5.28 gatt服务器无法为我的设备注册服务

Sam*_*Sam 5 raspberry-pi bluetooth-lowenergy bluez gatt

我想使用运行Raspbian版本3.18.11+的Raspberry Pi和BATTOP蓝牙CSR 4.0 Dongle作为BLE外设,并使用iOS设备连接到它.在编写自定义gatt服务器之前,我正在使用Bluez 5.28和gatt_example插件作为第一步.

我用这个教程来设置它.

这是我如何让蓝牙服务以详细模式运行(我在Bluez根目录中):

sudo src/bluetoothd -p gatt_example -n
Run Code Online (Sandbox Code Playgroud)

这是我在服务启动后得到的消息:

bluetoothd[2823]: Bluetooth daemon 5.28
bluetoothd[2823]: Unknown key PageTimeout in main.conf
bluetoothd[2823]: Unknown key DiscoverSchedulerInterval in main.conf
bluetoothd[2823]: Unknown key InitiallyPowered in main.conf
bluetoothd[2823]: Unknown key RememberPowered in main.conf
bluetoothd[2823]: Unknown key AttributeServer in main.conf
bluetoothd[2823]: Starting SDP server
bluetoothd[2823]: Ignoring (cli) hostname
bluetoothd[2823]: Ignoring (cli) wiimote
bluetoothd[2823]: Ignoring (cli) autopair
bluetoothd[2823]: Ignoring (cli) policy
bluetoothd[2823]: Ignoring (cli) neard
bluetoothd[2823]: Ignoring (cli) sap
bluetoothd[2823]: Ignoring (cli) a2dp
bluetoothd[2823]: Ignoring (cli) avrcp
bluetoothd[2823]: Ignoring (cli) network
bluetoothd[2823]: Ignoring (cli) input
bluetoothd[2823]: Ignoring (cli) hog
bluetoothd[2823]: Ignoring (cli) health
bluetoothd[2823]: Ignoring (cli) gap
bluetoothd[2823]: Ignoring (cli) scanparam
bluetoothd[2823]: Ignoring (cli) deviceinfo
bluetoothd[2823]: Ignoring (cli) alert
bluetoothd[2823]: Ignoring (cli) time
bluetoothd[2823]: Ignoring (cli) proximity
bluetoothd[2823]: Ignoring (cli) thermometer
bluetoothd[2823]: Ignoring (cli) heartrate
bluetoothd[2823]: Ignoring (cli) cyclingspeed
bluetoothd[2823]: Ignoring (cli) external_dummy
bluetoothd[2823]: Bluetooth management interface 1.7 initialized
Run Code Online (Sandbox Code Playgroud)

然后我在另一个终端窗口中使用这些命令来获取它的广告:

sudo tools/hciconfig hci0 up
sudo tools/hciconfig hci0 leadv 0
sudo tools/hciconfig hci0 noscan
sudo tools/hcitool -i hci0 cmd 0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 F3 4A 1A 1F 50 0F 48 FB AF AA 95 84 D6 41 D7 B1 00 01 00 00 C8 00
Run Code Online (Sandbox Code Playgroud)

完成这些步骤后,我使用iOS上的LightBlue应用程序连接并查看服务.我可以在列表中看到我的设备并连接到它,但在我连接之后我无法在gatt-example中看到任何服务而bluetoothd给了我以下消息:

bluetoothd[2823]: Refusing storage path for private addressed device /org/bluez/hci0/dev_4E_8C_5E_D8_69_A5
bluetoothd[2823]: Can't store info for private addressed device /org/bluez/hci0/dev_4E_8C_5E_D8_69_A5
bluetoothd[2823]: Can't store services for private addressed device /org/bluez/hci0/dev_4E_8C_5E_D8_69_A5
bluetoothd[2823]: Unable to register GATT service with handle 0x0001 for device 4E:8C:5E:D8:69:A5:
bluetoothd[2823]: Unable to register GATT service with handle 0x0006 for device 4E:8C:5E:D8:69:A5:
bluetoothd[2823]: Unable to register GATT service with handle 0x000a for device 4E:8C:5E:D8:69:A5:
bluetoothd[2823]: Unable to register GATT service with handle 0x000f for device 4E:8C:5E:D8:69:A5:
bluetoothd[2823]: Unable to register GATT service with handle 0x0013 for device 4E:8C:5E:D8:69:A5:
bluetoothd[2823]: Unable to register GATT service with handle 0x0019 for device 4E:8C:5E:D8:69:A5:
bluetoothd[2823]: Unable to register GATT service with handle 0x001e for device 4E:8C:5E:D8:69:A5:
bluetoothd[2823]: Unable to register GATT service with handle 0x0028 for device 4E:8C:5E:D8:69:A5:
Run Code Online (Sandbox Code Playgroud)

此外,当我断开它时,Pi停止广告,所以我必须再次运行前四个命令才能再次连接它.

我一直在寻找寻找解决方案的日子,但我无法让它得到它的工作.我很感激任何建议!

我也尝试过使用Bluez 5.35和5.16而没有运气.