*/
typedef enum
{
+ /** Not defined */
+ WLAN_ENC_MODE_UNKNOWN = 0x00,
/** Encryption disabled */
- WLAN_ENC_MODE_NONE = 0x01,
+ WLAN_ENC_MODE_NONE,
/** WEP */
WLAN_ENC_MODE_WEP,
/** TKIP */
char *_wifi_get_ip_config_str(net_ip_config_type_t ip_config_type);
net_ip_config_type_t _wifi_get_ip_config_type(const char *config);
net_proxy_type_t _wifi_get_proxy_type(const char *proxy);
+wlan_encryption_mode_type_t _wifi_get_encryption_type
+ (const char *encryption_mode);
struct connman_service *_wifi_get_service_h(wifi_ap_h ap_h);
wifi_error_e _wifi_connman_lib_error2wifi_error(enum connman_lib_err err_type);
return WIFI_ERROR_INVALID_PARAMETER;
}
+ const char *encryption_mode;
+ struct connman_service *service = _wifi_get_service_h(ap);
+ if (!service)
+ return WIFI_ERROR_INVALID_PARAMETER;
+
+ encryption_mode = connman_service_get_encryption_mode(service);
+ if (encryption_mode == NULL)
+ return WIFI_ERROR_INVALID_OPERATION;
+
+ switch (_wifi_get_encryption_type(encryption_mode)) {
+ case WLAN_ENC_MODE_NONE:
+ *type = WIFI_ENCRYPTION_TYPE_NONE;
+ break;
+ case WLAN_ENC_MODE_WEP:
+ *type = WIFI_ENCRYPTION_TYPE_WEP;
+ break;
+ case WLAN_ENC_MODE_TKIP:
+ *type = WIFI_ENCRYPTION_TYPE_TKIP;
+ break;
+ case WLAN_ENC_MODE_AES:
+ *type = WIFI_ENCRYPTION_TYPE_AES;
+ break;
+ case WLAN_ENC_MODE_TKIP_AES_MIXED:
+ *type = WIFI_ENCRYPTION_TYPE_TKIP_AES_MIXED;
+ break;
+ default:
+ return WIFI_ERROR_OPERATION_FAILED;
+ }
+
return WIFI_ERROR_NONE;
}
return WIFI_ERROR_INVALID_PARAMETER;
}
- return WIFI_ERROR_NONE;
+ return WIFI_ERROR_INVALID_OPERATION;
}
EXPORT_API int wifi_ap_is_passphrase_required(wifi_ap_h ap, bool* required)
return proxy_type;
}
+wlan_encryption_mode_type_t _wifi_get_encryption_type(
+ const char *encryption_mode)
+{
+ wlan_encryption_mode_type_t encryption_mode_type;
+
+ if (!g_strcmp0(encryption_mode, "none"))
+ encryption_mode_type = WLAN_ENC_MODE_NONE;
+ else if (!g_strcmp0(encryption_mode, "wep"))
+ encryption_mode_type = WLAN_ENC_MODE_WEP;
+ else if (!g_strcmp0(encryption_mode, "tkip"))
+ encryption_mode_type = WLAN_ENC_MODE_TKIP;
+ else if (!g_strcmp0(encryption_mode, "aes"))
+ encryption_mode_type = WLAN_ENC_MODE_AES;
+ else if (!g_strcmp0(encryption_mode, "mixed"))
+ encryption_mode_type = WLAN_ENC_MODE_TKIP_AES_MIXED;
+ else
+ encryption_mode_type = WLAN_ENC_MODE_UNKNOWN;
+
+ return encryption_mode_type;
+}
+
wifi_error_e _wifi_connman_lib_error2wifi_error(enum connman_lib_err err_type)
{
switch (err_type) {