SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to get message(TTSD_METHOD_HELLO). pid(%d) uid(%d)", pid, uid);
}
} else if (0 == strncmp(TTSD_METHOD_UTTERANCE_STARTED, method, strlen(TTSD_METHOD_UTTERANCE_STARTED))) {
- bundle_get_str(msg, TTS_BUNDLE_UTTID, &val);
+ bundle_get_str(msg, TTS_BUNDLE_MESSAGE, &val);
if (val) {
tts_core_notify_utt_started(client, atoi(val));
}
} else if (0 == strncmp(TTSD_METHOD_UTTERANCE_COMPLETED, method, strlen(TTSD_METHOD_UTTERANCE_COMPLETED))) {
- bundle_get_str(msg, TTS_BUNDLE_UTTID, &val);
+ bundle_get_str(msg, TTS_BUNDLE_MESSAGE, &val);
if (val) {
tts_core_notify_utt_completeted(client, atoi(val));
}
} else if (0 == strncmp(TTSD_METHOD_SET_STATE, method, strlen(TTSD_METHOD_SET_STATE))) {
- bundle_get_str(msg, TTS_BUNDLE_STATE, &val);
+ bundle_get_str(msg, TTS_BUNDLE_MESSAGE, &val);
if (val) {
tts_core_notify_state_changed_async(client, (tts_state_e)atoi(val));
}
* Message Definition for APIs
*******************************************************************************************/
#define TTS_BUNDLE_METHOD "method"
-#define TTS_BUNDLE_STATE "state"
+#define TTS_BUNDLE_MESSAGE "message"
#define TTS_BUNDLE_UTTID "uttid"
#define TTS_BUNDLE_REASON "reason"
#define TTS_BUNDLE_ERR_MSG "err_msg"
int(*ttsd_dbus_vtable[])() = {&ttsd_dbus_open_connection, &ttsd_dbus_close_connection, &ttsdc_dbus_send_utt_start_message,
&ttsdc_dbus_send_utt_finish_message, &ttsdc_dbus_send_set_state_message, &ttsdc_dbus_send_error_message};
-int(*ttsd_tidl_vtable[])() = {&ttsd_tidl_open_connection, &ttsd_tidl_close_connection, &ttsdc_tidl_send_message,
- &ttsdc_tidl_send_message, &ttsdc_tidl_send_message, &ttsdc_tidl_send_error_message};
+int(*ttsd_tidl_vtable[])() = {&ttsd_tidl_open_connection, &ttsd_tidl_close_connection, &ttsdc_tidl_send_utt_start_message,
+ &ttsdc_tidl_send_utt_finish_message, &ttsdc_tidl_send_set_state_message, &ttsdc_tidl_send_error_message};
int ttsd_ipc_open_connection()
{
case TTS_IPC_METHOD_TIDL:
SLOG(LOG_DEBUG, tts_tag(), "[IPC] ipc method : tidl");
- return ttsd_tidl_vtable[SEND_UTTERANCE_START](pid, uid, uttid, TTSD_METHOD_UTTERANCE_STARTED);
+ return ttsd_tidl_vtable[SEND_UTTERANCE_START](pid, uid, uttid);
default:
SLOG(LOG_ERROR, tts_tag(), "[ERROR] method is not valid");
case TTS_IPC_METHOD_TIDL:
SLOG(LOG_DEBUG, tts_tag(), "[IPC] ipc method : tidl");
- return ttsd_tidl_vtable[SEND_UTTERANCE_FINISH](pid, uid, uttid, TTSD_METHOD_UTTERANCE_COMPLETED);
+ return ttsd_tidl_vtable[SEND_UTTERANCE_FINISH](pid, uid, uttid);
default:
SLOG(LOG_ERROR, tts_tag(), "[ERROR] method is not valid");
case TTS_IPC_METHOD_TIDL:
SLOG(LOG_DEBUG, tts_tag(), "[IPC] ipc method : tidl");
- return ttsd_tidl_vtable[SEND_SET_STATE] (pid, uid, state, TTSD_METHOD_SET_STATE);
+ return ttsd_tidl_vtable[SEND_SET_STATE] (pid, uid, state);
default:
SLOG(LOG_ERROR, tts_tag(), "[ERROR] method is not valid");
return TTSE_ERROR_NONE;
}
-int ttsdc_tidl_send_message(int pid, int uid, int uttid, const char *method)
+static int __send_message(int pid, int uid, int data, const char *method)
{
SLOG(LOG_DEBUG, tts_tag(), "[TIDL] ttsdc_tidl_send_message");
- char tmp_uttid[10] = {0, };
+ char tmp_msg[10] = {0, };
bundle* msg = bundle_create();
- snprintf(tmp_uttid, 10, "%d", uttid);
+ snprintf(tmp_msg, 10, "%d", data);
bundle_add_str(msg, TTS_BUNDLE_METHOD, method);
- bundle_add_str(msg, TTS_BUNDLE_UTTID, tmp_uttid);
+ bundle_add_str(msg, TTS_BUNDLE_MESSAGE, tmp_msg);
SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTSD SEND MSG");
__send_msg(pid, uid, msg);
return TTSE_ERROR_NONE;
}
+int ttsdc_tidl_send_utt_start_message(int pid, int uid, int uttid)
+{
+ return __send_message(pid, uid, uttid, TTSD_METHOD_UTTERANCE_STARTED);
+}
+
+int ttsdc_tidl_send_utt_finish_message(int pid, int uid, int uttid)
+{
+ return __send_message(pid, uid, uttid, TTSD_METHOD_UTTERANCE_COMPLETED);
+}
+
+int ttsdc_tidl_send_set_state_message(int pid, int uid, int state)
+{
+ return __send_message(pid, uid, state, TTSD_METHOD_SET_STATE);
+}
+
int ttsdc_tidl_send_error_message(int pid, int uid, int uttid, int reason, char* err_msg)
{
SLOG(LOG_DEBUG, tts_tag(), "[TIDL] ttsdc_tidl_send_error_message");
int ttsdc_tidl_send_hello(int pid, int uid, int ret, int credential_needed);
-int ttsdc_tidl_send_message(int pid, int uid, int data, const char *method);
+int ttsdc_tidl_send_utt_start_message(int pid, int uid, int uttid);
+
+int ttsdc_tidl_send_utt_finish_message(int pid, int uid, int uttid);
+
+int ttsdc_tidl_send_set_state_message(int pid, int uid, int state);
int ttsdc_tidl_send_error_message(int pid, int uid, int uttid, int reason, char* err_msg);