Bluetooth 调用RegisterProfile时获取org.freedesktop.DBus.Error.UnknownMethod错误

Bluetooth 调用RegisterProfile时获取org.freedesktop.DBus.Error.UnknownMethod错误,bluetooth,dbus,bluez,Bluetooth,Dbus,Bluez,我正在尝试使用bluetoothctl(bluez5.42)来注册配置文件。 我运行bluetoothctl如下: bluez-5.42/dev/client# ./bluetoothctl [NEW] Controller 00:50:43:22:29:D9 pe-lt571-0 [default] [bluetooth]# register-profile 00000017-0000-1000-8000-00805f9 Failed to register profile: org.fre

我正在尝试使用bluetoothctl(bluez5.42)来注册配置文件。 我运行bluetoothctl如下:

bluez-5.42/dev/client# ./bluetoothctl 
[NEW] Controller 00:50:43:22:29:D9 pe-lt571-0 [default]
[bluetooth]# register-profile 00000017-0000-1000-8000-00805f9
Failed to register profile: org.freedesktop.DBus.Error.UnknownMethod
只需补充一点,我是在Linux内核4.4上。 在开始bluetoothctl之前,我已经运行了Bluetooth。 另外,我用d型脚做了同样的检查,我得到了同样的错误

为什么会出现未知方法错误?是安装问题吗

我在dbus监视器上得到以下信息

method call sender=:1.89 -> dest=org.bluez serial=20 path=/org/bluez/hci0; interface=org.bluez.GattManager1; member=RegisterProfile
   object path "/org/bluez/profile"
   array [
      string "00000100-0000-1000-8000-00805f9"
   ]
   array [
   ]

org.bluez.GattManager1 DBus接口上没有名为RegisterProfile的方法。这是bluez-5.42的bluetoothctl代码中的一个bug,在bluez-5.46中修复。RegisterProfile方法位于org.bluez.ProfileManager1接口上

从bluez-5.46和更高版本,不存在bluetoothctl的注册配置文件。如果您想注册蓝牙配置文件,请查看bluez源目录中的test/test hfp python脚本。它展示了如何在org.bluez.ProfileManager1上使用RegisterProfile方法。另请参见doc/profile-api.txt,了解此界面上可用的方法


或者,如果您想注册GATT服务,请参阅bluez源代码中的test/test GATT profile python脚本和doc/GATT-api.txt。

谢谢Ravi。实际上,我使用了gatt服务的RegisterApplication.c