return __send_message(pid, uid, state, TTSD_METHOD_SET_STATE);
}
+int ttsdc_dbus_send_set_service_state_message(int pid, unsigned int uid, int before_state, int current_state)
+{
+ if (NULL == g_conn_sender) {
+ SLOG(LOG_ERROR, tts_tag(), "[Dbus ERROR] Dbus connection is not available");
+ return TTSD_ERROR_OPERATION_FAILED;
+ }
+
+ 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 */
+ target_if_name, /* interface name of the signal */
+ TTSD_METHOD_SET_SERVICE_STATE); /* name of the signal */
+
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, tts_tag(), "[Dbus ERROR] Fail to create message : %s", TTSD_METHOD_SET_SERVICE_STATE);
+ return TTSD_ERROR_OPERATION_FAILED;
+ } else {
+ SLOG(LOG_DEBUG, tts_tag(), "[Dbus] Send set service state message : uid(%u) before_state(%d), current_state(%d)", uid, before_state, current_state);
+ }
+
+ dbus_message_append_args(msg, DBUS_TYPE_UINT32, &uid, DBUS_TYPE_INT32, &before_state, DBUS_TYPE_INT32, ¤t_state, DBUS_TYPE_INVALID);
+
+ 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] SUCCESS Send");
+ dbus_connection_flush(g_conn_sender);
+ }
+
+ dbus_message_unref(msg);
+
+ return TTSD_ERROR_NONE;
+}
+
int ttsdc_dbus_send_error_message(int pid, unsigned int uid, int uttid, int reason, char* err_msg)
{
if (NULL == g_conn_sender) {
} else if (dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_ADD_PCM)) {
ttsd_dbus_server_add_pcm(g_conn_listener, msg);
+ } else if (dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_GET_SERVICE_STATE)) {
+ ttsd_dbus_server_get_service_state(g_conn_listener, msg);
+
} else {
SLOG(LOG_DEBUG, tts_tag(), "Message is NOT valid");
/* Invalid method */