return NULL;
}
-int ttsdc_send_hello(int pid, int uid)
+int ttsdc_send_hello(int pid, int uid, int ret, int credential_needed)
{
-#if 0
if (NULL == g_conn_sender) {
SLOG(LOG_ERROR, tts_tag(), "[Dbus ERROR] Dbus connection is not available");
return -1;
}
- char service_name[64];
- memset(service_name, 0, 64);
- snprintf(service_name, 64, "%s%d", TTS_CLIENT_SERVICE_NAME, pid);
-
+ DBusMessage* msg;
char target_if_name[64];
snprintf(target_if_name, sizeof(target_if_name), "%s%d", TTS_CLIENT_SERVICE_INTERFACE, pid);
- DBusMessage* msg;
-
- /* create a message & check for errors */
- msg = dbus_message_new_method_call(
- service_name,
- TTS_CLIENT_SERVICE_OBJECT_PATH,
- target_if_name,
- TTSD_METHOD_HELLO);
+ /* create a message */
+ msg = dbus_message_new_signal(
+ TTS_CLIENT_SERVICE_OBJECT_PATH, /* object name of the signal */
+ target_if_name, /* interface name of the signal */
+ TTSD_METHOD_HELLO); /* name of the signal */
if (NULL == msg) {
- SLOG(LOG_ERROR, tts_tag(), "<<<< [Dbus ERROR] Fail to create hello message : uid(%d)", uid);
+ SLOG(LOG_ERROR, tts_tag(), "<<<< [Dbus ERROR] Fail to create hello message : uid(%d), ret(%d), credential_needed(%d)", uid, ret, credential_needed);
return -1;
} else {
- SLOG(LOG_DEBUG, tts_tag(), "<<<< [Dbus] Send hello message : uid(%d)", uid);
- }
-
- dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
-
- DBusError err;
- dbus_error_init(&err);
-
- DBusMessage* result_msg;
- int result = -1;
-
- result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err);
- dbus_message_unref(msg);
- if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Send error (%s)", err.message);
- dbus_error_free(&err);
+ SLOG(LOG_INFO, tts_tag(), "<<<< [Dbus] Send hello message : uid(%d), ret(%d), credential_needed(%d)", uid, ret, credential_needed);
}
- if (NULL != result_msg) {
- dbus_message_get_args(result_msg, &err, DBUS_TYPE_INT32, &result, DBUS_TYPE_INVALID);
-
- if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, tts_tag(), ">>>> [Dbus] Get arguments error (%s)", err.message);
- dbus_error_free(&err);
- result = -1;
- }
+ dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INT32, &credential_needed, DBUS_TYPE_INVALID);
- dbus_message_unref(result_msg);
+ if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
+ SLOG(LOG_ERROR, tts_tag(), "[Dbus ERROR] Fail to Send");
+ return TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, tts_tag(), ">>>> [Dbus] Result message is NULL. Client is not available");
- result = 0;
+ SLOG(LOG_INFO, tts_tag(), "[Dbus] SUCCESS Send");
+ dbus_connection_flush(g_conn_sender);
}
- return result;
-#endif
+ dbus_message_unref(msg);
return 0;
}
DBusMessage* msg = NULL;
+ char target_if_name[64];
+ snprintf(target_if_name, sizeof(target_if_name), "%s%d", TTS_CLIENT_SERVICE_INTERFACE, pid);
+
/* create a message */
msg = dbus_message_new_signal(
TTS_CLIENT_SERVICE_OBJECT_PATH, /* object name of the signal */
- TTS_CLIENT_SERVICE_INTERFACE, /* interface name of the signal */
+ target_if_name, /* interface name of the signal */
method); /* name of the signal */
if (NULL == msg) {
DBusMessage* msg = NULL;
+ char target_if_name[64];
+ snprintf(target_if_name, sizeof(target_if_name), "%s%d", TTS_CLIENT_SERVICE_INTERFACE, pid);
+
/* create a message */
msg = dbus_message_new_signal(
TTS_CLIENT_SERVICE_OBJECT_PATH, /* object name of the signal */
- TTS_CLIENT_SERVICE_INTERFACE, /* interface name of the signal */
+ target_if_name, /* interface name of the signal */
TTSD_METHOD_ERROR); /* name of the signal */
if (NULL == msg) {
if (dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_HELLO)) {
ttsd_dbus_server_hello(g_conn_listener, msg);
+ } else if (dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_HELLO_SYNC)) {
+ ttsd_dbus_server_hello_sync(g_conn_listener, msg);
+
} else if (dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_INITIALIZE)) {
ttsd_dbus_server_initialize(g_conn_listener, msg);