增加cat modem升级UI
authorhcj <1224667075@qq.com>
Wed, 30 Jul 2025 06:13:22 +0000 (14:13 +0800)
committerhcj <1224667075@qq.com>
Wed, 30 Jul 2025 06:13:22 +0000 (14:13 +0800)
code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp
code/sdk/drivers/peripheral/slip/cat1Service/cat1_at_cmd.cpp
code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp
code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.h
code/sdk/drivers/peripheral/slip/cat1Service/cat1_tcpServer.cpp
code/sdk/drivers/peripheral/slip/cat1Service/http_cat1_ota.cpp

index 40e1ecd..3c6823e 100644 (file)
@@ -372,23 +372,23 @@ bool chat_ws_url_init(char * put_buf,uint8_t type)
         }
         else if(type_ai==AI_TYPE_DOU)
         {
-            sprintf(put_buf,"ws://%s/chat/ws?device_id=%s&product_id=%s&platform=huoshan",Service_url,device_id,product_id);
+            sprintf(put_buf,"ws://%s/chat/ws?platform=huoshan",Service_url);
         }
         else if(type_ai==AI_TYPE_WEN)
         {
-            sprintf(put_buf,"ws://%s/chat/ws?device_id=%s&product_id=%s&platform=baidu",Service_url,device_id,product_id);
+            sprintf(put_buf,"ws://%s/chat/ws?platform=baidu",Service_url);
         }
         else if(type_ai==AI_TYPE_KIMI)
         {
-            sprintf(put_buf,"ws://%s/chat/ws?device_id=%s&product_id=%s&platform=moonshot",Service_url,device_id,product_id);
+            sprintf(put_buf,"ws://%s/chat/ws?platform=moonshot",Service_url);
         }
             else if(type_ai==AI_TYPE_DE)
         {
-            sprintf(put_buf,"ws://%s/chat/ws?device_id=%s&product_id=%s&platform=huoshan&model=ep-20250205103849-582m7",Service_url,device_id,product_id);
+            sprintf(put_buf,"ws://%s/chat/ws?platform=huoshan&model=ep-20250205103849-582m7",Service_url);
         }
         else 
         {
-            sprintf(put_buf,"ws://%s/chat/ws?device_id=%s&product_id=%s&platform=aliyun",Service_url,device_id,product_id);
+            sprintf(put_buf,"ws://%s/chat/ws?platform=aliyun",Service_url);
         }
         return false;
     }
index 4209627..f4f399e 100644 (file)
@@ -681,7 +681,7 @@ static uint32_t sendfotaurl(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
         printf("CAT1TEST ATCMD Convert Command Failed\n");
         return ERRCODE_FAIL;
     }
-    star_http_ota_updata(19);
+    // star_http_ota_updata(19);
     return 0;
 }
 
index 44f5c13..4d0e8a9 100644 (file)
@@ -267,6 +267,8 @@ static uint8_t PY_SRV_VER_CURRENT = 0;
 uint8_t g_py_ver = 4;
 
 
+uint8_t g_py_ver_new = 0;
+
 static osTimerId_t g_timer_time_answer = NULL;
 
 static osTimerId_t g_timer_time_Dial = NULL;
@@ -1523,6 +1525,10 @@ 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;
+                }
                
 
                 if(sntp_enabled()==0)
index 6e2e7c4..5637de6 100644 (file)
@@ -66,7 +66,7 @@ void cat1_call_hungup_timer(void);
 
 void send_fota_url(char *buf);
 
-void star_http_ota_updata(uint8_t ver);
+void star_http_ota_updata(char*mod_ver,uint8_t ver);
 
 #ifdef __cplusplus
 #if __cplusplus
index c1d7d18..b573038 100644 (file)
@@ -811,6 +811,7 @@ void start_cat1_ota(void){
     uint8_t TRANSMIT_DATA=START_CAT1_OTA;
                     
     CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1);
+
     uapi_cat1_keep_wakeup(1);
 }
 void Cat1_OTA(uint8_t ota_state)
@@ -1185,6 +1186,8 @@ void re_connect(void)
 uint8_t errno_count=0;
 static uint8_t IS_need_ota=1;
 extern uint8_t g_py_ver;
+
+
 void cat1_server_file_task(void *pvParameters)
 {
     char rx_buffer[512];
@@ -1265,17 +1268,9 @@ void cat1_server_file_task(void *pvParameters)
             else if (g_py_ver>=19 && (uapi_dev_runtime_get_cat1_networkstat()) )
             {
                 char * cat1_modemver = uapi_dev_runtime_get_cat1_modemver();
-                if(g_py_ver==19)
-                {
-                    if(strcmp(cat1_modemver, "EG810MCNLAR06A01M08_VOLTE_OCPU_QPY_TEST0630")!=0)
-                    {
-                        star_http_ota_updata(g_py_ver);
-                    }
-                }
-                else
-                {
-                    star_http_ota_updata(g_py_ver);
-                }
+
+                star_http_ota_updata(cat1_modemver ,g_py_ver);
+                
                
             }
             
index b0312fd..cbbc1bb 100644 (file)
@@ -205,20 +205,83 @@ static void  read_http_get_ota_url_file(char *out_put_url)
     }
 }
 
+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) {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"StartCallTimer osTimerStart failed, ret = %lx!!", retTimer);
+            osTimerDelete(modem_ota_timer);
+            modem_ota_timer = NULL;
+        }
+    }
+
+}
+
+
+
+
 
 // 
 // http://snicker.com.cn:8089/FD230/PY_SRV_V19/dfota_2.bin
 
-void star_http_ota_updata(uint8_t ver)
+void star_http_ota_updata(char*mod_ver, uint8_t ver)
 {
     int ret=0;
     char buf_1[256]={0};
-    char PY_BUF_1[32]={0};
-    sprintf(PY_BUF_1,"PY%d_1",ver);
+    char PY_BUF_1[128]={0};
+    sprintf(PY_BUF_1,"%s_PY%d_1",mod_ver,ver);
     ret = http_get_ota_url(buf_1,PY_BUF_1);
 
-    char PY_BUF_2[32]={0};
-    sprintf(PY_BUF_2,"PY%d_2",ver);
+    char PY_BUF_2[128]={0};
+    sprintf(PY_BUF_2,"%s_PY%d_2",mod_ver,ver);
     ret = http_get_ota_url(buf_1,PY_BUF_2);
 
     for (int i = 0;  i <3; i++)
@@ -259,8 +322,23 @@ void star_http_ota_updata(uint8_t ver)
     // 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");
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s ",send_buf);
 
+    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);
 }
 // http_get_ota_url()
\ No newline at end of file