{
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;
}
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;
}