* @retval #WIFI_MANAGER_ERROR_NOT_INITIALIZED Not initialized
* @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WIFI_MANAGER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_MANAGER_ERROR_NOW_IN_PROGRESS Now in progress
* @retval #WIFI_MANAGER_ERROR_OPERATION_FAILED Operation failed
* @retval #WIFI_MANAGER_ERROR_SECURITY_RESTRICTED Restricted by security system policy
* @retval #WIFI_MANAGER_ERROR_PERMISSION_DENIED Permission Denied
* @retval #WIFI_MANAGER_ERROR_NOT_INITIALIZED Not initialized
* @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WIFI_MANAGER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_MANAGER_ERROR_NOW_IN_PROGRESS Now in progress
* @retval #WIFI_MANAGER_ERROR_OPERATION_FAILED Operation failed
* @retval #WIFI_MANAGER_ERROR_SECURITY_RESTRICTED Restricted by security system policy
* @retval #WIFI_MANAGER_ERROR_PERMISSION_DENIED Permission Denied
* @retval #WIFI_MANAGER_ERROR_NOT_INITIALIZED Not initialized
* @retval #WIFI_MANAGER_ERROR_INVALID_OPERATION Invalid operation
* @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WIFI_MANAGER_ERROR_NOW_IN_PROGRESS Now in progress
* @retval #WIFI_MANAGER_ERROR_OPERATION_FAILED Operation failed
* @retval #WIFI_MANAGER_ERROR_PERMISSION_DENIED Permission Denied
* @retval #WIFI_MANAGER_ERROR_NOT_SUPPORTED Not supported
* @retval #WIFI_MANAGER_ERROR_NOT_INITIALIZED Not initialized
* @retval #WIFI_MANAGER_ERROR_INVALID_OPERATION Invalid operation
* @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WIFI_MANAGER_ERROR_NOW_IN_PROGRESS Now in progress
* @retval #WIFI_MANAGER_ERROR_OPERATION_FAILED Operation failed
* @retval #WIFI_MANAGER_ERROR_PERMISSION_DENIED Permission Denied
* @retval #WIFI_MANAGER_ERROR_NOT_SUPPORTED Not supported
* @retval #WIFI_MANAGER_ERROR_NOT_INITIALIZED Not initialized
* @retval #WIFI_MANAGER_ERROR_INVALID_OPERATION Invalid operation
* @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WIFI_MANAGER_ERROR_NOW_IN_PROGRESS Now in progress
* @retval #WIFI_MANAGER_ERROR_OPERATION_FAILED Operation failed
* @retval #WIFI_MANAGER_ERROR_PERMISSION_DENIED Permission Denied
* @retval #WIFI_MANAGER_ERROR_NOT_SUPPORTED Not supported
* @retval #WIFI_MANAGER_ERROR_NOT_INITIALIZED Not initialized
* @retval #WIFI_MANAGER_ERROR_INVALID_OPERATION Invalid operation
* @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WIFI_MANAGER_ERROR_NOW_IN_PROGRESS Now in progress
* @retval #WIFI_MANAGER_ERROR_OPERATION_FAILED Operation failed
* @retval #WIFI_MANAGER_ERROR_PERMISSION_DENIED Permission denied
* @retval #WIFI_MANAGER_ERROR_NOT_SUPPORTED Not supported
* @retval #WIFI_MANAGER_ERROR_NOT_INITIALIZED Not initialized
* @retval #WIFI_MANAGER_ERROR_INVALID_OPERATION Invalid operation
* @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WIFI_MANAGER_ERROR_NOW_IN_PROGRESS Now in progress
* @retval #WIFI_MANAGER_ERROR_OPERATION_FAILED Operation failed
* @retval #WIFI_MANAGER_ERROR_PERMISSION_DENIED Permission denied
* @retval #WIFI_MANAGER_ERROR_NOT_SUPPORTED Not supported
__convert_profile_info_to_wifi_info(&wifi_info, ap_info);
rv = net_open_connection_with_wifi_info(&wifi_info);
- if (rv == NET_ERR_ACCESS_DENIED) {
- WIFI_LOG(WIFI_ERROR, "Access denied"); //LCOV_EXCL_LINE
- return WIFI_MANAGER_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
- } else if (rv != NET_ERR_NONE)
- return WIFI_MANAGER_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ return rv;
return WIFI_MANAGER_ERROR_NONE;
}
int rv = NET_ERR_NONE;
rv = net_wifi_power_on(wifi_picker_test);
- if (rv == NET_ERR_ACCESS_DENIED) {
- WIFI_LOG(WIFI_ERROR, "Access denied"); //LCOV_EXCL_LINE
- return WIFI_MANAGER_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
- } else if (rv == NET_ERR_INVALID_OPERATION) {
- return WIFI_MANAGER_ERROR_INVALID_OPERATION; //LCOV_EXCL_LINE
- } else if (rv == NET_ERR_ALREADY_EXISTS) {
- return WIFI_MANAGER_ERROR_ALREADY_EXISTS; //LCOV_EXCL_LINE
- } else if (rv == NET_ERR_IN_PROGRESS) {
- return WIFI_MANAGER_ERROR_NOW_IN_PROGRESS; //LCOV_EXCL_LINE
- } else if (rv == NET_ERR_SECURITY_RESTRICTED) {
- return WIFI_MANAGER_ERROR_SECURITY_RESTRICTED; //LCOV_EXCL_LINE
- } else if (rv == NET_ERR_NONE) {
+ rv = __convert_to_ap_error_type(rv);
+ if (rv == WIFI_MANAGER_ERROR_NONE)
__set_activated_cb(wifi, callback, user_data);
- return WIFI_MANAGER_ERROR_NONE;
- }
-
- return WIFI_MANAGER_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ return rv;
}
int _wifi_deactivate(wifi_manager_h wifi, wifi_manager_deactivated_cb callback, void *user_data)
int rv = NET_ERR_NONE;
rv = net_wifi_power_off();
- if (rv == NET_ERR_ACCESS_DENIED) {
- WIFI_LOG(WIFI_ERROR, "Access denied"); //LCOV_EXCL_LINE
- return WIFI_MANAGER_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
- } else if (rv == NET_ERR_INVALID_OPERATION) {
- return WIFI_MANAGER_ERROR_INVALID_OPERATION; //LCOV_EXCL_LINE
- } else if (rv == NET_ERR_ALREADY_EXISTS) {
- return WIFI_MANAGER_ERROR_ALREADY_EXISTS; //LCOV_EXCL_LINE
- } else if (rv == NET_ERR_IN_PROGRESS) {
- return WIFI_MANAGER_ERROR_NOW_IN_PROGRESS; //LCOV_EXCL_LINE
- } else if (rv == NET_ERR_SECURITY_RESTRICTED) {
- return WIFI_MANAGER_ERROR_SECURITY_RESTRICTED; //LCOV_EXCL_LINE
- } else if (rv == NET_ERR_NONE) {
+ rv = __convert_to_ap_error_type(rv);
+ if (rv == WIFI_MANAGER_ERROR_NONE)
__set_deactivated_cb(wifi, callback, user_data);
- return WIFI_MANAGER_ERROR_NONE;
- }
- return WIFI_MANAGER_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ return rv;
}
wps_info.type = WIFI_WPS_PBC;
rv = net_wifi_enroll_wps(ap_info->ProfileName, &wps_info);
- if (rv == NET_ERR_ACCESS_DENIED) {
- WIFI_LOG(WIFI_ERROR, "Access denied");
- return WIFI_MANAGER_ERROR_PERMISSION_DENIED;
- } else if (rv != NET_ERR_NONE) {
- return WIFI_MANAGER_ERROR_OPERATION_FAILED;
- }
+ if (rv != NET_ERR_NONE)
+ return __convert_to_ap_error_type(rv);
__set_connected_cb(wifi, callback, user_data);
g_strlcpy(wps_info.pin, pin, NET_WLAN_MAX_WPSPIN_LEN + 1);
rv = net_wifi_enroll_wps(ap_info->ProfileName, &wps_info);
- if (rv == NET_ERR_ACCESS_DENIED) {
- WIFI_LOG(WIFI_ERROR, "Access denied");
- return WIFI_MANAGER_ERROR_PERMISSION_DENIED;
- } else if (rv != NET_ERR_NONE) {
- return WIFI_MANAGER_ERROR_OPERATION_FAILED;
- }
+ if (rv != NET_ERR_NONE)
+ return __convert_to_ap_error_type(rv);
__set_connected_cb(wifi, callback, user_data);
int _wifi_connect_with_wps_pbc_without_ssid(wifi_manager_h wifi,
wifi_manager_connected_cb callback, void *user_data)
{
+ int rv;
net_wifi_wps_info_s wps_info;
net_profile_info_s *profile = NULL;
GSList *list;
profile->ProfileState == NET_STATE_TYPE_CONFIGURATION ||
profile->ProfileState == NET_STATE_TYPE_READY ||
profile->ProfileState == NET_STATE_TYPE_ONLINE) {
- if (net_close_connection(profile->ProfileName) != NET_ERR_NONE)
- return WIFI_MANAGER_ERROR_OPERATION_FAILED;
+ rv = net_close_connection(profile->ProfileName);
+ if (rv != NET_ERR_NONE)
+ return __convert_to_ap_error_type(rv);
is_disconnect_wps_pbc = true;
}
}
- if (!is_disconnect_wps_pbc)
- if (net_wifi_enroll_wps_without_ssid(&wps_info) != NET_ERR_NONE)
- return WIFI_MANAGER_ERROR_OPERATION_FAILED;
+ if (!is_disconnect_wps_pbc) {
+ rv = net_wifi_enroll_wps_without_ssid(&wps_info);
+ if (rv != NET_ERR_NONE)
+ return __convert_to_ap_error_type(rv);
+ }
__set_connected_cb(wifi, callback, user_data);
int _wifi_connect_with_wps_pin_without_ssid(wifi_manager_h wifi, const char *pin,
wifi_manager_connected_cb callback, void* user_data)
{
+ int rv;
net_wifi_wps_info_s wps_info;
net_profile_info_s *profile = NULL;
GSList *list;
profile->ProfileState == NET_STATE_TYPE_CONFIGURATION ||
profile->ProfileState == NET_STATE_TYPE_READY ||
profile->ProfileState == NET_STATE_TYPE_ONLINE) {
- if (net_close_connection(profile->ProfileName) != NET_ERR_NONE)
- return WIFI_MANAGER_ERROR_OPERATION_FAILED;
+ rv = net_close_connection(profile->ProfileName);
+ if (rv != NET_ERR_NONE)
+ return __convert_to_ap_error_type(rv);
is_disconnect_wps_pin = true;
}
}
- if (!is_disconnect_wps_pin)
- if (net_wifi_enroll_wps_without_ssid(&wps_info) != NET_ERR_NONE)
- return WIFI_MANAGER_ERROR_OPERATION_FAILED;
+ if (!is_disconnect_wps_pin) {
+ rv = net_wifi_enroll_wps_without_ssid(&wps_info);
+ if (rv != NET_ERR_NONE)
+ return __convert_to_ap_error_type(rv);
+ }
__set_connected_cb(wifi, callback, user_data);
return WIFI_MANAGER_ERROR_NONE;
}
-int _wifi_get_service_state() {
+int _wifi_get_service_state()
+{
wifi_service_state_e ret = WIFI_SERVICE_STATE_UNKNOWN;
net_state_type_e service_state = net_get_service_state();