如果在最后一个包因为各种原因发送失败时,对方设备断开连接。
这时 415 行 ble_uart_notify 会发送失败,程序就会就在 421 行回到 END_TO_BLE_ALLOC_FAILED,从而陷入死循环:
|
case SEND_TO_BLE_ALLOC_FAILED: |
|
case SEND_TO_BLE_SEND_FAILED: |
|
|
|
noti.len = read_length; |
|
noti.pValue = GATT_bm_alloc(peripheralConnList.connHandle, ATT_HANDLE_VALUE_NOTI, noti.len, NULL, 0); |
|
if(noti.pValue != NULL) |
|
{ |
|
tmos_memcpy(noti.pValue, to_test_buffer, noti.len); |
|
result = ble_uart_notify(peripheralConnList.connHandle, ¬i, 0); |
|
if(result != SUCCESS) |
|
{ |
|
PRINT("R2:%02x\r\n", result); |
|
send_to_ble_state = SEND_TO_BLE_SEND_FAILED; |
|
GATT_bm_free((gattMsg_t *)¬i, ATT_HANDLE_VALUE_NOTI); |
|
tmos_start_task(Peripheral_TaskID, UART_TO_BLE_SEND_EVT, 2); |
|
} |
如果在最后一个包因为各种原因发送失败时,对方设备断开连接。
这时 415 行 ble_uart_notify 会发送失败,程序就会就在 421 行回到 END_TO_BLE_ALLOC_FAILED,从而陷入死循环:
ch583/EVT/EXAM/BLE/BLE_UART/APP/peripheral.c
Lines 407 to 422 in bd508ad