蓝牙 ->服务发现失败 [英] Bluetooth -> service discovery failed

查看:31
本文介绍了蓝牙 ->服务发现失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个能够与我的 PC 通信的应用程序.我已经使用了 SDK 2.1 的蓝牙功能.

I'm writing an application that is able to communicate with my PC. I have used the Bluetooth functionalities of the SDK 2.1.

我可以找到设备,获取它们的 MAC 地址,创建一个 RFCOMM 套接字,但是当我开始连接时,我收到以下错误消息.

I can find devices, get their MAC address, create an RFCOMM socket, but when I start the connection, I get the following error message.

服务发现失败.

  1. 是不是因为 UUID 在我的应用程序和我的电脑?
  2. 如何在我的 PC 上获取正确的 UUID?
  1. Is it because of the UUID, which is not the same on my application and on my PC?
  2. How can I get the correct UUID on my PC?

如果我编写这样的应用程序,我的 Nexus One 是客户端还是服务器?

If I write a such application, is my Nexus One the client or the server?

推荐答案

好的,我遇到了同样的问题,但我想我可以回答您的一些问题.如果您的 PC 打开了一个 SPP 端口,例如,通过使用sdptool add --channel=3 SP",您的 Android 手机将成为客户端打开一个套接字并使用该套接字连接到服务器(您的 PC 或任何其他蓝牙设备,例如,GPS、鼠标等).

OK, I got the same problem, but I think I can answer a few of your questions. If your PC opened an SPP Port, for example, by using "sdptool add --channel=3 SP" your Android phone would be the client opening a socket and connecting with this socket to the server (your PC or any other Bluetooth device, for example, GPS, mouse, etc.).

您可以通过阅读文章获得此信息蓝牙,我从这篇文章中取出了客户端的定义.

You can get this information by reading the article Bluetooth, the definition of a client did I take out of this article.

如果您在服务器(您的 PC 等)上打开 SPP 端口,则您提供的是标准服务,并且会为该服务分配一个特殊的 UUID.如果我没记错的话,这将是:00001101-0000-1000-8000-00805F9B34FB.

If you are opening an SPP Port on the server (your PC, etc.) you are offering a standard service and there is a special UUID assigned to this service. This would be: 00001101-0000-1000-8000-00805F9B34FB if I'm not mistaken.

所以我认为我们应该从 Android 开发者那里得到一个合格的答案.或者在周四 IRC 办公时间问这个问题.

So I think we should get a qualified answer from an Android developer. Or ask this question on Thursday during the IRC office hours.

这篇关于蓝牙 ->服务发现失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆