dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
-
SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts add text : uid(%d), text(%s), lang(%s), type(%d), speed(%d), uttid(%d), credential(%s)",
uid, (NULL == text) ? "NULL" : text, (NULL == lang) ? "NULL" : lang, voicetype, speed, uttid, (NULL == credential) ? "NULL" : credential);
ret = ttsd_server_add_queue(uid, text, lang, voicetype, speed, uttid, credential);
return 0;
}
+
+int ttsd_dbus_server_play_pcm(DBusConnection* conn, DBusMessage* msg)
+{
+ DBusError err;
+ dbus_error_init(&err);
+
+ int uid;
+ int ret = 0;
+
+ dbus_message_get_args(msg, &err,
+ DBUS_TYPE_INT32, &uid,
+ DBUS_TYPE_INVALID);
+
+ SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS PLAY PCM");
+
+ if (dbus_error_is_set(&err)) {
+ SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts play pcm : Get arguments error (%s)", err.message);
+ dbus_error_free(&err);
+ ret = TTSD_ERROR_OPERATION_FAILED;
+ } else {
+ SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts play pcm : uid(%d)", uid);
+ ret = ttsd_server_play_pcm(uid);
+ }
+
+ DBusMessage* reply;
+ reply = dbus_message_new_method_return(msg);
+
+ if (NULL != reply) {
+ dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
+
+ if (0 == ret) {
+ SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts play pcm : result(%d)", ret);
+ } else {
+ SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play pcm : result(%d)", ret);
+ }
+
+ if (!dbus_connection_send(conn, reply, NULL)) {
+ SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play pcm : Out Of Memory!");
+ }
+
+ dbus_connection_flush(conn);
+ dbus_message_unref(reply);
+ } else {
+ SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play pcm : Fail to create reply message!!");
+ }
+
+ SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, tts_tag(), " ");
+
+ return 0;
+}
+
+int ttsd_dbus_server_stop_pcm(DBusConnection* conn, DBusMessage* msg)
+{
+ DBusError err;
+ dbus_error_init(&err);
+
+ int uid;
+ int ret = 0;
+
+ dbus_message_get_args(msg, &err,
+ DBUS_TYPE_INT32, &uid,
+ DBUS_TYPE_INVALID);
+
+ SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS STOP PCM");
+
+ if (dbus_error_is_set(&err)) {
+ SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts stop pcm : Get arguments error (%s)", err.message);
+ dbus_error_free(&err);
+ ret = TTSD_ERROR_OPERATION_FAILED;
+ } else {
+ SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts stop pcm : uid(%d)", uid);
+ ret = ttsd_server_stop_pcm(uid);
+ }
+
+ DBusMessage* reply;
+ reply = dbus_message_new_method_return(msg);
+
+ if (NULL != reply) {
+ dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
+
+ if (0 == ret) {
+ SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts stop pcm : result(%d)", ret);
+ } else {
+ SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop pcm : result(%d)", ret);
+ }
+
+ if (!dbus_connection_send(conn, reply, NULL)) {
+ SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop pcm : Out Of Memory!");
+ }
+
+ dbus_connection_flush(conn);
+ dbus_message_unref(reply);
+ } else {
+ SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop pcm : Fail to create reply message!!");
+ }
+
+ SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, tts_tag(), " ");
+
+ return 0;
+}
+
+int ttsd_dbus_server_add_pcm(DBusConnection* conn, DBusMessage* msg)
+{
+ DBusError err;
+ dbus_error_init(&err);
+
+ int uid;
+ int event;
+ int audio_type;
+ int rate;
+ char* data = NULL;
+ int data_size;
+ int ret = 0;
+
+ dbus_message_get_args(msg, &err,
+ DBUS_TYPE_INT32, &uid,
+ DBUS_TYPE_INT32, &event,
+ DBUS_TYPE_INT32, &audio_type,
+ DBUS_TYPE_INT32, &rate,
+ //DBUS_TYPE_STRING, &data,
+ //DBUS_TYPE_INT32, &data_size,
+ DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
+ &data, &data_size,
+ DBUS_TYPE_INVALID);
+
+ SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS ADD PCM");
+
+ if (dbus_error_is_set(&err)) {
+ SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts add pcm : Get arguments error (%s)", err.message);
+ dbus_error_free(&err);
+ ret = TTSD_ERROR_OPERATION_FAILED;
+ } else {
+ SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts add pcm : uid(%d)", uid);
+ ret = ttsd_server_add_pcm(uid, event, (void*)data, data_size, audio_type, rate);
+ }
+
+ DBusMessage* reply;
+ reply = dbus_message_new_method_return(msg);
+
+ if (NULL != reply) {
+ dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
+
+ if (0 == ret) {
+ SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts add pcm : result(%d)", ret);
+ } else {
+ SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add pcm : result(%d)", ret);
+ }
+
+ if (!dbus_connection_send(conn, reply, NULL)) {
+ SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add pcm : Out Of Memory!");
+ }
+
+ dbus_connection_flush(conn);
+ dbus_message_unref(reply);
+ } else {
+ SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add pcm : Fail to create reply message!!");
+ }
+
+ SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, tts_tag(), " ");
+
+ return 0;
+}