2 * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 * http://www.apache.org/licenses/LICENSE-2.0
7 * Unless required by applicable law or agreed to in writing, software
8 * distributed under the License is distributed on an "AS IS" BASIS,
9 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 * See the License for the specific language governing permissions and
11 * limitations under the License.
18 #include "ttsd_main.h"
19 #include "ttsd_server.h"
20 #include "ttsd_stub.h"
22 #include "ttsd_tidl.h"
26 rpc_port_stub_tts_notify_cb_h notify_cb_h;
27 } tts_tidl_proxy_info_s;
29 static GList* g_tidl_proxy_infos = NULL;
31 static rpc_port_stub_tts_callback_s g_callback;
33 static pthread_mutex_t g_tidl_proxy_infos_mutex = PTHREAD_MUTEX_INITIALIZER;
36 static tts_tidl_proxy_info_s* __get_tidl_proxy_info_s(unsigned int uid)
39 tts_tidl_proxy_info_s* info = NULL;
41 if (g_list_length(g_tidl_proxy_infos) > 0) {
42 /* Get a first item */
43 iter = g_list_first(g_tidl_proxy_infos);
45 while (NULL != iter) {
47 if (info->uid == uid) {
52 iter = g_list_next(iter);
59 void __send_msg(int pid, unsigned int uid, bundle* msg)
61 SLOG(LOG_INFO, tts_tag(), "[TIDL] start : send msg : pid(%d), uid(%u)", pid, uid);
62 pthread_mutex_lock(&g_tidl_proxy_infos_mutex);
63 tts_tidl_proxy_info_s* info = __get_tidl_proxy_info_s(uid);
65 SLOG(LOG_ERROR, tts_tag(), "[TIDL] Uid is not valid. pid(%d), uid(%u)", pid, uid);
66 pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
70 rpc_port_stub_tts_notify_cb_h handle = info->notify_cb_h;
72 SLOG(LOG_INFO, tts_tag(), "notify callback handle null");
73 pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
77 if (0 != rpc_port_stub_tts_notify_cb_invoke(handle, pid, (int)uid, msg)) {
78 SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to send msg");
79 pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
82 SLOG(LOG_INFO, tts_tag(), "send msg : pid(%d), uid(%u)", pid, uid);
83 pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
86 static void __create_client_cb(rpc_port_stub_tts_context_h context, void *user_data)
90 rpc_port_stub_tts_context_get_sender(context, &sender);
94 SLOG(LOG_ERROR, tts_tag(), ">>>>> Client connect. appid(%s)", sender);
98 static void __destroy_client_cb(rpc_port_stub_tts_context_h context, void *user_data)
101 rpc_port_stub_tts_context_get_tag(context, &tag);
104 unsigned int uid = (uintptr_t)tag;
105 SLOG(LOG_ERROR, tts_tag(), ">>>>> TTS FINALIZE. uid(%u)", uid);
107 if (0 != ttsd_server_finalize(uid)) {
110 ttsd_server_update_instant_reprepare_client();
112 pthread_mutex_lock(&g_tidl_proxy_infos_mutex);
113 tts_tidl_proxy_info_s* info = __get_tidl_proxy_info_s(uid);
115 SLOG(LOG_ERROR, tts_tag(), "[TIDL ERROR] Fail to set notify callback");
116 pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
120 rpc_port_stub_tts_notify_cb_destroy(info->notify_cb_h);
121 info->notify_cb_h = NULL;
123 g_tidl_proxy_infos = g_list_remove(g_tidl_proxy_infos, info);
126 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
128 pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
130 rpc_port_stub_tts_context_set_tag(context, NULL);
133 rpc_port_stub_tts_context_get_sender(context, &sender);
137 SLOG(LOG_INFO, tts_tag(), ">>>>> Client disconnect. appid(%s)", sender);
141 static void __register_cb(rpc_port_stub_tts_context_h context, int pid, int uid, int mode, int playing_mode, int registered_event_mask, rpc_port_stub_tts_notify_cb_h callback, void *user_data)
143 unsigned int u_uid = (unsigned int)uid;
144 SLOG(LOG_ERROR, tts_tag(), ">>>>> TTS REGISTER CALLBACK uid(%u), mode(%d), playing_mode(%d), registered mask(%x)", u_uid, mode, playing_mode, registered_event_mask);
146 bool is_initialized = false;
147 ttsd_server_is_already_initialized(pid, u_uid, &is_initialized);
150 int credential_needed = 0;
151 ttsd_state_e service_state = TTSD_STATE_INVALID;
153 if (false == is_initialized) {
154 bool is_credential_needed = false;
155 ret = ttsd_server_initialize(pid, u_uid, mode, playing_mode, registered_event_mask, TTS_IPC_METHOD_TIDL, &service_state, &is_credential_needed);
157 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] ttsd Hello : server initialize, ret(%d)", ret);
159 ttsd_server_update_instant_reprepare_client();
161 credential_needed = is_credential_needed ? 1 : 0;
163 ret = TTS_ERROR_ALREADY_INITIALIZED;
164 credential_needed = TTS_CREDENTIAL_NEEDED_ALREADY_INITIALIZED;
167 uintptr_t ptr_uid = u_uid;
168 rpc_port_stub_tts_context_set_tag(context, (void*)ptr_uid);
170 pthread_mutex_lock(&g_tidl_proxy_infos_mutex);
171 tts_tidl_proxy_info_s* info = __get_tidl_proxy_info_s(u_uid);
173 info = (tts_tidl_proxy_info_s*)calloc(1, sizeof(tts_tidl_proxy_info_s));
175 SLOG(LOG_ERROR, tts_tag(), "[TIDL ERROR] Fail to allocate memory for tidl proxy");
176 pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
180 g_tidl_proxy_infos = g_list_remove(g_tidl_proxy_infos, info);
181 rpc_port_stub_tts_notify_cb_destroy(info->notify_cb_h);
182 info->notify_cb_h = NULL;
185 if (0 != rpc_port_stub_tts_notify_cb_clone(callback, &info->notify_cb_h)) {
186 SLOG(LOG_ERROR, tts_tag(), "[TIDL ERROR] Fail to set notify callback");
188 pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
193 g_tidl_proxy_infos = g_list_append(g_tidl_proxy_infos, info);
194 pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
196 SLOG(LOG_INFO, tts_tag(), "create player instance");
197 ttsdc_tidl_send_hello(pid, u_uid, ret, (int)service_state, credential_needed);
199 SLOG(LOG_ERROR, tts_tag(), "<<<<<<<<<<<");
203 static int __register_cb_sync(rpc_port_stub_tts_context_h context, int pid, int uid, rpc_port_stub_tts_notify_cb_h callback, void* user_data)
205 unsigned int u_uid = (unsigned int)uid;
206 SLOG(LOG_ERROR, tts_tag(), ">>>>> TTS REGISTER CALLBACK synchronously uid(%u)", u_uid);
208 uintptr_t ptr_uid = u_uid;
209 rpc_port_stub_tts_context_set_tag(context, (void*)ptr_uid);
211 pthread_mutex_lock(&g_tidl_proxy_infos_mutex);
212 tts_tidl_proxy_info_s* info = __get_tidl_proxy_info_s(u_uid);
214 info = (tts_tidl_proxy_info_s*)calloc(1, sizeof(tts_tidl_proxy_info_s));
216 SLOG(LOG_ERROR, tts_tag(), "[TIDL ERROR] Fail to allocate memory for tidl proxy");
217 pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
218 return TTSD_ERROR_OUT_OF_MEMORY;
221 g_tidl_proxy_infos = g_list_remove(g_tidl_proxy_infos, info);
222 rpc_port_stub_tts_notify_cb_destroy(info->notify_cb_h);
223 info->notify_cb_h = NULL;
226 if (0 != rpc_port_stub_tts_notify_cb_clone(callback, &info->notify_cb_h)) {
227 SLOG(LOG_ERROR, tts_tag(), "[TIDL ERROR] Fail to set notify callback");
229 pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
230 return TTSD_ERROR_OPERATION_FAILED;
234 g_tidl_proxy_infos = g_list_append(g_tidl_proxy_infos, info);
235 pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
237 SLOG(LOG_ERROR, tts_tag(), "<<<<<<<<<<<");
239 return TTSD_ERROR_NONE;
242 int ttsdc_tidl_send_hello(int pid, unsigned int uid, int ret, int service_state, int credential_needed)
244 SLOG(LOG_INFO, tts_tag(), "[TIDL] ttsdc_tidl_send_hello : pid(%d), uid(%u), service_state(%d), credential_needed(%d)",
245 pid, uid, service_state, credential_needed);
247 char credential_needed_str[12] = {0, };
248 char service_state_str[12] = {0, };
249 char ret_str[12] = {0, };
251 snprintf(credential_needed_str, 12, "%d", credential_needed);
252 snprintf(service_state_str, 12, "%d", service_state);
253 snprintf(ret_str, 12, "%d", ret);
255 bundle* msg = bundle_create();
257 SLOG(LOG_ERROR, tts_tag(), "[TIDL] Fail to create bundle: pid(%d), uid(%u)", pid, uid);
258 return TTSD_ERROR_OUT_OF_MEMORY;
261 bundle_add_str(msg, TTS_BUNDLE_METHOD, TTSD_METHOD_HELLO);
262 bundle_add_str(msg, TTS_BUNDLE_REASON, ret_str);
263 bundle_add_str(msg, TTS_BUNDLE_CURRENT_STATE, service_state_str);
264 bundle_add_str(msg, TTS_BUNDLE_CREDENTIAL_NEEDED, credential_needed_str);
266 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTSD SEND HELLO MSG");
267 __send_msg(pid, uid, msg);
270 return TTSD_ERROR_NONE;
273 static int __initialize_cb(rpc_port_stub_tts_context_h context, int pid, int uid, int mode, int playing_mode, int registered_event_mask, int *service_state, bool *credential_needed, void *user_data)
275 unsigned int u_uid = (unsigned int)uid;
276 SECURE_SLOG(LOG_ERROR, tts_tag(), "[IN] tts initialize : pid(%d), uid(%u), mode(%d)", pid, u_uid, mode);
278 ttsd_state_e tmp_service_state = TTSD_STATE_INVALID;
279 if (0 != ttsd_server_initialize(pid, u_uid, mode, playing_mode, registered_event_mask, TTS_IPC_METHOD_TIDL, &tmp_service_state, credential_needed)) {
280 return TTSD_ERROR_OPERATION_FAILED;
282 ttsd_server_update_instant_reprepare_client();
284 *service_state = (int)tmp_service_state;
285 SLOG(LOG_ERROR, tts_tag(), "[OUT] tts initialize service_state(%d), credential_needed(%d)", tmp_service_state, *credential_needed);
286 return TTSD_ERROR_NONE;
289 static int __finalize_cb(rpc_port_stub_tts_context_h context, int uid, void *user_data)
291 unsigned int u_uid = (unsigned int)uid;
292 SLOG(LOG_ERROR, tts_tag(), ">>>>> TTS FINALIZE. uid(%u)", u_uid);
294 int ret = ttsd_server_finalize(u_uid);
295 if (TTSD_ERROR_NONE != ret) {
296 SLOG(LOG_ERROR, tts_tag(), "[ERROR] TTS FINALIZE (%u) fail (%d/%s) <<<<<", u_uid, ret, get_error_message(ret));
299 ttsd_server_update_instant_reprepare_client();
301 pthread_mutex_lock(&g_tidl_proxy_infos_mutex);
302 tts_tidl_proxy_info_s* info = __get_tidl_proxy_info_s(u_uid);
304 SLOG(LOG_ERROR, tts_tag(), "[TIDL ERROR] Fail to set notify callback");
305 pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
306 return TTSD_ERROR_INVALID_PARAMETER;
309 rpc_port_stub_tts_notify_cb_destroy(info->notify_cb_h);
310 info->notify_cb_h = NULL;
312 g_tidl_proxy_infos = g_list_remove(g_tidl_proxy_infos, info);
314 pthread_mutex_unlock(&g_tidl_proxy_infos_mutex);
316 rpc_port_stub_tts_context_set_tag(context, NULL);
317 SLOG(LOG_ERROR, tts_tag(), "<<<<<");
318 return TTSD_ERROR_NONE;
321 static int __add_text_cb(rpc_port_stub_tts_context_h context, int uid, const char *text, const char *lang,
322 int vctype, int speed, int uttid, const char *credential, void *user_data)
324 unsigned int u_uid = (unsigned int)uid;
325 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS ADD TEXT (%u)", u_uid);
327 int ret = ttsd_server_add_text(u_uid, text, lang, vctype, speed, uttid, credential);
328 if (TTSD_ERROR_NONE != ret) {
329 SLOG(LOG_ERROR, tts_tag(), "[ERROR] TTS ADD TEXT (%u) fail (%d/%s) <<<<<", u_uid, ret, get_error_message(ret));
333 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
334 return TTSD_ERROR_NONE;
337 static int __stop_cb(rpc_port_stub_tts_context_h context, int uid, void *user_data)
339 unsigned int u_uid = (unsigned int)uid;
340 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS STOP (%u)", u_uid);
342 int ret = ttsd_server_stop(u_uid);
343 if (TTSD_ERROR_NONE != ret) {
344 SLOG(LOG_ERROR, tts_tag(), "[ERROR] TTS STOP (%u) fail (%d/%s) <<<<<", u_uid, ret, get_error_message(ret));
349 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
351 return TTSD_ERROR_NONE;
354 static int __pause_cb(rpc_port_stub_tts_context_h context, int uid, void *user_data)
356 unsigned int u_uid = (unsigned int)uid;
357 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS PLAYER PAUSE (%u)", u_uid);
359 int ret = ttsd_server_pause(u_uid);
360 if (TTSD_ERROR_NONE != ret) {
361 SLOG(LOG_ERROR, tts_tag(), "[ERROR] TTS PLAYER PAUSE (%u) fail (%d/%s) <<<<<", u_uid, ret, get_error_message(ret));
365 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
367 return TTSD_ERROR_NONE;
370 static int __play_pcm_cb(rpc_port_stub_tts_context_h context, int uid, void *user_data)
372 unsigned int u_uid = (unsigned int)uid;
373 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS PLAY PCM (%u)", u_uid);
375 int ret = ttsd_server_play_pcm(u_uid);
376 if (TTSD_ERROR_NONE != ret) {
377 SLOG(LOG_ERROR, tts_tag(), "[ERROR] TTS PLAY PCM (%u) fail (%d/%s) <<<<<", u_uid, ret, get_error_message(ret));
381 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
383 return TTSD_ERROR_NONE;
386 static int __stop_pcm_cb(rpc_port_stub_tts_context_h context, int uid, void *user_data)
388 unsigned int u_uid = (unsigned int)uid;
389 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS STOP PCM (%u)", u_uid);
391 int ret = ttsd_server_stop(u_uid);
392 if (TTSD_ERROR_NONE != ret) {
393 SLOG(LOG_ERROR, tts_tag(), "[ERROR] TTS STOP PCM (%u) fail (%d/%s) <<<<<", u_uid, ret, get_error_message(ret));
397 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
398 return TTSD_ERROR_NONE;
401 static int __set_private_cb(rpc_port_stub_tts_context_h context, int uid, const char *key, const char *data, void *user_data)
403 unsigned int u_uid = (unsigned int)uid;
404 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS SET PRIVATE DATA (%u)", u_uid);
406 int ret = ttsd_server_set_private_data(u_uid, key, data);
407 if (TTSD_ERROR_NONE != ret) {
408 SLOG(LOG_ERROR, tts_tag(), "[ERROR] TTS SET PRIVATE DATA (%u) fail (%d/%s) <<<<<", u_uid, ret, get_error_message(ret));
412 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
414 return TTSD_ERROR_NONE;
417 static int __get_private_cb(rpc_port_stub_tts_context_h context, int uid, const char *key, char **data, void *user_data)
419 unsigned int u_uid = (unsigned int)uid;
420 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS GET PRIVATE DATA (%u)", u_uid);
422 int ret = ttsd_server_get_private_data(u_uid, key, data);
423 if (TTSD_ERROR_NONE != ret) {
424 SLOG(LOG_ERROR, tts_tag(), "[ERROR] TTS GET PRIVATE DATA (%u) fail (%d/%s) <<<<<", u_uid, ret, get_error_message(ret));
428 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
429 return TTSD_ERROR_NONE;
432 static int __play_cb(rpc_port_stub_tts_context_h context, int uid, const char *credential, void *user_data)
434 unsigned int u_uid = (unsigned int)uid;
435 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS PLAY (%u)", u_uid);
437 int ret = ttsd_server_play(u_uid, credential);
438 if (TTSD_ERROR_NONE != ret) {
439 SLOG(LOG_ERROR, tts_tag(), "[ERROR] TTS PLAY (%u) fail (%d/%s) <<<<<", u_uid, ret, get_error_message(ret));
443 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
444 return TTSD_ERROR_NONE;
447 static int __add_pcm_cb(rpc_port_stub_tts_context_h context, int uid, int event, rpc_port_stub_array_char_h pcm_data, int data_size, int audio_type, int rate, void *user_data)
449 unsigned int u_uid = (unsigned int)uid;
450 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS ADD PCM (%u)", u_uid);
452 char* pcm_data_raw = NULL;
453 int pcm_data_size = 0;
454 rpc_port_stub_array_char_get(pcm_data, &pcm_data_raw, &pcm_data_size);
456 int ret = ttsd_server_add_pcm(u_uid, event, (void *)pcm_data_raw, data_size, audio_type, rate);
459 if (TTSD_ERROR_NONE != ret) {
460 SLOG(LOG_ERROR, tts_tag(), "[ERROR] TTS ADD PCM (%u) fail (%d/%s) <<<<<", u_uid, ret, get_error_message(ret));
464 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
465 return TTSD_ERROR_NONE;
468 static int __get_service_state(rpc_port_stub_tts_context_h context, int uid, int* service_state, void *user_data)
470 unsigned int u_uid = (unsigned int)uid;
471 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS GET SERVICE STATE (%u)", u_uid);
473 int ret = ttsd_server_get_service_state(u_uid, service_state);
474 if (TTSD_ERROR_NONE != ret) {
475 SLOG(LOG_ERROR, tts_tag(), "[ERROR] TTS GET SERVICE STATE (%u) fail (%d/%s) <<<<<", u_uid, ret, get_error_message(ret));
479 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
480 return TTSD_ERROR_NONE;
483 int ttsd_tidl_open_connection()
485 SLOG(LOG_DEBUG, tts_tag(), "[TIDL] ttsd_tidl_open_connection");
487 g_callback.create = __create_client_cb;
488 g_callback.terminate = __destroy_client_cb;
489 g_callback.register_cb = __register_cb;
490 g_callback.register_cb_sync = __register_cb_sync;
491 g_callback.initialize = __initialize_cb;
492 g_callback.finalize = __finalize_cb;
493 g_callback.add_text = __add_text_cb;
494 g_callback.stop = __stop_cb;
495 g_callback.pause = __pause_cb;
496 g_callback.play_pcm = __play_pcm_cb;
497 g_callback.stop_pcm = __stop_pcm_cb;
498 g_callback.set_private = __set_private_cb;
499 g_callback.get_private = __get_private_cb;
500 g_callback.play = __play_cb;
501 g_callback.add_pcm = __add_pcm_cb;
502 g_callback.get_service_state = __get_service_state;
507 while (TTS_RETRY_MIN_COUNT >= count) {
508 ret = rpc_port_stub_tts_register(&g_callback, NULL);
510 SLOG(LOG_DEBUG, tts_tag(), "regitster callback");
511 return TTSD_ERROR_NONE;
517 SLOG(LOG_ERROR, tts_tag(), "Fail to register callback(%d)", ret);
518 return TTSE_ERROR_OPERATION_FAILED;
521 int ttsd_tidl_close_connection()
523 SLOG(LOG_DEBUG, tts_tag(), "[TIDL] ttsd_tidl_close_connection");
524 rpc_port_stub_tts_unregister();
526 return TTSD_ERROR_NONE;
529 static int __send_message(int pid, unsigned int uid, int data, const char *method)
531 SLOG(LOG_DEBUG, tts_tag(), "[TIDL] ttsdc_tidl_send_message");
533 char tmp_msg[10] = {0, };
535 bundle* msg = bundle_create();
536 snprintf(tmp_msg, 10, "%d", data);
537 bundle_add_str(msg, TTS_BUNDLE_METHOD, method);
538 bundle_add_str(msg, TTS_BUNDLE_MESSAGE, tmp_msg);
540 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTSD SEND MSG");
541 __send_msg(pid, uid, msg);
544 return TTSD_ERROR_NONE;
547 int ttsdc_tidl_send_utt_start_message(int pid, unsigned int uid, int uttid)
549 return __send_message(pid, uid, uttid, TTSD_METHOD_UTTERANCE_STARTED);
552 int ttsdc_tidl_send_utt_finish_message(int pid, unsigned int uid, int uttid)
554 return __send_message(pid, uid, uttid, TTSD_METHOD_UTTERANCE_COMPLETED);
557 int ttsdc_tidl_send_set_state_message(int pid, unsigned int uid, int state)
559 return __send_message(pid, uid, state, TTSD_METHOD_SET_STATE);
562 int ttsdc_tidl_send_set_service_state_message(int pid, unsigned int uid, int before_state, int current_state)
564 SLOG(LOG_DEBUG, tts_tag(), "[TIDL] ttsdc_tidl_send_set_service_state_message");
566 char str_before_state[10] = {0, };
567 char str_current_state[10] = {0, };
569 snprintf(str_before_state, 10, "%d", before_state);
570 snprintf(str_current_state, 10, "%d", current_state);
572 bundle* msg = bundle_create();
573 bundle_add_str(msg, TTS_BUNDLE_METHOD, TTSD_METHOD_SET_SERVICE_STATE);
574 bundle_add_str(msg, TTS_BUNDLE_BEFORE_STATE, str_before_state);
575 bundle_add_str(msg, TTS_BUNDLE_CURRENT_STATE, str_current_state);
577 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTSD SEND SET SERVICE STATE MESSAGE");
578 __send_msg(pid, uid, msg);
581 return TTSD_ERROR_NONE;
584 int ttsdc_tidl_send_error_message(int pid, unsigned int uid, int uttid, int reason, char* err_msg)
586 SLOG(LOG_DEBUG, tts_tag(), "[TIDL] ttsdc_tidl_send_error_message");
588 char tmp_uttid[10] = {0, };
589 char tmp_reason[10] = {0, };
591 bundle* msg = bundle_create();
592 snprintf(tmp_uttid, 10, "%d", uttid);
593 bundle_add_str(msg, TTS_BUNDLE_METHOD, TTSD_METHOD_ERROR);
594 bundle_add_str(msg, TTS_BUNDLE_UTTID, tmp_uttid);
595 bundle_add_str(msg, TTS_BUNDLE_REASON, tmp_reason);
596 bundle_add_str(msg, TTS_BUNDLE_ERR_MSG, err_msg);
598 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTSD SEND ERROR MSG");
599 __send_msg(pid, uid, msg);
602 return TTSD_ERROR_NONE;