Name: ug-setting-wifidirect-efl
Summary: Wi-Fi Direct setting UI gadget
-Version: 1.11.86
+Version: 1.11.87
Release: 1
Group: Applications/Network
License: Flora-1.1
int wfd_discovery_status;
bool is_paused;
-
-#ifdef WFD_DBUS_LAUNCH
- GCancellable *dbus_cancellable;
- GDBusConnection *conn;
-#endif
};
extern Elm_Gen_Item_Class device_name_title_itc;
return 0;
}
-#ifdef WFD_DBUS_LAUNCH
-void wfd_gdbus_callback(GObject *source_object, GAsyncResult *result, gpointer user_data)
-{
- __FUNC_ENTER__;
- struct ug_data *ugd = (struct ug_data *)user_data;
- WFD_RET_IF(ugd == NULL, "Incorrect parameter(NULL)\n");
- int res = -1;
-
- GError *error = NULL;
- GVariant *return_data;
-
- g_object_unref(ugd->dbus_cancellable);
- ugd->dbus_cancellable = NULL;
- ugd->conn = G_DBUS_CONNECTION(source_object);
- return_data = g_dbus_connection_call_finish(ugd->conn, result, &error);
-
- if (error != NULL) {
- DBG(LOG_ERROR, "DBus action failed. Error Msg [%s]\n", error->message);
- g_clear_error(&error);
- } else {
- DBG(LOG_INFO, "error msg is NULL\n");
- }
-
- if (return_data)
- g_variant_unref(return_data);
-
- if (ugd->conn) {
- g_object_unref(ugd->conn);
- ugd->conn = NULL;
- }
-
- res = init_wfd_client(ugd);
- WFD_RET_IF(res != 0, "Failed to initialize WFD client library\n");
-
- /* Activate WiFi Direct */
- DBG(LOG_INFO, "Activating WiFi Direct...");
- if (ugd->wfd_status <= WIFI_DIRECT_STATE_DEACTIVATING) {
- res = wfd_client_switch_on(ugd);
- WFD_RET_IF(res != 0, "Failed to activate WFD\n");
- }
-
- __FUNC_EXIT__;
-}
-
-int launch_wifi_direct_manager(void *data)
-{
- __FUNC_ENTER__;
-
- gchar *addr = NULL;
- GError *error = NULL;
-
- struct ug_data *ugd = (struct ug_data *)data;
- WFD_RETV_IF(ugd == NULL, -1, "Incorrect parameter(NULL)\n");
-
- ugd->dbus_cancellable = g_cancellable_new();
-
- addr = g_dbus_address_get_for_bus_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
- WFD_RETV_IF(addr == NULL, -1, "Fail to get dbus addr.\n");
-
- ugd->conn = g_dbus_connection_new_for_address_sync(addr, G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT |
- G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION, NULL, NULL, NULL);
-
- if (ugd->conn == NULL) {
- DBG(LOG_ERROR, "g_dbus_conn is NULL\n");
- return -1;
- } else {
- g_dbus_connection_call(ugd->conn, "net.netconfig", "/net/netconfig/wifi", "net.netconfig.wifi",
- "LaunchDirect", NULL, NULL, G_DBUS_CALL_FLAGS_NONE, -1, ugd->dbus_cancellable, wfd_gdbus_callback, data);
- }
-
- __FUNC_EXIT__;
- return 0;
-}
-#endif
-
void wfd_client_destroy_tethering(struct ug_data *ugd)
{
__FUNC_ENTER__;
__FUNC_ENTER__;
struct ug_data *ugd = (struct ug_data *) data;
-#ifdef WFD_DBUS_LAUNCH
- if (ugd->dbus_cancellable != NULL) {
- g_cancellable_cancel(ugd->dbus_cancellable);
- g_object_unref(ugd->dbus_cancellable);
- ugd->dbus_cancellable = NULL;
- if (ugd->conn) {
- g_object_unref(ugd->conn);
- ugd->conn = NULL;
- }
- DBG(LOG_INFO, "Cancelled dbus call");
- return;
- } else
-#endif
- {
- DBG(LOG_INFO, "dbus_cancellable is NULL");
- ug_destroy_me(ugd->ug);
- }
+ DBG(LOG_INFO, "dbus_cancellable is NULL");
+ ug_destroy_me(ugd->ug);
__FUNC_EXIT__;
return;
__FUNC_EXIT__;
}
-#ifdef WFD_DBUS_LAUNCH
-/**
- * This function let the ug initialize wfd
- * @return void
- * @param[in] data the pointer to the main data structure
- * @param[in] evas the pointer to the evas canvas
- * @param[in] obj the pointer to the evas object
- * @param[in] event_info the pointer to the event information
- */
-static void _wfd_init_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
-{
- __FUNC_ENTER__;
- int res = -1;
- struct ug_data *ugd = (struct ug_data *)data;
- WFD_RET_IF(ugd == NULL || ugd->base == NULL, "Incorrect parameter(NULL)\n");
-
- evas_object_event_callback_del(ugd->base, EVAS_CALLBACK_SHOW, _wfd_init_cb);
-
- res = launch_wifi_direct_manager(ugd);
- if (res != 0)
- DBG(LOG_ERROR, "Failed to launch wifi direct manager\n");
-
- __FUNC_EXIT__;
- return;
-}
-#endif
-
static void *on_create(ui_gadget_h ug, enum ug_mode mode, app_control_h control, void *priv)
{
__FUNC_ENTER__;
} else {
ugd->wfd_status = WIFI_DIRECT_STATE_DEACTIVATED;
-#ifdef WFD_DBUS_LAUNCH
- evas_object_event_callback_add(ugd->base, EVAS_CALLBACK_SHOW, _wfd_init_cb, ugd);
-#else
ret = init_wfd_client(ugd);
WFD_RETV_IF(ret != 0, NULL, "Failed to initialize WFD client library\n");
ret = wfd_client_switch_on(ugd);
WFD_RETV_IF(ret != 0, NULL, "Failed to activate WFD\n");
}
-#endif
}
ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
__wfd_main_vconf_change_cb, ugd);
WFD_IF_FREE_MEM(ugd->view_type);
WFD_IF_DEL_OBJ(ugd->bg);
-
-#ifdef WFD_DBUS_LAUNCH
- if (ugd->base)
- evas_object_event_callback_del(ugd->base, EVAS_CALLBACK_SHOW, _wfd_init_cb);
-#endif
WFD_IF_DEL_OBJ(ugd->base);
DBG(LOG_INFO, "WFD client deregistered");
bool owner = FALSE;
app_control_h control = NULL;
-#ifdef WFD_DBUS_LAUNCH
- if (ugd->dbus_cancellable != NULL) {
- g_cancellable_cancel(ugd->dbus_cancellable);
- g_object_unref(ugd->dbus_cancellable);
- ugd->dbus_cancellable = NULL;
- if (ugd->conn) {
- g_object_unref(ugd->conn);
- ugd->conn = NULL;
- }
- DBG(LOG_INFO, "Cancel dbus call");
- }
-#endif
-
wfd_refresh_wifi_direct_state(ugd);
if (ugd->wfd_status <= WIFI_DIRECT_STATE_DEACTIVATING) {
DBG(LOG_INFO, "WiFi direct is already deactivated\n");
return;
}
-#ifdef WFD_DBUS_LAUNCH
- if (ugd->dbus_cancellable != NULL) {
- g_cancellable_cancel(ugd->dbus_cancellable);
- g_object_unref(ugd->dbus_cancellable);
- ugd->dbus_cancellable = NULL;
- if (ugd->conn) {
- g_object_unref(ugd->conn);
- ugd->conn = NULL;
- }
- DBG(LOG_INFO, "Cancel dbus call");
- }
-#endif
-
wfd_refresh_wifi_direct_state(ugd);
if (ugd->wfd_status <= WIFI_DIRECT_STATE_DEACTIVATING) {
DBG(LOG_INFO, "WiFi direct is already deactivated\n");