我想通过蓝牙访问我的智能手机的联系人。这应该是我用覆盆子皮做项目的第一步。我读了一些关于电话bok接入协议(PBAP)的文章。
但我所能做的对我并不是很有帮助。我找到的最古老的例子。
我已经成功地配对和连接我的智能手机(一加一)。我也可以看到这是支持PBAP。我在5.23-2+rpi1版本中使用bluez。
我发现了两个PBAP客户机的例子,一个来自obexd(http://code.metager.de/source/xref/linux/bluetooth/obexd/test/pbap-client),另一个来自bluez(http://code.metager.de/source/xref/linux/bluetooth/bluez/test/pbap-client)。
如果我在pi上执行obexd示例,将得到以下错误:

Creating Session
Traceback (most recent call last):
  File "pbap-client-obexd.py", line 110, in <module>
    session_path = client.CreateSession(sys.argv[1], { "Target": "PBAP" })
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 70, in __call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.bluez.obex.Error.Failed: No adapter found

如果我执行bluez示例,会得到以下错误:
Creating Session
Traceback (most recent call last):
  File "pbap-client-bluez.py", line 128, in <module>
    session_path = client.CreateSession(sys.argv[1], { "Target": "PBAP" })
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 70, in __call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownObject: Method "CreateSession" with signature "sa{ss}" on interface "org.bluez.obex.Client1" doesn't exist

你们中有谁有办法解决这个问题,一个实际的教程或者其他的例子吗?
谢谢你

最佳答案

几个小时后,我找到了一个名为PyOBEX的python库。它包含一些示例,例如PBAP客户端、通过蓝牙下载文件的示例等等。它还包含所有配对和连接的方法。对我来说是第一次尝试。
链接:
https://bitbucket.org/dboddie/pyobex/overview

关于linux - 适用于Linux(Raspberry Pi)的电话簿访问(PBAP)客户端,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37346210/

10-10 17:42