Android的蓝牙串行RFCOMM低波特率/传输慢 [英] Android Bluetooth Serial RFCOMM low baud rate / slow transmission

查看:1317
本文介绍了Android的蓝牙串行RFCOMM低波特率/传输慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个 Android的蓝牙项目从定制的硬件发送和接收数据。我用的蓝牙聊天样品的SDK中作为基础。

我意识到,有没有办法改变的波特率的在客户端(Android手机)和波特率取决于硬件。我试图在硬件上设置不同的的波特率的,没有达到我们的预期;

最快我可以为91Kbps(当波特率设置为2.7Mbps〜910Kbps)。利用最小波特率(115Kbps的)我得到43Kbps。我试着用不同的手机,它是相同的。我需要每秒170KB传输数据的硬件。


规格
协议的:同步或生成的数据是使用最多520个字节的包发送到硬件。硬件发送确认命令后,每个包:收到并批准再电话发送下一个数据包。
客户的:安卓2.3.3,三星galaxyW¯¯I8150,蓝牙v3.0,RFCOMM
硬件的:自定义,蓝牙v2.1 BLUEGIGA WT11i


我完全糊涂了..这都不可能在手机上所造成的Andr​​oid或蓝牙设备出了问题?我想知道的最大波特率是什么?有没有一种方法,以加快传输(如增加最大的封装尺寸,或发送的所有包,而无需等待硬件验证命令)。


  

修改
  改变包装的尺寸来4160字节后,吞吐量   提高到254Kbps。我试图找出最佳的包   规模达到1.5Mbps的。我AP preciate任何建议

解决方案

首先改变的波特率的蓝牙 RFCOMM /串口协议不应该有所作为,因为它不是一个的真正的串行端口,但仅仅是一个的模拟的。 (具体的制造商可以使一些特别的东西有,但蓝牙在一般或Android不使用该参数来控制空中比特率)

该因素影响的数据速率 SPP 将成为的数据包大小的,在实际的最大数据速率可以克服蓝牙,以及如何快速的接收器读取/频率如何发送者发送。对于数据包的大小,你可以看看内部文档或者尝试不同的大小,以达到最佳的数字为您的应用。 此外,我会建议发送的多个包的(或全部),直到流可以连续发送数据,同样连续读取。

在这里为你的主要问题似乎是实际的 throuput 可以实现通过蓝牙。如果您正在使用非 EDR 版本为你所提到的在你的问题在​​非常低的水平的理论速度的 720Kbps 的,并添加协议和应用了头以及为 RFCOMM 的协议开销,你可以得到最高各地的 450-500 Kbps的的。

如果你有机会获得的两端都+ EDR 即蓝牙版本2.0以上+ EDR,那么你可以指望的应用程序的 throuput 在1.2到1.5 Mbps的顺序(理论空中比特率是2.0或3.0 Mbps的)

I'm working on an Android Bluetooth project to send and receive data from a custom made hardware. I used Bluetooth Chat Sample in SDK as basis.

I realized that there is no way to change baud rate on Client (Android phone) and baud rate will depend on hardware. I tried setting different baud rates on hardware and none met our expectations;

Fastest i can get is 91Kbps (when baud rate is set to 2.7Mbps ~ 910Kbps). Using minimum baud rate (115Kbps) i get 43Kbps. I tried using different phones and it's the same. I need to transfer 170KB data per second to hardware.


Specifications
Protocol: Synchronized or generated data is sent to hardware using packages of maximum 520 bytes size. Hardware sends verify command after each package recieved and approved then phone sends next data package.
Client: Android 2.3.3, Samsung galaxy w i8150, Bluetooth v3.0, RFCOMM
Hardware: Custom, Bluetooth v2.1 BlueGiga WT11i


I'm totally confused.. Can it possibly be a problem caused by Android or Bluetooth device on the phone? I wonder what the maximum baud rate is? Is there a way to speed up the transmission (like increasing maximum package size, or sending all packages without waiting for hardware verify commands).


Edit
After changing the package size to 4160 Bytes, Throughput has increased to 254Kbps. I'm trying to figure out the optimum package size to reach 1.5Mbps. I appreciate any suggestions

解决方案

Firstly changing the baud rate on the Bluetooth RFCOMM / Serial Port protocol should not make a difference, since it is not a real serial port but just an emulation. (Specific manufacturers could so something special with it but Bluetooth in general or Android does not use the parameter to control over the air bit rates)

The factors that effect the data rate over SPP will be the size of the packets, the practical max data rate you can get over Bluetooth and how fast the receiver is reading / and how frequently the sender is sending. For the packet size you could look at internal documentations or try different sizes to reach an optimal number for your application. Also I would suggest sending multiple packets (or all) until the stream can send data continuously, similarly read continuously.

The main issue here for you seems to be the practical throuput you can achieve over Bluetooth. If you are using the non-EDR versions as you have mentioned in your question the theoretical speed at the very low level is 720Kbps , and adding protocol and application over heads as well as RFCOMM protocol overhead you could get max around 450-500 Kbps.

If you have access to both devices that are +EDR I.e Bluetooth version 2.0 or more + EDR then you can expect application throuput in the order of 1.2 to 1.5 Mbps ( theoretical over the air bit rate being 2.0 or 3.0 Mbps)

这篇关于Android的蓝牙串行RFCOMM低波特率/传输慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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