安卓蓝牙PBAP
我将尝试简要介绍一下我正在做的事情,并且 然后提出我的问题...任何帮助将非常感激!
我一直在尝试将 Android 设备连接到其他手机 使用电话簿通过蓝牙导入电话簿信息 访问配置文件。为了实现这一目标,我尝试将我的设备设置为 PCE, 而另一部电话将充当 PSE。
我知道 PSE 角色已经在 Android 上实现,所以我 研究它的代码并尝试以某种方式对其进行逆向工程 落实另一方。
所以..我的问题是:创建服务器套接字时,它没有 指定任何 UUID,它只是开始侦听端口 19,如下所示:
mServerSocket = mAdapter.listenUsingRfcommOn(PORT_NUM);
难道它不应该在某处注册 PBAP 服务吗?怎么样 其他设备发现该服务,更重要的是,哪个 UUID 当尝试连接我的 PCE 设备时我应该使用:
mSocket = mDevice.createRfcommSocketToServiceRecord(UUID_PBAP);
谢谢,Pedro。
I'm gonna try to introduce briefly what I'm working on, and
then present my question... any help will be very much appreciated!
I've been trying to connect an Android device to other phones in order
to import their phonebook info over bluetooth, using the phonebook
access profile. To achieve that, I'm trying to place my device as PCE,
while the other phone will act as the PSE.
I know that the PSE role is already implemented on Android, so I'm
looking into its code and trying to somehow reverse engineer it to
implement the other side.
So.. my problem is: when the server socket is created, it doesn't
specify any UUID, it simply starts listening on a port 19, like this:
mServerSocket = mAdapter.listenUsingRfcommOn(PORT_NUM);
Wasn't it supposed to register the PBAP service somewhere? How does
other devices discover the service, and more important, which UUID
should I use when trying to connect in my PCE device with:
mSocket = mDevice.createRfcommSocketToServiceRecord(UUID_PBAP);
Thanks, Pedro.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该使用 uuid 创建客户端套接字,sdp 将为您找到对应的通道。
您不必关心频道号,并且您分配的频道在各种情况下并不总是正确的。
you should use uuid to create a client socket, sdp will find the crosponding channel for you.
you need not care about the channel number and the channel you assign is not always right in various.
请使用此方法:listenUsingRfcommWithServiceRecord 的BluetoothAdapter 和正确的UUID。
please use this method:listenUsingRfcommWithServiceRecord of BluetoothAdapter with the right UUID.