/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
dbus_error_init(&err);
int pid, uid;
+ bool credential_needed = 0;
int ret = 0;
dbus_message_get_args(msg, &err,
} else {
SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts initialize : pid(%d), uid(%d)", pid , uid);
- ret = ttsd_server_initialize(pid, uid);
+ ret = ttsd_server_initialize(pid, uid, &credential_needed);
}
DBusMessage* reply;
reply = dbus_message_new_method_return(msg);
+ int temp = (int)credential_needed;
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] tts initialize : result(%d), credential_needed(%d)", ret, (int)credential_needed);
if (NULL != reply) {
- dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
+ dbus_message_append_args(reply,
+ DBUS_TYPE_INT32, &ret,
+ DBUS_TYPE_INT32, &temp,
+ DBUS_TYPE_INVALID);
if (0 == ret) {
- SLOG(LOG_DEBUG, get_tag(), "[OUT] tts initialize : result(%d)", ret);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] tts initialize : result(%d), credential_needed(%d)", ret, credential_needed);
} else {
SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts initialize : result(%d)", ret);
}
dbus_error_init(&err);
int uid, voicetype, speed, uttid;
- char *text, *lang;
+ char *text, *lang, *credential;
int ret = 0;
dbus_message_get_args(msg, &err,
DBUS_TYPE_INT32, &voicetype,
DBUS_TYPE_INT32, &speed,
DBUS_TYPE_INT32, &uttid,
+ DBUS_TYPE_STRING, &credential,
DBUS_TYPE_INVALID);
SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS ADD TEXT");
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts add text : uid(%d), text(%s), lang(%s), type(%d), speed(%d), uttid(%d)",
- uid, text, lang, voicetype, speed, uttid);
- ret = ttsd_server_add_queue(uid, text, lang, voicetype, speed, uttid);
+ SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts add text : uid(%d), text(%s), lang(%s), type(%d), speed(%d), uttid(%d), credential(%s)",
+ uid, text, lang, voicetype, speed, uttid, credential);
+ ret = ttsd_server_add_queue(uid, text, lang, voicetype, speed, uttid, credential);
}
DBusMessage* reply;
dbus_error_init(&err);
int uid;
+ char* credential;
int ret = 0;
- dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
+ dbus_message_get_args(msg, &err,
+ DBUS_TYPE_INT32, &uid,
+ DBUS_TYPE_STRING, &credential,
+ DBUS_TYPE_INVALID);
SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS PLAY");
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts play : uid(%d)", uid);
- ret = ttsd_server_play(uid);
+ SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts play : uid(%d), credential(%s)", uid, credential);
+ ret = ttsd_server_play(uid, credential);
}
DBusMessage* reply;
return 0;
}
+
+int ttsd_dbus_server_set_private_data(DBusConnection* conn, DBusMessage* msg)
+{
+ DBusError err;
+ dbus_error_init(&err);
+
+ int uid;
+ char* key;
+ char* data;
+ int ret = 0;
+ dbus_message_get_args(msg, &err,
+ DBUS_TYPE_INT32, &uid,
+ DBUS_TYPE_STRING, &key,
+ DBUS_TYPE_STRING, &data,
+ DBUS_TYPE_INVALID);
+
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS set private data");
+
+ if (dbus_error_is_set(&err)) {
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] Fail to get arguments (%s)", err.message);
+ dbus_error_free(&err);
+ ret = TTSD_ERROR_OPERATION_FAILED;
+ } else {
+ SLOG(LOG_DEBUG, get_tag(), "[IN] tts set private data(%d)", uid);
+ ret = ttsd_server_set_private_data(uid, key, data);
+ }
+
+ 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, get_tag(), "[OUT] tts set private data : (%d)", ret);
+ } else {
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts set private data : (%d)", ret);
+ }
+
+ if (!dbus_connection_send(conn, reply, NULL)) {
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] Fail to send reply");
+ }
+
+ dbus_connection_flush(conn);
+ dbus_message_unref(reply);
+ } else {
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] Fail to create reply message");
+ }
+
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), "");
+
+ return 0;
+}
+
+int ttsd_dbus_server_get_private_data(DBusConnection* conn, DBusMessage* msg)
+{
+ DBusError err;
+ dbus_error_init(&err);
+
+ int uid;
+ char* key;
+ char* data;
+ int ret = 0;
+ dbus_message_get_args(msg, &err,
+ DBUS_TYPE_INT32, &uid,
+ DBUS_TYPE_STRING, &key,
+ DBUS_TYPE_INVALID);
+
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS get private data");
+
+ if (dbus_error_is_set(&err)) {
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] Fail to get arguments (%s)", err.message);
+ dbus_error_free(&err);
+ ret = TTSD_ERROR_OPERATION_FAILED;
+ } else {
+ SLOG(LOG_DEBUG, get_tag(), "[IN] tts get private data(%d)", uid);
+ ret = ttsd_server_get_private_data(uid, key, &data);
+ }
+
+ 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, get_tag(), "[OUT] tts get private data : (%d)", ret);
+ } else {
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts get private data : (%d)", ret);
+ }
+
+ if (!dbus_connection_send(conn, reply, NULL)) {
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] Fail to send reply");
+ }
+
+ dbus_connection_flush(conn);
+ dbus_message_unref(reply);
+ } else {
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] Fail to create reply message");
+ }
+
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), "");
+
+ if (NULL != data) free(data);
+
+ return 0;
+}