lwip添加tcp tls支持 ,修改AT^DOWNLOADOTA指令尝试支持https下载
authorSnickerSun <snickersun@163.com>
Sun, 21 Apr 2024 14:29:14 +0000 (22:29 +0800)
committerSnickerSun <snickersun@163.com>
Sun, 21 Apr 2024 14:29:14 +0000 (22:29 +0800)
code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c
code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/lwip/lwipopts.h

index 546ec99..a899a8a 100644 (file)
@@ -118,23 +118,25 @@ static uint32_t custom_start_ota_download(uint8_t *para, uint32_t paraLen, char
         return ERRCODE_FAIL;
     }
 
-    if (argc != 2) {
+    if (argc != 4) {
         PRINT("CUSTOM_UTILSTEST ATCMD Set Parameter Failed argc %d\n",argc);
         return ERRCODE_FAIL;
     }
 
     //通讯开始,唤醒cat1
     uapi_cat1_wakeup_cat1(1);
-    uint8_t *uri = (uint8_t*)argv[0];
-    uint8_t *otadatapath = (uint8_t*)argv[1];
-    PRINT("custom_start_ota_download %s to %s\r\n",uri,otadatapath);
+    uint8_t *server = (uint8_t*)argv[0];
+    uint8_t port = atoi((const char*)argv[1]);
+    uint8_t *uri = (uint8_t*)argv[2];
+    uint8_t *otadatapath = (uint8_t*)argv[3];
+    PRINT("custom_start_ota_download %s:%d %s to %s\r\n",server,port,uri,otadatapath);
     httpc_connection_t settings = {0};
     settings.result_fn=httpc_download_result;
     settings.headers_done_fn=httpc_download_headers_done;
     httpc_state_t* connection=NULL;
     err_t rett =  httpc_get_file_dns_to_disk(
-                    (const char*) "icfota.snicker.com.cn", 
-                    8089,
+                    (const char*) server, 
+                    port,
                     (const char*) uri,
                     (const httpc_connection_t *)&settings,
                      NULL, 
index ff0eff1..b362e4a 100644 (file)
 #define NO_SYS                          0
 #define TCP_QUEUE_OOSEQ                 LWIP_TCP
 
+#define LWIP_ALTCP                      1
+#define LWIP_ALTCP_TLS                  1
+
 #if defined LWIP_STATS_DISPLAY && !LWIP_STATS
 #undef LWIP_STATS_DISPLAY
 #define LWIP_STATS_DISPLAY              0