[英]Linux BlueZ dbus communication
I work with BlueZ 5.30 and kernel 3.13.0-32 and I need to implement in my app read/write characteristics functionality via DBus. 我使用BlueZ 5.30和内核3.13.0-32,我需要通过DBus在我的app中实现读/写特性功能。
I'm using BlueZ test scripts to established connection: 我正在使用BlueZ测试脚本建立连接:
"test-discovery", and then "test-device connect". “测试发现”,然后是“测试设备连接”。
the problem is I don't see any services displayed in DBus (org.bluez). 问题是我没有在DBus(org.bluez)中看到任何服务。 Using d-feet app I can only see: 使用d-feet app我只能看到:
"/org/bluez/hci0/dev_btaddr" Interfaces org.bluez.Device1 org.freedesktop/DBus.Introspectable org.freedesktop.DBus.Properties “/ org / bluez / hci0 / dev_btaddr”接口org.bluez.Device1 org.freedesktop / DBus.Introspectable org.freedesktop.DBus.Properties
and in "/var/log/syslog" I can see many of: 在“/ var / log / syslog”中我可以看到很多:
" bluetoothd[715]: Unable to register GATT service with handle 0x0045 for device..." “bluetoothd [715]:无法为设备注册带有句柄0x0045的GATT服务......”
using gatttool I'm able to read/write characteristics, primaries etc. Under hcidump I see all of characteristics are read properly. 使用gatttool我能够读/写特性,原色等。在hcidump下我看到所有特性都被正确读取。
But, from DBus PoV only Device1 interface is available. 但是,从DBus PoV只有Device1接口可用。
here is my BlueZ configuration: " ./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var --enable-library --disable-systemd --enable-experimental --enable-maintainer-mode --enable-debug " 这是我的BlueZ配置:“。/ configure --prefix = / usr --mandir = / usr / share / man --sysconfdir = / etc --localstatedir = / var --enable-library --disable-systemd - enable-experimental --enable-maintainer-mode --enable-debug“
I was looking here: " http://i-miss-erin.blogspot.com/2010/12/gatt-related-dbus-api.html " but as I mentioned, don't have any interface or services which are displayed here. 我在这里看:“ http://i-miss-erin.blogspot.com/2010/12/gatt-related-dbus-api.html ”但正如我所提到的,没有任何显示的界面或服务这里。
For test I use proximity and hid devices. 对于测试我使用接近和隐藏设备。 In case of hid, after proper connection I can see chars in the terminal window (hid keyboard device) so I assume it works correctly. 在隐藏的情况下,在正确连接后,我可以在终端窗口中看到字符(隐藏键盘设备),所以我认为它可以正常工作。
Any suggestions? 有什么建议?
You have to activate the experimental features for your bluetooth set in order to get GATT services enabled. 您必须激活蓝牙设备的实验性功能才能启用GATT服务。
On a Debian system you can achieve this by putting 在Debian系统上,您可以通过put实现此目的
NOPLUGIN_OPTION="-E"
into the /etc/default/bluetooth
file. 进入/etc/default/bluetooth
文件。
After restart, in order to get my device (Logitech MX Master) working properly on my Debian Stretch, I also had to pair and trust it manually using the bluetoothctl
command. 重新启动后,为了让我的设备(Logitech MX Master)在我的Debian Stretch上正常工作,我还必须使用bluetoothctl
命令手动配对并信任它。 I had no success with the graphical bluetooth tool from Gnome. 我没有成功使用Gnome的图形蓝牙工具。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.