From 0631042a117bafc9d1622d50f025b1bc906a2aac Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Mon, 30 Sep 2024 11:10:05 +0800 Subject: [PATCH] =?utf8?q?ble=E8=A7=A3=E7=BB=91=E6=81=A2=E5=A4=8D=E5=87=BA?= =?utf8?q?=E5=8E=82=E4=BF=AE=E6=94=B9=EF=BC=8C=E4=BB=85=E6=B8=85=E9=99=A4?= =?utf8?q?=E9=85=8D=E5=AF=B9=EF=BC=8C=E4=B8=8D=E5=81=9A=E5=A4=9A=E4=BD=99?= =?utf8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../service/ble_service/bleservice/bleEvent.c | 15 ++++++++++++++- .../service/ble_service/bleservice/bleEvent.h | 2 ++ .../drivers/peripheral/utils/custom_cmd_service.c | 3 ++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c index fda66f29a..882d37105 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -606,6 +606,18 @@ errcode_t UnbindSucessCmd(uint8_t flag)//发送解绑指令,解绑界面调用 return sendok; } + +void watch_clean_pairs(void) +{ + if(0!=remove(PHONE_WATCH_CONFIG_PATH)) + { + printf("json remove fail\r\n"); + } + gap_ble_remove_all_pairs(); + gap_remove_all_pairs(); +} + + void getDeviceState(void)//获取设备状态 { bd_addr_t addr={0}; @@ -633,6 +645,7 @@ void clearPaireFlag(uint8_t flag) sendBleData(value,19); UnbindSucessCmd(1);//1确认解绑; + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_RESTORE_FACTORY_SETTING, NULL, 0);//恢复出厂 //uapi_reboot_device(); } @@ -2790,7 +2803,7 @@ uint8_t read_jsonHistory_weather(void) fclose(fp); return 0; } - + char *str = fgets((char *)buf,size + 1,fp); if(str!=NULL) { diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h index 675d7bb0a..e46f1927d 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h @@ -831,6 +831,8 @@ void reply_APP_SportPasueResetCmd(uint16_t time); void reply_APP_SportStopModeCmd(uint16_t time); +void watch_clean_pairs(void); + ///////////////////////////自定义文件传输协议///////////////////////////// #define OTA_FILE_MSG_CMD 0x0601 #define OTA_FILE_DATA_CMD 0x0602 diff --git a/code/sdk/drivers/peripheral/utils/custom_cmd_service.c b/code/sdk/drivers/peripheral/utils/custom_cmd_service.c index 854b1a6cf..23a4bd0a2 100644 --- a/code/sdk/drivers/peripheral/utils/custom_cmd_service.c +++ b/code/sdk/drivers/peripheral/utils/custom_cmd_service.c @@ -149,7 +149,8 @@ static void custom_cmd_service_check_task(void const *arg) case CUSTOM_CMD_MSG_TYPE_RESTORE_FACTORY_SETTING: { ble_Alipayunbind(); - UnbindSucessCmd(1);//1确认解绑 + // UnbindSucessCmd(1);//1确认解绑 + watch_clean_pairs(); uapi_restore_factory_setting(); } break; -- 2.17.1