Check the wifi state when active & deactive 57/83057/1 accepted/tizen/common/20160809.184132 accepted/tizen/ivi/20160809.232842 accepted/tizen/mobile/20160809.232934 accepted/tizen/tv/20160809.232805 accepted/tizen/wearable/20160809.232912 submit/tizen/20160809.065304
authortaesubkim <taesub.kim@samsung.com>
Tue, 9 Aug 2016 03:53:05 +0000 (12:53 +0900)
committertaesubkim <taesub.kim@samsung.com>
Tue, 9 Aug 2016 03:53:08 +0000 (12:53 +0900)
Change-Id: Ic7cfb01de0fbe852c837a7238284100a0651bb63
Signed-off-by: Taesub Kim <taesub.kim@samsung.com>
packaging/capi-network-wifi.spec
test/wifi_test.c

index d3230555fe9acbabb890a0c89c1c46eb5ef46f8c..dd9821d186318631f7cbd9fcc7ce89b7e254946a 100755 (executable)
@@ -1,6 +1,6 @@
 Name:          capi-network-wifi
 Summary:       Network Wi-Fi library in TIZEN C API
-Version:       1.0.77
+Version:       1.0.78
 Release:       1
 Group:         System/Network
 License:       Apache-2.0
index 2f61cbf69e28587705de666d126778a5cc524067..a809dfe87c0b89afc504f9acd9069512d5aa6ec2 100755 (executable)
@@ -1080,14 +1080,21 @@ int test_wifi_activate(void)
 {
        int rv = 0;
 
-       rv = wifi_activate(__test_activated_callback, NULL);
+       bool state = false;
 
-       if (rv != WIFI_ERROR_NONE) {
-               printf("Fail to activate Wi-Fi device [%s]\n", __test_convert_error_to_string(rv));
-               return -1;
-       }
+       rv = wifi_is_activated(&state);
+
+       if(state != true) {
+               rv = wifi_activate(__test_activated_callback, NULL);
 
-       printf("Success to activate Wi-Fi device\n");
+               if (rv != WIFI_ERROR_NONE) {
+                       printf("Fail to activate Wi-Fi device [%s]", __test_convert_error_to_string(rv));
+                       return -1;
+               }
+       }
+       else {
+               __test_activated_callback(WIFI_ERROR_NONE, NULL);
+       }
 
        return 1;
 }
@@ -1095,15 +1102,21 @@ int test_wifi_activate(void)
 int test_wifi_deactivate(void)
 {
        int rv = 0;
+       bool state = false;
 
-       rv = wifi_deactivate(__test_deactivated_callback, NULL);
+       rv = wifi_is_activated(&state);
 
-       if (rv != WIFI_ERROR_NONE) {
-               printf("Fail to deactivate Wi-Fi device [%s]\n", __test_convert_error_to_string(rv));
-               return -1;
-       }
+       if(state == true) {
+               rv = wifi_deactivate(__test_deactivated_callback, NULL);
 
-       printf("Success to deactivate Wi-Fi device\n");
+               if (rv != WIFI_ERROR_NONE) {
+                       printf("Fail to deactivate Wi-Fi device [%s]\n", __test_convert_error_to_string(rv));
+                       return -1;
+               }
+       }
+       else {
+               __test_deactivated_callback(WIFI_ERROR_NONE, NULL);
+       }
 
        return 1;
 }