雷鸟:删除无用代码
authorluozheng <1732036298@qq.com>
Mon, 29 Sep 2025 02:02:07 +0000 (10:02 +0800)
committerluozheng <1732036298@qq.com>
Mon, 29 Sep 2025 02:02:07 +0000 (10:02 +0800)
code/sdk/zhihui/leiniao/imsl_ln/leiniao_api_at.c
code/sdk/zhihui/leiniao/imsl_ln/ln_api.c
code/sdk/zhihui/leiniao/imsl_ln/ln_api.h
code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.cpp
code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.h

index 2d62492..dfa8798 100644 (file)
@@ -1740,73 +1740,6 @@ static uint32_t ln_switch_expression_at(uint8_t *para, uint32_t paraLen, char *s
     }
 }
 
-/* AT^LN_CHECK_INTERNET - 检测是否有外网连接 */
-static uint32_t ln_check_internet_at(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
-{
-    VAD_UNUSED(para);
-    VAD_UNUSED(paraLen);
-    VAD_UNUSED(strCommonCmd);
-    
-    printf("[LN][CHECK_INTERNET] Checking internet connection...\n");
-    
-    // 调用C接口检测网络连接
-    int result = check_internet_connection();
-    
-    if (result == 1) {
-        printf("[LN][CHECK_INTERNET] Internet connection: AVAILABLE\n");
-        printf("+LN_CHECK_INTERNET: OK\n");
-    } else if (result == 0) {
-        printf("[LN][CHECK_INTERNET] Internet connection: NOT AVAILABLE\n");
-        printf("+LN_CHECK_INTERNET: NO_CONNECTION\n");
-    } else {
-        printf("[LN][CHECK_INTERNET] Internet connection: CHECK_FAILED\n");
-        printf("+LN_CHECK_INTERNET: ERROR\n");
-        return ERRCODE_FAIL;
-    }
-    
-    return ERRCODE_SUCC;
-}
-
-/* AT^LN_CHECK_DNS - 检测DNS解析 */
-static uint32_t ln_check_dns_at(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
-{
-    VAD_UNUSED(strCommonCmd);
-    
-    const char *hostname = "www.baidu.com"; // 默认测试主机
-    
-    // 解析参数
-    if (para != NULL && paraLen > 0) {
-        char hostname_str[256] = {0};
-        if (paraLen >= sizeof(hostname_str)) {
-            printf("[LN][CHECK_DNS] Error: Hostname too long (max 255 characters)\n");
-            return ERRCODE_FAIL;
-        }
-        
-        memcpy(hostname_str, para, paraLen);
-        hostname_str[paraLen] = '\0';
-        hostname = hostname_str;
-    }
-    
-    printf("[LN][CHECK_DNS] Checking DNS resolution for: %s\n", hostname);
-    
-    // 调用C接口检测DNS解析
-    int result = check_dns_resolution(hostname);
-    
-    if (result == 1) {
-        printf("[LN][CHECK_DNS] DNS resolution: SUCCESS\n");
-        printf("+LN_CHECK_DNS: OK\n");
-    } else if (result == 0) {
-        printf("[LN][CHECK_DNS] DNS resolution: FAILED\n");
-        printf("+LN_CHECK_DNS: FAIL\n");
-    } else {
-        printf("[LN][CHECK_DNS] DNS resolution: ERROR\n");
-        printf("+LN_CHECK_DNS: ERROR\n");
-        return ERRCODE_FAIL;
-    }
-    
-    return ERRCODE_SUCC;
-}
-
 /* AT^LN_API_ERROR - 推送协议错误 */
 static uint32_t ln_api_error_at(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
 {
@@ -1916,10 +1849,6 @@ static const at_cmd_table_t g_ln_api_cmd[] = {
     //帧率控制
     {(char *)"AT^LN_SET_FPS", ln_set_fps_at, (char *)"设置帧率: AT^LN_SET_FPS=<fps_value>"},
     {(char *)"AT^LN_GET_FPS", ln_get_fps_at, (char *)"获取当前帧率: AT^LN_GET_FPS"},
-    
-    //网络检测
-    {(char *)"AT^LN_CHECK_INTERNET", ln_check_internet_at, (char *)"检测外网连接: AT^LN_CHECK_INTERNET"},
-    {(char *)"AT^LN_CHECK_DNS", ln_check_dns_at, (char *)"检测DNS解析: AT^LN_CHECK_DNS[=hostname]"},
 };
 
 
index 41dd733..9f0a85e 100644 (file)
@@ -1225,92 +1225,4 @@ errcode_t uapi_ln_http_server_init(void)
     ln_load_init_config();
 
     return ERRCODE_SUCC;
-}
-
-/* ============================ 网络连接检测函数 ============================ */
-
-/**
- * @brief 检测DNS解析是否正常(判断是否有外网连接)
- * @param hostname 要解析的主机名
- * @return 1: 解析成功(有外网) 0: 解析失败(无外网) -1: 参数错误
- */
-int uapi_ln_check_dns_resolution(const char *hostname)
-{
-    if (hostname == NULL || strlen(hostname) == 0) {
-        printf("[LN_NET] Error: hostname is NULL or empty\n");
-        return -1;
-    }
-    
-    printf("[LN_NET] Checking DNS resolution for: %s\n", hostname);
-    
-    struct hostent *host_entry = NULL;
-    
-    // 使用lwip_gethostbyname进行DNS解析
-    host_entry = lwip_gethostbyname(hostname);
-    
-    if (host_entry == NULL) {
-        printf("[LN_NET] DNS resolution failed for: %s\n", hostname);
-        return 0; // 解析失败,无外网
-    }
-    
-    printf("[LN_NET] DNS resolution successful for: %s\n", hostname);
-    printf("[LN_NET] Host name: %s\n", host_entry->h_name);
-    
-    // 打印解析到的IP地址
-    if (host_entry->h_addr_list && host_entry->h_addr_list[0]) {
-        struct in_addr addr;
-        memcpy(&addr, host_entry->h_addr_list[0], sizeof(addr));
-        printf("[LN_NET] IP address: %s\n", inet_ntoa(addr));
-    }
-    
-    return 1; // 解析成功,有外网
-}
-
-/**
- * @brief 检测是否有外网连接
- * 通过尝试解析多个公共DNS服务器来判断网络连接状态
- * @return 1: 有外网连接 0: 无外网连接 -1: 检测失败
- */
-int uapi_ln_check_internet_connection(void)
-{
-    printf("[LN_NET] Checking internet connection...\n");
-    
-    // 定义要测试的公共DNS服务器列表
-    const char *test_hosts[] = {
-        "223.5.5.5",         // 阿里DNS
-        "183.2.172.17",     // 百度
-    };
-    
-    int test_count = sizeof(test_hosts) / sizeof(test_hosts[0]);
-    int success_count = 0;
-    
-    for (int i = 0; i < test_count; i++) {
-        printf("[LN_NET] Testing host %d/%d: %s\n", i + 1, test_count, test_hosts[i]);
-        
-        int result = uapi_ln_check_dns_resolution(test_hosts[i]);
-        if (result == 1) {
-            success_count++;
-            printf("[LN_NET] Host %s resolved successfully\n", test_hosts[i]);
-        } else if (result == 0) {
-            printf("[LN_NET] Host %s resolution failed\n", test_hosts[i]);
-        } else {
-            printf("[LN_NET] Host %s test error\n", test_hosts[i]);
-        }
-        
-        // 如果已经有成功的解析,可以提前返回
-        if (success_count > 0) {
-            break;
-        }
-    }
-    
-    if (success_count > 0) {
-        printf("[LN_NET] Internet connection detected (%d/%d hosts resolved)\n", 
-               success_count, test_count);
-        return 1; // 有外网连接
-    } else {
-        printf("[LN_NET] No internet connection detected (0/%d hosts resolved)\n", test_count);
-        return 0; // 无外网连接
-    }
-}
-
-/* ============================ 队列相关代码 End ============================ */
\ No newline at end of file
+}
\ No newline at end of file
index 5c3695c..d3756df 100644 (file)
@@ -198,10 +198,6 @@ const char *uapi_ln_get_user_id(void);
 /*文件下载函数:从URL下载到指定路径*/
 int uapi_ln_download_file(const char *url, const char *save_path);
 
-/*网络连接检测函数*/
-int uapi_ln_check_internet_connection(void);
-int uapi_ln_check_dns_resolution(const char *hostname);
-
 /* ============================== 共享全局状态(跨文件) ============================== */
 extern char *g_device_token;
 extern int g_ln_last_update_type;
index ca7763f..febdf30 100644 (file)
@@ -8,12 +8,6 @@
 #include <cstring>
 #include "wearable_log.h"
 
-// 前向声明网络检测函数,避免循环依赖
-extern "C" {
-    int uapi_ln_check_internet_connection(void);
-    int uapi_ln_check_dns_resolution(const char *hostname);
-}
-
 #ifdef __cplusplus
 extern "C"
 {
@@ -227,17 +221,6 @@ void push_screen_image_download_success_notification(void)
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SCREEN_IMAGE_DOWNLOAD_SUCCESS]");
     SendMsgToUIService(HAND_SCREEN_IMAGE_DOWNLOAD_SUCCESS_NOTIFY, 0, NULL, 0);
 }
-// 检测是否有外网连接
-int check_internet_connection(void)
-{
-    return uapi_ln_check_internet_connection();
-}
-
-// 检测DNS解析是否正常
-int check_dns_resolution(const char *hostname)
-{
-    return uapi_ln_check_dns_resolution(hostname);
-}
 
 #ifdef __cplusplus
 };
index e97ce42..8bfe15e 100644 (file)
@@ -87,10 +87,6 @@ void push_bind_and_unbind_notification(int is_bind);
 // 推送屏保下载成功通知到UI
 void push_screen_image_download_success_notification(void);
 
-// 网络连接检测
-int check_internet_connection(void);
-int check_dns_resolution(const char *hostname);
-
 #ifdef __cplusplus
 }
 #endif