static int _netconfig_wifi_bssid_get_bss(void)
{
gboolean reply = FALSE;
- const char *if_path = NULL;
+ char *if_path = NULL;
GVariant *params = NULL;
if_path = netconfig_wifi_get_supplicant_interface();
reply = netconfig_invoke_dbus_method_nonblock(SUPPLICANT_SERVICE,
if_path, DBUS_INTERFACE_PROPERTIES,
"Get", params, __netconfig_wifi_bssid_get_bss_result);
+
+ g_free(if_path);
if (reply != TRUE) {
ERR("Fail to method: Get");
__netconfig_set_bssid_scan_mode(FALSE);
}
-static int __netconfig_wifi_bssid_request_scan(const char *if_path)
+static void __netconfig_wifi_bssid_scan_request_reply(GObject *source_object,
+ GAsyncResult *res, gpointer user_data)
+{
+ GVariant *message;
+ GDBusConnection *conn = NULL;
+ GError *error = NULL;
+
+ conn = G_DBUS_CONNECTION(source_object);
+ message = g_dbus_connection_call_finish(conn, res, &error);
+
+ if (message == NULL) {
+ if (error != NULL) {
+ ERR("Fail to request status [%d: %s]", error->code, error->message);
+ g_error_free(error);
+ } else {
+ ERR("Fail to request bssid scan");
+ }
+ } else {
+ DBG("Successfully requested bssid scan");
+ g_variant_unref(message);
+ }
+
+ netconfig_gdbus_pending_call_unref();
+}
+
+static int __netconfig_wifi_bssid_request_scan(char *if_path)
{
- GDBusConnection *connection = NULL;
GVariant *message = NULL;
GVariantBuilder *builder = NULL;
const char *key1 = "Type";
const char *val1 = "passive";
+ gboolean is_free_required = FALSE;
+ gboolean reply = FALSE;
- if (if_path == NULL)
+ if (if_path == NULL) {
if_path = netconfig_wifi_get_supplicant_interface();
+ is_free_required = TRUE;
+ }
if (if_path == NULL) {
DBG("Fail to get wpa_supplicant DBus path");
- return -ESRCH;
- }
-
- connection = netdbus_get_connection();
- if (connection == NULL) {
- ERR("Failed to get GDBusconnection");
- return -EIO;
+ goto out;
}
builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
message = g_variant_new("(@a{sv})", g_variant_builder_end(builder));
g_variant_builder_unref(builder);
- g_dbus_connection_call(connection,
+ DBG("[net-config]: TizenMW-->WPAS: .Interface.Scan");
+ reply = netconfig_supplicant_invoke_dbus_method_nonblock(
SUPPLICANT_SERVICE,
if_path,
SUPPLICANT_INTERFACE ".Interface",
"Scan",
message,
- NULL,
- G_DBUS_CALL_FLAGS_NONE,
- NETCONFIG_DBUS_REPLY_TIMEOUT,
- netdbus_get_cancellable(),
- NULL,
- NULL);
+ (GAsyncReadyCallback) __netconfig_wifi_bssid_scan_request_reply);
+
+ if (reply != TRUE) {
+ ERR("Fail to Scan");
+ goto out;
+ }
netconfig_is_device_scanning = TRUE;
- g_variant_unref(message);
+out:
+ if (is_free_required)
+ g_free(if_path);
+
/* Clear bss_info_list for the next scan result */
if (bssid_info_list) {
g_slist_free_full(bssid_info_list, g_free);
static void __netconfig_wifi_interface_create_result(
GObject *source_object, GAsyncResult *res, gpointer user_data)
{
- GVariant *message;
+ GVariant *message = NULL;
gchar *path = NULL;
GDBusConnection *conn = NULL;
GError *error = NULL;
g_free(path);
} else
__netconfig_wifi_bssid_request_scan(NULL);
+
+ g_error_free(error);
} else {
ERR("Failed to create interface, Error: %d[%s]", error->code, error->message);
__netconfig_set_bssid_scan_mode(FALSE);
wifi_power_driver_and_supplicant(FALSE);
+ g_error_free(error);
}
g_variant_unref(message);
+ netconfig_gdbus_pending_call_unref();
}
static int __netconfig_wifi_bssid_create_interface(void)
{
- GDBusConnection *connection = NULL;
GVariant *message = NULL;
GVariantBuilder *builder = NULL;
const char *key = "Ifname";
const char *val = WIFI_IFNAME;
-
- connection = netdbus_get_connection();
- if (connection == NULL) {
- DBG("Failed to get GDBusconnection");
- return -EIO;
- }
+ gboolean reply = FALSE;
builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
g_variant_builder_add(builder, "{sv}", key, g_variant_new_string(val));
message = g_variant_new("(@a{sv})", g_variant_builder_end(builder));
+ g_variant_builder_unref(builder);
- g_dbus_connection_call(connection,
+ DBG("[net-config]: TizenMW-->WPAS: CreateInterface");
+ reply = netconfig_supplicant_invoke_dbus_method_nonblock(
SUPPLICANT_SERVICE,
SUPPLICANT_PATH,
SUPPLICANT_INTERFACE,
"CreateInterface",
message,
- NULL,
- G_DBUS_CALL_FLAGS_NONE,
- NETCONFIG_DBUS_REPLY_TIMEOUT,
- netdbus_get_cancellable(),
- (GAsyncReadyCallback) __netconfig_wifi_interface_create_result,
- NULL);
+ (GAsyncReadyCallback) __netconfig_wifi_interface_create_result);
- g_variant_unref(message);
+ if (reply != TRUE)
+ ERR("Fail to CreateInterface");
return 0;
}
int err, enabled = 0;
wifi_tech_state_e tech_state;
- g_return_val_if_fail(wifi != NULL, FALSE);
+ g_return_val_if_fail(wifi != NULL, TRUE);
if (netconfig_is_wifi_tethering_on() == TRUE) {
ERR("Wi-Fi Tethering is enabled");
netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_NO_SERVICE, "TetheringEnabled");
- return -EBUSY;
+ return TRUE;
}
#if !defined TIZEN_WEARABLE
if (netconfig_wifi_is_bgscan_paused()) {
ERR("Scan is paused");
netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_NO_SERVICE, "ScanPaused");
- return FALSE;
+ return TRUE;
}
#endif
if (enabled == 0) {
netconfig_error_permission_denied(context);
- return FALSE;
+ return TRUE;
}
}
else
netconfig_error_wifi_driver_failed(context);
- return FALSE;
+ return TRUE;
}
wifi_complete_request_bssid_scan(wifi, context);