__NETWORK_FUNC_ENTER__;
GVariant *params = NULL;
+ GVariantBuilder *builder;
net_err_t Error = NET_ERR_NONE;
- params = g_variant_new("(s)", ssid);
+ builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
+ g_variant_builder_add(builder, "{sv}", "SSID", g_variant_new_string(ssid));
- Error = _net_invoke_dbus_method_nonblock(NETCONFIG_SERVICE,
- NETCONFIG_WIFI_PATH, NETCONFIG_WIFI_INTERFACE,
- "RequestSpecificScan", params, 6 * DBUS_REPLY_TIMEOUT,
- __net_specific_scan_wifi_reply);
+ params = g_variant_new("(@a{sv})", g_variant_builder_end(builder));
+ g_variant_builder_unref(builder);
+
+ /* use DBus signal than reply pending because of performance reason */
+ Error = _net_invoke_dbus_method_nonblock(CONNMAN_SERVICE,
+ CONNMAN_WIFI_TECHNOLOGY_PREFIX,
+ CONNMAN_TECHNOLOGY_INTERFACE, "SpecificScan", params,
+ DBUS_REPLY_TIMEOUT, __net_specific_scan_wifi_reply);
+
+ if (Error == NET_ERR_IN_PROGRESS)
+ Error = NET_ERR_NONE; //LCOV_EXCL_LINE
__NETWORK_FUNC_EXIT__;
return Error;
return NET_ERR_NONE;
}
-static wlan_security_mode_type_t __net_get_wlan_sec_mode(int security)
-{
- switch (security) {
- default:
- return WLAN_SEC_MODE_NONE;
- case 2:
- return WLAN_SEC_MODE_WEP;
- case 3:
- return WLAN_SEC_MODE_WPA_PSK;
- case 4:
- return WLAN_SEC_MODE_WPA2_PSK;
- case 5:
- return WLAN_SEC_MODE_IEEE8021X;
- }
-}
-
-static int __net_handle_specific_scan_resp(GSList *bss_info_list)
-{
- __NETWORK_FUNC_ENTER__;
-
- int count = 0;;
- net_event_info_t event_data = { 0, };
-
- if (request_table[NETWORK_REQUEST_TYPE_SPECIFIC_SCAN].flag == TRUE) {
- memset(&request_table[NETWORK_REQUEST_TYPE_SPECIFIC_SCAN],
- 0, sizeof(network_request_table_t));
-
- _net_dbus_pending_call_unref();
-
- count = (int)g_slist_length(bss_info_list);
- NETWORK_LOG(NETWORK_LOW,
- "Received the signal: %s with total bss count = %d",
- NETCONFIG_SIGNAL_SPECIFIC_SCAN_DONE,
- count);
-
- event_data.Event = NET_EVENT_SPECIFIC_SCAN_IND;
- event_data.Datalength = count;
- event_data.Data = bss_info_list;
-
- _net_client_callback(&event_data);
- } else
- g_slist_free_full(bss_info_list, g_free);
-
- __NETWORK_FUNC_EXIT__;
- return NET_ERR_NONE;
-}
-
-static int __net_handle_wifi_specific_scan_rsp(GVariant *param)
-{
- GVariantIter *iter = NULL;
- GVariant *value = NULL;
- gchar *key = NULL;
- const gchar *ssid = NULL;
- gint32 security = 0;
- gboolean wps = FALSE;
- GSList *bss_info_list = NULL;
- gboolean ssid_found = FALSE;
- gboolean sec_found = FALSE;
- gboolean wps_found = FALSE;
-
- g_variant_get(param, "(a{sv})", &iter);
-
- while (g_variant_iter_loop(iter, "{sv}", &key, &value)) {
- if (g_strcmp0(key, "ssid") == 0 && ssid_found == FALSE) {
- ssid = g_variant_get_string(value, NULL);
- NETWORK_LOG(NETWORK_LOW, "SSID: %s", ssid);
- ssid_found = TRUE;
- }
- if (g_strcmp0(key, "security") == 0 && sec_found == FALSE) {
- security = g_variant_get_int32(value);
- NETWORK_LOG(NETWORK_LOW, "with security: %d", security);
- sec_found = TRUE;
- }
- if (g_strcmp0(key, "wps") == 0 && wps_found == FALSE) {
- wps = g_variant_get_boolean(value);
- NETWORK_LOG(NETWORK_LOW, "wps supported: %d", wps);
- wps_found = TRUE;
- }
-
- if (ssid_found == TRUE && sec_found == TRUE) {
- struct ssid_scan_bss_info_t *bss = NULL;
- bss = g_try_new0(struct ssid_scan_bss_info_t, 1);
- if (bss == NULL) {
- NETWORK_LOG(NETWORK_ERROR, "Memory allocation error");
-
- g_slist_free_full(bss_info_list, g_free);
- g_variant_unref(value);
- g_free(key);
- return NET_ERR_UNKNOWN;
- }
-
- g_strlcpy(bss->ssid, ssid, NET_WLAN_ESSID_LEN);
- bss->security = __net_get_wlan_sec_mode(security);
- bss_info_list = g_slist_append(bss_info_list, bss);
-
- ssid_found = sec_found = FALSE;
- }
- }
- g_variant_iter_free(iter);
-
- __net_handle_specific_scan_resp(bss_info_list);
-
- /* To enhance performance,
- * BSS list should be release in a delayed manner in _net_client_callback */
-
- return NET_ERR_NONE;
-}
-
static void __net_handle_state_ind(const char *profile_name,
net_state_type_t profile_state)
{
static int __net_handle_scan_done(GVariant *param)
{
net_event_info_t event_data = { 0, };
+ const char *key = NULL;
+ GVariant *value;
+ int last_scan_type = -1;
+
+ NETWORK_LOG(NETWORK_LOW, "param type: %s", g_variant_get_type_string(param));
+
+ if (g_variant_is_of_type(param, ((const GVariantType *)"(sv)"))) {
+ g_variant_get(param, "(sv)", &key, &value);
+ NETWORK_LOG(NETWORK_LOW, "key: %s", key);
+ if (g_strcmp0(key, "Scantype") == 0) {
+ if (g_variant_is_of_type(value, G_VARIANT_TYPE_INT32)) {
+ last_scan_type = g_variant_get_int32(value);
+ NETWORK_LOG(NETWORK_LOW, "last scan type: %d (0:full,1:specific,2:multi)", last_scan_type);
+ }
+ }
+
+ g_free((gchar *)key);
+ if (NULL != value)
+ g_variant_unref(value);
+ }
+
+ if (request_table[NETWORK_REQUEST_TYPE_SPECIFIC_SCAN].flag == TRUE) {
+ memset(&request_table[NETWORK_REQUEST_TYPE_SPECIFIC_SCAN],
+ 0, sizeof(network_request_table_t));
+
+ _net_dbus_pending_call_unref();
+
+ NETWORK_LOG(NETWORK_LOW, "Specific scan completed");
+
+ event_data.Event = NET_EVENT_SPECIFIC_SCAN_IND;
- if (request_table[NETWORK_REQUEST_TYPE_SCAN].flag == TRUE) {
+ } else if (request_table[NETWORK_REQUEST_TYPE_SCAN].flag == TRUE) {
memset(&request_table[NETWORK_REQUEST_TYPE_SCAN], 0,
sizeof(network_request_table_t));
__net_handle_wifi_power_rsp(TRUE);
else if (g_strcmp0(sig, NETCONFIG_SIGNAL_POWEROFF_COMPLETED) == 0)
__net_handle_wifi_power_rsp(FALSE);
- else if (g_strcmp0(sig, NETCONFIG_SIGNAL_SPECIFIC_SCAN_DONE) == 0)
- __net_handle_wifi_specific_scan_rsp(param);
else if (g_strcmp0(sig, NETCONFIG_SIGNAL_TDLS_CONNECTED) == 0)
__net_handle_wifi_tdls_connected_event(param);
else if (g_strcmp0(sig, NETCONFIG_SIGNAL_TDLS_DISCONNECTED) == 0)