Commit 0bf6fdee authored by 王金亮's avatar 王金亮

feat: 变更单号:TYW-2024-0920

增加TYW清大计策略,清除蓝牙配对信息
parent efe3a649
......@@ -276,6 +276,10 @@ static void Protocol_UartHandle(const Protocol_Data_t *pData)
}
// }
}
if (pData->Data[1] == 1)
{
ODO_Clear_BLEinfo();
}
}
else
{
......
......@@ -5,6 +5,8 @@
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "bt_app_main.h"
#include "esp_gap_bt_api.h"
#include <string.h>
extern esp_bd_addr_t peer_addr;
#define TAG "APP_BLE_USER"
......@@ -134,6 +136,41 @@ void BT_User_Process(void )
}
}
/* */
uint8_t ODO_Clear_BLEinfo(void )
{
esp_hf_client_disconnect(peer_addr);
uint8_t ret = 0;
uint8_t bond_dev_num = esp_bt_gap_get_bond_device_num();
if(bond_dev_num)
{
esp_bd_addr_t *dev_list = (esp_bd_addr_t *)malloc(sizeof(esp_bd_addr_t) * bond_dev_num);
if (dev_list != NULL)
{
esp_bt_gap_get_bond_device_list(&bond_dev_num, dev_list);
memcpy(peer_addr, dev_list[0], 6);
if(bond_dev_num > 0)
{
int i = 0;
for(i=0; i<bond_dev_num; i++)
{
esp_bt_gap_remove_bond_device(dev_list[i]);
}
}
ret = 1;
free(dev_list);
}
}
else
{
memset(peer_addr, 0, 6);
ret = 0;
}
return ret;
}
......
......@@ -48,5 +48,6 @@ void BT_Connect_Event_Pro(void );
void BT_DisConnect_Event_Pro(void );
void BT_User_Process(void );
void BT_User_Init(void );
extern uint8_t ODO_Clear_BLEinfo(void );
#endif
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment