From cd86649c8649c7ccca05ad3c29a0c0e050657b9a Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Mon, 8 Dec 2025 19:29:46 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0cat1=20http=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- cat1modem/src/LeiNiao/cat1Service.py | 2 +- .../4g/cat1Service/Service/cat1_server.c | 14 +++ .../4g/cat1Service/Service/cat1_tcpServer.c | 85 +++++++++++++++++++ 3 files changed, 100 insertions(+), 1 deletion(-) diff --git a/cat1modem/src/LeiNiao/cat1Service.py b/cat1modem/src/LeiNiao/cat1Service.py index 0490b4bdb..2d00955e9 100644 --- a/cat1modem/src/LeiNiao/cat1Service.py +++ b/cat1modem/src/LeiNiao/cat1Service.py @@ -79,7 +79,7 @@ sms.setCallback(msg_cb)#sms注册回调 CAT1_SERVICE_HEAD = 'FE' #固定head PROJECT_NAME = "Cat1SlipUDPService" -PROJECT_VERSION = "PY_SRV_V27" +PROJECT_VERSION = "PY_SRV_V28" CONFIG_JSON="/usr/system_config.json" CURRENT_APP_TYPE="pysrv" diff --git a/code/sdk/zhihui/4g/cat1Service/Service/cat1_server.c b/code/sdk/zhihui/4g/cat1Service/Service/cat1_server.c index 07046df54..d97f195c4 100644 --- a/code/sdk/zhihui/4g/cat1Service/Service/cat1_server.c +++ b/code/sdk/zhihui/4g/cat1Service/Service/cat1_server.c @@ -131,6 +131,9 @@ static uint8_t g_msg_format_type = 0; // void watch_replay_cat1_ANSWER(void); void cat1_get_DEV_ID(void); +uint8_t g_py_ver_new = 0; + + static char ble_buffer[20] = {0}; static uint8_t g_flag_disable_cat1_cmd = 0; @@ -150,6 +153,12 @@ void ble_get_cat1_at_msg(char *buffer,uint8_t len) memcpy_s(buffer,len,ble_buffer,strlen(ble_buffer)); } + +void send_fota_url(char *buf)//发送VOLTE->CAT1 +{ + udp_send_msg_toCat1(UDP_MSG_SEND_OTA,buf); +} + void send_ble_mac_toCat1(void)//发送BLE mac地址 to CAT1 { errcode_t ret = 0; @@ -1703,6 +1712,11 @@ static int udp_packet_parse(char *rx_buffer, int len) restart_time_sync(); cat1_getsignal(); + + if(g_py_ver_new) + { + g_py_ver_new=0; + } cat1_print_info("IMEI received, sending AT+ICCID command\n"); cat1_at_cmd("AT+ICCID"); diff --git a/code/sdk/zhihui/4g/cat1Service/Service/cat1_tcpServer.c b/code/sdk/zhihui/4g/cat1Service/Service/cat1_tcpServer.c index 302cbaab4..11c599d53 100644 --- a/code/sdk/zhihui/4g/cat1Service/Service/cat1_tcpServer.c +++ b/code/sdk/zhihui/4g/cat1Service/Service/cat1_tcpServer.c @@ -1361,6 +1361,91 @@ char* xor_encrypt_decrypt(const char* message, const char* key) { } +static uint8_t old_model_ver=0; + +extern uint8_t g_py_ver; + +extern uint8_t g_py_ver_new; + +static osTimerId_t modem_ota_timer=NULL; + +static uint16 mode_ota_count=0; + + +static void modem_ota_timer_CallBack(int data_tmp) +{ + if(old_model_ver!=g_py_ver) + { + uint8_t TRANSMIT_DATA=TRANS_FREE; + CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); + + if(modem_ota_timer){ + osTimerStop(modem_ota_timer); + osTimerDelete(modem_ota_timer); + modem_ota_timer = NULL; + } + + } + else + { + mode_ota_count++; + if(mode_ota_count>120 || g_py_ver_new==0) + { + uint8_t TRANSMIT_DATA=OTA_UPDATA_FAIL; + CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); + + if(modem_ota_timer){ + osTimerStop(modem_ota_timer); + osTimerDelete(modem_ota_timer); + modem_ota_timer = NULL; + } + } + } +} + + +void start_mode_ota_timer() +{ + uint32_t tick; + osStatus_t retTimer; + if(modem_ota_timer == NULL){ + modem_ota_timer = osTimerNew((osTimerFunc_t)modem_ota_timer_CallBack, osTimerPeriodic, NULL, NULL); + tick = 5000;// osMs2Tick(1000); + retTimer = osTimerStart(modem_ota_timer, tick); + if (retTimer != osOK && modem_ota_timer != NULL) { + cat1_print_err("StartCallTimer osTimerStart failed, ret = %lx!!", retTimer); + osTimerDelete(modem_ota_timer); + modem_ota_timer = NULL; + } + } + +} +void star_http_ota_updata(char*buf_1,char* buf_2,uint8_t ver) +{ + int ret=0; + char * send_buf=(char *) malloc(strlen(buf_1)+strlen(buf_2)+40); + memset(send_buf,0,strlen(buf_1)+strlen(buf_2)+40); + + sprintf(send_buf,"%s and %s",buf_1,buf_2); + // sprintf(send_buf,"%s and %s","http://snicker.com.cn:8089/FD230/PY_SRV_V19/dfota_1.bin","http://snicker.com.cn:8089/FD230/PY_SRV_V19/dfota_2.bin"); + + uint8_t TRANSMIT_DATA=START_CAT1_OTA; + + CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); + + + old_model_ver=ver; + + + send_fota_url(send_buf); + + g_py_ver_new=1; + + start_mode_ota_timer(); + + free(send_buf); +} + #ifdef __cplusplus -- 2.17.1