return TTS_ERROR_OPERATION_FAILED;
}
- tts_ipc_request_set_mode(uid, tts_client_get_mode(client));
-
tts_core_notify_state_changed(client, TTS_STATE_READY);
SLOG(LOG_DEBUG, TAG_TTSC, "@@@");
return TTS_ERROR_OPERATION_FAILED;
}
- tts_ipc_request_set_mode(uid, tts_client_get_mode(client));
tts_core_notify_state_changed(client, TTS_STATE_READY);
SLOG(LOG_DEBUG, TAG_TTSC, "@@@");
return result;
}
-int tts_dbus_request_set_mode(unsigned int uid, tts_mode_e mode)
-{
- DBusMessage* msg = __tts_dbus_make_message(uid, TTS_METHOD_SET_MODE);
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts set mode : Fail to make message");
- return TTS_ERROR_OPERATION_FAILED;
- } else {
- SLOG(LOG_DEBUG, TAG_TTSC, ">>>> Request tts set mode : uid(%u), mode(%d)", uid, mode);
- }
-
- if (true != dbus_message_append_args(msg,
- DBUS_TYPE_UINT32, &uid,
- DBUS_TYPE_INT32, &mode,
- DBUS_TYPE_INVALID)) {
- dbus_message_unref(msg);
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to append args");
-
- return TTS_ERROR_OPERATION_FAILED;
- }
-
- int result = __send_message_and_get_result(msg, TTS_METHOD_SET_MODE);
- return result;
-}
-
int tts_dbus_request_add_text(unsigned int uid, const char* text, const char* lang, int vctype, int speed, int uttid, const char* credential)
{
if (NULL == text || NULL == lang) {
int tts_dbus_request_finalize(unsigned int uid);
-int tts_dbus_request_set_mode(unsigned int uid, tts_mode_e mode);
-
int tts_dbus_request_add_text(unsigned int uid, const char* text, const char* lang, int vctype, int speed, int uttid, const char* credential);
int tts_dbus_request_play(unsigned int uid, const char* credential);
REQUEST_GET_PRIVATE_DATA,
REQUEST_PLAY_PCM,
REQUEST_STOP_PCM,
- REQUEST_ADD_PCM,
- REQUEST_SET_MODE
+ REQUEST_ADD_PCM
} tts_ipc_vtable_e;
&tts_dbus_request_hello, &tts_dbus_request_hello_sync, &tts_dbus_request_initialize,
&tts_dbus_request_finalize, &tts_dbus_request_add_text, &tts_dbus_request_play, &tts_dbus_request_stop,
&tts_dbus_request_pause, &tts_dbus_request_set_private_data, &tts_dbus_request_get_private_data,
- &tts_dbus_request_play_pcm, &tts_dbus_request_stop_pcm, &tts_dbus_request_add_pcm, &tts_dbus_request_set_mode };
+ &tts_dbus_request_play_pcm, &tts_dbus_request_stop_pcm, &tts_dbus_request_add_pcm };
static int(*ttsc_tidl_vtable[])() = { &tts_tidl_open_connection, &tts_tidl_close_connection, &tts_tidl_stop_listening,
&tts_tidl_request_hello, &tts_tidl_request_hello_sync, &tts_tidl_request_initialize,
&tts_tidl_request_finalize, &tts_tidl_request_add_text, &tts_tidl_request_play, &tts_tidl_request_stop,
&tts_tidl_request_pause, &tts_tidl_request_set_private_data, &tts_tidl_request_get_private_data,
- &tts_tidl_request_play_pcm, &tts_tidl_request_stop_pcm, &tts_tidl_request_add_pcm, &tts_tidl_request_set_mode };
+ &tts_tidl_request_play_pcm, &tts_tidl_request_stop_pcm, &tts_tidl_request_add_pcm };
static int (**g_vtable)();
static tts_ipc_method_e g_ipc_method = TTS_IPC_METHOD_UNDEFINED;
return g_vtable[REQUEST_ADD_PCM](uid, event, data, data_size, audio_type, rate);
}
-
-int tts_ipc_request_set_mode(unsigned int uid, tts_mode_e mode)
-{
- SLOG(LOG_INFO, TAG_TTSC, "[IPC] tts_ipc_request_set_mode");
-
- RETVM_IF(false == tts_client_is_valid_uid(uid), TTS_ERROR_INVALID_PARAMETER, "Fail to get tts_client with uid(%u)", uid);
- RETVM_IF(NULL == g_vtable, TTS_ERROR_OPERATION_FAILED, "[ERROR] IPC method is not set");
-
- return g_vtable[REQUEST_SET_MODE](uid, mode);
-}
int tts_ipc_request_add_pcm(unsigned int uid, int event, const char* data, int data_size, int audio_type, int rate);
-int tts_ipc_request_set_mode(unsigned int uid, tts_mode_e mode);
-
#ifdef __cplusplus
}
#endif
return TTS_ERROR_NONE;
}
-
-int tts_tidl_request_set_mode(unsigned int uid, tts_mode_e mode)
-{
- SLOG(LOG_DEBUG, TAG_TTSC, "[TIDL] tts_tidl_request_set_mode");
-
- tts_client_s* client = tts_client_get_by_uid(uid);
- RETVM_IF(NULL == client, TTS_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get client");
-
- tts_tidl_info_s* info = __get_tidl_info_s(uid);
- RETVM_IF(NULL == info, TTS_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
-
- RETVM_IF(!info->connected, TTS_ERROR_OPERATION_FAILED, "[ERROR] Not Connected");
-
- int ret = rpc_port_proxy_tts_invoke_set_mode(info->rpc_h, uid, mode);
- int exception = get_last_result();
- if (RPC_PORT_ERROR_NONE != exception) {
- ret = __convert_unhandled_error(exception);
- }
-
- if (TTS_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request set private data : Fail to invoke message(%d)", ret);
- return ret;
- }
-
- return TTS_ERROR_NONE;
-}
int tts_tidl_request_add_pcm(unsigned int uid, int event, const char* data, int data_size, int audio_type, int rate);
-int tts_tidl_request_set_mode(unsigned int uid, tts_mode_e mode);
-
#ifdef __cplusplus
}
#endif
#define TTS_METHOD_HELLO_SYNC "tts_method_hello_sync"
#define TTS_METHOD_INITIALIZE "tts_method_initialize"
#define TTS_METHOD_FINALIZE "tts_method_finalilze"
-#define TTS_METHOD_SET_MODE "tts_method_set_mode"
#define TTS_METHOD_GET_SUPPORT_VOICES "tts_method_get_support_voices"
#define TTS_METHOD_GET_CURRENT_VOICE "tts_method_get_current_voice"
#define TTS_METHOD_ADD_TEXT "tts_method_add_text"
} else if (dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_FINALIZE)) {
ttsd_dbus_server_finalize(g_conn_listener, msg);
- } else if (dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_SET_MODE)) {
- ttsd_dbus_server_set_mode(g_conn_listener, msg);
-
} else if (dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_GET_SUPPORT_VOICES)) {
ttsd_dbus_server_get_support_voices(g_conn_listener, msg);
return 0;
}
-int ttsd_dbus_server_set_mode(DBusConnection* conn, DBusMessage* msg)
-{
- DBusError err;
- dbus_error_init(&err);
-
- unsigned int uid;
- int tmp_mode;
- ttsd_mode_e mode;
- int ret = 0;
- dbus_message_get_args(msg, &err,
- DBUS_TYPE_UINT32, &uid,
- DBUS_TYPE_INT32, &tmp_mode,
- DBUS_TYPE_INVALID);
-
- mode = (ttsd_mode_e)tmp_mode;
- SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS set mode");
-
- if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] Fail to get arguments (%s)", err.message);
- dbus_error_free(&err);
- ret = TTSD_ERROR_OPERATION_FAILED;
- } else {
- SLOG(LOG_DEBUG, tts_tag(), "[IN] tts set mode. uid(%u), mode(%d)", uid, mode);
- }
-
- 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 set mode : (%d)", ret);
- } else {
- SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts set mode : (%d)", ret);
- }
-
- if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Fail to send reply");
- }
-
- dbus_connection_flush(conn);
- dbus_message_unref(reply);
- } else {
- SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Fail to create reply message");
- }
-
- SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
- SLOG(LOG_DEBUG, tts_tag(), "");
-
- return 0;
-}
-
int ttsd_dbus_server_get_support_voices(DBusConnection* conn, DBusMessage* msg)
{
DBusError err;
/*
-* Copyright (c) 2011-2016 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 Server functions for APIs
-*/
+*/
int ttsd_dbus_server_initialize(DBusConnection* conn, DBusMessage* msg);
int ttsd_dbus_server_finalize(DBusConnection* conn, DBusMessage* msg);
-int ttsd_dbus_server_set_mode(DBusConnection* conn, DBusMessage* msg);
-
int ttsd_dbus_server_get_support_voices(DBusConnection* conn, DBusMessage* msg);
int ttsd_dbus_server_get_current_voice(DBusConnection* conn, DBusMessage* msg);
return TTSD_ERROR_NONE;
}
-static int __set_mode_cb(rpc_port_stub_tts_context_h context, int uid, int mode, void* user_data)
-{
- unsigned int u_uid = (unsigned int)uid;
- SLOG(LOG_INFO, tts_tag(), ">>>>> TTS SET MODE. uid(%u). mode (%d)", u_uid, mode);
-
- SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
- return TTSD_ERROR_NONE;
-}
-
int ttsdc_tidl_send_hello(int pid, unsigned int uid, int ret, int credential_needed)
{
SLOG(LOG_INFO, tts_tag(), "[TIDL] ttsdc_tidl_send_hello : pid(%d), uid(%u), credential_needed(%d)", pid, uid, credential_needed);
g_callback.create = __create_client_cb;
g_callback.terminate = __destroy_client_cb;
- g_callback.set_mode = __set_mode_cb;
g_callback.register_cb = __register_cb;
g_callback.register_cb_sync = __register_cb_sync;
g_callback.initialize = __initialize_cb;
void register_cb(int pid, int uid, int mode, notify_cb callback) async;
int register_cb_sync(int pid, int uid, notify_cb callback);
- int set_mode(in int uid, in int mode);
int initialize(in int pid, in int uid, in int mode, out bool credential_needed);
int finalize(in int uid);
int add_text(int uid, string text, string lang, int vctype, int speed, int uttid, string credential);