From 8d8e23ecaac765e4664a0be5cf1927e952fa0623 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Thu, 27 Feb 2025 12:17:58 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E6=94=B9CAT1=E5=8D=87=E7=BA=A7?= =?utf8?q?=E6=9C=8D=E5=8A=A1=E5=90=AF=E5=8A=A8=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../brandy/brandy_standard/thread_pri_init.c | 4 +++- .../peripheral/slip/cat1Service/cat1_server.cpp | 10 +++++++++- .../slip/cat1Service/cat1_tcpServer.cpp | 16 +++++----------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/code/sdk/application/brandy/brandy_standard/thread_pri_init.c b/code/sdk/application/brandy/brandy_standard/thread_pri_init.c index 99d5caf34..9f95366ad 100755 --- a/code/sdk/application/brandy/brandy_standard/thread_pri_init.c +++ b/code/sdk/application/brandy/brandy_standard/thread_pri_init.c @@ -485,12 +485,14 @@ uapi_pm_remove_sleep_veto(PM_ID_DEBUG); cat1_server_init(); #endif #if SUPPORT_CAT1_TCP_SERVICE - cat1_tcp_server_init(); + + // cat1_tcp_server_init(); #endif /*蓝牙接收数据处理服务*/ uapi_blesrv_service_init(); + // uapi_Ai_send_service_init(); #ifdef ENABLE_CUSTOM_I2C errcode_t result = custom_iic_init(); diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp index 6901e18b4..11e741423 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp @@ -260,7 +260,7 @@ static uint8_t PY_SRV_VER_CURRENT = 0; #define PY_SRV_VER_5 "PY_SRV_V5" #define PY_SRV_VER_6 "PY_SRV_V6" -static uint8_t g_py_ver = 4; +uint8_t g_py_ver = 4; static osTimerId_t g_timer_time_answer = NULL; @@ -1027,6 +1027,8 @@ int cat1_handle_networ_msg(char *msg) return 1; } +static uint8_t tcp_init =1; + int cat1_handle_version_msg(char *msg) { @@ -1044,6 +1046,12 @@ int cat1_handle_version_msg(char *msg) OHOS::ConfigModel::GetInstance()->SetmoderVer(uapi_dev_runtime_get_cat1_modemver()); cat1_msg_event_sendmsg_toUI("verupdate"); } + if(tcp_init) + { + tcp_init=0; + cat1_tcp_server_init(); + } + return 1; } diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_tcpServer.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_tcpServer.cpp index 9dfa47ad0..f0ef59906 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_tcpServer.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_tcpServer.cpp @@ -1059,12 +1059,6 @@ static int udp_packet_parse(char *rx_buffer, int len) case CAT1_REPLAY_OTA_SUCC: //ota 成功失败与否 收到CAT1的回复就停止计时器 stop_cat1_ota(); //成功直接重启 - if(is_need_udp_updata) - { - // FILE *fp= fopen(CAT1_PY_IS_NEED_UDP_PATH,"wb+"); - // fclose(fp); - remove(CAT1_PY_IS_NEED_UDP_PATH); - } CustomEventPublish(TOPIC_EVENT_SHUTDOWN_ANIMATIOR, &shutdowflag, sizeof(shutdowflag)); //添加GUI break; @@ -1197,7 +1191,7 @@ void cat1_server_file_task(void *pvParameters) int index; socklen_t addrLen = sizeof(filesourceAddr); while (1) { - if(errno_count>3) + if(errno_count>10) { //如果失败太多次将退出循环,避免浪费系统资源 // return; @@ -1292,6 +1286,8 @@ void cat1_server_file_task(void *pvParameters) #define CAT1_SERVICE_TASK_SIZE (0x800*5) #define CAT1_SERVICE_TASK_PRIO 5 +extern uint8_t g_py_ver; + errcode_t cat1_tcp_server_init(void) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"cat1_tcp_server_init !\r\n"); @@ -1302,12 +1298,10 @@ errcode_t cat1_tcp_server_init(void) taskcfg.attr.stack_size = CAT1_SERVICE_TASK_SIZE; taskcfg.func = cat1_server_file_task; taskcfg.use_mem = USE_EXTEND_MEM; - FILE* fp= fopen(CAT1_PY_IS_NEED_UDP_PATH,"rb"); - if(fp) + + if(g_py_ver<=16) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"is_need_udp_updata !\r\n"); is_need_udp_updata=1; - fclose(fp); } errcode_t ret=uapi_create_osThread_custom(&taskcfg); -- 2.17.1