From: hcj <1224667075@qq.com> Date: Mon, 30 Sep 2024 03:10:05 +0000 (+0800) Subject: ble解绑恢复出厂修改,仅清除配对,不做多余处理 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F1066%2F1;p=mirrors%2FFD230.git ble解绑恢复出厂修改,仅清除配对,不做多余处理 --- 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;