从 HTC Desire Z 中的 inputream 读取时出现 Android 蓝牙问题
我正在做一个项目,涉及将图像文件从 BTM-182 蓝牙模块传输到 Android 手机。该程序基于Android 2.0。
我已经阅读了google的蓝牙聊天程序,我可以使用标准蓝牙SPP配置文件UUID建立连接。我可以在程序中从BluetoothSocket获取输入流和输出流。
从输入流读取数据时,我的 HTC Desire Z(Android 2.2,未 root)会出现此问题。我每次需要读取38400字节的数据,但是程序似乎只能读取大约24000字节并挂起,无法读取更多字节并且没有抛出异常!
然而,同样的程序在另一部未修改的 Android 2.2 系统且已 root 的手机上运行良好。
我已经在 google 上搜索过,HTC Desire 中的蓝牙 SPP 配置文件似乎已损坏并且存在错误的实现: http://code.google.com/p/android/issues/detail ?id=8382 我不知道我的 Desire Z 是否也遇到同样的错误实现。
对于这个问题有什么建议吗?
I am doing a project dealing with transmitting image files from BTM-182 Bluetooth module to Android phone. The program is based on Android 2.0.
I have read the Bluetooth Chat program from google, and I can establish the connection using standard Bluetooth SPP profile UUID. I can obtain the inputstream and outputstream from BluetoothSocket in the program.
The problem happens in my HTC Desire Z (Android 2.2, not rooted) when reading from inputstream. I need to read 38400 byte of data each time, but the program seems that it can only read about 24000 byte and hangs, no more bytes can be read and no exceptions are thrown!
However, the same program runs fine on another phone with unmodified Android 2.2 system which is rooted.
I have already googled that it seems that the Bluetooth SPP profile in HTC Desire is broken and has a buggy implementation:
http://code.google.com/p/android/issues/detail?id=8382
I don't know whether my Desire Z suffers the same buggy implementation.
Any suggestions of this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试一下 Amarino API 怎么样? www.amarino-toolkit.net/
How about trying out the Amarino API. www.amarino-toolkit.net/