You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Nordic Android BLE库时连接间隔自动变更问题求助

Android BLE连接间隔自动变更问题求助

使用no.nordicsemi.android:ble:2.3.1开发Android应用,连接传感器并向其写入49KB数据。传输前已设置CONNECTION_PRIORITY_HIGH(对应11.25-15ms连接间隔)和247的MTU值,随后发送128、232、240字节的数据包。但发送完成后,GATT自动将连接间隔设置为36ms,而非需求的12ms,该传感器支持12-30ms的间隔。已测试不同Android版本,BLE版本未对问题产生影响,相关HCI日志已留存。

数据发送前执行的代码

requestConnectionPriority(ConnectionPriorityRequest.CONNECTION_PRIORITY_HIGH)
    .done(device -> Log.e("BleControlManager", "Interval request sent"))
    .fail((device, status) -> Log.e("BleControlManager", "Failed to send Interval request: " + status))
    .enqueue();
requestMtu(247)
    .done(device -> Log.e("BleControlManager", "MTU request sent "))
    .fail((device, status) -> Log.e("BleControlManager", "Failed to send MTU request: " + status))
    .enqueue();

Gatt日志关键内容

// 配置MTU和设置连接间隔成功
2024-04-17 15:03:59.776 18358-18412 BluetoothGatt           com.example.bluetoothcontrol         D  onConfigureMTU() - Device=38:3B:26:7E:76:9B mtu=247 status=0
2024-04-17 15:03:59.910 18358-18412 BluetoothGatt           com.example.bluetoothcontrol         D  onConnectionUpdated() - Device=38:3B:26:7E:76:9B interval=12 latency=0 timeout=500 status=0

// 发送数据包后连接间隔变更
2024-04-17 15:04:00.405 18358-18412 BluetoothGatt           com.example.bluetoothcontrol         D  onConnectionUpdated() - Device=38:3B:26:7E:76:9B interval=36 latency=0 timeout=100 status=0

HCI日志关键条目

1704    330.000533  SamsungElect_3a:0a:01 (Galaxy A7 (2018))    JiangsuQinhe_7e:76:9b (SatelliteOnline0000) ATT 12  Sent Exchange MTU Request, Client Rx MTU: 247
1703    329.798134  controller  host    HCI_EVT 7   Rcvd Command Status (LE Connection Update)
1705    330.014861  controller  host    HCI_EVT 8   Rcvd Number of Completed Packets
1706    330.059797  JiangsuQinhe_7e:76:9b (SatelliteOnline0000) SamsungElect_3a:0a:01 (Galaxy A7 (2018))    ATT 12  Rcvd Exchange MTU Response, Server Rx MTU: 255
1707    330.060311  host    controller  HCI_CMD 10  Sent LE Set Data Length
1708    330.064660  controller  host    HCI_EVT 9   Rcvd Command Complete (LE Set Data Length)
1762    330.616503  controller  host    HCI_EVT 8   Rcvd Number of Completed Packets
1763    330.616628  SamsungElect_3a:0a:01 (Galaxy A7 (2018))    JiangsuQinhe_7e:76:9b (SatelliteOnline0000) L2CAP   15  Sent Connection Parameter Update Response (Accepted)
1764    330.617120  host    controller  HCI_CMD 18  Sent LE Connection Update
1765    330.617907  controller  host    HCI_EVT 7   Rcvd Command Status (LE Connection Update)
1766    330.630105  JiangsuQinhe_7e:76:9b (SatelliteOnline0000) SamsungElect_3a:0a:01 (Galaxy A7 (2018))    ATT 10  Rcvd Write Response, Handle: 0x0013 (Nordic UART Service: Nordic UART Rx: Client Characteristic Configuration)

现寻求该问题的解决方案或相关参考资料。

内容的提问来源于stack exchange,提问作者Артур Шитиков

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 14:47:13