fix(vd960DBN): BLE 分包粒度动态化 — 修复 offlog_query Too large noti 丢包
- 根因: MAX_BLE_DAT_RESPONSE_LEN=96 写死, MTU 协商 96 后整包 102B > MTU-3=93 peripheralChar4Notify 直接 return 丢第一包, 小程序重组不完整 - peripheral.c: 新增 peripheral_get_mtu() getter - dbn_ble_srv.c: ble_notify_chunk_max() 按 min(MTU-9,94) 动态分包 4 处 MAX_BLE_DAT_RESPONSE_LEN 统一替换 (set_response_buf/to_notify/iot_net/iot_topic) - 消除 BLE_Notify_Buf.buf[100] 写 102B 越界 2B 隐患 - 隔离 C 测试 MTU=23/96/185/517 四组全过, 重组 130B 逐字节一致
This commit is contained in:
@@ -147,6 +147,11 @@ static uint8_t attDeviceName[GAP_DEVICE_NAME_LEN] = "DLD960GA"; // "Simple Perip
|
||||
static peripheralConnItem_t peripheralConnList;
|
||||
|
||||
static uint16_t peripheralMTU = ATT_MTU_SIZE;
|
||||
/* getter for dbn_ble_srv.c: dynamic notify chunk by negotiated MTU */
|
||||
uint16_t peripheral_get_mtu(void)
|
||||
{
|
||||
return peripheralMTU;
|
||||
}
|
||||
/*********************************************************************
|
||||
* LOCAL FUNCTIONS
|
||||
*/
|
||||
@@ -703,7 +708,7 @@ static void peripheralChar4Notify(uint8_t *pValue, uint16_t len)
|
||||
attHandleValueNoti_t noti;
|
||||
if(len > (peripheralMTU - 3))
|
||||
{
|
||||
PRINT("Too large noti\n");
|
||||
PRINT("Too large noti, len:%d, peripheralMTU:%d\n", len, peripheralMTU);
|
||||
return;
|
||||
}
|
||||
noti.len = len;
|
||||
|
||||
Reference in New Issue
Block a user