#include "network_dbus.h"
#include "network_signal.h"
+/* WPS Errors */
+#define NET_WPS_CFG_NO_ERROR 0
+#define NET_WPS_CFG_MULTIPLE_PBC_DETECTED 12
+#define NET_WPS_CFG_MSG_TIMEOUT 16
+#define NET_WPS_EI_NO_ERROR 0
+#define NET_WPS_EI_OPERATION_FAILED 1
+#define NET_WPS_EI_SECURITY_WEP_PROHIBITED 2
+
extern __thread network_info_s NetworkInfo;
extern __thread network_request_table_s request_table[NETWORK_REQUEST_TYPE_MAX];
return NET_ERR_NONE;
}
+static int __net_handle_wifi_wps_fail_event_rsp(GVariant *param)
+{
+ GVariantIter *iter = NULL;
+ GVariant *value = NULL;
+ const char *key = NULL;
+ gint32 config_error = 0;
+ gint32 error_indication = 0;
+
+ g_variant_get(param, "(a{sv})", &iter);
+
+ while (g_variant_iter_loop(iter, "{sv}", &key, &value)) {
+ if (g_strcmp0(key, "config_error") == 0) {
+ config_error = g_variant_get_int32(value);
+ WIFI_LOG(WIFI_INFO, "Config Error: %d", config_error);
+ } else if (g_strcmp0(key, "error_indication") == 0) {
+ error_indication = g_variant_get_int32(value);
+ WIFI_LOG(WIFI_INFO, "Error Indication: %d", error_indication);
+ }
+ }
+ g_variant_iter_free(iter);
+
+ net_event_info_s event_data;
+ memset(&event_data, 0, sizeof(event_data));
+
+ if (request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS_WITHOUT_SSID].flag ==
+ TRUE)
+ memset(&request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS_WITHOUT_SSID], 0,
+ sizeof(network_request_table_s));
+
+ event_data.Event = NET_EVENT_WIFI_WPS_RSP;
+ if (config_error == NET_WPS_CFG_MSG_TIMEOUT &&
+ error_indication == NET_WPS_EI_NO_ERROR)
+ event_data.Error = NET_ERR_CONNECTION_WPS_TIMEOUT;
+ else if (config_error == NET_WPS_CFG_NO_ERROR &&
+ error_indication == NET_WPS_EI_OPERATION_FAILED)
+ event_data.Error = NET_ERR_CONNECTION_CONNECT_FAILED;
+ else if (config_error == NET_WPS_CFG_MULTIPLE_PBC_DETECTED &&
+ error_indication == NET_WPS_EI_NO_ERROR)
+ event_data.Error = NET_ERR_CONNECTION_WPS_OVERLAP;
+ else if (config_error == NET_WPS_CFG_NO_ERROR &&
+ error_indication == NET_WPS_EI_SECURITY_WEP_PROHIBITED)
+ event_data.Error = NET_ERR_CONNECTION_WPS_WEP_PROHIBITED;
+
+ event_data.Datalength = 0;
+ event_data.Data = NULL;
+
+ _net_client_callback(&event_data);
+
+ return NET_ERR_NONE;
+}
+
static void __net_connman_manager_signal_filter(GDBusConnection *conn,
const gchar *name, const gchar *path, const gchar *interface,
const gchar *sig, GVariant *param, gpointer user_data)
__net_handle_wifi_tdls_disconnected_event(param);
else if (g_strcmp0(sig, NETCONFIG_SIGNAL_WIFI_CONNECT_FAIL) == 0)
__net_handle_wifi_connect_fail_event(param);
+ else if (g_strcmp0(sig, NETCONFIG_SIGNAL_WPS_FAIL_EVENT) == 0)
+ __net_handle_wifi_wps_fail_event_rsp(param);
}
static void __net_netconfig_network_signal_filter(GDBusConnection *conn,
return WIFI_MANAGER_ERROR_NO_REPLY;
case NET_ERR_ACCESS_DENIED:
return WIFI_MANAGER_ERROR_PERMISSION_DENIED;
+ case NET_ERR_CONNECTION_WPS_TIMEOUT:
+ return WIFI_MANAGER_ERROR_WPS_TIMEOUT;
+ case NET_ERR_CONNECTION_WPS_OVERLAP:
+ return WIFI_MANAGER_ERROR_WPS_OVERLAP;
+ case NET_ERR_CONNECTION_WPS_WEP_PROHIBITED:
+ return WIFI_MANAGER_ERROR_WPS_WEP_PROHIBITED;
default:
return WIFI_MANAGER_ERROR_OPERATION_FAILED;
}
return "PERMISSION_DENIED";
case WIFI_MANAGER_ERROR_NOT_SUPPORTED:
return "NOT_SUPPROTED";
+ case WIFI_MANAGER_ERROR_WPS_OVERLAP:
+ return "WPS_OVERLAP";
+ case WIFI_MANAGER_ERROR_WPS_TIMEOUT:
+ return "WPS_TIMEOUT";
+ case WIFI_MANAGER_ERROR_WPS_WEP_PROHIBITED:
+ return "WPS_WEP_PROHIBITED";
default:
return "UNKNOWN";
case NET_EVENT_OPEN_IND:
if ((_wifi_check_profile_name_validity(event_cb->ProfileName) !=
true) && (event_cb->Error !=
- NET_ERR_CONNECTION_CONNECT_FAILED))
+ NET_ERR_CONNECTION_CONNECT_FAILED) &&
+ (event_cb->Error !=
+ NET_ERR_CONNECTION_WPS_TIMEOUT) &&
+ (event_cb->Error !=
+ NET_ERR_CONNECTION_WPS_OVERLAP) &&
+ (event_cb->Error !=
+ NET_ERR_CONNECTION_WPS_WEP_PROHIBITED))
return;
result = __convert_to_ap_error_type(event_cb->Error);