From 0a72541b5fc5277405dc0cabcb2008fb413b465f Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Mon, 30 Sep 2019 18:53:22 +0900 Subject: [PATCH] Revert "Merge "Migration from DBUS to GDBUS" into tizen" This reverts commit a148c1f3b344f4ea8654b12a6571e6b27b49dde8, reversing changes made to bfd06ef00407ac3bb44833d14485d2eb79555ead. Change-Id: I4149d1183bec408fd04e2c434ebd41569d6e5d6d --- CMakeLists.txt | 16 +- client/CMakeLists.txt | 4 - client/vc.c | 6 +- client/vc_dbus.c | 494 +----------- client/vc_mgr.c | 4 +- client/vc_mgr_dbus.c | 866 +-------------------- client/vc_setting_dbus.c | 111 --- client/vc_widget_dbus.c | 324 +------- common/vc_defs.h | 12 +- ...mon.service => org.tizen.voice.vcserver.service | 2 +- ....service => org.tizen.voice.vcserver.tv.service | 2 +- org.tizen.voice.voice-control.gdbus.xml | 360 --------- packaging/voice-control.spec | 6 +- server/CMakeLists.txt | 1 - server/vcd_dbus.c | 407 +--------- server/vcd_dbus_server.c | 700 ----------------- server/vcd_dbus_server.h | 154 ---- server/vce.c | 4 - vc-service.conf => vc-server.conf | 4 +- 19 files changed, 70 insertions(+), 3407 deletions(-) rename org.tizen.voice.vcdaemon.service => org.tizen.voice.vcserver.service (87%) rename org.tizen.voice.vcdaemon.tv.service => org.tizen.voice.vcserver.tv.service (75%) delete mode 100644 org.tizen.voice.voice-control.gdbus.xml rename vc-service.conf => vc-server.conf (85%) diff --git a/CMakeLists.txt b/CMakeLists.txt index cbc716f..c2b603d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,14 +36,6 @@ ADD_DEFINITIONS("-Werror") # for the use of ecore_wl2 ADD_DEFINITIONS("-DEFL_BETA_API_SUPPORT") -FIND_PROGRAM(GDBUS_CODEGEN NAMES gdbus-codegen) -EXEC_PROGRAM(${GDBUS_CODEGEN} ARGS "\\ - --generate-c-code ${CMAKE_CURRENT_SOURCE_DIR}/common/vc_gdbus \\ - --c-namespace GDBus\\ - --interface-prefix org.tizen.voice. \\ - ${CMAKE_CURRENT_SOURCE_DIR}/org.tizen.voice.voice-control.gdbus.xml \\ - ") - # pkg config tool INCLUDE(FindPkgConfig) @@ -55,12 +47,12 @@ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/include") INCLUDE(FindPkgConfig) IF("${_TV_PRODUCT}" STREQUAL "TRUE") pkg_check_modules(pkgs REQUIRED - aul buxton2 capi-appfw-app-control capi-appfw-app-manager capi-base-common capi-media-audio-io capi-media-sound-manager ecore-wl2 gio-2.0 gio-unix-2.0 + aul buxton2 capi-appfw-app-control capi-appfw-app-manager capi-base-common capi-media-audio-io capi-media-sound-manager ecore-wl2 capi-network-bluetooth capi-network-bluetooth-tv capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf msfapi farfield-voice-api ) ELSE() pkg_check_modules(pkgs REQUIRED - aul buxton2 capi-appfw-app-control capi-appfw-app-manager capi-base-common capi-media-audio-io capi-media-sound-manager ecore-wl2 gio-2.0 gio-unix-2.0 + aul buxton2 capi-appfw-app-control capi-appfw-app-manager capi-base-common capi-media-audio-io capi-media-sound-manager ecore-wl2 capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf ) ENDIF() @@ -83,9 +75,9 @@ INSTALL(FILES ${CMAKE_SOURCE_DIR}/voice-control.info DESTINATION ${TZ_SYS_RO_SHA ## config ## INSTALL(FILES ${CMAKE_SOURCE_DIR}/vc-config.xml DESTINATION ${TZ_SYS_RO_SHARE}/voice/vc/1.0) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.voice.vcdaemon.service DESTINATION ${TZ_SYS_RO_SHARE}/dbus-1/services) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.voice.vcserver.service DESTINATION ${TZ_SYS_RO_SHARE}/dbus-1/services) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/vc-service.conf DESTINATION /etc/dbus-1/session.d) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/vc-server.conf DESTINATION /etc/dbus-1/session.d) ## vc_getengine ## IF("${ARCH}" MATCHES "^arm.*") diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index a874dd2..29a1049 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -10,7 +10,6 @@ SET(SRCS ../common/vc_config_parser.c ../common/vc_info_parser.c ../common/vc_json_parser.c - ../common/vc_gdbus.c ) SET(SETTING_SRCS @@ -18,7 +17,6 @@ SET(SETTING_SRCS vc_setting.c ../common/vc_config_mgr.c ../common/vc_config_parser.c - ../common/vc_gdbus.c ) SET(WIDGET_SRCS @@ -32,7 +30,6 @@ SET(WIDGET_SRCS ../common/vc_config_parser.c ../common/vc_info_parser.c ../common/vc_json_parser.c - ../common/vc_gdbus.c ) SET(MANAGER_SRCS @@ -48,7 +45,6 @@ SET(MANAGER_SRCS ../common/vc_config_parser.c ../common/vc_info_parser.c ../common/vc_json_parser.c - ../common/vc_gdbus.c ) #INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) diff --git a/client/vc.c b/client/vc.c index c446137..f63e842 100644 --- a/client/vc.c +++ b/client/vc.c @@ -309,10 +309,6 @@ static Eina_Bool __focus_changed_cb(void *data, int type, void *event) int vc_initialize(void) { - if (!ecore_main_loop_glib_integrate()) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail ecore_main_loop_glib_integrate()"); - } - if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } @@ -1672,7 +1668,7 @@ static void __vc_notify_error(void *data) } } -int __vc_cb_error(int reason, int daemon_pid, const char* msg) +int __vc_cb_error(int reason, int daemon_pid, char* msg) { vc_state_e state; if (0 != vc_client_get_client_state(g_vc, &state)) { diff --git a/client/vc_dbus.c b/client/vc_dbus.c index cb0c7b6..c78d5db 100644 --- a/client/vc_dbus.c +++ b/client/vc_dbus.c @@ -18,17 +18,18 @@ #include "vc_dbus.h" #include "vc_main.h" -#define USE_GDBUS +static pthread_mutex_t g_dbus_mutex = PTHREAD_MUTEX_INITIALIZER; -#ifdef USE_GDBUS -#include "vc_gdbus.h" +static int g_waiting_time = 3000; +static int g_waiting_short_time = 200; +static bool g_is_connection_opened = false; -static GDBusConnection* g_connection = NULL; -static GDBusVcdaemon *g_daemon_proxy = NULL; -static int g_own_name_id = 0; -static guint g_name_owner_changed_subscription_id = 0; +static Ecore_Fd_Handler* g_fd_handler = NULL; + +static DBusConnection* g_conn_sender = NULL; +static DBusConnection* g_conn_listener = NULL; -extern int __vc_cb_error(int reason, int daemon_pid, const char* msg); +extern int __vc_cb_error(int reason, int daemon_pid, char* msg); extern void __vc_cb_result(); @@ -39,19 +40,8 @@ extern int __vc_cb_manager_pid(int manager_pid); extern int __vc_cb_tts_streaming(int utt_id, vc_feedback_event_e event, char* buffer, int len); extern int __vc_cb_utterance_status(int utt_id, int utt_status); -#else -static pthread_mutex_t g_dbus_mutex = PTHREAD_MUTEX_INITIALIZER; -static bool g_is_connection_opened = false; -static int g_waiting_time = 3000; -static int g_waiting_short_time = 200; -static Ecore_Fd_Handler* g_fd_handler = NULL; -static DBusConnection* g_conn_listener = NULL; -static DBusConnection* g_conn_sender = NULL; - -#endif //LCOV_EXCL_START -#ifndef USE_GDBUS static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handler) { if (NULL == g_conn_listener) return ECORE_CALLBACK_RENEW; @@ -259,209 +249,9 @@ static void __vc_dbus_connection_free() g_conn_sender = NULL; } } -#endif - -#ifdef USE_GDBUS -static GDBusVcmanager* get_manager_proxy() { - char service_name[64] = {0,}; - char object_path[64] = {0,}; - - snprintf(service_name, 64, "%s", VC_MANAGER_SERVICE_NAME); - snprintf(object_path, 64, "%s", VC_MANAGER_SERVICE_OBJECT_PATH); - - GError *error = NULL; - GDBusVcmanager *proxy = gdbus_vcmanager_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, 0, - service_name, object_path, NULL, &error); - - if (error) { - SLOG(LOG_ERROR, TAG_VCC, "[DBUS] Proxy : %p, service_name(%s), object_path(%s) : %s", - proxy, service_name, object_path, error->message); - g_error_free(error); - } - - return proxy; -} - -gboolean vcd_client_method_hello(GDBusVcclient *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - int response = -1; - if (pid > 0) { - SLOG(LOG_DEBUG, TAG_VCC, "@@ vc get hello : pid(%d) ", pid); - response = 1; - } else { - SLOG(LOG_ERROR, TAG_VCC, "@@ vc get hello : invalid pid "); - } - gdbus_vcclient_complete_vcd_client_method_hello(service, invocation, response); - return TRUE; -} - -gboolean vcd_client_method_result(GDBusVcclient *service, GDBusMethodInvocation *invocation, - gpointer user_data) -{ - __vc_cb_result(); - gdbus_vcclient_complete_vcd_client_method_result(service, invocation); - return TRUE; -} - -gboolean vcd_client_method_feedback_streaming(GDBusVcclient *service, GDBusMethodInvocation *invocation, - gint utt_id, gint event, guint size, GVariant* buffer, gpointer user_data) -{ - int len = 0; - GVariantIter *iter; - guchar uc; - - char *data = NULL; - data = malloc(size); - if (!data) return FALSE; - - g_variant_get(buffer, "ay", &iter); - while (g_variant_iter_loop(iter, "y", &uc)) { - if (len < size) { - data[len++] = uc; - } else { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] max size reached : %d", len); - } - } - g_variant_iter_free(iter); - - int ret = __vc_cb_tts_streaming(utt_id, event, data, len); - - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to send_audio_streaming"); - } - - gdbus_vcclient_complete_vcd_client_method_feedback_streaming(service, invocation); - - free(data); - return ret; -} - -gboolean vcm_client_method_utterance_status(GDBusVcclient *service, GDBusMethodInvocation *invocation, - gint utt_id, gint utt_status, gpointer user_data) -{ - SLOG(LOG_INFO, TAG_VCC, "@@@ Get TTS utterance status streaming"); - __vc_cb_utterance_status(utt_id, utt_status); - gdbus_vcclient_complete_vcm_client_method_utterance_status(service, invocation); - return TRUE; -} - -static void -on_name_acquired(GDBusConnection *connection, - const gchar *name, - gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCC, "Name acquired : %s", name); - - GDBusVcclient *service; - GError *error = NULL; - gboolean ret = FALSE; - - service = gdbus_vcclient_skeleton_new(); - - /* vc daemon methods */ - g_signal_connect(service, "handle-vcd-client-method-hello", - G_CALLBACK(vcd_client_method_hello), NULL); - g_signal_connect(service, "handle-vcd-client-method-result", - G_CALLBACK(vcd_client_method_result), NULL); - g_signal_connect(service, "handle-vcd-client-method-feedback-streaming", - G_CALLBACK(vcd_client_method_feedback_streaming), NULL); - - /* vc manager methods */ - g_signal_connect(service, "handle-vcm-client-method-utterance-status", - G_CALLBACK(vcm_client_method_utterance_status), NULL); - - ret = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(service), - connection, VC_CLIENT_SERVICE_OBJECT_PATH, &error); - if (ret == FALSE || error) { - SLOG(LOG_DEBUG, TAG_VCC, "Error : %s\n", error->message); - g_error_free(error); - } -} - -static void vcd_signal_set_service_state(GDBusVcdaemon* proxy, - gint state, gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCC, "@@ state changed : %d", state); - __vc_cb_service_state(state); -} - -static void vcd_client_signal_send_error(GDBusVcdaemon* proxy, - gint reason, gint daemon_pid, const gchar* err_msg, gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCC, "@@ vc Get Error message : reason(%d), daemon_pid(%d), msg(%s)", - reason, daemon_pid, err_msg); - __vc_cb_error(reason, daemon_pid, err_msg); -} - -static void vcd_client_signal_send_manager_pid(GDBusVcdaemon* proxy, - gint manager_pid, gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCC, "@@ manager pid is changed : %d", manager_pid); - __vc_cb_manager_pid(manager_pid); -} - -static void _on_name_owner_changed(GDBusConnection *connection, - const gchar *sender_name, const gchar *object_path, - const gchar *interface_name, const gchar *signal_name, - GVariant *parameters, gpointer user_data) -{ - gchar *name; - gchar *old_owner; - gchar *new_owner; - - g_variant_get(parameters, - "(sss)", - &name, - &old_owner, - &new_owner); - - if (g_name_owner_changed_subscription_id > 0) { - g_dbus_connection_signal_unsubscribe(connection, g_name_owner_changed_subscription_id); - g_name_owner_changed_subscription_id = 0; - } - - SLOG(LOG_ERROR, TAG_VCC, "name_owner_changed(%s: %s -> %s) interface %s sender %s object %s", - name, old_owner, new_owner, interface_name, sender_name, object_path); - __vc_cb_error(VC_ERROR_SERVICE_RESET, -1, "Daemon Reset"); - - g_free(name); - g_free(old_owner); - g_free(new_owner); -} -#endif int vc_dbus_open_connection() { -#ifdef USE_GDBUS - GError* error = NULL; - g_connection = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error); - int pid = getpid(); - - char service_name[64]; - memset(service_name, '\0', 64); - snprintf(service_name, 64, "%s%d", VC_CLIENT_SERVICE_NAME, pid); - g_own_name_id = g_bus_own_name(G_BUS_TYPE_SESSION, - service_name, G_BUS_NAME_OWNER_FLAGS_REPLACE, NULL, on_name_acquired, NULL, NULL, NULL); - SLOG(LOG_DEBUG, TAG_VCC, "service_name : %s, %d", service_name, g_own_name_id); - - g_daemon_proxy = gdbus_vcdaemon_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, 0, - VC_DAEMON_SERVICE_NAME, VC_DAEMON_SERVICE_OBJECT_PATH, NULL, &error); - if (error) { - SLOG(LOG_ERROR, TAG_VCC, "Error : %s", error->message); - g_error_free(error); - } else { - /* vc common signals */ - g_signal_connect(g_daemon_proxy, "vcd-signal-set-service-state", - G_CALLBACK(vcd_signal_set_service_state), NULL); - - /* vc daemon signals */ - g_signal_connect(g_daemon_proxy, "vcd-client-signal-send-error", - G_CALLBACK(vcd_client_signal_send_error), NULL); - g_signal_connect(g_daemon_proxy, "vcd-client-signal-send-manager-pid", - G_CALLBACK(vcd_client_signal_send_manager_pid), NULL); - } -#else pthread_mutex_lock(&g_dbus_mutex); if (NULL != g_conn_sender && NULL != g_conn_listener) { @@ -575,26 +365,12 @@ int vc_dbus_open_connection() pthread_mutex_unlock(&g_dbus_mutex); SLOG(LOG_INFO, TAG_VCC, "[INFO] vc client dbus connection is opened"); -#endif + return VC_ERROR_NONE; } int vc_dbus_close_connection() { -#ifdef USE_GDBUS - if (g_daemon_proxy) { - g_object_unref(g_daemon_proxy); - g_daemon_proxy = NULL; - } - if (g_own_name_id) { - g_bus_unown_name(g_own_name_id); - g_own_name_id = 0; - } - if (g_connection != NULL) { - g_object_unref(g_connection); - g_connection = NULL; - } -#else pthread_mutex_lock(&g_dbus_mutex); DBusError err; @@ -627,25 +403,12 @@ int vc_dbus_close_connection() pthread_mutex_unlock(&g_dbus_mutex); SLOG(LOG_INFO, TAG_VCC, "[INFO] vc client dbus connection is closed"); -#endif + return 0; } int vc_dbus_reconnect() { -#ifdef USE_GDBUS - if (!g_own_name_id || !g_daemon_proxy) { - vc_dbus_close_connection(); - - if (0 != vc_dbus_open_connection()) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to reconnect"); //LCOV_EXCL_LINE - return -1; - } - - SLOG(LOG_DEBUG, TAG_VCC, "[DBUS] Reconnect"); //LCOV_EXCL_LINE - return 0; - } -#else if (!g_conn_sender || !g_conn_listener) { vc_dbus_close_connection(); @@ -673,24 +436,16 @@ int vc_dbus_reconnect() SLOG(LOG_DEBUG, TAG_VCC, "[DBUS] Reconnect"); //LCOV_EXCL_LINE } -#endif + return 0; } static int __dbus_check() { -#ifdef USE_GDBUS - SLOG(LOG_DEBUG, TAG_VCC, "%d %p", g_own_name_id, g_daemon_proxy); //LCOV_EXCL_LINE - if (0 == g_own_name_id || NULL == g_daemon_proxy) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] NULL connection"); //LCOV_EXCL_LINE - return vc_dbus_reconnect(); - } -#else if (NULL == g_conn_sender || NULL == g_conn_listener) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] NULL connection"); //LCOV_EXCL_LINE return vc_dbus_reconnect(); } -#endif return 0; } @@ -700,20 +455,6 @@ int vc_dbus_request_hello() return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - GError *error = NULL; - int result = 0; - if (!gdbus_vcdaemon_call_vc_method_hello_sync(g_daemon_proxy, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCC, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCC, "Failed without explicit error"); - } - } - return result; -#else SLOG(LOG_DEBUG, TAG_VCC, "[DBUS] Request vc hello"); //LCOV_EXCL_LINE DBusMessage* msg; @@ -752,7 +493,6 @@ int vc_dbus_request_hello() } return result; -#endif } @@ -762,26 +502,6 @@ int vc_dbus_request_initialize(int pid, int* mgr_pid, int* service_state, int* d return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - GError *error = NULL; - int result = 0; - if (!gdbus_vcdaemon_call_vcc_daemon_method_initialize_sync(g_daemon_proxy, - pid, &result, mgr_pid, service_state, daemon_pid, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCC, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCC, "Failed without explicit error"); - } - } - if (0 == result && NULL != g_connection) { - g_name_owner_changed_subscription_id = g_dbus_connection_signal_subscribe(g_connection, - "org.freedesktop.DBus", "org.freedesktop.DBus", "NameOwnerChanged", "/org/freedesktop/DBus", - VC_DAEMON_SERVICE_NAME, G_DBUS_SIGNAL_FLAGS_NONE, _on_name_owner_changed, NULL, NULL); - } - return result; -#else DBusMessage* msg; msg = dbus_message_new_method_call( @@ -869,35 +589,10 @@ int vc_dbus_request_initialize(int pid, int* mgr_pid, int* service_state, int* d } return result; -#endif } int vc_dbus_request_finalize(int pid) { -#ifdef USE_GDBUS - if (0 != __dbus_check()) { - return VC_ERROR_OPERATION_FAILED; - } - - if (g_name_owner_changed_subscription_id > 0) { - g_dbus_connection_signal_unsubscribe(g_connection, g_name_owner_changed_subscription_id); - g_name_owner_changed_subscription_id = 0; - } - - GError *error = NULL; - int result = 0; - if (!gdbus_vcdaemon_call_vcc_daemon_method_finalize_sync(g_daemon_proxy, pid, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCC, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCC, "Failed without explicit error"); - } - } - - return result; -#else DBusError err; dbus_error_init(&err); @@ -969,7 +664,6 @@ int vc_dbus_request_finalize(int pid) } return result; -#endif } //LCOV_EXCL_START @@ -979,20 +673,6 @@ int vc_dbus_request_set_exclusive_command(int pid, bool value) return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - GError *error = NULL; - int result = 0; - if (!gdbus_vcdaemon_call_vcc_daemon_method_set_exclusive_cmd_sync(g_daemon_proxy, pid, value, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCC, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCC, "Failed without explicit error"); - } - } - return result; -#else DBusMessage* msg; msg = dbus_message_new_method_call( @@ -1053,7 +733,6 @@ int vc_dbus_request_set_exclusive_command(int pid, bool value) } return result; -#endif } //LCOV_EXCL_STOP @@ -1063,20 +742,6 @@ int vc_dbus_request_set_command(int pid, vc_cmd_type_e cmd_type) return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - GError *error = NULL; - int result = 0; - if (!gdbus_vcdaemon_call_vcc_daemon_method_set_command_sync(g_daemon_proxy, pid, cmd_type, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCC, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCC, "Failed without explicit error"); - } - } - return result; -#else DBusMessage* msg; msg = dbus_message_new_method_call( @@ -1135,7 +800,6 @@ int vc_dbus_request_set_command(int pid, vc_cmd_type_e cmd_type) } return result; -#endif } int vc_dbus_request_unset_command(int pid, vc_cmd_type_e cmd_type) @@ -1144,20 +808,6 @@ int vc_dbus_request_unset_command(int pid, vc_cmd_type_e cmd_type) return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - GError *error = NULL; - gint result = 0; - if (!gdbus_vcdaemon_call_vcc_daemon_method_unset_command_sync(g_daemon_proxy, pid, cmd_type, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCC, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCC, "Failed without explicit error"); - } - } - return result; -#else DBusMessage* msg; msg = dbus_message_new_method_call( @@ -1216,7 +866,6 @@ int vc_dbus_request_unset_command(int pid, vc_cmd_type_e cmd_type) } return result; -#endif } int vc_dbus_set_foreground(int pid, bool value) @@ -1225,16 +874,6 @@ int vc_dbus_set_foreground(int pid, bool value) return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - GDBusVcmanager* proxy = get_manager_proxy(); - gdbus_vcmanager_call_vcc_manager_method_set_foreground(proxy, - pid, value, NULL, NULL, NULL); - if (proxy) g_object_unref(proxy); - - gdbus_vcdaemon_call_vcc_daemon_method_set_foreground(g_daemon_proxy, - pid, value, NULL, NULL, NULL); - return 0; -#else DBusMessage* msg = NULL; int tmp_value = 0; @@ -1297,26 +936,11 @@ int vc_dbus_set_foreground(int pid, bool value) dbus_message_unref(msg); return 0; -#endif } //LCOV_EXCL_START int vc_dbus_set_server_dialog(int pid, const char* app_id, const char* credential) { -#ifdef USE_GDBUS - GError *error = NULL; - int result = 0; - if (!gdbus_vcdaemon_call_vcc_daemon_method_set_server_dialog_sync(g_daemon_proxy, pid, app_id, credential, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCC, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCC, "Failed without explicit error"); - } - } - return result; -#else if (NULL == g_conn_sender) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] NULL connection"); if (0 != vc_dbus_reconnect()) { @@ -1382,17 +1006,11 @@ int vc_dbus_set_server_dialog(int pid, const char* app_id, const char* credentia } return result; -#endif } //LCOV_EXCL_STOP int vc_dbus_request_dialog(int pid, const char* disp_text, const char* utt_text, bool continuous) { -#ifdef USE_GDBUS - int result = 0; - gdbus_vcdaemon_call_vcc_daemon_method_dialog(g_daemon_proxy, pid, disp_text, utt_text, continuous, NULL, NULL, NULL); - return result; -#else if (NULL == g_conn_sender) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] NULL connection"); //LCOV_EXCL_LINE if (0 != vc_dbus_reconnect()) { @@ -1482,28 +1100,10 @@ int vc_dbus_request_dialog(int pid, const char* disp_text, const char* utt_text, return result; */ //LCOV_EXCL_STOP -#endif } int vc_dbus_request_is_system_command_valid(int pid, bool* is_sys_cmd_valid) { -#ifdef USE_GDBUS - GError *error = NULL; - int result = 0; - gboolean valid = FALSE; - if (!gdbus_vcdaemon_call_vcc_daemon_method_is_system_command_valid_sync(g_daemon_proxy, pid, &result, &valid, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCC, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCC, "Failed without explicit error"); - } - } else { - if (is_sys_cmd_valid) *is_sys_cmd_valid = valid; - } - return result; -#else if (NULL == g_conn_sender) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] NULL connection"); //LCOV_EXCL_LINE if (0 != vc_dbus_reconnect()) { @@ -1571,7 +1171,6 @@ int vc_dbus_request_is_system_command_valid(int pid, bool* is_sys_cmd_valid) } return result; -#endif } //LCOV_EXCL_START @@ -1771,9 +1370,6 @@ int vc_dbus_request_cancel(int pid) /* Authority */ int vc_dbus_request_auth_enable(int pid, int mgr_pid) { -#ifdef USE_GDBUS - return 0; -#else if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } @@ -1844,14 +1440,10 @@ int vc_dbus_request_auth_enable(int pid, int mgr_pid) } return result; -#endif } int vc_dbus_request_auth_disable(int pid, int mgr_pid) { -#ifdef USE_GDBUS - return 0; -#else if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } @@ -1922,14 +1514,10 @@ int vc_dbus_request_auth_disable(int pid, int mgr_pid) } return result; -#endif } int vc_dbus_request_auth_start(int pid, int mgr_pid) { -#ifdef USE_GDBUS - return 0; -#else if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } @@ -2002,14 +1590,10 @@ int vc_dbus_request_auth_start(int pid, int mgr_pid) } return result; -#endif } int vc_dbus_request_auth_stop(int pid, int mgr_pid) { -#ifdef USE_GDBUS - return 0; -#else if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } @@ -2080,14 +1664,10 @@ int vc_dbus_request_auth_stop(int pid, int mgr_pid) } return result; -#endif } int vc_dbus_request_auth_cancel(int pid, int mgr_pid) { -#ifdef USE_GDBUS - return 0; -#else if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } @@ -2158,26 +1738,11 @@ int vc_dbus_request_auth_cancel(int pid, int mgr_pid) } return result; -#endif } //LCOV_EXCL_STOP int vc_dbus_request_tts(int pid, const char* text, const char* language, bool to_vcm, int* utt_id) { -#ifdef USE_GDBUS - GError *error = NULL; - int result = 0; - if (!gdbus_vcdaemon_call_vcc_daemon_method_request_tts_sync(g_daemon_proxy, pid, text, language, to_vcm, &result, utt_id, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCC, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCC, "Failed without explicit error"); - } - } - return result; -#else if (NULL == g_conn_sender) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] NULL connection"); if (0 != vc_dbus_reconnect()) { @@ -2253,25 +1818,10 @@ int vc_dbus_request_tts(int pid, const char* text, const char* language, bool to return result; return 0; -#endif } int vc_dbus_cancel_tts(int pid, int utt_id) { -#ifdef USE_GDBUS - GError *error = NULL; - int result = 0; - if (!gdbus_vcdaemon_call_vcc_daemon_method_cancel_tts_sync(g_daemon_proxy, pid, utt_id, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCC, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCC, "Failed without explicit error"); - } - } - return result; -#else if (NULL == g_conn_sender) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] NULL connection"); if (0 != vc_dbus_reconnect()) { @@ -2339,29 +1889,10 @@ int vc_dbus_cancel_tts(int pid, int utt_id) return result; return 0; -#endif } int vc_dbus_get_tts_audio_format(int pid, int* rate, vc_audio_channel_e* channel, vc_audio_type_e* audio_type) { -#ifdef USE_GDBUS - GError *error = NULL; - int result = 0; - gint out_channel, out_audio_type; - if (!gdbus_vcdaemon_call_vcc_daemon_method_get_tts_audio_format_sync(g_daemon_proxy, pid, &result, rate, &out_channel, &out_audio_type, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCC, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCC, "Failed without explicit error"); - } - } else { - if (channel) *channel = out_channel; - if (audio_type) *audio_type = out_audio_type; - } - return result; -#else if (NULL == g_conn_sender) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] NULL connection"); if (0 != vc_dbus_reconnect()) { @@ -2438,6 +1969,5 @@ int vc_dbus_get_tts_audio_format(int pid, int* rate, vc_audio_channel_e* channel return result; return 0; -#endif } diff --git a/client/vc_mgr.c b/client/vc_mgr.c index 35f272c..cee3254 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -83,7 +83,7 @@ static Eina_Bool __vc_mgr_notify_state_changed(void *data); static void __vc_mgr_notify_error(void *data); static Eina_Bool __vc_mgr_notify_result(void *data); -int __vc_mgr_cb_error(int reason, int daemon_pid, const char* msg); +int __vc_mgr_cb_error(int reason, int daemon_pid, char* msg); static const char* __vc_mgr_get_error_code(vc_error_e err) @@ -2950,7 +2950,7 @@ static void __vc_mgr_notify_error(void *data) } } -int __vc_mgr_cb_error(int reason, int daemon_pid, const char* msg) +int __vc_mgr_cb_error(int reason, int daemon_pid, char* msg) { vc_state_e state; if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) { diff --git a/client/vc_mgr_dbus.c b/client/vc_mgr_dbus.c index f071430..aa20c13 100644 --- a/client/vc_mgr_dbus.c +++ b/client/vc_mgr_dbus.c @@ -20,32 +20,20 @@ #include "vc_mgr_dbus.h" #include "vc_command.h" -#define USE_GDBUS -#ifdef USE_GDBUS -#include "vc_gdbus.h" - -static GDBusConnection* g_connection = NULL; -static GDBusVcdaemon *g_daemon_proxy = NULL; -static int g_own_name_id = 0; -static guint g_watch_id = 0; -static guint g_name_owner_changed_subscription_id = 0; -static bool g_daemon_name_appeared = false; - -static int g_volume_count = 0; -#else static pthread_mutex_t g_m_dbus_mutex = PTHREAD_MUTEX_INITIALIZER; -static Ecore_Fd_Handler* g_m_fd_handler = NULL; - -static bool g_is_connection_opened = false; static int g_m_waiting_time = 3000; static int g_m_waiting_short_time = 200; +static bool g_is_connection_opened = false; + +static Ecore_Fd_Handler* g_m_fd_handler = NULL; static DBusConnection* g_m_conn_sender = NULL; static DBusConnection* g_m_conn_listener = NULL; -#endif +static int g_volume_count = 0; + extern void __vc_mgr_cb_all_result(vc_result_type_e type); @@ -55,7 +43,7 @@ extern void __vc_mgr_cb_system_result(); extern void __vc_mgr_cb_speech_detected(); -extern int __vc_mgr_cb_error(int reason, int daemon_pid, const char* msg); +extern int __vc_mgr_cb_error(int reason, int daemon_pid, char* msg); extern int __vc_mgr_cb_set_volume(float volume); @@ -87,7 +75,6 @@ extern int __vc_mgr_cb_dialog(int pid, const char* disp_text, const char* utt_te extern void __vc_mgr_cb_specific_engine_result(const char* engine_app_id, const char* event, const char* result); -#ifndef USE_GDBUS static Eina_Bool vc_mgr_listener_event_callback(void* data, Ecore_Fd_Handler *fd_handler) { if (NULL == g_m_conn_listener) return ECORE_CALLBACK_RENEW; @@ -667,323 +654,8 @@ static void __vc_mgr_dbus_connection_free() } } -#endif - -#ifdef USE_GDBUS -gboolean vcd_manager_method_hello(GDBusVcmanager *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - int response = -1; - if (pid > 0) { - SLOG(LOG_DEBUG, TAG_VCM, "@@ vc mgr get hello : pid(%d) ", pid); - response = 1; - } else { - SLOG(LOG_ERROR, TAG_VCM, "@@ vc mgr get hello : invalid pid "); - } - gdbus_vcmanager_complete_vcd_manager_method_hello(service, invocation, response); - return TRUE; -} - -gboolean vcd_manager_method_speech_detected(GDBusVcmanager *service, GDBusMethodInvocation *invocation, - gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCM, "@@@ Get Speech detected"); - __vc_mgr_cb_speech_detected(); - gdbus_vcmanager_complete_vcd_manager_method_speech_detected(service, invocation); - return TRUE; -} - -gboolean vcd_manager_method_all_result(GDBusVcmanager *service, GDBusMethodInvocation *invocation, - gint result_type, gpointer user_data) -{ - __vc_mgr_cb_all_result((vc_result_type_e)result_type); - gdbus_vcmanager_complete_vcd_manager_method_all_result(service, invocation); - return TRUE; -} - -gboolean vcd_manager_method_pre_result(GDBusVcmanager *service, GDBusMethodInvocation *invocation, - gint event, const gchar* pre_result, gpointer user_data) -{ - if (NULL != pre_result) { - __vc_mgr_cb_pre_result((vc_pre_result_event_e)event, pre_result); - } - gdbus_vcmanager_complete_vcd_manager_method_pre_result(service, invocation); - return TRUE; -} - -gboolean vcd_manager_method_result(GDBusVcmanager *service, GDBusMethodInvocation *invocation, - gpointer user_data) -{ - __vc_mgr_cb_system_result(); - gdbus_vcmanager_complete_vcd_manager_method_result(service, invocation); - return TRUE; -} - -gboolean vcd_manager_method_set_volume(GDBusVcmanager *service, GDBusMethodInvocation *invocation, - gint volume, gpointer user_data) -{ - if (10 == g_volume_count) { - SLOG(LOG_DEBUG, TAG_VCM, "@@@ Set volume"); - SLOG(LOG_DEBUG, TAG_VCM, "@@ vc mgr set volume : volume(%d)", volume); - g_volume_count = 0; - } - - __vc_mgr_cb_set_volume(volume); - g_volume_count++; - gdbus_vcmanager_complete_vcd_manager_method_set_volume(service, invocation); - return TRUE; -} - -gboolean vcd_manager_method_dialog(GDBusVcmanager *service, GDBusMethodInvocation *invocation, - gint pid, const gchar* disp_text, const gchar* utt_text, gboolean continuous, gpointer user_data) -{ - __vc_mgr_cb_dialog(pid, disp_text, utt_text, continuous); - gdbus_vcmanager_complete_vcd_manager_method_dialog(service, invocation); - return TRUE; -} - -gboolean vcd_manager_method_set_private_data(GDBusVcmanager *service, GDBusMethodInvocation *invocation, - gint pid, const gchar* key, const gchar* data, gpointer user_data) -{ - if (pid > 0) { - SLOG(LOG_DEBUG, TAG_VCM, "@@ vc mgr get request set private data : pid(%d) ", pid); - __vc_mgr_cb_private_data_set(key, data); - } else { - SLOG(LOG_ERROR, TAG_VCM, "@@ vc mgr get request set private data : invalid pid "); - } - gdbus_vcmanager_complete_vcd_manager_method_set_private_data(service, invocation); - return TRUE; -} - -gboolean vcd_manager_method_get_private_data(GDBusVcmanager *service, GDBusMethodInvocation *invocation, - int pid, const gchar* key, gpointer user_data) -{ - gint ret = 0; - gchar* value = NULL; - if (pid > 0) { - SLOG(LOG_DEBUG, TAG_VCM, "@@ vc mgr get request get private data : pid(%d) ", pid); - ret = __vc_mgr_cb_private_data_requested(key, &value); - } else { - SLOG(LOG_ERROR, TAG_VCM, "@@ vc mgr get request get private data : invalid pid "); - } - gdbus_vcmanager_complete_vcd_manager_method_get_private_data(service, invocation, ret, value); - return TRUE; -} - -gboolean vcd_manager_method_specific_engine_result(GDBusVcmanager *service, GDBusMethodInvocation *invocation, - const gchar* engine_app_id, const gchar* event, const gchar* result, gpointer user_data) -{ - if (NULL != result) { - __vc_mgr_cb_specific_engine_result(engine_app_id, event, result); - } - gdbus_vcmanager_complete_vcd_manager_method_specific_engine_result(service, invocation); - return TRUE; -} - -gboolean vcd_manager_method_feedback_audio_format(GDBusVcmanager *service, GDBusMethodInvocation *invocation, - gint rate, gint channel, gint audio_type, gpointer user_data) -{ - __vc_mgr_cb_feedback_audio_format(rate, channel, audio_type); - gdbus_vcmanager_complete_vcd_manager_method_feedback_audio_format(service, invocation); - return TRUE; -} - -gboolean vcd_manager_method_feedback_streaming(GDBusVcmanager *service, GDBusMethodInvocation *invocation, - gint pid, gint utt_id, gint event, guint size, GVariant* buffer, gpointer user_data) -{ - int index = 0; - GVariantIter *iter; - guchar uc; - - char *data = NULL; - data = malloc(size); - if (!data) return FALSE; - - g_variant_get(buffer, "ay", &iter); - while (g_variant_iter_loop(iter, "y", &uc)) { - if (index < size) { - data[index++] = uc; - } else { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] max size reached : %d", index); - } - } - g_variant_iter_free(iter); - - __vc_mgr_cb_feedback_streaming(pid, utt_id, event, data, size); - - gdbus_vcmanager_complete_vcd_manager_method_feedback_streaming(service, invocation); - - free(data); - return TRUE; -} - -gboolean vcc_manager_method_set_foreground(GDBusVcmanager *service, GDBusMethodInvocation *invocation, - int pid, gboolean value, gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCM, "@@ foreground changed : pid(%d) value(%s)", pid, value ? "true" : "false"); - - __vc_mgr_cb_set_foreground(pid, value); - gdbus_vcmanager_complete_vcc_manager_method_set_foreground(service, invocation); - return TRUE; -} - -gboolean vcw_manager_method_set_foreground(GDBusVcmanager *service, GDBusMethodInvocation *invocation, - int pid, gboolean value, gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCM, "@@ foreground changed : pid(%d) value(%s)", pid, value ? "true" : "false"); - - __vc_mgr_cb_set_foreground(pid, value); - gdbus_vcmanager_complete_vcw_manager_method_set_foreground(service, invocation); - return TRUE; -} - -static void -on_name_acquired(GDBusConnection *connection, - const gchar *name, - gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCM, "Name acquired : %s", name); - - GDBusVcmanager *service; - GError *error = NULL; - - service = gdbus_vcmanager_skeleton_new(); - - /* vc client methods */ - g_signal_connect(service, "handle-vcc-manager-method-set-foreground", - G_CALLBACK(vcc_manager_method_set_foreground), NULL); - - /* vc daemon methods */ - g_signal_connect(service, "handle-vcd-manager-method-hello", - G_CALLBACK(vcd_manager_method_hello), NULL); - g_signal_connect(service, "handle-vcd-manager-method-speech-detected", - G_CALLBACK(vcd_manager_method_speech_detected), NULL); - g_signal_connect(service, "handle-vcd-manager-method-all-result", - G_CALLBACK(vcd_manager_method_all_result), NULL); - - g_signal_connect(service, "handle-vcd-manager-method-pre-result", - G_CALLBACK(vcd_manager_method_pre_result), NULL); - g_signal_connect(service, "handle-vcd-manager-method-result", - G_CALLBACK(vcd_manager_method_result), NULL); - g_signal_connect(service, "handle-vcd-manager-method-set-volume", - G_CALLBACK(vcd_manager_method_set_volume), NULL); - g_signal_connect(service, "handle-vcd-manager-method-dialog", - G_CALLBACK(vcd_manager_method_dialog), NULL); - g_signal_connect(service, "handle-vcd-manager-method-set-private-data", - G_CALLBACK(vcd_manager_method_set_private_data), NULL); - g_signal_connect(service, "handle-vcd-manager-method-get-private-data", - G_CALLBACK(vcd_manager_method_get_private_data), NULL); - g_signal_connect(service, "handle-vcd-manager-method-specific-engine-result", - G_CALLBACK(vcd_manager_method_specific_engine_result), NULL); - g_signal_connect(service, "handle-vcd-manager-method-feedback-audio-format", - G_CALLBACK(vcd_manager_method_feedback_audio_format), NULL); - g_signal_connect(service, "handle-vcd-manager-method-feedback-streaming", - G_CALLBACK(vcd_manager_method_feedback_streaming), NULL); - - /* vc widget methods */ - g_signal_connect(service, "handle-vcw-manager-method-set-foreground", - G_CALLBACK(vcw_manager_method_set_foreground), NULL); - - g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(service), - connection, VC_MANAGER_SERVICE_OBJECT_PATH, &error); - if (error) { - SLOG(LOG_DEBUG, TAG_VCM, "Error : %s\n", error->message); - g_error_free(error); - } -} - -static void _on_name_owner_changed(GDBusConnection *connection, - const gchar *sender_name, const gchar *object_path, - const gchar *interface_name, const gchar *signal_name, - GVariant *parameters, gpointer user_data) -{ - gchar *name; - gchar *old_owner; - gchar *new_owner; - - g_variant_get(parameters, - "(sss)", - &name, - &old_owner, - &new_owner); - - if (g_name_owner_changed_subscription_id > 0) { - g_dbus_connection_signal_unsubscribe(connection, g_name_owner_changed_subscription_id); - g_name_owner_changed_subscription_id = 0; - } - - SLOG(LOG_ERROR, TAG_VCM, "name_owner_changed(%s: %s -> %s) interface %s sender %s object %s", - name, old_owner, new_owner, interface_name, sender_name, object_path); - __vc_mgr_cb_error(VC_ERROR_SERVICE_RESET, -1, "Daemon Reset"); - - g_free(name); - g_free(old_owner); - g_free(new_owner); -} - -static void name_appeared_handler(GDBusConnection *connection, - const gchar *name, const gchar *name_owner, gpointer user_data) -{ - SLOG(LOG_INFO, TAG_VCM, "@@ Name appeared : name %s owner %s", name, name_owner); - g_daemon_name_appeared = true; -} - -static void name_vanished_handler(GDBusConnection *connection, - const gchar *name, gpointer user_data) -{ - SLOG(LOG_INFO, TAG_VCM, "@@ Name vanished : name %s", name); - g_daemon_name_appeared = false; -} - -#endif - -static void vcd_signal_set_service_state(GDBusVcdaemon* proxy, - gint state, gpointer user_data) -{ - SLOG(LOG_INFO, TAG_VCM, "@@ state changed : %d", state); - - __vc_mgr_cb_service_state(state); -} - -static void vcd_manager_signal_send_error(GDBusVcdaemon* proxy, - gint reason, gint daemon_pid, const gchar* err_msg, gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCM, "Error Signal : reason(%d), daemon_pid(%d), err_msg(%s)", - reason, daemon_pid, err_msg); -} - int vc_mgr_dbus_open_connection() { -#ifdef USE_GDBUS - GError* error = NULL; - g_connection = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error); - g_watch_id = g_bus_watch_name_on_connection(g_connection, VC_DAEMON_SERVICE_NAME, 0, - name_appeared_handler, - name_vanished_handler, - NULL, NULL); - - char service_name[64]; - memset(service_name, '\0', 64); - snprintf(service_name, 64, "%s", VC_MANAGER_SERVICE_NAME); - g_own_name_id = g_bus_own_name(G_BUS_TYPE_SESSION, - service_name, 0, NULL, on_name_acquired, NULL, NULL, NULL); - SLOG(LOG_DEBUG, TAG_VCM, "service_name : %s, %d", service_name, g_own_name_id); - - g_daemon_proxy = gdbus_vcdaemon_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, 0, - VC_DAEMON_SERVICE_NAME, VC_DAEMON_SERVICE_OBJECT_PATH, NULL, &error); - if (error) { - SLOG(LOG_DEBUG, TAG_VCM, "Error : %s", error->message); - g_error_free(error); - } else { - /* vc common signals */ - g_signal_connect(g_daemon_proxy, "vcd-signal-set-service-state", - G_CALLBACK(vcd_signal_set_service_state), NULL); - - /* vc manager signals */ - g_signal_connect(g_daemon_proxy, "vcd-manager-signal-send-error", - G_CALLBACK(vcd_manager_signal_send_error), NULL); - } -#else pthread_mutex_lock(&g_m_dbus_mutex); if (NULL != g_m_conn_sender && NULL != g_m_conn_listener) { @@ -1093,30 +765,12 @@ int vc_mgr_dbus_open_connection() pthread_mutex_unlock(&g_m_dbus_mutex); SLOG(LOG_INFO, TAG_VCM, "[INFO] manager dbus connection is opened"); -#endif + return VC_ERROR_NONE; } int vc_mgr_dbus_close_connection() { -#ifdef USE_GDBUS - if (g_daemon_proxy) { - g_object_unref(g_daemon_proxy); - g_daemon_proxy = NULL; - } - if (g_own_name_id) { - g_bus_unown_name(g_own_name_id); - g_own_name_id = 0; - } - if (g_watch_id) { - g_bus_unwatch_name(g_watch_id); - g_watch_id = 0; - } - if (g_connection != NULL) { - g_object_unref(g_connection); - g_connection = NULL; - } -#else pthread_mutex_lock(&g_m_dbus_mutex); DBusError err; @@ -1149,25 +803,12 @@ int vc_mgr_dbus_close_connection() pthread_mutex_unlock(&g_m_dbus_mutex); SLOG(LOG_INFO, TAG_VCM, "[INFO] manager dbus connection is closed"); -#endif + return VC_ERROR_NONE; } int vc_mgr_dbus_reconnect() { -#ifdef USE_GDBUS - if (!g_own_name_id || !g_daemon_proxy) { - vc_mgr_dbus_close_connection(); - - if (0 != vc_mgr_dbus_open_connection()) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to reconnect"); //LCOV_EXCL_LINE - return -1; - } - - SLOG(LOG_DEBUG, TAG_VCM, "[DBUS] Reconnect"); //LCOV_EXCL_LINE - return 0; - } -#else if (!g_m_conn_sender || !g_m_conn_listener) { vc_mgr_dbus_close_connection(); @@ -1196,24 +837,16 @@ int vc_mgr_dbus_reconnect() SLOG(LOG_DEBUG, TAG_VCM, "[DBUS] Reconnect"); } -#endif + return 0; } static int __dbus_check() { -#ifdef USE_GDBUS - SLOG(LOG_DEBUG, TAG_VCM, "%d %p", g_own_name_id, g_daemon_proxy); //LCOV_EXCL_LINE - if (0 == g_own_name_id || NULL == g_daemon_proxy) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] NULL connection"); //LCOV_EXCL_LINE - return vc_mgr_dbus_reconnect(); - } -#else if (NULL == g_m_conn_sender || NULL == g_m_conn_listener) { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] NULL connection"); //LCOV_EXCL_LINE return vc_mgr_dbus_reconnect(); } -#endif return 0; } @@ -1222,20 +855,7 @@ int vc_mgr_dbus_request_hello() if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - GError *error = NULL; - int result = 0; - if (!gdbus_vcdaemon_call_vc_method_hello_sync(g_daemon_proxy, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCM, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCM, "Failed without explicit error"); - } - } - return result; -#else + DBusMessage* msg; msg = dbus_message_new_method_call( @@ -1272,7 +892,6 @@ int vc_mgr_dbus_request_hello() } return result; -#endif } static int __dbus_restore_daemon() @@ -1280,15 +899,19 @@ static int __dbus_restore_daemon() int ret = -1; int count = 0; while (0 != ret) { - usleep(100000); - SLOG(LOG_DEBUG, TAG_VCM, "[DEBUG] requesting hello : %d", count); ret = vc_mgr_dbus_request_hello(); if (0 != ret) { - SLOG(LOG_WARN, TAG_VCM, "[WARNING] retry restore daemon"); - count++; - if (VC_RETRY_COUNT == count) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to request"); + if (VC_ERROR_TIMED_OUT != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); break; + } else { + SLOG(LOG_WARN, TAG_VCM, "[WARNING] retry restore daemon"); + usleep(10000); + count++; + if (VC_RETRY_COUNT == count) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to request"); + break; + } } } else { SLOG(LOG_ERROR, TAG_VCM, "[SUCCESS] restore daemon"); @@ -1302,34 +925,7 @@ int vc_mgr_dbus_request_initialize(int pid, int audio_streaming_mode, int* servi if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - if (false == g_daemon_name_appeared) { - int ret = __dbus_restore_daemon(); - if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); - return VC_ERROR_TIMED_OUT; - } - } - GError *error = NULL; - int result = 0; - if (!gdbus_vcdaemon_call_vcm_daemon_method_initialize_sync(g_daemon_proxy, - pid, audio_streaming_mode, &result, service_state, foreground, daemon_pid, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCM, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCM, "Failed without explicit error"); - } - } - if (0 == result && NULL != g_connection && 0 == g_name_owner_changed_subscription_id) { - g_name_owner_changed_subscription_id = g_dbus_connection_signal_subscribe(g_connection, - "org.freedesktop.DBus", "org.freedesktop.DBus", "NameOwnerChanged", "/org/freedesktop/DBus", - VC_DAEMON_SERVICE_NAME, G_DBUS_SIGNAL_FLAGS_NONE, _on_name_owner_changed, NULL, NULL); - } - return result; -#else DBusError err; dbus_error_init(&err); @@ -1430,39 +1026,14 @@ int vc_mgr_dbus_request_initialize(int pid, int audio_streaming_mode, int* servi } return result; -#endif } int vc_mgr_dbus_request_finalize(int pid) { -#ifdef USE_GDBUS - if (false == g_daemon_name_appeared) { - int ret = __dbus_restore_daemon(); - if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); - return VC_ERROR_TIMED_OUT; - } + if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } - GError *error = NULL; - gint result; - if (g_name_owner_changed_subscription_id > 0) { - g_dbus_connection_signal_unsubscribe(g_connection, g_name_owner_changed_subscription_id); - g_name_owner_changed_subscription_id = 0; - } - if (!gdbus_vcdaemon_call_vcm_daemon_method_finalize_sync(g_daemon_proxy, - pid, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCM, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCM, "Failed without explicit error"); - } - } - return result; -#else DBusError err; dbus_error_init(&err); @@ -1545,7 +1116,7 @@ int vc_mgr_dbus_request_finalize(int pid) vc_mgr_dbus_reconnect(); result = VC_ERROR_TIMED_OUT; } -#endif + return result; } @@ -1554,30 +1125,7 @@ int vc_mgr_dbus_request_set_command(int pid) if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - if (false == g_daemon_name_appeared) { - int ret = __dbus_restore_daemon(); - if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); - return VC_ERROR_TIMED_OUT; - } - return VC_ERROR_OPERATION_FAILED; - } - GError *error = NULL; - gint result; - if (!gdbus_vcdaemon_call_vcm_daemon_method_set_command_sync(g_daemon_proxy, - pid, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCM, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCM, "Failed without explicit error"); - } - } - return result; -#else DBusError err; dbus_error_init(&err); @@ -1651,7 +1199,6 @@ int vc_mgr_dbus_request_set_command(int pid) } return result; -#endif } int vc_mgr_dbus_request_unset_command(int pid) @@ -1659,30 +1206,7 @@ int vc_mgr_dbus_request_unset_command(int pid) if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - if (false == g_daemon_name_appeared) { - int ret = __dbus_restore_daemon(); - if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); - return VC_ERROR_TIMED_OUT; - } - return VC_ERROR_OPERATION_FAILED; - } - GError *error = NULL; - gint result; - if (!gdbus_vcdaemon_call_vcm_daemon_method_unset_command_sync(g_daemon_proxy, - pid, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCM, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCM, "Failed without explicit error"); - } - } - return result; -#else DBusError err; dbus_error_init(&err); @@ -1756,7 +1280,6 @@ int vc_mgr_dbus_request_unset_command(int pid) } return result; -#endif } int vc_mgr_dbus_request_demandable_client(int pid) @@ -1764,30 +1287,7 @@ int vc_mgr_dbus_request_demandable_client(int pid) if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - if (false == g_daemon_name_appeared) { - int ret = __dbus_restore_daemon(); - if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); - return VC_ERROR_TIMED_OUT; - } - return VC_ERROR_OPERATION_FAILED; - } - GError *error = NULL; - gint result; - if (!gdbus_vcdaemon_call_vcm_daemon_method_set_demandable_client_sync(g_daemon_proxy, - pid, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCM, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCM, "Failed without explicit error"); - } - } - return result; -#else DBusError err; dbus_error_init(&err); @@ -1861,7 +1361,6 @@ int vc_mgr_dbus_request_demandable_client(int pid) } return result; -#endif } int vc_mgr_dbus_request_set_audio_type(int pid, const char* audio_type) @@ -1870,30 +1369,6 @@ int vc_mgr_dbus_request_set_audio_type(int pid, const char* audio_type) return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - if (false == g_daemon_name_appeared) { - int ret = __dbus_restore_daemon(); - if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); - return VC_ERROR_TIMED_OUT; - } - return VC_ERROR_OPERATION_FAILED; - } - - GError *error = NULL; - gint result; - if (!gdbus_vcdaemon_call_vcm_daemon_method_set_audio_type_sync(g_daemon_proxy, - pid, audio_type, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCM, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCM, "Failed without explicit error"); - } - } - return result; -#else DBusError err; dbus_error_init(&err); @@ -1969,7 +1444,6 @@ int vc_mgr_dbus_request_set_audio_type(int pid, const char* audio_type) } return result; -#endif } int vc_mgr_dbus_request_get_audio_type(int pid, char** audio_type) @@ -1977,34 +1451,7 @@ int vc_mgr_dbus_request_get_audio_type(int pid, char** audio_type) if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - if (false == g_daemon_name_appeared) { - int ret = __dbus_restore_daemon(); - if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); - return VC_ERROR_TIMED_OUT; - } - return VC_ERROR_OPERATION_FAILED; - } - GError *error = NULL; - gint result; - gchar *temp = NULL; - if (!gdbus_vcdaemon_call_vcm_daemon_method_get_audio_type_sync(g_daemon_proxy, - pid, &result, &temp, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCM, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCM, "Failed without explicit error"); - } - } - if (NULL != audio_type && NULL != temp) { - *audio_type = strdup(temp); - } - return result; -#else DBusError err; dbus_error_init(&err); @@ -2085,16 +1532,10 @@ int vc_mgr_dbus_request_get_audio_type(int pid, char** audio_type) } return result; -#endif } int vc_mgr_dbus_request_set_private_data(int pid, const char* key, const char* data) { -#ifdef USE_GDBUS - gdbus_vcdaemon_call_vcm_daemon_method_set_private_data(g_daemon_proxy, - pid, key, data, NULL, NULL, NULL); - return 0; -#else if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } @@ -2136,30 +1577,10 @@ int vc_mgr_dbus_request_set_private_data(int pid, const char* key, const char* d dbus_message_unref(msg); return VC_ERROR_NONE; -#endif } int vc_mgr_dbus_request_get_private_data(int pid, const char* key, char** data) { -#ifdef USE_GDBUS - GError *error = NULL; - gint result = 0; - gchar *temp = NULL; - if (!gdbus_vcdaemon_call_vcm_daemon_method_get_private_data_sync(g_daemon_proxy, - pid, key, &result, &temp, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCM, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCM, "Failed without explicit error"); - } - } - if (NULL != data && NULL != temp) { - *data = strdup(temp); - } - return result; -#else if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } @@ -2230,7 +1651,6 @@ int vc_mgr_dbus_request_get_private_data(int pid, const char* key, char** data) } return result; -#endif } int vc_mgr_dbus_request_set_client_info(int pid) @@ -2238,33 +1658,6 @@ int vc_mgr_dbus_request_set_client_info(int pid) if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - if (false == g_daemon_name_appeared) { - int ret = __dbus_restore_daemon(); - if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); - return VC_ERROR_TIMED_OUT; - } - return VC_ERROR_OPERATION_FAILED; - } - - GError *error = NULL; - gint result; - if (!gdbus_vcdaemon_call_vcm_daemon_method_set_client_info_sync(g_daemon_proxy, - pid, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCM, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCM, "Failed without explicit error"); - } - } - return result; -#else - if (0 != __dbus_check()) { - return VC_ERROR_OPERATION_FAILED; - } DBusError err; dbus_error_init(&err); @@ -2340,26 +1733,10 @@ int vc_mgr_dbus_request_set_client_info(int pid) } return result; -#endif } int vc_mgr_dbus_request_set_domain(int pid, const char* domain) { -#ifdef USE_GDBUS - GError *error = NULL; - gint result; - if (!gdbus_vcdaemon_call_vcm_daemon_method_set_domain_sync(g_daemon_proxy, - pid, domain, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCM, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCM, "Failed without explicit error"); - } - } - return result; -#else if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } @@ -2423,16 +1800,10 @@ int vc_mgr_dbus_request_set_domain(int pid, const char* domain) } return result; -#endif } int vc_mgr_dbus_request_do_action(int pid, vc_send_event_type_e type, char* send_event) { -#ifdef USE_GDBUS - gdbus_vcdaemon_call_vcm_daemon_method_do_action(g_daemon_proxy, - pid, type, send_event, NULL, NULL, NULL); - return 0; -#else if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } @@ -2472,7 +1843,6 @@ int vc_mgr_dbus_request_do_action(int pid, vc_send_event_type_e type, char* send dbus_message_unref(msg); return 0; -#endif } int vc_mgr_dbus_request_start(int pid, int recognition_mode, bool exclusive_command_option, bool start_by_client) @@ -2480,33 +1850,6 @@ int vc_mgr_dbus_request_start(int pid, int recognition_mode, bool exclusive_comm if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - if (false == g_daemon_name_appeared) { - int ret = __dbus_restore_daemon(); - if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); - return VC_ERROR_TIMED_OUT; - } - return VC_ERROR_OPERATION_FAILED; - } - - GError *error = NULL; - gint result; - if (!gdbus_vcdaemon_call_vcm_daemon_method_request_start_sync(g_daemon_proxy, - pid, recognition_mode, exclusive_command_option, start_by_client, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCM, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCM, "Failed without explicit error"); - } - } - return result; -#else - if (0 != __dbus_check()) { - return VC_ERROR_OPERATION_FAILED; - } DBusError err; dbus_error_init(&err); @@ -2589,7 +1932,6 @@ int vc_mgr_dbus_request_start(int pid, int recognition_mode, bool exclusive_comm } return result; -#endif } int vc_mgr_dbus_request_stop(int pid) @@ -2597,30 +1939,7 @@ int vc_mgr_dbus_request_stop(int pid) if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - if (false == g_daemon_name_appeared) { - int ret = __dbus_restore_daemon(); - if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); - return VC_ERROR_TIMED_OUT; - } - return VC_ERROR_OPERATION_FAILED; - } - GError *error = NULL; - gint result; - if (!gdbus_vcdaemon_call_vcm_daemon_method_request_stop_sync(g_daemon_proxy, - pid, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCM, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCM, "Failed without explicit error"); - } - } - return result; -#else DBusError err; dbus_error_init(&err); @@ -2695,7 +2014,6 @@ int vc_mgr_dbus_request_stop(int pid) } return result; -#endif } int vc_mgr_dbus_request_cancel(int pid) @@ -2703,30 +2021,7 @@ int vc_mgr_dbus_request_cancel(int pid) if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - if (false == g_daemon_name_appeared) { - int ret = __dbus_restore_daemon(); - if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); - return VC_ERROR_TIMED_OUT; - } - return VC_ERROR_OPERATION_FAILED; - } - GError *error = NULL; - gint result; - if (!gdbus_vcdaemon_call_vcm_daemon_method_request_cancel_sync(g_daemon_proxy, - pid, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCM, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCM, "Failed without explicit error"); - } - } - return result; -#else DBusError err; dbus_error_init(&err); @@ -2801,7 +2096,6 @@ int vc_mgr_dbus_request_cancel(int pid) } return result; -#endif } int vc_mgr_dbus_request_enable_command_type(int pid, int cmd_type) @@ -2809,30 +2103,7 @@ int vc_mgr_dbus_request_enable_command_type(int pid, int cmd_type) if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - if (false == g_daemon_name_appeared) { - int ret = __dbus_restore_daemon(); - if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); - return VC_ERROR_TIMED_OUT; - } - return VC_ERROR_OPERATION_FAILED; - } - GError *error = NULL; - gint result; - if (!gdbus_vcdaemon_call_vcm_daemon_method_enable_command_type_sync(g_daemon_proxy, - pid, cmd_type, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCM, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCM, "Failed without explicit error"); - } - } - return result; -#else DBusError err; dbus_error_init(&err); @@ -2908,7 +2179,6 @@ int vc_mgr_dbus_request_enable_command_type(int pid, int cmd_type) } return result; -#endif } int vc_mgr_dbus_request_disable_command_type(int pid, int cmd_type) @@ -2916,33 +2186,6 @@ int vc_mgr_dbus_request_disable_command_type(int pid, int cmd_type) if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - if (false == g_daemon_name_appeared) { - int ret = __dbus_restore_daemon(); - if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); - return VC_ERROR_TIMED_OUT; - } - return VC_ERROR_OPERATION_FAILED; - } - - GError *error = NULL; - gint result; - if (!gdbus_vcdaemon_call_vcm_daemon_method_disable_command_type_sync(g_daemon_proxy, - pid, cmd_type, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCM, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCM, "Failed without explicit error"); - } - } - return result; -#else - if (0 != __dbus_check()) { - return VC_ERROR_OPERATION_FAILED; - } DBusError err; dbus_error_init(&err); @@ -3019,10 +2262,8 @@ int vc_mgr_dbus_request_disable_command_type(int pid, int cmd_type) } return result; -#endif } -#ifndef USE_GDBUS static DBusMessage* __get_message(int pid, const char* method, int type) { char service_name[64]; @@ -3049,13 +2290,9 @@ static DBusMessage* __get_message(int pid, const char* method, int type) return dbus_message_new_method_call(service_name, object_path, target_if_name, method); } -#endif int vc_mgr_dbus_send_result(int pid, int cmd_type, int result_id) { -#ifdef USE_GDBUS - return 0; -#else if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } @@ -3094,16 +2331,10 @@ int vc_mgr_dbus_send_result(int pid, int cmd_type, int result_id) dbus_message_unref(msg); return 0; -#endif } int vc_mgr_dbus_send_result_selection(int pid) { -#ifdef USE_GDBUS - gdbus_vcdaemon_call_vcm_daemon_method_result_selection(g_daemon_proxy, - pid, NULL, NULL, NULL); - return 0; -#else if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } @@ -3139,16 +2370,10 @@ int vc_mgr_dbus_send_result_selection(int pid) } return 0; -#endif } int vc_mgr_dbus_send_specific_engine_request(int pid, const char* engine_app_id, const char* event, const char* request) { -#ifdef USE_GDBUS - gdbus_vcdaemon_call_vcm_daemon_method_specific_engine_request(g_daemon_proxy, - pid, engine_app_id, event, request, NULL, NULL, NULL); - return 0; -#else if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } @@ -3189,17 +2414,10 @@ int vc_mgr_dbus_send_specific_engine_request(int pid, const char* engine_app_id, dbus_message_unref(msg); return 0; -#endif } int vc_mgr_dbus_send_utterance_status(int pid, int utt_id, int utt_status) { -#ifdef USE_GDBUS - /* To Client */ - //gdbus_vcdaemon_call_vcm_daemon_method_utterance_status(g_daemon_proxy, - // utt_id, utt_status, NULL, NULL, NULL); - return 0; -#else if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } @@ -3232,21 +2450,10 @@ int vc_mgr_dbus_send_utterance_status(int pid, int utt_id, int utt_status) dbus_message_unref(msg); return 0; -#endif } int vc_mgr_dbus_send_audio_streaming(int pid, vc_audio_streaming_event_e event, unsigned char* buffer, unsigned int len) { -#ifdef USE_GDBUS - GVariant *variant = g_variant_new_from_data(G_VARIANT_TYPE ("ay"), - buffer, len, TRUE, NULL, NULL); - - gdbus_vcdaemon_call_vcm_daemon_method_send_audio_streaming(g_daemon_proxy, - pid, event, len, variant, NULL, NULL, NULL); - - g_variant_ref(variant); - return 0; -#else if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } @@ -3285,7 +2492,6 @@ int vc_mgr_dbus_send_audio_streaming(int pid, vc_audio_streaming_event_e event, dbus_message_unref(msg); return 0; -#endif } int vc_mgr_dbus_change_system_volume(int pid, vc_system_volume_event_e volume_event) @@ -3293,33 +2499,6 @@ int vc_mgr_dbus_change_system_volume(int pid, vc_system_volume_event_e volume_ev if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - if (false == g_daemon_name_appeared) { - int ret = __dbus_restore_daemon(); - if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); - return VC_ERROR_TIMED_OUT; - } - return VC_ERROR_OPERATION_FAILED; - } - - GError *error = NULL; - gint result; - if (!gdbus_vcdaemon_call_vcm_daemon_method_change_system_volume_sync(g_daemon_proxy, - pid, volume_event, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCM, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCM, "Failed without explicit error"); - } - } - return result; -#else - if (0 != __dbus_check()) { - return VC_ERROR_OPERATION_FAILED; - } DBusError err; dbus_error_init(&err); @@ -3397,6 +2576,5 @@ int vc_mgr_dbus_change_system_volume(int pid, vc_system_volume_event_e volume_ev } return result; -#endif } diff --git a/client/vc_setting_dbus.c b/client/vc_setting_dbus.c index a28d700..c249d40 100644 --- a/client/vc_setting_dbus.c +++ b/client/vc_setting_dbus.c @@ -17,15 +17,7 @@ #include "vc_setting_dbus.h" #include "vc_main.h" -#define USE_GDBUS -#ifdef USE_GDBUS -#include "vc_gdbus.h" - -static GDBusVcdaemon *g_daemon_proxy = NULL; -static int g_own_name_id = 0; - -#else static int g_s_waiting_time = 3000; static Ecore_Fd_Handler* g_s_fd_handler = NULL; @@ -33,9 +25,7 @@ static Ecore_Fd_Handler* g_s_fd_handler = NULL; static DBusConnection* g_s_conn_sender = NULL; static DBusConnection* g_s_conn_listener = NULL; -#endif -#ifndef USE_GDBUS static Eina_Bool listener_setting_event_callback(void* data, Ecore_Fd_Handler *fd_handler) { if (NULL == g_s_conn_listener) return ECORE_CALLBACK_RENEW; @@ -122,52 +112,9 @@ static void __vc_setting_dbus_connection_free() g_s_conn_sender = NULL; } } -#endif - -#ifdef USE_GDBUS -static void -on_name_acquired(GDBusConnection *connection, - const gchar *name, - gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCS, "Name acquired : %s", name); - - GDBusVcsetting *service; - GError *error = NULL; - - service = gdbus_vcsetting_skeleton_new(); - - g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(service), - connection, VC_SETTING_SERVICE_OBJECT_PATH, &error); - if (error) { - SLOG(LOG_DEBUG, TAG_VCS, "Error : %s\n", error->message); - g_error_free(error); - } -} - -#endif int vc_setting_dbus_open_connection() { -#ifdef USE_GDBUS - int pid = getpid(); - - char service_name[64]; - memset(service_name, '\0', 64); - snprintf(service_name, 64, "%s%d", VC_SETTING_SERVICE_NAME, pid); - g_own_name_id = g_bus_own_name(G_BUS_TYPE_SESSION, - service_name, 0, NULL, on_name_acquired, NULL, NULL, NULL); - SLOG(LOG_DEBUG, TAG_VCS, "service_name : %s, %d", service_name, g_own_name_id); - - GError *error = NULL; - g_daemon_proxy = gdbus_vcdaemon_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, 0, - VC_DAEMON_SERVICE_NAME, VC_DAEMON_SERVICE_OBJECT_PATH, NULL, &error); - if (error) { - SLOG(LOG_DEBUG, TAG_VCS, "Error : %s", error->message); - g_error_free(error); - } - return 0; -#else if (NULL != g_s_conn_sender && NULL != g_s_conn_listener) { SLOG(LOG_WARN, TAG_VCS, "already existed connection "); return 0; @@ -263,22 +210,10 @@ int vc_setting_dbus_open_connection() } return 0; -#endif } int vc_setting_dbus_close_connection() { -#ifdef USE_GDBUS - if (g_daemon_proxy) { - g_object_unref(g_daemon_proxy); - g_daemon_proxy = NULL; - } - if (g_own_name_id) { - g_bus_unown_name(g_own_name_id); - g_own_name_id = 0; - } - return 0; -#else DBusError err; dbus_error_init(&err); @@ -307,24 +242,10 @@ int vc_setting_dbus_close_connection() __vc_setting_dbus_connection_free(); return 0; -#endif } int vc_setting_dbus_reconnect() { -#ifdef USE_GDBUS - if (!g_own_name_id || !g_daemon_proxy) { - vc_setting_dbus_close_connection(); - - if (0 != vc_setting_dbus_open_connection()) { - SLOG(LOG_ERROR, TAG_VCS, "[ERROR] Fail to reconnect"); //LCOV_EXCL_LINE - return -1; - } - - SLOG(LOG_DEBUG, TAG_VCS, "[DBUS] Reconnect"); //LCOV_EXCL_LINE - } - return 0; -#else if (!g_s_conn_sender || !g_s_conn_listener) { vc_setting_dbus_close_connection(); @@ -354,25 +275,10 @@ int vc_setting_dbus_reconnect() } return 0; -#endif } int vc_setting_dbus_request_hello() { -#ifdef USE_GDBUS - GError *error = NULL; - int result = 0; - if (!gdbus_vcdaemon_call_vc_method_hello_sync(g_daemon_proxy, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCS, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCS, "Failed without explicit error"); - } - } - return result; -#else if (NULL == g_s_conn_sender) { return VC_ERROR_OPERATION_FAILED; } @@ -412,26 +318,10 @@ int vc_setting_dbus_request_hello() } return result; -#endif } int vc_setting_dbus_request_set_language(int pid, const char* language) { -#ifdef USE_GDBUS - GError *error = NULL; - int result; - if (!gdbus_vcdaemon_call_vcs_daemon_method_set_language_sync(g_daemon_proxy, - pid, language, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCS, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCS, "Failed without explicit error"); - } - } - return result; -#else if (NULL == g_s_conn_sender) { SLOG(LOG_ERROR, TAG_VCS, "[ERROR] Dbus does not open"); return VC_ERROR_OPERATION_FAILED; @@ -491,5 +381,4 @@ int vc_setting_dbus_request_set_language(int pid, const char* language) } return result; -#endif } diff --git a/client/vc_widget_dbus.c b/client/vc_widget_dbus.c index 1108085..eddeb77 100644 --- a/client/vc_widget_dbus.c +++ b/client/vc_widget_dbus.c @@ -21,27 +21,18 @@ #include "vc_widget_client.h" #include "vc_widget_dbus.h" -#define USE_GDBUS -#ifdef USE_GDBUS -#include "vc_gdbus.h" - -static GDBusVcdaemon *g_daemon_proxy = NULL; -static int g_own_name_id = 0; -#else -static pthread_mutex_t g_w_init_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t g_w_dbus_mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t g_w_init_mutex = PTHREAD_MUTEX_INITIALIZER; static int g_w_waiting_time = 3000; static int g_w_waiting_short_time = 200; - static bool g_is_connection_opened = false; static Ecore_Fd_Handler* g_w_fd_handler = NULL; -static DBusConnection* g_w_conn_listener = NULL; static DBusConnection* g_w_conn_sender = NULL; -#endif +static DBusConnection* g_w_conn_listener = NULL; extern int __vc_widget_cb_error(int reason, int daemon_pid, char* msg); @@ -53,7 +44,7 @@ extern bool __vc_widget_cb_asr_result(int event, const char* asr_result); extern int __vc_widget_cb_service_state(int state); -#ifndef USE_GDBUS + static Eina_Bool widget_listener_event_callback(void* data, Ecore_Fd_Handler *fd_handler) { if (NULL == g_w_conn_listener) return ECORE_CALLBACK_RENEW; @@ -289,113 +280,9 @@ static void __vc_widget_dbus_connection_free() g_w_conn_sender = NULL; } } -#endif - -#ifdef USE_GDBUS - -gboolean vcd_widget_method_hello(GDBusVcwidget *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - int response = -1; - - if (pid > 0) { - SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget get hello : pid(%d) ", pid); - response = 1; - } else { - SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget get hello : invalid pid "); - } - - gdbus_vcwidget_complete_vcd_widget_method_hello(service, invocation, response); - return TRUE; -} - -gboolean vcd_widget_method_show_tooltip(GDBusVcwidget *service, GDBusMethodInvocation *invocation, - int pid, gboolean show, gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget show tooltip : pid(%d), show(%d)", pid, show); - __vc_widget_cb_show_tooltip(pid, show); - - gdbus_vcwidget_complete_vcd_widget_method_show_tooltip(service, invocation); - return TRUE; -} - -gboolean vcd_widget_method_result(GDBusVcwidget *service, GDBusMethodInvocation *invocation, - int pid, gboolean show, gpointer user_data) -{ - __vc_widget_cb_result(); - - gdbus_vcwidget_complete_vcd_widget_method_result(service, invocation); - return TRUE; -} - - -gboolean vcd_widget_method_asr_result(GDBusVcwidget *service, GDBusMethodInvocation *invocation, - int event, const gchar* asr_result, gpointer user_data) -{ - int ret = 0; - - if (false == __vc_widget_cb_asr_result(event, asr_result)) - ret = 0; - else - ret = 1; - - SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget get asr result, event(%d), asr_result(%s), consumed(%d)", event, asr_result, ret); - gdbus_vcwidget_complete_vcd_widget_method_asr_result(service, invocation, ret); - return TRUE; -} - -static void -on_name_acquired(GDBusConnection *connection, - const gchar *name, - gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCW, "Name acquired : %s", name); - - GDBusVcwidget *service; - GError *error = NULL; - - service = gdbus_vcwidget_skeleton_new(); - - /* vc daemon methods */ - g_signal_connect(service, "handle-vcd-widget-method-hello", - G_CALLBACK(vcd_widget_method_hello), NULL); - g_signal_connect(service, "handle-vcd-widget-method-result", - G_CALLBACK(vcd_widget_method_result), NULL); - g_signal_connect(service, "handle-vcd-widget-method-asr-result", - G_CALLBACK(vcd_widget_method_asr_result), NULL); - g_signal_connect(service, "handle-vcd-widget-method-show-tooltip", - G_CALLBACK(vcd_widget_method_show_tooltip), NULL); - - g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(service), - connection, VC_WIDGET_SERVICE_OBJECT_PATH, &error); - if (error) { - SLOG(LOG_DEBUG, TAG_VCW, "Error : %s\n", error->message); - g_error_free(error); - } -} -#endif int vc_widget_dbus_open_connection() { -#ifdef USE_GDBUS - int pid = getpid(); - - char service_name[64]; - memset(service_name, '\0', 64); - snprintf(service_name, 64, "%s%d", VC_WIDGET_SERVICE_NAME, pid); - g_own_name_id = g_bus_own_name(G_BUS_TYPE_SESSION, - service_name, 0, NULL, on_name_acquired, NULL, NULL, NULL); - SLOG(LOG_DEBUG, TAG_VCW, "service_name : %s, %d", service_name, g_own_name_id); - - GError *error = NULL; - g_daemon_proxy = gdbus_vcdaemon_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, 0, - VC_DAEMON_SERVICE_NAME, VC_DAEMON_SERVICE_OBJECT_PATH, NULL, &error); - if (error) { - SLOG(LOG_DEBUG, TAG_VCW, "Error : %s", error->message); - g_error_free(error); - } - return 0; -#else pthread_mutex_lock(&g_w_dbus_mutex); if (NULL != g_w_conn_sender && NULL != g_w_conn_listener) { @@ -511,31 +398,19 @@ int vc_widget_dbus_open_connection() SLOG(LOG_INFO, TAG_VCW, "[INFO] widget dbus connection is opened"); -return 0; -#endif + return 0; } int vc_widget_dbus_close_connection() { -#ifdef USE_GDBUS - if (g_daemon_proxy) { - g_object_unref(g_daemon_proxy); - g_daemon_proxy = NULL; - } - if (g_own_name_id) { - g_bus_unown_name(g_own_name_id); - g_own_name_id = 0; - } - return 0; -#else pthread_mutex_lock(&g_w_dbus_mutex); DBusError err; dbus_error_init(&err); if (NULL != g_w_fd_handler) { - ecore_main_fd_handler_del(g_w_fd_handler); - g_w_fd_handler = NULL; + ecore_main_fd_handler_del(g_w_fd_handler); + g_w_fd_handler = NULL; } if (NULL != g_w_conn_listener) { @@ -562,24 +437,10 @@ int vc_widget_dbus_close_connection() SLOG(LOG_INFO, TAG_VCW, "[INFO] widget dbus connection is closed"); return 0; -#endif } int vc_widget_dbus_reconnect() { -#ifdef USE_GDBUS - if (!g_own_name_id || !g_daemon_proxy) { - vc_widget_dbus_close_connection(); - - if (0 != vc_widget_dbus_open_connection()) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to reconnect"); //LCOV_EXCL_LINE - return -1; - } - - SLOG(LOG_DEBUG, TAG_VCC, "[DBUS] Reconnect"); //LCOV_EXCL_LINE - } - return 0; -#else if (!g_w_conn_sender || !g_w_conn_listener) { vc_widget_dbus_close_connection(); @@ -609,45 +470,15 @@ int vc_widget_dbus_reconnect() } return 0; -#endif } static int __dbus_check() { -#ifdef USE_GDBUS - SLOG(LOG_DEBUG, TAG_VCW, "%d %p", g_own_name_id, g_daemon_proxy); //LCOV_EXCL_LINE - if (0 == g_own_name_id || NULL == g_daemon_proxy) { - SLOG(LOG_ERROR, TAG_VCW, "[ERROR] NULL connection"); //LCOV_EXCL_LINE - return vc_widget_dbus_reconnect(); - } - return 0; -#else if (NULL == g_w_conn_sender || NULL == g_w_conn_listener) { SLOG(LOG_ERROR, TAG_VCW, "[ERROR] NULL connection"); return vc_widget_dbus_reconnect(); } return 0; -#endif -} - -static GDBusVcmanager* get_manager_proxy() { - char service_name[64] = {0,}; - char object_path[64] = {0,}; - - snprintf(service_name, 64, "%s", VC_MANAGER_SERVICE_NAME); - snprintf(object_path, 64, "%s", VC_MANAGER_SERVICE_OBJECT_PATH); - - GError *error = NULL; - GDBusVcmanager *proxy = gdbus_vcmanager_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, 0, - service_name, object_path, NULL, &error); - - if (error) { - SLOG(LOG_ERROR, TAG_VCC, "[DBUS] Proxy : %p, service_name(%s), object_path(%s) : %s", - proxy, service_name, object_path, error->message); - g_error_free(error); - } - - return proxy; } int vc_widget_dbus_request_hello() @@ -655,20 +486,7 @@ int vc_widget_dbus_request_hello() if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - GError *error = NULL; - int result = 0; - if (!gdbus_vcdaemon_call_vc_method_hello_sync(g_daemon_proxy, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCW, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCW, "Failed without explicit error"); - } - } - return result; -#else + DBusMessage* msg; msg = dbus_message_new_method_call( @@ -706,27 +524,11 @@ int vc_widget_dbus_request_hello() } return result; -#endif } int vc_widget_dbus_request_initialize(int pid, int* service_state, int* daemon_pid) { -#ifdef USE_GDBUS - GError *error = NULL; - int result; - if (!gdbus_vcdaemon_call_vcw_daemon_method_initialize_sync(g_daemon_proxy, - pid, &result, service_state, daemon_pid, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCW, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCC, "Failed without explicit error"); - } - } - return result; -#else pthread_mutex_lock(&g_w_init_mutex); if (0 != __dbus_check()) { pthread_mutex_unlock(&g_w_init_mutex); @@ -817,26 +619,10 @@ int vc_widget_dbus_request_initialize(int pid, int* service_state, int* daemon_p pthread_mutex_unlock(&g_w_init_mutex); return result; -#endif } int vc_widget_dbus_request_finalize(int pid) { -#ifdef USE_GDBUS - GError *error = NULL; - int result; - if (!gdbus_vcdaemon_call_vcw_daemon_method_finalize_sync(g_daemon_proxy, - pid, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCW, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCC, "Failed without explicit error"); - } - } - return result; -#else pthread_mutex_lock(&g_w_init_mutex); if (0 != __dbus_check()) { pthread_mutex_unlock(&g_w_init_mutex); @@ -914,7 +700,6 @@ int vc_widget_dbus_request_finalize(int pid) pthread_mutex_unlock(&g_w_init_mutex); return result; -#endif } int vc_widget_dbus_request_start_recording(int pid, bool command) @@ -922,21 +707,7 @@ int vc_widget_dbus_request_start_recording(int pid, bool command) if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - GError *error = NULL; - int result; - if (!gdbus_vcdaemon_call_vcw_daemon_method_start_recording_sync(g_daemon_proxy, - pid, command, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCW, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCC, "Failed without explicit error"); - } - } - return result; -#else + DBusMessage* msg; msg = dbus_message_new_method_call( @@ -995,7 +766,6 @@ int vc_widget_dbus_request_start_recording(int pid, bool command) } return result; -#endif } int vc_widget_dbus_set_foreground(int pid, bool value) @@ -1003,14 +773,7 @@ int vc_widget_dbus_set_foreground(int pid, bool value) if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - /* To Manager */ - GDBusVcmanager* proxy = get_manager_proxy(); - gdbus_vcmanager_call_vcw_manager_method_set_foreground(proxy, - pid, value, NULL, NULL, NULL); - if (proxy) g_object_unref(proxy); - return 0; -#else + DBusMessage* msg = NULL; int tmp_value = 0; @@ -1073,7 +836,6 @@ int vc_widget_dbus_set_foreground(int pid, bool value) dbus_message_unref(msg); return 0; -#endif } int vc_widget_dbus_request_enable_asr_result(int pid, bool enable) @@ -1081,21 +843,7 @@ int vc_widget_dbus_request_enable_asr_result(int pid, bool enable) if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - GError *error = NULL; - int result; - if (!gdbus_vcdaemon_call_vcw_daemon_method_start_recording_sync(g_daemon_proxy, - pid, enable, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCW, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCC, "Failed without explicit error"); - } - } - return result; -#else + DBusMessage* msg; /* create a signal & check for errors */ @@ -1160,7 +908,6 @@ int vc_widget_dbus_request_enable_asr_result(int pid, bool enable) } return result; -#endif } int vc_widget_dbus_request_start(int pid, int silence) @@ -1168,21 +915,7 @@ int vc_widget_dbus_request_start(int pid, int silence) if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - GError *error = NULL; - int result; - if (!gdbus_vcdaemon_call_vcw_daemon_method_start_sync(g_daemon_proxy, - pid, silence, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCW, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCC, "Failed without explicit error"); - } - } - return result; -#else + DBusMessage* msg; /* create a signal & check for errors */ @@ -1244,7 +977,6 @@ int vc_widget_dbus_request_start(int pid, int silence) } return result; -#endif } int vc_widget_dbus_request_stop(int pid) @@ -1252,21 +984,7 @@ int vc_widget_dbus_request_stop(int pid) if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - GError *error = NULL; - int result; - if (!gdbus_vcdaemon_call_vcw_daemon_method_stop_sync(g_daemon_proxy, - pid, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCW, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCC, "Failed without explicit error"); - } - } - return result; -#else + DBusMessage* msg; /* create a signal & check for errors */ @@ -1325,7 +1043,6 @@ int vc_widget_dbus_request_stop(int pid) } return result; -#endif } int vc_widget_dbus_request_cancel(int pid) @@ -1333,21 +1050,7 @@ int vc_widget_dbus_request_cancel(int pid) if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; } -#ifdef USE_GDBUS - GError *error = NULL; - int result; - if (!gdbus_vcdaemon_call_vcw_daemon_method_cancel_sync(g_daemon_proxy, - pid, &result, NULL, &error)) { - if (error) { - SLOG(LOG_ERROR, TAG_VCW, "Error : %s", error->message); - result = VC_ERROR_OPERATION_FAILED; - g_error_free(error); - } else { - SLOG(LOG_ERROR, TAG_VCC, "Failed without explicit error"); - } - } - return result; -#else + DBusMessage* msg; /* create a signal & check for errors */ @@ -1406,5 +1109,4 @@ int vc_widget_dbus_request_cancel(int pid) } return result; -#endif } diff --git a/common/vc_defs.h b/common/vc_defs.h index b3db152..4011131 100644 --- a/common/vc_defs.h +++ b/common/vc_defs.h @@ -30,7 +30,7 @@ extern "C" { *******************************************************************************************/ #define VC_CLIENT_SERVICE_NAME "org.tizen.voice.vcclient" -#define VC_CLIENT_SERVICE_OBJECT_PATH "/org/tizen/voice/vcclient" +#define VC_CLIENT_SERVICE_OBJECT_PATH "/org/tize/voice/vcclient" #define VC_CLIENT_SERVICE_INTERFACE "org.tizen.voice.vcclient" #define VC_WIDGET_SERVICE_NAME "org.tizen.voice.vcwidget" @@ -38,15 +38,15 @@ extern "C" { #define VC_WIDGET_SERVICE_INTERFACE "org.tizen.voice.vcwidget" #define VC_MANAGER_SERVICE_NAME "org.tizen.voice.vcmanager" -#define VC_MANAGER_SERVICE_OBJECT_PATH "/org/tizen/voice/vcmanager" +#define VC_MANAGER_SERVICE_OBJECT_PATH "/org/tize/voice/vcmanager" #define VC_MANAGER_SERVICE_INTERFACE "org.tizen.voice.vcmanager" -#define VC_DAEMON_SERVICE_NAME "org.tizen.voice.vcdaemon" -#define VC_DAEMON_SERVICE_OBJECT_PATH "/org/tizen/voice/vcdaemon" -#define VC_DAEMON_SERVICE_INTERFACE "org.tizen.voice.vcdaemon" +#define VC_SERVER_SERVICE_NAME "org.tizen.voice.vcserver" +#define VC_SERVER_SERVICE_OBJECT_PATH "/org/tizen/voice/vcserver" +#define VC_SERVER_SERVICE_INTERFACE "org.tizen.voice.vcserver" #define VC_SETTING_SERVICE_NAME "org.tizen.voice.vcsetting" -#define VC_SETTING_SERVICE_OBJECT_PATH "/org/tizen/voice/vcsetting" +#define VC_SETTING_SERVICE_OBJECT_PATH "/org/tize/voice/vcsetting" #define VC_SETTING_SERVICE_INTERFACE "org.tizen.voice.vcsetting" /****************************************************************************************** diff --git a/org.tizen.voice.vcdaemon.service b/org.tizen.voice.vcserver.service similarity index 87% rename from org.tizen.voice.vcdaemon.service rename to org.tizen.voice.vcserver.service index 4c73109..aa51fd1 100644 --- a/org.tizen.voice.vcdaemon.service +++ b/org.tizen.voice.vcserver.service @@ -1,5 +1,5 @@ [D-BUS Service] -Name=org.tizen.voice.vcdaemon +Name=org.tizen.voice.vcserver #Exec=/usr/bin/vc-daemon #Exec=/bin/sh -c "launch_app org.tizen.vc-engine-default" Exec=/bin/sh -c "vc_getengine get system db/voice/vc/engine/default | awk '{print$5}' | xargs -t -i launch_app {}" diff --git a/org.tizen.voice.vcdaemon.tv.service b/org.tizen.voice.vcserver.tv.service similarity index 75% rename from org.tizen.voice.vcdaemon.tv.service rename to org.tizen.voice.vcserver.tv.service index 33ae340..22b0781 100644 --- a/org.tizen.voice.vcdaemon.tv.service +++ b/org.tizen.voice.vcserver.tv.service @@ -1,4 +1,4 @@ [D-BUS Service] -Name=org.tizen.voice.vcdaemon +Name=org.tizen.voice.vcserver #Exec=/usr/bin/vc-daemon Exec=/bin/sh -c "launch_app org.tizen.voice-client" diff --git a/org.tizen.voice.voice-control.gdbus.xml b/org.tizen.voice.voice-control.gdbus.xml deleted file mode 100644 index b424ee6..0000000 --- a/org.tizen.voice.voice-control.gdbus.xml +++ /dev/null @@ -1,360 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 8872f45..d7ceb5a 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -33,8 +33,6 @@ BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(sqlite3) BuildRequires: pkgconfig(pkgmgr-info) BuildRequires: pkgconfig(pkgmgr-installer) -BuildRequires: pkgconfig(gio-2.0) -BuildRequires: pkgconfig(gio-unix-2.0) %if "%{tizen_profile_name}" == "tv" BuildRequires: pkgconfig(capi-network-bluetooth) BuildRequires: pkgconfig(capi-network-bluetooth-tv) @@ -133,7 +131,7 @@ find . -name '*.gcno' -exec cp '{}' gcov-obj ';' rm -rf %{buildroot} %if "%{tizen_profile_name}" == "tv" -mv -f org.tizen.voice.vcdaemon.tv.service org.tizen.voice.vcdaemon.service +mv -f org.tizen.voice.vcserver.tv.service org.tizen.voice.vcserver.service %endif %make_install @@ -164,7 +162,7 @@ mkdir -p %{_libdir}/voice/vc %{TZ_SYS_RO_SHARE}/dbus-1/services/org.tizen.voice* %{TZ_SYS_RO_SHARE}/parser-plugins/voice-control.info %{TZ_SYS_RO_ETC}/package-manager/parserlib/metadata/libvc-engine-parser.so* -/etc/dbus-1/session.d/vc-service.conf +/etc/dbus-1/session.d/vc-server.conf %files devel %manifest %{name}-devel.manifest diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 98a5c30..778f56d 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -6,7 +6,6 @@ SET(SRCS ../common/vc_config_parser.c ../common/vc_info_parser.c ../common/vc_json_parser.c - ../common/vc_gdbus.c vcd_client_data.c vcd_server_data.cpp vcd_config.c diff --git a/server/vcd_dbus.c b/server/vcd_dbus.c index 853a26e..462f1a6 100644 --- a/server/vcd_dbus.c +++ b/server/vcd_dbus.c @@ -20,84 +20,17 @@ #include "vcd_dbus_server.h" #include "vcd_main.h" -#define USE_GDBUS -#ifdef USE_GDBUS -#include "vc_gdbus.h" -static GDBusVcdaemon *g_daemon = NULL; -static int g_own_name_id = 0; -#else -static Ecore_Fd_Handler* g_dbus_fd_handler = NULL; static DBusConnection* g_conn_sender = NULL; static DBusConnection* g_conn_listener = NULL; -static int g_waiting_time = 3000; +static Ecore_Fd_Handler* g_dbus_fd_handler = NULL; -#endif +static int g_waiting_time = 3000; static int g_volume_count = 0; -#ifdef USE_GDBUS -static GDBusVcmanager* get_manager_proxy() { - char service_name[64] = {0,}; - char object_path[64] = {0,}; - - snprintf(service_name, 64, "%s", VC_MANAGER_SERVICE_NAME); - snprintf(object_path, 64, "%s", VC_MANAGER_SERVICE_OBJECT_PATH); - - GError *error = NULL; - GDBusVcmanager *proxy = gdbus_vcmanager_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, 0, - service_name, object_path, NULL, &error); - - if (error) { - SLOG(LOG_ERROR, TAG_VCD, "[DBUS] Proxy : %p, service_name(%s), object_path(%s) : %s", - proxy, service_name, object_path, error->message); - g_error_free(error); - } - - return proxy; -} - -static GDBusVcclient* get_client_proxy(int pid) { - char service_name[64] = {0,}; - char object_path[64] = {0,}; - - snprintf(service_name, 64, "%s%d", VC_CLIENT_SERVICE_NAME, pid); - snprintf(object_path, 64, "%s", VC_CLIENT_SERVICE_OBJECT_PATH); - - GError *error = NULL; - GDBusVcclient *proxy = gdbus_vcclient_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, 0, - service_name, object_path, NULL, &error); - - if (error) { - SLOG(LOG_ERROR, TAG_VCD, "[DBUS] Proxy : %p, service_name(%s), object_path(%s) : %s", - proxy, service_name, object_path, error->message); - g_error_free(error); - } - - return proxy; -} - -static GDBusVcwidget* get_widget_proxy(int pid) { - char service_name[64] = {0,}; - char object_path[64] = {0,}; - - snprintf(service_name, 64, "%s%d", VC_WIDGET_SERVICE_NAME, pid); - snprintf(object_path, 64, "%s", VC_WIDGET_SERVICE_OBJECT_PATH); - - GError *error = NULL; - GDBusVcwidget *proxy = gdbus_vcwidget_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, 0, - service_name, object_path, NULL, &error); - - if (error) { - SLOG(LOG_ERROR, TAG_VCD, "[DBUS] Proxy : %p, service_name(%s), object_path(%s) : %s", - proxy, service_name, object_path, error->message); - g_error_free(error); - } - return proxy; -} -#else static DBusMessage* __get_message(int pid, const char* method, vcd_client_type_e type) { char service_name[64] = {0,}; @@ -225,17 +158,9 @@ int vcdc_send_hello(int pid, vcd_client_type_e type) return result; } -#endif int vcdc_send_show_tooltip(int pid, bool show) { -#ifdef USE_GDBUS - GDBusVcwidget* proxy = get_widget_proxy(pid); - gdbus_vcwidget_call_vcd_widget_method_show_tooltip(proxy, - pid, show, NULL, NULL, NULL); - g_object_unref(proxy); - return 0; -#else if (0 != __dbus_check()) { return VCD_ERROR_OPERATION_FAILED; } @@ -289,25 +214,10 @@ int vcdc_send_show_tooltip(int pid, bool show) dbus_message_unref(msg); return 0; -#endif } int vcdc_send_set_volume(int manger_pid, float volume) { -#ifdef USE_GDBUS - GDBusVcmanager* proxy = get_manager_proxy(); - gdbus_vcmanager_call_vcd_manager_method_set_volume(proxy, - volume, NULL, NULL, NULL); - g_object_unref(proxy); - - if (10 == g_volume_count) { - SLOG(LOG_DEBUG, TAG_VCD, "@@ Send set volume : pid(%d), volume(%f)", manger_pid, volume); - g_volume_count = 0; - } - g_volume_count++; - - return 0; -#else if (0 != __dbus_check()) { return VCD_ERROR_OPERATION_FAILED; } @@ -346,49 +256,10 @@ int vcdc_send_set_volume(int manger_pid, float volume) dbus_message_unref(msg); return 0; -#endif } int vcdc_send_result(int pid, int manager_pid, int cmd_type) { -#ifdef USE_GDBUS - SLOG(LOG_DEBUG, TAG_VCD, "[Dbus] Result command type(%d)", cmd_type); - - switch (cmd_type) { - case VC_COMMAND_TYPE_FOREGROUND: - case VC_COMMAND_TYPE_BACKGROUND: - if (pid == manager_pid) { - GDBusVcmanager* proxy = get_manager_proxy(); - gdbus_vcmanager_call_vcd_manager_method_result(proxy, NULL, NULL, NULL); - g_object_unref(proxy); - } else { - GDBusVcclient* proxy = get_client_proxy(pid); - gdbus_vcclient_call_vcd_client_method_result(proxy, NULL, NULL, NULL); - g_object_unref(proxy); - } - break; - case VC_COMMAND_TYPE_WIDGET: { - GDBusVcwidget* proxy = get_widget_proxy(pid); - gdbus_vcwidget_call_vcd_widget_method_result(proxy, NULL, NULL, NULL); - g_object_unref(proxy); - } - break; - case VC_COMMAND_TYPE_SYSTEM: - case VC_COMMAND_TYPE_SYSTEM_BACKGROUND: - case VC_COMMAND_TYPE_EXCLUSIVE: { - GDBusVcmanager* proxy = get_manager_proxy(); - gdbus_vcmanager_call_vcd_manager_method_result(proxy, NULL, NULL, NULL); - g_object_unref(proxy); - } - break; - - default: - SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Command type is NOT valid(%d)", cmd_type); - return -1; - } - - return 0; -#else if (0 != __dbus_check()) { return VCD_ERROR_OPERATION_FAILED; } @@ -438,24 +309,10 @@ int vcdc_send_result(int pid, int manager_pid, int cmd_type) dbus_message_unref(msg); return 0; -#endif } int vcdc_send_asr_result(int pid, int event, const char* asr_result, int cmd_type, bool* is_consumed) { -#ifdef USE_GDBUS - GError *error = NULL; - gint result = 0; - GDBusVcwidget* proxy = get_widget_proxy(pid); - gdbus_vcwidget_call_vcd_widget_method_asr_result_sync(proxy, - event, asr_result, &result, NULL, &error); - if (error) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Dbus Error (%s)", error->message); - g_error_free(error); - } - g_object_unref(proxy); - return 0; -#else if (0 != __dbus_check()) { return VCD_ERROR_OPERATION_FAILED; } @@ -513,18 +370,10 @@ int vcdc_send_asr_result(int pid, int event, const char* asr_result, int cmd_typ SLOG(LOG_ERROR, TAG_VCD, "@@ Result message is NULL "); return VCD_ERROR_OPERATION_FAILED; } -#endif } int vcdc_send_pre_result_to_manager(int manager_pid, int event, const char* pre_result) { -#ifdef USE_GDBUS - GDBusVcmanager* proxy = get_manager_proxy(); - gdbus_vcmanager_call_vcd_manager_method_pre_result(proxy, - event, pre_result, NULL, NULL, NULL); - g_object_unref(proxy); - return 0; -#else if (0 != __dbus_check()) { return VCD_ERROR_OPERATION_FAILED; } @@ -554,18 +403,10 @@ int vcdc_send_pre_result_to_manager(int manager_pid, int event, const char* pre_ } return 0; -#endif } int vcdc_send_specific_engine_result_to_manager(int manager_pid, const char* engine_app_id, const char* event, const char* result) { -#ifdef USE_GDBUS - GDBusVcmanager* proxy = get_manager_proxy(); - gdbus_vcmanager_call_vcd_manager_method_specific_engine_result(proxy, - engine_app_id, event, result, NULL, NULL, NULL); - g_object_unref(proxy); - return 0; -#else SLOG(LOG_DEBUG, TAG_VCD, "[VCDC] send specific engine result to manager, mgr pid(%d), engine app id(%s), event(%s), result(%s),", manager_pid, engine_app_id, event, result); @@ -598,19 +439,10 @@ int vcdc_send_specific_engine_result_to_manager(int manager_pid, const char* eng } return 0; -#endif } int vcdc_send_result_to_manager(int manger_pid, int result_type) { -#ifdef USE_GDBUS - GDBusVcmanager* proxy = get_manager_proxy(); - SLOG(LOG_DEBUG, TAG_VCD, "[Dbus] send result : result type(%d)", result_type); - gdbus_vcmanager_call_vcd_manager_method_all_result(proxy, - result_type, NULL, NULL, NULL); - g_object_unref(proxy); - return 0; -#else if (0 != __dbus_check()) { return VCD_ERROR_OPERATION_FAILED; } @@ -644,18 +476,10 @@ int vcdc_send_result_to_manager(int manger_pid, int result_type) dbus_message_unref(msg); return 0; -#endif } int vcdc_send_speech_detected(int manger_pid) { -#ifdef USE_GDBUS - GDBusVcmanager* proxy = get_manager_proxy(); - gdbus_vcmanager_call_vcd_manager_method_speech_detected(proxy, - NULL, NULL, NULL); - g_object_unref(proxy); - return 0; -#else if (0 != __dbus_check()) { return VCD_ERROR_OPERATION_FAILED; } @@ -686,15 +510,10 @@ int vcdc_send_speech_detected(int manger_pid) dbus_message_unref(msg); return 0; -#endif } int vcdc_send_service_state(vcd_state_e state) { -#ifdef USE_GDBUS - gdbus_vcdaemon_emit_vcd_signal_set_service_state(g_daemon, state); - return 0; -#else if (0 != __dbus_check()) { return VCD_ERROR_OPERATION_FAILED; } @@ -776,14 +595,10 @@ int vcdc_send_service_state(vcd_state_e state) dbus_message_unref(msg); return 0; -#endif } int vcdc_send_manager_pid(int manager_pid) { -#ifdef USE_GDBUS - gdbus_vcdaemon_emit_vcd_client_signal_send_manager_pid(g_daemon, manager_pid); -#else DBusError err; dbus_error_init(&err); @@ -811,19 +626,12 @@ int vcdc_send_manager_pid(int manager_pid) } dbus_message_unref(msg); -#endif + return 0; } int vcdc_send_dialog(int manger_pid, int pid, const char* disp_text, const char* utt_text, int continuous) { -#ifdef USE_GDBUS - GDBusVcmanager* proxy = get_manager_proxy(); - gdbus_vcmanager_call_vcd_manager_method_dialog(proxy, - pid, disp_text, utt_text, continuous, NULL, NULL, NULL); - g_object_unref(proxy); - return 0; -#else if (0 != __dbus_check()) { return VCD_ERROR_OPERATION_FAILED; } @@ -885,16 +693,10 @@ int vcdc_send_dialog(int manger_pid, int pid, const char* disp_text, const char* } return ret; -#endif } int vcdc_send_error_signal_to_manager(int manager_pid, int reason, char *err_msg) { -#ifdef USE_GDBUS - int daemon_pid = getpid(); - gdbus_vcdaemon_emit_vcd_manager_signal_send_error(g_daemon, reason, daemon_pid, err_msg); - return 0; -#else SLOG(LOG_ERROR, TAG_VCD, "@@ Send error signal to manager"); if (0 != __dbus_check()) { @@ -947,18 +749,10 @@ int vcdc_send_error_signal_to_manager(int manager_pid, int reason, char *err_msg } return 0; -#endif } int vcdc_send_error_signal(int reason, char *err_msg) { -#ifdef USE_GDBUS - int daemon_pid = getpid(); - gdbus_vcdaemon_emit_vcd_client_signal_send_error(g_daemon, reason, daemon_pid, err_msg); - gdbus_vcdaemon_emit_vcd_manager_signal_send_error(g_daemon, reason, daemon_pid, err_msg); - gdbus_vcdaemon_emit_vcd_widget_signal_send_error(g_daemon, reason, daemon_pid, err_msg); - return 0; -#else SLOG(LOG_ERROR, TAG_VCD, "@@ Send error signal"); if (NULL == err_msg) { @@ -1046,18 +840,10 @@ int vcdc_send_error_signal(int reason, char *err_msg) dbus_message_unref(msg); return 0; -#endif } int vcdc_send_request_set_private_data(int pid, const char* key, const char* data) { -#ifdef USE_GDBUS - GDBusVcmanager* proxy = get_manager_proxy(); - gdbus_vcmanager_call_vcd_manager_method_set_private_data(proxy, - pid, key, data, NULL, NULL, NULL); - g_object_unref(proxy); - return 0; -#else if (0 != __dbus_check()) { return VCD_ERROR_OPERATION_FAILED; } @@ -1089,28 +875,10 @@ int vcdc_send_request_set_private_data(int pid, const char* key, const char* dat dbus_message_unref(msg); return VCD_ERROR_NONE; -#endif } int vcdc_send_request_get_private_data(int pid, const char* key, char** data) { -#ifdef USE_GDBUS - GError *error = NULL; - gint result = 0; - gchar* value = NULL; - GDBusVcmanager* proxy = get_manager_proxy(); - gdbus_vcmanager_call_vcd_manager_method_get_private_data_sync(proxy, - pid, key, &result, &value, NULL, &error); - if (error) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Dbus Error (%s)", error->message); - g_error_free(error); - } - if (NULL != data && NULL != value) { - *data = strdup(value); - } - g_object_unref(proxy); - return 0; -#else if (0 != __dbus_check()) { return VCD_ERROR_OPERATION_FAILED; } @@ -1168,18 +936,10 @@ int vcdc_send_request_get_private_data(int pid, const char* key, char** data) } return result; -#endif } int vcdc_send_feedback_audio_format_to_manager(int manager_pid, int rate, vc_audio_channel_e channel, vce_audio_type_e audio_type) { -#ifdef USE_GDBUS - GDBusVcmanager* proxy = get_manager_proxy(); - gdbus_vcmanager_call_vcd_manager_method_feedback_audio_format(proxy, - rate, channel, audio_type, NULL, NULL, NULL); - g_object_unref(proxy); - return 0; -#else SLOG(LOG_INFO, TAG_VCD, "[Dbus] Send TTS feedback audio format : manager_pid(%d), rate(%d), audio channel(%d), audio type(%d)", manager_pid, rate, channel, audio_type); if (0 != __dbus_check()) { @@ -1218,23 +978,10 @@ int vcdc_send_feedback_audio_format_to_manager(int manager_pid, int rate, vc_aud dbus_message_unref(msg); return ret; -#endif } int vcdc_send_feedback_streaming_to_manager(int manager_pid, int pid, int utt_id, vc_feedback_event_e event, char* buffer, int len) { -#ifdef USE_GDBUS - GDBusVcmanager* proxy = get_manager_proxy(); - GVariant *variant = g_variant_new_from_data(G_VARIANT_TYPE ("ay"), - buffer, len, TRUE, NULL, NULL); - - gdbus_vcmanager_call_vcd_manager_method_feedback_streaming(proxy, - pid, utt_id, event, len, variant, NULL, NULL, NULL); - - g_object_unref(proxy); - g_variant_ref(variant); - return 0; -#else SLOG(LOG_INFO, TAG_VCD, "[Dbus] Send TTS feedback streaming : manager_pid(%d), pid(%d), utt_id(%d) feedback event(%d), buffer(%p), length(%d)", manager_pid, pid, utt_id, event, buffer, len); if (0 != __dbus_check()) { @@ -1275,23 +1022,10 @@ int vcdc_send_feedback_streaming_to_manager(int manager_pid, int pid, int utt_id dbus_message_unref(msg); return ret; -#endif } int vcdc_send_feedback_streaming(int pid, int utt_id, vc_feedback_event_e event, char* buffer, int len) { -#ifdef USE_GDBUS - GDBusVcclient* proxy = get_client_proxy(pid); - GVariant *variant = g_variant_new_from_data(G_VARIANT_TYPE ("ay"), - buffer, len, TRUE, NULL, NULL); - - gdbus_vcclient_call_vcd_client_method_feedback_streaming(proxy, - utt_id, event, len, variant, NULL, NULL, NULL); - - g_object_unref(proxy); - g_variant_ref(variant); - return 0; -#else SLOG(LOG_INFO, TAG_VCD, "[Dbus] Send TTS feedback streaming : pid(%d), utt_id(%d), feedback event(%d), buffer(%p), length(%d)", pid, utt_id, event, buffer, len); if (0 != __dbus_check()) { @@ -1331,10 +1065,8 @@ int vcdc_send_feedback_streaming(int pid, int utt_id, vc_feedback_event_e event, dbus_message_unref(msg); return ret; -#endif } -#ifndef USE_GDBUS static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handler) { if (NULL == g_conn_listener) return ECORE_CALLBACK_RENEW; @@ -1529,129 +1261,9 @@ static void __vcd_dbus_connection_free() g_conn_sender = NULL; } } -#endif - -#ifdef USE_GDBUS -static void -on_name_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCD, "Name acquired : %s", name); - - GError *error = NULL; - - g_daemon = gdbus_vcdaemon_skeleton_new(); - - /* vc common methods */ - g_signal_connect(g_daemon, "handle-vc-method-hello", - G_CALLBACK(vc_method_hello), NULL); - - /* vc client methods */ - g_signal_connect(g_daemon, "handle-vcc-daemon-method-initialize", - G_CALLBACK(vcc_daemon_method_initialize), NULL); - g_signal_connect(g_daemon, "handle-vcc-daemon-method-finalize", - G_CALLBACK(vcc_daemon_method_finalize), NULL); - g_signal_connect(g_daemon, "handle-vcc-daemon-method-set-exclusive-cmd", - G_CALLBACK(vcc_daemon_method_set_exclusive_cmd), NULL); - g_signal_connect(g_daemon, "handle-vcc-daemon-method-set-command", - G_CALLBACK(vcc_daemon_method_set_command), NULL); - g_signal_connect(g_daemon, "handle-vcc-daemon-method-unset-command", - G_CALLBACK(vcc_daemon_method_unset_command), NULL); - g_signal_connect(g_daemon, "handle-vcc-daemon-method-set-foreground", - G_CALLBACK(vcc_daemon_method_set_foreground), NULL); - g_signal_connect(g_daemon, "handle-vcc-daemon-method-set-server-dialog", - G_CALLBACK(vcc_daemon_method_set_server_dialog), NULL); - g_signal_connect(g_daemon, "handle-vcc-daemon-method-dialog", - G_CALLBACK(vcc_daemon_method_dialog), NULL); - g_signal_connect(g_daemon, "handle-vcc-daemon-method-is-system-command-valid", - G_CALLBACK(vcc_daemon_method_is_system_command_valid), NULL); - g_signal_connect(g_daemon, "handle-vcc-daemon-method-request-tts", - G_CALLBACK(vcc_daemon_method_request_tts), NULL); - g_signal_connect(g_daemon, "handle-vcc-daemon-method-cancel-tts", - G_CALLBACK(vcc_daemon_method_cancel_tts), NULL); - g_signal_connect(g_daemon, "handle-vcc-daemon-method-get-tts-audio-format", - G_CALLBACK(vcc_daemon_method_get_tts_audio_format), NULL); - - /* vc widget methods */ - g_signal_connect(g_daemon, "handle-vcw-daemon-method-initialize", - G_CALLBACK(vcw_daemon_method_initialize), NULL); - g_signal_connect(g_daemon, "handle-vcw-daemon-method-finalize", - G_CALLBACK(vcw_daemon_method_finalize), NULL); - g_signal_connect(g_daemon, "handle-vcw-daemon-method-start-recording", - G_CALLBACK(vcw_daemon_method_start_recording), NULL); - g_signal_connect(g_daemon, "handle-vcw-daemon-method-enable-asr-result", - G_CALLBACK(vcw_daemon_method_enable_asr_result), NULL); - g_signal_connect(g_daemon, "handle-vcw-daemon-method-start", - G_CALLBACK(vcw_daemon_method_start), NULL); - g_signal_connect(g_daemon, "handle-vcw-daemon-method-stop", - G_CALLBACK(vcw_daemon_method_stop), NULL); - g_signal_connect(g_daemon, "handle-vcw-daemon-method-cancel", - G_CALLBACK(vcw_daemon_method_cancel), NULL); - - /* vc manager methods */ - g_signal_connect(g_daemon, "handle-vcm-daemon-method-initialize", - G_CALLBACK(vcm_daemon_method_initialize), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-finalize", - G_CALLBACK(vcm_daemon_method_finalize), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-set-command", - G_CALLBACK(vcm_daemon_method_set_command), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-unset-command", - G_CALLBACK(vcm_daemon_method_unset_command), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-set-demandable-client", - G_CALLBACK(vcm_daemon_method_set_demandable_client), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-set-audio-type", - G_CALLBACK(vcm_daemon_method_set_audio_type), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-get-audio-type", - G_CALLBACK(vcm_daemon_method_get_audio_type), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-set-client-info", - G_CALLBACK(vcm_daemon_method_set_client_info), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-set-private-data", - G_CALLBACK(vcm_daemon_method_set_private_data), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-get-private-data", - G_CALLBACK(vcm_daemon_method_get_private_data), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-enable-command-type", - G_CALLBACK(vcm_daemon_method_enable_command_type), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-disable-command-type", - G_CALLBACK(vcm_daemon_method_disable_command_type), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-request-start", - G_CALLBACK(vcm_daemon_method_request_start), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-request-stop", - G_CALLBACK(vcm_daemon_method_request_stop), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-request-cancel", - G_CALLBACK(vcm_daemon_method_request_cancel), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-result-selection", - G_CALLBACK(vcm_daemon_method_result_selection), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-set-domain", - G_CALLBACK(vcm_daemon_method_set_domain), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-do-action", - G_CALLBACK(vcm_daemon_method_do_action), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-specific-engine-request", - G_CALLBACK(vcm_daemon_method_specific_engine_request), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-send-audio-streaming", - G_CALLBACK(vcm_daemon_method_send_audio_streaming), NULL); - g_signal_connect(g_daemon, "handle-vcm-daemon-method-change-system-volume", - G_CALLBACK(vcm_daemon_method_change_system_volume), NULL); - - /* vc setting methods */ - g_signal_connect(g_daemon, "handle-vcs-daemon-method-set-language", - G_CALLBACK(vcs_daemon_method_set_language), NULL); - - g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(g_daemon), - connection, VC_DAEMON_SERVICE_OBJECT_PATH, &error); - - if (error) { - SLOG(LOG_ERROR, TAG_VCD, "Exporting interface error : %s", error->message); - g_error_free(error); - } -} -#endif int vcd_dbus_open_connection() { -#ifdef USE_GDBUS - g_own_name_id = g_bus_own_name(G_BUS_TYPE_SESSION, - VC_DAEMON_SERVICE_NAME, G_BUS_NAME_OWNER_FLAGS_REPLACE, NULL, on_name_acquired, NULL, NULL, NULL); - SLOG(LOG_DEBUG, TAG_VCD, "g_bus_own_name returned %d", g_own_name_id); -#else DBusError err; dbus_error_init(&err); @@ -1744,22 +1356,12 @@ int vcd_dbus_open_connection() } SLOG(LOG_INFO, TAG_VCD, "[INFO] Success to open dbus connection"); -#endif + return 0; } int vcd_dbus_close_connection() { -#ifdef USE_GDBUS - if (g_daemon) { - g_object_unref(g_daemon); - g_daemon = NULL; - } - if (g_own_name_id) { - g_bus_unown_name(g_own_name_id); - g_own_name_id = 0; - } -#else DBusError err; dbus_error_init(&err); @@ -1776,7 +1378,6 @@ int vcd_dbus_close_connection() } __vcd_dbus_connection_free(); -#endif return 0; } diff --git a/server/vcd_dbus_server.c b/server/vcd_dbus_server.c index f880201..b1affc8 100644 --- a/server/vcd_dbus_server.c +++ b/server/vcd_dbus_server.c @@ -22,705 +22,6 @@ #include "vcd_server.h" #include "vcd_config.h" -#define USE_GDBUS - -#ifdef USE_GDBUS -gboolean vc_method_hello(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCD, "[ENTER]"); - gdbus_vcdaemon_complete_vc_method_hello(service, invocation); - return TRUE; -} - -gboolean vcc_daemon_method_initialize(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - int ret = vcd_server_initialize(pid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to initialize"); - } - - int service_state = vcd_server_get_service_state(); - int daemon_pid = getpid(); - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd initialize : pid(%d) daemon_pid(%d)", pid, daemon_pid); - - int mgr_pid = vcd_client_manager_get_pid(); - - if (0 == ret) { - SLOG(LOG_DEBUG, TAG_VCD, "[OUT SUCCESS] Result(%d)", ret); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret); - } - - gdbus_vcdaemon_complete_vcc_daemon_method_initialize(service, invocation, - ret, mgr_pid, service_state, daemon_pid); - - return TRUE; -} - -gboolean vcc_daemon_method_finalize(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - int ret = vcd_server_mgr_finalize(pid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to finalize"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd finalize : pid(%d)", pid); - - gdbus_vcdaemon_complete_vcc_daemon_method_finalize(service, invocation, ret); - - return TRUE; -} - -gboolean vcc_daemon_method_set_exclusive_cmd(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gboolean value, gpointer user_data) -{ - /* - int ret = vcd_server_set_exclusive_command(pid, value); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to set_exclusive_cmd"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd set_exclusive_cmd : pid(%d), exclusive(%d)", pid, value); - - gdbus_vcdaemon_complete_vcc_daemon_method_set_exclusive_cmd(service, invocation, ret); - */ - return TRUE; -} - -gboolean vcc_daemon_method_set_command(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int cmd_type, gpointer user_data) -{ - int ret = vcd_server_set_command(pid, (vc_cmd_type_e)cmd_type); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to set_command"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd set_command : pid(%d), cmd_type(%d)", pid, cmd_type); - - gdbus_vcdaemon_complete_vcc_daemon_method_set_command(service, invocation, ret); - - return TRUE; -} - -gboolean vcc_daemon_method_unset_command(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int cmd_type, gpointer user_data) -{ - int ret = vcd_server_unset_command(pid, (vc_cmd_type_e)cmd_type); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to unset_command"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd unset_command : pid(%d), cmd_type(%d)", pid, cmd_type); - - gdbus_vcdaemon_complete_vcc_daemon_method_unset_command(service, invocation, ret); - - return TRUE; -} - -gboolean vcc_daemon_method_set_foreground(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gboolean value, gpointer user_data) -{ - int ret = vcd_server_set_foreground(pid, value); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to set_foreground"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd set_foreground : pid(%d), value(%d)", pid, value); - - gdbus_vcdaemon_complete_vcc_daemon_method_set_foreground(service, invocation); - - return TRUE; -} - -gboolean vcc_daemon_method_set_server_dialog(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, const gchar* app_id, const gchar* credential, gpointer user_data) -{ - int ret = vcd_server_set_server_dialog(pid, app_id, credential); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to set_server_dialog"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd set_server_dialog : pid(%d), app_id(%s)", pid, app_id); - - gdbus_vcdaemon_complete_vcc_daemon_method_set_server_dialog(service, invocation, ret); - - return TRUE; -} - -gboolean vcc_daemon_method_dialog(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, const gchar* disp_text, const gchar* utt_text, gboolean continuous, gpointer user_data) -{ - int ret = vcd_server_dialog(pid, disp_text, utt_text, continuous); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to dialog"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd dialog : pid(%d), disp_text(%s), utt_text(%s)", pid, disp_text, utt_text); - - gdbus_vcdaemon_complete_vcc_daemon_method_dialog(service, invocation); - - return TRUE; -} - -gboolean vcc_daemon_method_is_system_command_valid(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - int is_sys_cmd_valid; - int ret = vcd_server_is_system_command_valid(pid, &is_sys_cmd_valid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to is_system_command_valid"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd is_system_command_valid : pid(%d)", pid); - - gdbus_vcdaemon_complete_vcc_daemon_method_is_system_command_valid(service, invocation, - ret, is_sys_cmd_valid); - - return TRUE; -} - -gboolean vcc_daemon_method_request_tts(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, const gchar* text, const gchar* language, gboolean to_vcm, gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd request tts : pid(%d), text(%s), language(%s), to_vcm(%d)", - pid, text, language, to_vcm); - - int utt_id = -1; - int ret = vcd_server_request_tts(pid, text, language, to_vcm, &utt_id); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to request_tts"); - } - - gdbus_vcdaemon_complete_vcc_daemon_method_request_tts(service, invocation, ret, utt_id); - - return TRUE; -} - -gboolean vcc_daemon_method_cancel_tts(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int utt_id, gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd cancel tts : pid(%d), utt_id(%d)", pid, utt_id); - - int ret = vcd_server_cancel_tts(pid, utt_id); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to cancel_tts"); - } - - gdbus_vcdaemon_complete_vcc_daemon_method_cancel_tts(service, invocation, ret); - - return TRUE; -} - -gboolean vcc_daemon_method_get_tts_audio_format(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd get tts audio format : pid(%d)", pid); - - int rate; - int channel; - int audio_type; - int ret = vcd_server_get_tts_audio_format(pid, &rate, &channel, &audio_type); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get_tts_audio_format"); - } - - gdbus_vcdaemon_complete_vcc_daemon_method_get_tts_audio_format(service, invocation, - ret, rate, channel, audio_type); - - return TRUE; -} - -gboolean vcw_daemon_method_initialize(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - int ret = vcd_server_widget_initialize(pid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to widget_initialize"); - } - int service_state = vcd_server_get_service_state(); - int daemon_pid = getpid(); - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd widget initialize : pid(%d) daemon_pid(%d)", pid, daemon_pid); - - gdbus_vcdaemon_complete_vcw_daemon_method_initialize(service, invocation, - ret, service_state, daemon_pid); - - return TRUE; -} - -gboolean vcw_daemon_method_finalize(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd widget finalize : pid(%d)", pid); - - int ret = vcd_server_widget_finalize(pid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to widget_finalize"); - } - - gdbus_vcdaemon_complete_vcw_daemon_method_finalize(service, invocation, ret); - - return TRUE; -} - -gboolean vcw_daemon_method_start_recording(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int widget_command, gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd widget start recording : pid(%d)", pid); - - int ret = vcd_server_widget_start_recording(pid, widget_command); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to start_recording"); - } - - gdbus_vcdaemon_complete_vcw_daemon_method_start_recording(service, invocation, ret); - - return TRUE; -} - -gboolean vcw_daemon_method_enable_asr_result(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gboolean enable, gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd widget enable asr result : pid(%d) enable(%d)", pid, enable); - - int ret = vcd_server_widget_enable_asr_result(pid, enable); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to enable_asr_result"); - } - - gdbus_vcdaemon_complete_vcw_daemon_method_enable_asr_result(service, invocation, ret); - - return TRUE; -} - -gboolean vcw_daemon_method_start(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gboolean silence, gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd widget start : pid(%d), silence(%d)", pid, silence); - - int ret = vcd_server_widget_start(pid, silence); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to start"); - } - - gdbus_vcdaemon_complete_vcw_daemon_method_start(service, invocation, ret); - - return TRUE; -} - -gboolean vcw_daemon_method_stop(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd widget stop : pid(%d)", pid); - - int ret = vcd_server_widget_stop(pid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to stop"); - } - - gdbus_vcdaemon_complete_vcw_daemon_method_stop(service, invocation, ret); - - return TRUE; -} - -gboolean vcw_daemon_method_cancel(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd widget cancel : pid(%d)", pid); - - int ret = vcd_server_widget_cancel(pid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to cancel"); - } - - gdbus_vcdaemon_complete_vcw_daemon_method_cancel(service, invocation, ret); - - return TRUE; -} - -gboolean vcw_daemon_method_set_foreground(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gboolean value, gpointer user_data) -{ - int ret = vcd_server_set_foreground(pid, value); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to set_foreground"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd set_foreground : pid(%d), value(%d)", pid, value); - - gdbus_vcdaemon_complete_vcw_daemon_method_set_foreground(service, invocation); - - return TRUE; -} - -gboolean vcm_daemon_method_initialize(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int streaming_mode, gpointer user_data) -{ - vcd_config_set_audio_streaming_mode((vcd_audio_streaming_mode_e)streaming_mode); - int ret = vcd_server_mgr_initialize(pid); - int service_state = vcd_server_get_service_state(); - int foreground = vcd_server_get_foreground(); - int daemon_pid = getpid(); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to initialize"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr initialize : pid(%d) service state(%d) foreground(%d) daemon_pid(%d)", pid, service_state, foreground, daemon_pid); - - gdbus_vcdaemon_complete_vcm_daemon_method_initialize(service, invocation, - ret, service_state, foreground, daemon_pid); - - return TRUE; -} - -gboolean vcm_daemon_method_finalize(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - int ret = vcd_server_mgr_finalize(pid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to finalize"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr finalize : pid(%d)", pid); - - gdbus_vcdaemon_complete_vcm_daemon_method_finalize(service, invocation, ret); - - return TRUE; -} - -gboolean vcm_daemon_method_set_command(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - int ret = vcd_server_mgr_set_command(pid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to set_command"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr set command : pid(%d)", pid); - - gdbus_vcdaemon_complete_vcm_daemon_method_set_command(service, invocation, ret); - - return TRUE; -} - -gboolean vcm_daemon_method_unset_command(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - int ret = vcd_server_mgr_unset_command(pid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to unset_command"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr unset command : pid(%d)", pid); - - gdbus_vcdaemon_complete_vcm_daemon_method_unset_command(service, invocation, ret); - - return TRUE; -} - -gboolean vcm_daemon_method_set_demandable_client(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - int ret = vcd_server_mgr_set_demandable_client(pid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to set_demandable_client"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr set demandable client : pid(%d)", pid); - - gdbus_vcdaemon_complete_vcm_daemon_method_set_demandable_client(service, invocation, ret); - - return TRUE; -} - -gboolean vcm_daemon_method_set_audio_type(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, const gchar* audio_type, gpointer user_data) -{ - int ret = vcd_server_mgr_set_audio_type(pid, audio_type); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to set_audio_type"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr set audio type : pid(%d), audio type(%s)", pid, audio_type); - - gdbus_vcdaemon_complete_vcm_daemon_method_set_audio_type(service, invocation, ret); - - return TRUE; -} - -gboolean vcm_daemon_method_get_audio_type(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - char* audio_type = NULL; - int ret = vcd_server_mgr_get_audio_type(pid, &audio_type); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to set_audio_type"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr get audio type : pid(%d)", pid); - - gdbus_vcdaemon_complete_vcm_daemon_method_get_audio_type(service, invocation, ret, audio_type); - if (audio_type) { - free (audio_type); - audio_type = NULL; - } - return TRUE; -} - -gboolean vcm_daemon_method_set_client_info(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - int ret = vcd_server_mgr_set_client_info(pid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to set_client_info"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr set client info : pid(%d)", pid); - - gdbus_vcdaemon_complete_vcm_daemon_method_set_client_info(service, invocation, ret); - - return TRUE; -} - -gboolean vcm_daemon_method_set_private_data(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, const gchar* key, const gchar* data, gpointer user_data) -{ - int ret = vcd_server_mgr_set_private_data(pid, key, data); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to set_private_data"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr set domain : pid(%d), key(%s), data(%s)", pid, key, data); - - gdbus_vcdaemon_complete_vcm_daemon_method_set_private_data(service, invocation); - - return TRUE; -} - -gboolean vcm_daemon_method_get_private_data(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, const gchar* key, gpointer user_data) -{ - char* data = NULL; - int ret = vcd_server_mgr_get_private_data(pid, key, &data); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get_private_data"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr get private data : pid(%d), key(%s)", pid, key); - - gdbus_vcdaemon_complete_vcm_daemon_method_get_private_data(service, invocation, ret, data); - - return TRUE; -} - -gboolean vcm_daemon_method_enable_command_type(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int cmd_type, gpointer user_data) -{ - int ret = vcd_server_mgr_enable_command_type(pid, cmd_type); - - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to enable_command_type"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr enable command type : pid(%d), cmd_type(%d)", pid, cmd_type); - - gdbus_vcdaemon_complete_vcm_daemon_method_enable_command_type(service, invocation, ret); - - return TRUE; -} - -gboolean vcm_daemon_method_disable_command_type(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int cmd_type, gpointer user_data) -{ - int ret = vcd_server_mgr_disable_command_type(pid, cmd_type); - - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to disable_command_type"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr disable command type : pid(%d), cmd_type(%d)", pid, cmd_type); - - gdbus_vcdaemon_complete_vcm_daemon_method_disable_command_type(service, invocation, ret); - - return TRUE; -} - -gboolean vcm_daemon_method_request_start(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int recognition_mode, gboolean exclusive, gboolean start_by_client, gpointer user_data) -{ - int ret = vcd_server_mgr_start((vcd_recognition_mode_e)recognition_mode, exclusive, start_by_client); - - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to request_start"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr start : pid(%d) recognition_mode(%d) exclusive(%d) start by client(%d)", pid, recognition_mode, exclusive, start_by_client); - - gdbus_vcdaemon_complete_vcm_daemon_method_request_start(service, invocation, ret); - - return TRUE; -} - -gboolean vcm_daemon_method_request_stop(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - int ret = vcd_server_mgr_stop(); - - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to request_stop"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr stop : pid(%d)", pid); - - gdbus_vcdaemon_complete_vcm_daemon_method_request_stop(service, invocation, ret); - - return TRUE; -} - -gboolean vcm_daemon_method_request_cancel(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - int ret = vcd_server_mgr_cancel(); - - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to request_cancel"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr cancel : pid(%d)", pid); - - gdbus_vcdaemon_complete_vcm_daemon_method_request_cancel(service, invocation, ret); - - return TRUE; -} - -gboolean vcm_daemon_method_result_selection(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data) -{ - vcd_server_mgr_result_select(); - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr result selection : pid(%d)", pid); - - gdbus_vcdaemon_complete_vcm_daemon_method_result_selection(service, invocation); - - return TRUE; -} - -gboolean vcm_daemon_method_set_domain(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, const gchar* domain, gpointer user_data) -{ - int ret = vcd_server_mgr_set_domain(pid, domain); - - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to disable_command_type"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr set domain : pid(%d), domain(%s)", pid, domain); - - gdbus_vcdaemon_complete_vcm_daemon_method_set_domain(service, invocation, ret); - - return TRUE; -} - -gboolean vcm_daemon_method_do_action(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int type, const gchar* send_event, gpointer user_data) -{ - int ret = vcd_server_mgr_do_action(pid, type, send_event); - - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to disable_command_type"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr request to do action : pid(%d), type(%d) send_event(%s)", pid, type, send_event); - - gdbus_vcdaemon_complete_vcm_daemon_method_do_action(service, invocation); - - return TRUE; -} - -gboolean vcm_daemon_method_specific_engine_request(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, const gchar* engine_app_id, const gchar* event, const gchar* request, gpointer user_data) -{ - int ret = vcd_server_mgr_send_specific_engine_request(pid, engine_app_id, event, request); - - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to specific_engine_request"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr specific engine request : pid(%d), engine_app_id(%s), event(%s), request(%s), ret(%d)", pid, engine_app_id, event, request, ret); - - gdbus_vcdaemon_complete_vcm_daemon_method_specific_engine_request(service, invocation); - - return TRUE; -} - -gboolean vcm_daemon_method_send_audio_streaming(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int event, GVariant *buffer, gpointer user_data) -{ - int len = 0; - GVariantIter *iter; - guchar uc; - const int MAX_STREAMING_DATA_SIZE = 4096; - unsigned char data[MAX_STREAMING_DATA_SIZE]; - - gdbus_vcdaemon_complete_vcm_daemon_method_send_audio_streaming(service, invocation); - - g_variant_get(buffer, "ay", &iter); - while (g_variant_iter_loop(iter, "y", &uc)) { - if (len < MAX_STREAMING_DATA_SIZE) { - data[len++] = uc; - } else { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] max size reached : %d", len); - } - } - g_variant_iter_free(iter); - - int ret = vcd_server_mgr_send_audio_streaming(pid, event, data, len); - - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send_audio_streaming"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr send audio streaming : pid(%d), event(%d), buffer(%p), len(%d)", pid, event, data, len); - - return TRUE; -} - -gboolean vcm_daemon_method_change_system_volume(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int volume_event, gpointer user_data) -{ - int ret = vcd_server_mgr_change_system_volume(pid, volume_event); - - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to change_system_volume"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr change system volume: pid(%d), volume_event(%d)", pid, volume_event); - - gdbus_vcdaemon_complete_vcm_daemon_method_change_system_volume(service, invocation, ret); - - return TRUE; -} - -gboolean vcs_daemon_method_set_language(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, const gchar* language, gpointer user_data) -{ - int ret = vcd_server_set_language(language); - - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to set_language"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd server set language : language(%s)", language); - - gdbus_vcdaemon_complete_vcs_daemon_method_set_language(service, invocation, ret); - - return TRUE; -} -#else int __dbus_error_return(DBusConnection* conn, DBusMessage* msg, int ret) { DBusMessage* reply; @@ -3074,4 +2375,3 @@ int vcd_dbus_server_get_tts_audio_format(DBusConnection* conn, DBusMessage* msg) return 0; } -#endif diff --git a/server/vcd_dbus_server.h b/server/vcd_dbus_server.h index bebf860..6182697 100644 --- a/server/vcd_dbus_server.h +++ b/server/vcd_dbus_server.h @@ -25,159 +25,6 @@ extern "C" { #endif -#define USE_GDBUS - -#ifdef USE_GDBUS -#include "vc_gdbus.h" - -/* -* Dbus Common Server functions -*/ -gboolean vc_method_hello(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - gpointer user_data); - -/* -* Dbus Server functions for client -*/ -gboolean vcc_daemon_method_initialize(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data); - -gboolean vcc_daemon_method_finalize(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data); - -gboolean vcc_daemon_method_set_exclusive_cmd(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gboolean value, gpointer user_data); - -gboolean vcc_daemon_method_set_command(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int cmd_type, gpointer user_data); - -gboolean vcc_daemon_method_unset_command(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int cmd_type, gpointer user_data); - -gboolean vcc_daemon_method_set_foreground(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gboolean value, gpointer user_data); - -gboolean vcc_daemon_method_set_server_dialog(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, const gchar* app_id, const gchar* credential, gpointer user_data); - -gboolean vcc_daemon_method_dialog(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, const gchar* disp_text, const gchar* utt_text, gboolean continuous, gpointer user_data); - -gboolean vcc_daemon_method_is_system_command_valid(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data); - -gboolean vcc_daemon_method_request_tts(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, const gchar* text, const gchar* language, gboolean to_vcm, gpointer user_data); - -gboolean vcc_daemon_method_cancel_tts(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int utt_id, gpointer user_data); - -gboolean vcc_daemon_method_get_tts_audio_format(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data); - -/* -* Dbus Server functions for widget -*/ - -gboolean vcw_daemon_method_initialize(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data); - -gboolean vcw_daemon_method_finalize(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data); - -gboolean vcw_daemon_method_start_recording(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int widget_command, gpointer user_data); - -gboolean vcw_daemon_method_enable_asr_result(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gboolean enable, gpointer user_data); - -gboolean vcw_daemon_method_start(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gboolean silence, gpointer user_data); - -gboolean vcw_daemon_method_stop(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data); - -gboolean vcw_daemon_method_cancel(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data); - -gboolean vcw_daemon_method_set_foreground(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gboolean value, gpointer user_data); - -/* -* Dbus Server functions for manager -*/ - -gboolean vcm_daemon_method_initialize(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int streaming_mode, gpointer user_data); - -gboolean vcm_daemon_method_finalize(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data); - -gboolean vcm_daemon_method_set_command(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data); - -gboolean vcm_daemon_method_unset_command(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data); - -gboolean vcm_daemon_method_set_demandable_client(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data); - -gboolean vcm_daemon_method_set_audio_type(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, const gchar* audio_type, gpointer user_data); - -gboolean vcm_daemon_method_get_audio_type(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data); - -gboolean vcm_daemon_method_set_client_info(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data); - -gboolean vcm_daemon_method_set_private_data(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, const gchar* key, const gchar* data, gpointer user_data); - -gboolean vcm_daemon_method_get_private_data(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, const gchar* key, gpointer user_data); - -gboolean vcm_daemon_method_enable_command_type(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int cmd_type, gpointer user_data); - -gboolean vcm_daemon_method_disable_command_type(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int cmd_type, gpointer user_data); - -gboolean vcm_daemon_method_request_start(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int recognition_mode, gboolean exclusive, gboolean start_by_client, gpointer user_data); - -gboolean vcm_daemon_method_request_stop(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data); - -gboolean vcm_daemon_method_request_cancel(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data); - -gboolean vcm_daemon_method_result_selection(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, gpointer user_data); - -gboolean vcm_daemon_method_set_domain(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, const gchar* domain, gpointer user_data); - -gboolean vcm_daemon_method_do_action(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int type, const gchar* send_event, gpointer user_data); - -gboolean vcm_daemon_method_specific_engine_request(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, const gchar* engine_app_id, const gchar* event, const gchar* request, gpointer user_data); - -gboolean vcm_daemon_method_send_audio_streaming(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int event, GVariant *buffer, gpointer user_data); - -gboolean vcm_daemon_method_change_system_volume(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, int volume_event, gpointer user_data); - -/* -* Dbus Server functions for setting -*/ - -gboolean vcs_daemon_method_set_language(GDBusVcdaemon *service, GDBusMethodInvocation *invocation, - int pid, const gchar* language, gpointer user_data); - -#else int vcd_dbus_server_hello(DBusConnection* conn, DBusMessage* msg); /* @@ -290,7 +137,6 @@ int vcd_dbus_server_cancel_tts(DBusConnection* conn, DBusMessage* msg); int vcd_dbus_server_get_tts_audio_format(DBusConnection* conn, DBusMessage* msg); -#endif #ifdef __cplusplus } diff --git a/server/vce.c b/server/vce.c index 1cd3c2b..7a9bf97 100644 --- a/server/vce.c +++ b/server/vce.c @@ -150,10 +150,6 @@ int vce_main(int argc, char** argv, vce_request_callback_s *callback) SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail ecore_init()"); return VCE_ERROR_OPERATION_FAILED; } - if (!ecore_main_loop_glib_integrate()) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail ecore_main_loop_glib_integrate()"); - return VCE_ERROR_OPERATION_FAILED; - } // if (0 != vcd_dbus_open_connection()) { // SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to open connection"); diff --git a/vc-service.conf b/vc-server.conf similarity index 85% rename from vc-service.conf rename to vc-server.conf index e7d601f..60a1d1b 100644 --- a/vc-service.conf +++ b/vc-server.conf @@ -13,7 +13,7 @@ - - + + -- 2.7.4