android串口byte超过128,【基本解决】蓝牙数据传输数据单次超过990字节时被截断分段多次传输...

本文介绍了Android蓝牙在发送超过990字节数据时遭遇截断的问题,涉及蓝牙协议层次、L2CAP和RFCOMM的MTU限制。通过分析不同层次的MTU值,如L2CAP的128字节和蓝牙设备的实际限制,探讨了解决数据分段传输的策略,并提到Android中可能的默认MTU值和如何通过Exchange MTU Request and Response PDUs来调整MTU,以优化传输效率。
摘要由CSDN通过智能技术生成

【背景】

Android中,用蓝牙发送数据,结果出现,超过990的字节的大批量的数据,就会被截断。

【解决过程】

1.google去搜:

Bluetooth 990 bytes

找到:

有人遇到,但是无解:

提到了“My android mobile bluetooth supporting maximum RFCOMM payload is 990 bytes”

不过好像其遇到的问题不一样:

发送了1K=2014=990+34,结果990丢失了,而不是截断的事情了。

说是:

RFCOMM中,就像串口,是没有Package包的概念的,只有字节流;

然后有时候多个小的数据包,又会被放在一起传输->一次性接收到的,是多个小的数据包。

而分段的大小,即一次性最大传输多少个,此处的990,是取决于每个蓝牙芯片内部的参数设置的。

->感觉说的也不一定对。。。

也有人遇到类似问题。

5.看到:

中关于蓝牙配置时,有个:# hciconfig

hci0: Type: BR/EDRBus: USB

BD Address: B4:B6:76:8D:AB:07ACL MTU: 310:10SCO MTU: 64:8

UP RUNNING

RX bytes:990 acl:0 sco:0 events:44 errors:0

TX bytes:738 acl:0 sco:0 commands:44 errors:0

其中的

RX bytes:990

感觉像是说:

一次性最多接受990个字节

如果是的话,那么:

TX bytes:738

或许就意味着:

一次性最多发送738个字节

6.再去搜:

Bluetooth RFCOMM max payload

找到:

都提到了:L2CAP’s functions include:Multiplexing data between different higher layer protocols.

Segmentation and reassembly of packets.

Providing one-way transmission management of multicast data to a group of other Bluetooth devices.

Quality of service (QoS) management for higher layer protocols.

L2CAP is used to communicate over the host ACL link. Its connection is established after the ACL link has been set up.

In basic mode, L2CAP provides packets with a payload configurable up to 64 kB, with 672 bytes as the default MTU, and 48 bytes as the minimum mandatory supported MTU.

根据:

Segmentation and reassembly of pac

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值