static int (**g_vtable)();
static tts_ipc_method_e g_ipc_method = TTS_IPC_METHOD_UNDEFINED;
-int tts_ipc_set_method(tts_ipc_method_e method) {
- if (TTS_IPC_METHOD_UNDEFINED > method || TTS_IPC_METHOD_TIDL < method) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] method is not valid");
- return TTS_ERROR_INVALID_PARAMETER;
- }
-
- g_ipc_method = method;
-
- /* choose ipc */
- switch (g_ipc_method) {
+int tts_ipc_set_method(tts_ipc_method_e method)
+{
+ switch (method) {
case TTS_IPC_METHOD_DBUS:
g_vtable = ttsc_dbus_vtable;
break;
default:
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] IPC method is not valid");
g_vtable = NULL;
+ return TTS_ERROR_INVALID_PARAMETER;
}
+ g_ipc_method = method;
return TTS_ERROR_NONE;
}
-int tts_ipc_get_method(tts_ipc_method_e* method) {
+int tts_ipc_get_method(tts_ipc_method_e* method)
+{
if (NULL == method) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] method is NULL");
return TTS_ERROR_INVALID_PARAMETER;
return TTS_ERROR_NONE;
}
-bool tts_ipc_is_method_set() {
+bool tts_ipc_is_method_set()
+{
SLOG(LOG_INFO, TAG_TTSC, "Set method (TIDL or DBUS) for ipc");
return (g_ipc_method != TTS_IPC_METHOD_UNDEFINED);
}
return TTS_ERROR_INVALID_STATE;
}
- /* choose ipc */
- switch (g_ipc_method) {
- case TTS_IPC_METHOD_DBUS:
- g_vtable = ttsc_dbus_vtable;
- break;
- case TTS_IPC_METHOD_TIDL:
- g_vtable = ttsc_tidl_vtable;
- break;
- default:
+ if (NULL == g_vtable) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] IPC method is not set");
return TTS_ERROR_OPERATION_FAILED;
}