蓝牙2.0+ [英] Bluetooth on 2.0+

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

问题描述

我做的蓝牙开发与PC连接。我basicly用BTChatExample,改变了UUID的标准PC SPP-轮廓。

I'm doing bluetooth development for connecting with a PC. I've basicly used the BTChatExample and changed the UUID to the standard PC SPP-profile.

  1. 试图在一个阻塞读关闭蓝牙应用程序,通过关闭的BluetoothSocket将离开蓝牙堆栈中一个不可用状态。这只能固定通过禁用和启用蓝牙和重新启动应用程序。检查的logcat,你可以看到一些内部方法都失败,留下一个开放的端口。这方面的消息?

  1. Trying to close a bluetooth application during a blocking read, by closing the BluetoothSocket will leave the Bluetooth stack in a unusable state. This can only be fixed by disabling and enabling bluetooth and restarting the application. Checking logcat, you can see that some of the internal methods are failing, leaving a open port. Any information on this?

首先有接缝是如何蓝牙是对N1和HTC传奇实施/欲望都运行2.1的差别,你知道这事?

First of all there seams to be differences on how bluetooth is implemented on N1 and HTC Legend/Desire both running 2.1, do you know anything about this?

连接不是100%可靠的,有时我得到一个警告说〜PortSystemContext初始化:无法。这使得蓝牙无法使用,重新启动是必需的。

Connecting isn't 100% reliable, sometimes I get a warning saying ~PortSystemContext init: FAILED. This leaves bluetooth unusable, and restarting is needed.

我是正确的假设,最高人民检察院是唯一配置文件支持的API的使用?这就是在BluetoothAdapter的文档说。

Am I right in assuming that SPP is the only profile supported for use with the APIs? That's what the docs on the BluetoothAdapter says.

我很想讨论的蓝牙问题与开发商和化解这些错误,使机器人具有良好的适当支持蓝牙值得。

I would love to discuss issues on bluetooth with a developer and iron out these bugs so that Android can have good proper Bluetooth support it deserves.

推荐答案

在阻塞读关闭在一个线程插座一定要引起读返回(通过抛出IOException异常),并且不应该离开堆栈的不良状态。这是Droid和Nexus One的行为。

Closing a socket in one thread during a blocking read should definitely cause the read to return (by throwing IOException) and should not leave the stack in a 'bad state'. This is the behavior on Droid and Nexus.

我说话直接到原来的海报,他也观察到HTC联想和HTC Desire的这个问题。它看起来像他们不执行API的正确。我提出他们的问题。

I spoke directly to the original poster, and he had observed this problem on HTC Legend and HTC Desire. It appears like they are not implementing the API's correctly. I am raising the issue with them.

您是正确的,SPP / RFCOMM是用于与该API的使用的唯一配置文件。 SPP / RFCOMM让你流套接字这是一个很大的用例足够好了。

You are correct that SPP/RFCOMM is the only profile that is intended for use with the API's. SPP/RFCOMM gets you a streaming socket which is good enough for a lot of use cases.

现在,我建议在Nexus BT开发一个/摩托罗拉Droid,这被认为是蓝牙API的参考实现。

For now I recommend BT development on Nexus One / Motorola Droid, which are considered 'reference' implementations of the Bluetooth API's.

这篇关于蓝牙2.0+的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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