Delete the redundant code
authorChengyi Zhao <chengyi1.zhao@archermind.com>
Fri, 20 Jun 2014 07:27:54 +0000 (15:27 +0800)
committerZhang zhengguang <zhengguang.zhang@intel.com>
Thu, 26 Jun 2014 06:16:54 +0000 (14:16 +0800)
src/include/common.h
src/wifi-internal.c
test/wifi_test.c

index 2ae94fb01edd4a5db8197187f1795eb5524eab3f..386014760103d42ef0aee9991bfcfe462ed2c90e 100644 (file)
@@ -412,13 +412,6 @@ typedef enum {
        WLAN_SEC_EAP_AUTH_MD5,
 } wlan_eap_auth_type_t;
 
-/*
-========================================================================
-                                            MACROS
-========================================================================
-*/
-
-
 /*======================================================================
                                  STRUCTURES AND OTHER TYPEDEFS
 =====================================================++================*/
index d11e19bd6b563ae90cc892ae7b46f004d25aac9f..abfabd267b34aeb1d3091a0eb3fc102f50fd8c33 100755 (executable)
@@ -466,44 +466,6 @@ static int __libnet_connect_with_wifi_info(wifi_ap_h ap_h,
        return WIFI_ERROR_NONE;
 }
 
-static void __libnet_set_activated_cb(wifi_activated_cb user_cb,
-                                                       void *user_data)
-{
-       if (user_cb) {
-               wifi_callbacks.activated_cb = user_cb;
-               wifi_callbacks.activated_user_data = user_data;
-       }
-}
-
-static void __libnet_activated_cb(wifi_error_e result)
-{
-       if (wifi_callbacks.activated_cb)
-               wifi_callbacks.activated_cb(result,
-                               wifi_callbacks.activated_user_data);
-
-       wifi_callbacks.activated_cb = NULL;
-       wifi_callbacks.activated_user_data = NULL;
-}
-
-static void __libnet_set_deactivated_cb(wifi_disconnected_cb user_cb,
-                                                       void *user_data)
-{
-       if (user_cb) {
-               wifi_callbacks.deactivated_cb = user_cb;
-               wifi_callbacks.deactivated_user_data = user_data;
-       }
-}
-
-static void __libnet_deactivated_cb(wifi_error_e result)
-{
-       if (wifi_callbacks.deactivated_cb)
-               wifi_callbacks.deactivated_cb(result,
-                               wifi_callbacks.deactivated_user_data);
-
-       wifi_callbacks.deactivated_cb = NULL;
-       wifi_callbacks.deactivated_user_data = NULL;
-}
-
 static void __libnet_set_scan_request_cb(wifi_disconnected_cb user_cb,
                                                        void *user_data)
 {
@@ -632,24 +594,6 @@ static void technology_added_callback(
                                                user_data);
 }
 
-static void __connman_technology_powered_on_cb(
-                                       enum connman_lib_err_e result,
-                                       void *user_data)
-{
-       WIFI_LOG(WIFI_INFO, "callback: %d\n", result);
-
-       __libnet_activated_cb(connman_lib2capi_result(result));
-}
-
-static void __connman_technology_powered_off_cb(
-                                       enum connman_lib_err_e result,
-                                       void *user_data)
-{
-       WIFI_LOG(WIFI_INFO, "callback: %d\n", result);
-
-       __libnet_deactivated_cb(connman_lib2capi_result(result));
-}
-
 bool _wifi_libnet_init(void)
 {
        struct connman_technology *technology;
@@ -693,11 +637,7 @@ int _wifi_activate(wifi_activated_cb callback, void *user_data)
        if (!technology)
                return WIFI_ERROR_OPERATION_FAILED;
 
-       __libnet_set_activated_cb(callback, user_data);
-
-       connman_enable_technology(technology,
-                                       __connman_technology_powered_on_cb,
-                                       NULL);
+       connman_enable_technology(technology);
 
        return WIFI_ERROR_NONE;
 }
@@ -709,11 +649,7 @@ int _wifi_deactivate(wifi_deactivated_cb callback, void *user_data)
        if (!technology)
                return WIFI_ERROR_OPERATION_FAILED;
 
-       __libnet_set_deactivated_cb(callback, user_data);
-
-       connman_disable_technology(technology,
-                                       __connman_technology_powered_off_cb,
-                                       NULL);
+       connman_disable_technology(technology);
 
        if (winet_wifi_set_work_mode(WIFI_WORK_MODE_OFF) < 0)
                return WIFI_ERROR_OPERATION_FAILED;
index 49defeba2de0ba89f3be4b189353f6d36d8c822a..0cc5c26585bc8a30f8071b1d95aecd92e0efe1bc 100644 (file)
@@ -527,11 +527,6 @@ static bool __test_found_print_ap_info_callback(wifi_ap_h ap, void *user_data)
        int int_value;
        wifi_connection_state_e conn_state;
        wifi_ip_config_type_e ip_type;
-       wifi_proxy_type_e proxy_type;
-       wifi_security_type_e sec_type;
-       wifi_encryption_type_e enc_type;
-       wifi_eap_type_e eap_type;
-       wifi_eap_auth_type_e eap_auth_type;
        bool bool_value;
        char *ap_name_part = (char*)user_data;
 
@@ -602,92 +597,6 @@ static bool __test_found_print_ap_info_callback(wifi_ap_h ap, void *user_data)
                } else
                        printf("Fail to get Gateway\n");
 
-               if (wifi_ap_get_proxy_type(ap, &proxy_type) == WIFI_ERROR_NONE)
-                       printf("Proxy type : %d\n", proxy_type);
-               else
-                       printf("Fail to get Proxy type\n");
-
-/*             if (wifi_ap_get_proxy_address(ap, WIFI_ADDRESS_FAMILY_IPV4, &str_value) == WIFI_ERROR_NONE) {
-                       printf("Proxy : %s\n", str_value);
-                       g_free(str_value);
-               } else
-                       printf("Fail to get Proxy\n");
-
-               if (wifi_ap_get_dns_address(ap, 1, WIFI_ADDRESS_FAMILY_IPV4, &str_value) == WIFI_ERROR_NONE) {
-                       printf("DNS1 : %s\n", str_value);
-                       g_free(str_value);
-               } else
-                       printf("Fail to get DNS1\n");
-
-               if (wifi_ap_get_dns_address(ap, 2, WIFI_ADDRESS_FAMILY_IPV4, &str_value) == WIFI_ERROR_NONE) {
-                       printf("DNS2 : %s\n", str_value);
-                       g_free(str_value);
-               } else
-                       printf("Fail to get DNS2\n");*/
-
-               /* Security info */
-               if (wifi_ap_get_security_type(ap, &sec_type) == WIFI_ERROR_NONE)
-                       printf("Security type : %d\n", sec_type);
-               else
-                       printf("Fail to get Security type\n");
-
-               if (wifi_ap_get_encryption_type(ap, &enc_type) == WIFI_ERROR_NONE)
-                       printf("Encryption type : %d\n", enc_type);
-               else
-                       printf("Fail to get Encryption type\n");
-
-               if (wifi_ap_is_passphrase_required(ap, &bool_value) == WIFI_ERROR_NONE)
-                       printf("Passphrase required : %s\n", bool_value ? "TRUE" : "FALSE");
-               else
-                       printf("Fail to get Passphrase required\n");
-
-               if (wifi_ap_is_wps_supported(ap, &bool_value) == WIFI_ERROR_NONE)
-                       printf("WPS supported : %s\n", bool_value ? "TRUE" : "FALSE");
-               else
-                       printf("Fail to get WPS supported\n");
-
-               if (sec_type != WIFI_SECURITY_TYPE_EAP) {
-                       g_free(ap_name);
-                       wifi_ap_destroy(ap);
-                       return false;
-               }
-
-               /* EAP info */
-               if (wifi_ap_get_eap_type(ap, &eap_type) == WIFI_ERROR_NONE)
-                       printf("EAP type : %d\n", eap_type);
-               else
-                       printf("Fail to get EAP type\n");
-
-               if (wifi_ap_get_eap_auth_type(ap, &eap_auth_type) == WIFI_ERROR_NONE)
-                       printf("EAP auth type : %d\n", eap_auth_type);
-               else
-                       printf("Fail to get EAP auth type\n");
-
-               if (wifi_ap_get_eap_passphrase(ap, &str_value, &bool_value) == WIFI_ERROR_NONE) {
-                       printf("EAP user name : %s\n", str_value);
-                       printf("EAP is password setted : %s\n", bool_value ? "TRUE" : "FALSE");
-                       g_free(str_value);
-               } else
-                       printf("Fail to get EAP passphrase(user name/password)\n");
-
-               if (wifi_ap_get_eap_ca_cert_file(ap, &str_value) == WIFI_ERROR_NONE) {
-                       printf("EAP ca cert file : %s\n", str_value);
-                       g_free(str_value);
-               } else
-                       printf("Fail to get EAP ca cert file\n");
-
-               if (wifi_ap_get_eap_client_cert_file(ap, &str_value) == WIFI_ERROR_NONE) {
-                       printf("EAP client cert file : %s\n", str_value);
-                       g_free(str_value);
-               } else
-                       printf("Fail to get EAP client cert file\n");
-
-               if (wifi_ap_get_eap_private_key_file(ap, &str_value) == WIFI_ERROR_NONE) {
-                       printf("EAP private key file : %s\n", str_value);
-                       g_free(str_value);
-               } else
-                       printf("Fail to get EAP private key file\n");
-
                g_free(ap_name);
                wifi_ap_destroy(ap);
                return false;
@@ -1092,20 +1001,15 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
                printf("4       - Deactivate Wi-Fi device\n");
                printf("5       - Is Wi-Fi activated?\n");
                printf("6       - Get connection state\n");
-               printf("7       - Get MAC address\n");
-               printf("8       - Get Wi-Fi interface name\n");
-               printf("9       - Scan request\n");
+               printf("7       - Scan request\n");
                printf("a       - Get Connected AP\n");
                printf("b       - Get AP list\n");
                printf("c       - Connect\n");
                printf("d       - Disconnect\n");
-               printf("e       - Connect by wps pbc\n");
                printf("f       - Forget an AP\n");
-               printf("g       - Set & connect EAP\n");
                printf("h       - Set IP method type\n");
                printf("i       - Set Proxy method type\n");
                printf("j       - Get AP info\n");
-               printf("k       - Scan hidden AP\n");
                printf("0       - Exit \n");
 
                printf("ENTER  - Show options menu.......\n");
@@ -1131,12 +1035,6 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
                rv = test_get_connection_state();
                break;
        case '7':
-               rv = test_get_mac_address(); /*TODO*/
-               break;
-       case '8':
-               rv = test_get_interface_name(); /*TODO*/
-               break;
-       case '9':
                rv = test_scan_request();
                break;
        case 'a':