return dbus_message_new_method_call(service_name, object_path, target_if_name, method);
}
+int vcd_dbus_reconnect()
+{
+ bool sender_connected = dbus_connection_get_is_connected(g_conn_sender);
+ bool listener_connected = dbus_connection_get_is_connected(g_conn_listener);
+ SLOG(LOG_WARN, TAG_VCD, "[DBUS] Sender(%s) Listener(%s)",
+ sender_connected ? "Connected" : "Not connected", listener_connected ? "Connected" : "Not connected");
+
+ if (false == sender_connected || false == listener_connected) {
+ vcd_dbus_close_connection();
+
+ if (0 != vcd_dbus_open_connection()) {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to reconnect");
+ return -1;
+ }
+
+ SLOG(LOG_DEBUG, TAG_VCD, "[DBUS] Reconnect");
+ }
+
+ return 0;
+}
+
+static int __dbus_check()
+{
+ if (NULL == g_conn_sender) {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] NULL connection");
+ return vcd_dbus_reconnect();
+ }
+ return 0;
+}
+
int vcdc_send_hello(int pid, vcd_client_type_e type)
{
+ if (0 != __dbus_check()) {
+ return VCD_ERROR_OPERATION_FAILED;
+ }
+
DBusMessage* msg = NULL;
if (VCD_CLIENT_TYPE_NORMAL == type) {
int vcdc_send_show_tooltip(int pid, bool show)
{
+ if (0 != __dbus_check()) {
+ return VCD_ERROR_OPERATION_FAILED;
+ }
+
if (0 > pid) {
SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] widget pid is NOT valid");
return -1;
int vcdc_send_set_volume(int manger_pid, float volume)
{
+ if (0 != __dbus_check()) {
+ return VCD_ERROR_OPERATION_FAILED;
+ }
+
DBusMessage* msg = NULL;
/* SLOG(LOG_DEBUG, TAG_VCD, "[Dbus] Set volume (%f)", volume); */
int vcdc_send_result(int pid, int manager_pid, int cmd_type)
{
+ if (0 != __dbus_check()) {
+ return VCD_ERROR_OPERATION_FAILED;
+ }
+
DBusMessage* msg = NULL;
SLOG(LOG_DEBUG, TAG_VCD, "[Dbus] Result command type(%d)", cmd_type);
int vcdc_send_pre_result_to_manager(int manager_pid, int event, const char* pre_result)
{
+ if (0 != __dbus_check()) {
+ return VCD_ERROR_OPERATION_FAILED;
+ }
+
DBusError err;
dbus_error_init(&err);
int vcdc_send_result_to_manager(int manger_pid, int result_type)
{
+ if (0 != __dbus_check()) {
+ return VCD_ERROR_OPERATION_FAILED;
+ }
+
DBusError err;
dbus_error_init(&err);
int vcdc_send_speech_detected(int manger_pid)
{
+ if (0 != __dbus_check()) {
+ return VCD_ERROR_OPERATION_FAILED;
+ }
+
DBusError err;
dbus_error_init(&err);
int vcdc_send_service_state(vcd_state_e state)
{
+ if (0 != __dbus_check()) {
+ return VCD_ERROR_OPERATION_FAILED;
+ }
+
DBusError err;
dbus_error_init(&err);
int vcdc_send_dialog(int manger_pid, int pid, const char* disp_text, const char* utt_text, int continuous)
{
+ if (0 != __dbus_check()) {
+ return VCD_ERROR_OPERATION_FAILED;
+ }
+
DBusError err;
dbus_error_init(&err);
return VCD_ERROR_INVALID_PARAMETER;
}
+ if (0 != __dbus_check()) {
+ return VCD_ERROR_OPERATION_FAILED;
+ }
+
int daemon_pid;
DBusError err;
dbus_error_init(&err);
return VCD_ERROR_INVALID_PARAMETER;
}
+ if (0 != __dbus_check()) {
+ return VCD_ERROR_OPERATION_FAILED;
+ }
+
int daemon_pid;
DBusError err;
dbus_error_init(&err);
g_conn_sender = NULL;
return 0;
-}
\ No newline at end of file
+}