只能接收最大长度是20的indication data,为什么

公告

大中华汽车电子生态圈社区并入开发者社区- 更多资讯点击此

Tip / 登入 to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
YaTr_3516311
Level 5
Level 5
25 sign-ins First solution authored 100 replies posted

Hi,

pastedImage_0.png

定义了数据接收的大小是255,然后与hello_sensor建立链接,hello_sensor发送的数据改成了"HelloHelloHelloHelloHelloHello 0"(数据长度大于20)

建立链接的时候,hello_sensor按键会发送"HelloHelloHelloHelloHelloHello 0"的数据,但我发现我这边只能收到20长度的数据。 请问什么地方会影响这个收数据的长度?

0 点赞
1 解答
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

需要在client端调用下面的API配置MTU size,我这边测试可以正常配置的。

wiced_bt_gatt_status_t wiced_bt_gatt_configure_mtu (uint16_t conn_id, uint16_t mtu);

在原帖中查看解决方案

0 点赞
10 回复数
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

在hello sensor的发送端也需要修改包的长度。

0 点赞

改过了,hello sensor那边改成30byte左右,但是最大能收到的还是20byte左右

0 点赞

这个问题请尽快确认一下,你们也可以用hello_sensor和hello_client的demo测试。看看有没有这个问题

0 点赞

这个问题有更新吗

0 点赞
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

需要在client端调用下面的API配置MTU size,我这边测试可以正常配置的。

wiced_bt_gatt_status_t wiced_bt_gatt_configure_mtu (uint16_t conn_id, uint16_t mtu);

0 点赞

这个配置只能在connection up上了以后进行设置吗?能不能提前设置?比如说在还没有链接之前,初始化的时候就设置好?

0 点赞
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

只能在连接之后进行设置,而且需要根据connection id进行配置。

0 点赞

我明白需要用connection id的,比如说我只支持5个最大的链接,我可不可以在初始化的时候就按如下设置好?这个设置是只能有了connection以后才可以设置。对吧?

wiced_bt_gatt_status_t wiced_bt_gatt_configure_mtu (1, 255);

wiced_bt_gatt_status_t wiced_bt_gatt_configure_mtu (2, 255);

wiced_bt_gatt_status_t wiced_bt_gatt_configure_mtu (5, 255);

0 点赞
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

不可以的,这个参数只能在连接之后进行配置,而且需要等到对端确认之后才能生效。

0 点赞
lock attach
Attachments are accessible only for community members.

好的,有mtu的这个相关文档介绍吗?因为我不是很明白为什么data size需要在connection up的时候要重新配置一下,gatt config里已经有长度了

0 点赞