Skip to content

Commit bddfd77

Browse files
committed
ble 传输
1 parent 7b8fb20 commit bddfd77

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

src/tuya_cloud_service/ble/ble_mgr.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -291,15 +291,21 @@ static int ble_packet_recv(tuya_ble_mgr_t *ble, uint8_t *buf, uint16_t len, ble_
291291
int rt = OPRT_OK;
292292
ble_packet_recv_t *packet_recv = s_ble_mgr->packet_recv;
293293

294-
rt = ble_packet_trsmitr(packet_recv, buf, len);
295-
if (OPRT_OK != rt) {
296-
if (rt == OPRT_SVC_BT_API_TRSMITR_CONTINUE) {
297-
PR_DEBUG("ble receive multi-packet...");
298-
} else {
299-
PR_ERR("ble trsmitr err:%d", rt);
300-
}
301-
return rt;
302-
}
294+
rt = ble_packet_trsmitr(packet_recv, buf, len);
295+
if (OPRT_OK != rt) {
296+
if (rt == OPRT_SVC_BT_API_TRSMITR_CONTINUE) {
297+
PR_DEBUG("ble receive multi-packet...");
298+
return rt;
299+
}
300+
if (rt == OPRT_SVC_BT_API_TRSMITR_ERROR) {
301+
PR_DEBUG("ble trsmitr resync after sequence error");
302+
ble_packet_recv_reset(ble);
303+
return OPRT_SVC_BT_API_TRSMITR_CONTINUE;
304+
} else {
305+
PR_ERR("ble trsmitr err:%d", rt);
306+
return rt;
307+
}
308+
}
303309
if (packet_recv->raw_len > TUYA_BLE_AIR_FRAME_MAX) {
304310
PR_ERR("ble packet size too large");
305311
return OPRT_INVALID_PARM;

0 commit comments

Comments
 (0)