SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(EXEC_PREFIX "${PREFIX}")
-SET(VERSION 0.2.53)
+SET(VERSION 0.2.54)
## Include common directory ##
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/common")
## config ##
INSTALL(FILES ${CMAKE_SOURCE_DIR}/stt-config.xml DESTINATION /usr/lib/voice/stt/1.0)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/stt-server.conf DESTINATION /etc/dbus-1/system.d)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.voice.sttserver.service DESTINATION /usr/share/dbus-1/system-services)
+stt (0.2.54) -- Tue, 2 Jun 2015
+
+ * Update IPC for getting volume not to use file (Dongyeol Lee <dy3.lee@samsung.com>)
+ * Remove unused smack label (Kwangyoun Kim <ky85.kim@samsung.com>)
+ * Update daemon start by dbus activation (Dongyeol Lee <dy3.lee@samsung.com>)
+ * Update state changed callback for thread (Dongyeol Lee <dy3.lee@samsung.com>)
+ * Apply dbus policy config (Kwangyoun Kim <ky85.kim@samsung.com>)
+
stt (0.2.53) -- Thu, 21 Aug 2014
* Remove agreement api (Dongyeol Lee <dy3.lee@samsung.com>)
#include "stt_main.h"
-static bool g_is_daemon_started = false;
-
static Ecore_Timer* g_connect_timer = NULL;
-static Eina_Bool __stt_notify_state_changed(void *data);
+static void __stt_notify_state_changed(void *data);
static Eina_Bool __stt_notify_error(void *data);
-static int g_stt_daemon_pid = -1;
static int g_count_check_daemon = 0;
const char* stt_tag()
if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request finalize : %s", __stt_get_error_code(ret));
}
-
- g_is_daemon_started = false;
case STT_STATE_CREATED:
if (NULL != g_connect_timer) {
SLOG(LOG_DEBUG, TAG_STTC, "Connect Timer is deleted");
}
}
+ stt = NULL;
+
SLOG(LOG_DEBUG, TAG_STTC, "=====");
SLOG(LOG_DEBUG, TAG_STTC, " ");
}
client->current_engine_id = strdup(engine_id);
-#if 0
- if (client->current_state == STT_STATE_READY) {
- int ret = 0;
- bool silence_supported = false;
-
- ret = stt_dbus_request_set_current_engine(client->uid, engine_id, &silence_supported);
-
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to set current engine : %s", __stt_get_error_code(ret));
- return ret;
- } else {
- SECURE_SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Current engine uuid = %s", engine_id);
- /* success to change engine */
- client->silence_supported = silence_supported;
- SECURE_SLOG(LOG_DEBUG, TAG_STTC, "Supported options : silence(%s)", silence_supported ? "true" : "false");
- }
- }
-#endif
SLOG(LOG_DEBUG, TAG_STTC, "=====");
SLOG(LOG_DEBUG, TAG_STTC, " ");
return 0;
}
-static int __read_proc(const char *path, char *buf, int size)
-{
- int fd;
- int ret;
-
- if (NULL == buf || NULL == path) {
- return -1;
- }
-
- fd = open(path, O_RDONLY);
- if (fd < 0) {
- return -1;
- }
-
- ret = read(fd, buf, size - 1);
- if (0 >= ret) {
- close(fd);
- return -1;
- } else {
- buf[ret] = 0;
- }
- close(fd);
- return ret;
-}
-
-static bool __stt_check_daemon_exist()
-{
- char buf[128];
- int ret;
-
- FILE* fp;
- fp = fopen(STT_PID_FILE_PATH, "r");
- if (NULL == fp) {
- return false;
- }
-
- g_stt_daemon_pid = -1;
- int pid;
- if (0 >= fscanf(fp, "%d", &pid)) {
- SECURE_SLOG(LOG_DEBUG, TAG_STTC, "Fail to read pid");
- fclose(fp);
- return false;
- }
-
- fclose(fp);
- snprintf(buf, sizeof(buf), "/proc/%d/cmdline", pid);
- ret = __read_proc(buf, buf, sizeof(buf));
- if (0 >= ret) {
- return false;
- } else {
- if (!strcmp(buf, "/usr/bin/stt-daemon")) {
- SECURE_SLOG(LOG_DEBUG, TAG_STTC, "Daemon existed - [%d]%s", pid, buf);
- g_stt_daemon_pid = pid;
- return true;
- }
- }
- return false;
-}
-
-static void* __fork_stt_daemon(void* NotUsed)
-{
- int pid, i;
- pid = fork();
-
- switch(pid) {
- case -1:
- SLOG(LOG_DEBUG, TAG_STTC, "[STT ERROR] fail to create STT-DAEMON");
- break;
-
- case 0:
- setsid();
- for (i = 0;i < _NSIG;i++)
- signal(i, SIG_DFL);
-
- execl("/usr/bin/stt-daemon", "/usr/bin/stt-daemon", NULL);
- break;
-
- default:
- break;
- }
-
- return (void*) 1;
-}
-
static Eina_Bool __stt_connect_daemon(void *data)
{
stt_client_s* client = (stt_client_s*)data;
/* Send hello */
int ret = -1;
ret = stt_dbus_request_hello();
-
- if (STT_DAEMON_NORMAL != ret) {
+ if (0 != ret) {
if (STT_ERROR_INVALID_STATE == ret) {
return EINA_FALSE;
}
-
- if (STT_DAEMON_ON_TERMINATING == ret) {
- /* Todo - Wait for terminating and do it again*/
- usleep(50);
- return EINA_TRUE;
- } else {
- /* for new daemon */
- bool check = __stt_check_daemon_exist();
- if (true == check) {
- g_count_check_daemon++;
- if (3 < g_count_check_daemon) {
- /* Todo - Kill daemon and restart */
- SECURE_SLOG(LOG_DEBUG, TAG_STTC, "Need to Kill daemon");
- }
- usleep(50);
- return EINA_TRUE;
- } else {
- if (false == g_is_daemon_started) {
- g_is_daemon_started = true;
-
- pthread_t thread;
- int thread_id;
- thread_id = pthread_create(&thread, NULL, __fork_stt_daemon, NULL);
- if (thread_id < 0) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to make thread");
- g_connect_timer = NULL;
- return EINA_FALSE;
- }
-
- pthread_detach(thread);
- }
-
- usleep(50);
- return EINA_TRUE;
- }
- }
+ return EINA_TRUE;
}
g_connect_timer = NULL;
return ret;
} else {
SLOG(LOG_WARN, TAG_STTC, "[WARNING] retry");
- usleep(10);
+ usleep(10000);
count++;
- if (10 == count) {
+ if (STT_RETRY_COUNT == count) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request");
return ret;
}
int stt_unprepare(stt_h stt)
{
- bool supported = false;
- if (0 == system_info_get_platform_bool(STT_FEATURE_PATH, &supported)) {
- if (false == supported) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] STT NOT supported");
- return STT_ERROR_NOT_SUPPORTED;
+ bool stt_supported = false;
+ bool mic_supported = false;
+ if (0 == system_info_get_platform_bool(STT_FEATURE_PATH, &stt_supported)) {
+ if (0 == system_info_get_platform_bool(STT_MIC_FEATURE_PATH, &mic_supported)) {
+ if (false == stt_supported || false == mic_supported) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] STT NOT supported");
+ return STT_ERROR_NOT_SUPPORTED;
+ }
}
}
break;
} else {
SLOG(LOG_WARN, TAG_STTC, "[WARNING] retry");
- usleep(10);
+ usleep(10000);
count++;
- if (10 == count) {
+ if (STT_RETRY_COUNT == count) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request");
break;
}
}
}
- g_is_daemon_started = false;
-
client->internal_state = STT_INTERNAL_STATE_NONE;
client->before_state = client->current_state;
}
} else {
current_engine_id = strdup(client->current_engine_id);
+ if (NULL == current_engine_id) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory");
+ return STT_ERROR_OUT_OF_MEMORY;
+ }
}
client->supported_lang_cb = callback;
return ret;
} else {
SLOG(LOG_WARN, TAG_STTC, "[WARNING] retry");
- usleep(10);
+ usleep(10000);
count++;
- if (10 == count) {
+ if (STT_RETRY_COUNT == count) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request");
return ret;
}
return STT_ERROR_INVALID_PARAMETER;
}
- stt_client_s* client = stt_client_get(stt);
+ if (0 != access(filename, F_OK)) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] File does not exist");
+ return STT_ERROR_INVALID_PARAMETER;
+ }
+ stt_client_s* client = stt_client_get(stt);
if (NULL == client) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Get state : A handle is not valid");
return STT_ERROR_INVALID_PARAMETER;
return ret;
} else {
SLOG(LOG_WARN, TAG_STTC, "[WARNING] retry");
- usleep(10);
+ usleep(10000);
count++;
- if (10 == count) {
+ if (STT_RETRY_COUNT == count) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request");
return ret;
}
return ret;
} else {
SLOG(LOG_WARN, TAG_STTC, "[WARNING] retry");
- usleep(10);
+ usleep(10000);
count++;
- if (10 == count) {
+ if (STT_RETRY_COUNT == count) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request");
return ret;
}
return STT_ERROR_INVALID_PARAMETER;
}
+ if (0 != access(filename, F_OK)) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] File does not exist");
+ return STT_ERROR_INVALID_PARAMETER;
+ }
+
stt_client_s* client = stt_client_get(stt);
if (NULL == client) {
return ret;
} else {
SLOG(LOG_WARN, TAG_STTC, "[WARNING] retry");
- usleep(10);
+ usleep(10000);
count++;
- if (10 == count) {
+ if (STT_RETRY_COUNT == count) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request");
return ret;
}
return ret;
} else {
SLOG(LOG_WARN, TAG_STTC, "[WARNING] retry");
- usleep(10);
+ usleep(10000);
count++;
- if (10 == count) {
+ if (STT_RETRY_COUNT == count) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request");
return ret;
}
return STT_ERROR_INVALID_STATE;
}
+ int ret = -1;
char appid[128] = {0, };
- aul_app_get_appid_bypid(getpid(), appid, sizeof(appid));
-
- if (0 == strlen(appid)) {
+ ret = aul_app_get_appid_bypid(getpid(), appid, sizeof(appid));
+
+ if ((AUL_R_OK != ret) || (0 == strlen(appid))) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get application ID");
} else {
SLOG(LOG_DEBUG, TAG_STTC, "[DEBUG] Current app id is %s", appid);
temp = strdup(language);
}
- int ret = -1;
+ ret = -1;
/* do request */
int count = 0;
while (0 != ret) {
return ret;
} else {
SLOG(LOG_WARN, TAG_STTC, "[WARNING] retry to start");
- usleep(10);
+ usleep(10000);
count++;
- if (10 == count) {
+ if (STT_RETRY_COUNT == count) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request");
if (NULL != temp) free(temp);
return ret;
client->current_state = STT_STATE_RECORDING;
if (NULL != client->state_changed_cb) {
- stt_client_use_callback(client);
- client->state_changed_cb(client->stt, client->before_state,
- client->current_state, client->state_changed_user_data);
- stt_client_not_use_callback(client);
- SLOG(LOG_DEBUG, TAG_STTC, "State changed callback is called");
+ ecore_main_loop_thread_safe_call_async(__stt_notify_state_changed, client);
} else {
SLOG(LOG_WARN, TAG_STTC, "[WARNING] State changed callback is null");
}
return ret;
} else {
SLOG(LOG_WARN, TAG_STTC, "[WARNING] retry stop");
- usleep(10);
+ usleep(10000);
count++;
- if (10 == count) {
+ if (STT_RETRY_COUNT == count) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request");
return ret;
}
client->current_state = STT_STATE_PROCESSING;
if (NULL != client->state_changed_cb) {
- stt_client_use_callback(client);
- client->state_changed_cb(client->stt, client->before_state,
- client->current_state, client->state_changed_user_data);
- stt_client_not_use_callback(client);
+ ecore_main_loop_thread_safe_call_async(__stt_notify_state_changed, client);
SLOG(LOG_DEBUG, TAG_STTC, "State changed callback is called");
} else {
SLOG(LOG_WARN, TAG_STTC, "[WARNING] State changed callback is null");
return ret;
} else {
SLOG(LOG_WARN, TAG_STTC, "[WARNING] retry");
- usleep(10);
+ usleep(10000);
count++;
- if (10 == count) {
+ if (STT_RETRY_COUNT == count) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request");
return ret;
}
client->current_state = STT_STATE_READY;
if (NULL != client->state_changed_cb) {
- stt_client_use_callback(client);
- client->state_changed_cb(client->stt, client->before_state,
- client->current_state, client->state_changed_user_data);
- stt_client_not_use_callback(client);
+ ecore_main_loop_thread_safe_call_async(__stt_notify_state_changed, client);
SLOG(LOG_DEBUG, TAG_STTC, "State changed callback is called");
} else {
SLOG(LOG_WARN, TAG_STTC, "[WARNING] State changed callback is null");
return 0;
}
-static Eina_Bool __stt_notify_state_changed(void *data)
+static void __stt_notify_state_changed(void *data)
{
stt_client_s* client = (stt_client_s*)data;
/* check handle */
if (NULL == client) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to notify error : A handle is not valid");
- return EINA_FALSE;
+ return;
}
- if (NULL == stt_client_get_by_uid(client->uid))
- return EINA_FALSE;
+ if (NULL == stt_client_get_by_uid(client->uid)) {
+ return;
+ }
if (STT_INTERNAL_STATE_STARTING == client->internal_state && STT_STATE_RECORDING == client->current_state) {
client->internal_state = STT_INTERNAL_STATE_NONE;
client->state_changed_cb(client->stt, client->before_state,
client->current_state, client->state_changed_user_data);
stt_client_not_use_callback(client);
+ SLOG(LOG_DEBUG, TAG_STTC, "State changed callback is called");
} else {
SLOG(LOG_WARN, TAG_STTC, "[WARNING] State changed callback is null");
}
- return EINA_FALSE;
+ return;
}
static Eina_Bool __stt_notify_result(void *data)
client->current_state = STT_STATE_READY;
if (NULL != client->state_changed_cb) {
- ecore_timer_add(0, __stt_notify_state_changed, client);
+ ecore_main_loop_thread_safe_call_async(__stt_notify_state_changed, client);
} else {
SLOG(LOG_WARN, TAG_STTC, "[WARNING] State changed callback is null");
}
client = stt_client_get_by_uid(uid);
if (NULL == client) {
SLOG(LOG_ERROR, TAG_STTC, "Handle is NOT valid");
- return -1;
+ return STT_ERROR_INVALID_PARAMETER;
}
if (NULL != msg) SLOG(LOG_DEBUG, TAG_STTC, "Recognition Result Message = %s", msg);
if (data_count > 0) {
char **temp = NULL;
temp = (char**)calloc(data_count, sizeof(char*));
+ if (NULL == temp) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory");
+ return STT_ERROR_OUT_OF_MEMORY;
+ }
for (i = 0;i < data_count;i++) {
if(NULL != data[i])
client->data_list = temp;
}
-
- ecore_timer_add(0, __stt_notify_result, client);
} else {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] User result callback is null");
}
- return 0;
+ ecore_timer_add(0, __stt_notify_result, client);
+
+ return STT_ERROR_NONE;
}
int __stt_cb_set_state(int uid, int state)
client->before_state = client->current_state;
client->current_state = state_from_daemon;
- ecore_timer_add(0, __stt_notify_state_changed, client);
+ ecore_main_loop_thread_safe_call_async(__stt_notify_state_changed, client);
return 0;
}
{
stt_client_s *client = NULL;
- client = (stt_client_s*)g_malloc0 (sizeof(stt_client_s));
+ client = (stt_client_s*)calloc(1, sizeof(stt_client_s));
+ if (NULL == client) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory");
+ return STT_ERROR_OUT_OF_MEMORY;
+ }
- stt_h temp = (stt_h)g_malloc0(sizeof(struct stt_s));
- temp->handle = __client_generate_uid(getpid());
+ stt_h temp = (stt_h)calloc(1, sizeof(struct stt_s));
+ if (NULL == temp) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory");
+ free(client);
+ return STT_ERROR_OUT_OF_MEMORY;
+ }
+ temp->handle = __client_generate_uid(getpid());
/* initialize client data */
client->stt = temp;
static Ecore_Fd_Handler* g_fd_handler = NULL;
-static DBusConnection* g_conn = NULL;
+static DBusConnection* g_conn_sender = NULL;
+static DBusConnection* g_conn_listener = NULL;
extern int __stt_cb_error(int uid, int reason);
static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handler)
{
- DBusConnection* conn = (DBusConnection*)data;
- DBusMessage* msg = NULL;
- DBusMessage *reply = NULL;
-
- if (NULL == conn)
- return ECORE_CALLBACK_RENEW;
+ if (NULL == g_conn_listener) return ECORE_CALLBACK_RENEW;
- dbus_connection_read_write_dispatch(conn, 50);
+ dbus_connection_read_write_dispatch(g_conn_listener, 50);
- msg = dbus_connection_pop_message(conn);
+ DBusMessage* msg = NULL;
+ msg = dbus_connection_pop_message(g_conn_listener);
- if (true != dbus_connection_get_is_connected(conn)) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Conn is disconnected");
+ if (true != dbus_connection_get_is_connected(g_conn_listener)) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection is disconnected");
return ECORE_CALLBACK_RENEW;
}
DBusError err;
dbus_error_init(&err);
+ DBusMessage *reply = NULL;
+
char if_name[64];
- snprintf(if_name, 64, "%s%d", STT_CLIENT_SERVICE_INTERFACE, getpid());
+ snprintf(if_name, 64, "%s", STT_CLIENT_SERVICE_INTERFACE);
if (dbus_message_is_method_call(msg, if_name, STTD_METHOD_HELLO)) {
SLOG(LOG_DEBUG, TAG_STTC, "===== Get Hello");
if (NULL != reply) {
dbus_message_append_args(reply, DBUS_TYPE_INT32, &response, DBUS_TYPE_INVALID);
- if (!dbus_connection_send(conn, reply, NULL))
+ if (!dbus_connection_send(g_conn_listener, reply, NULL))
SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get hello : fail to send reply");
else
SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt get hello : result(%d)", response);
- dbus_connection_flush(conn);
+ dbus_connection_flush(g_conn_listener);
dbus_message_unref(reply);
} else {
SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get hello : fail to create reply message");
else if (dbus_message_is_method_call(msg, if_name, STTD_METHOD_SET_STATE)) {
SLOG(LOG_DEBUG, TAG_STTC, "===== Set State");
int uid = 0;
- int response = -1;
int state = -1;
dbus_message_get_args(msg, &err,
}
if (uid > 0 && state >= 0) {
- SECURE_SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt set state : uid(%d), state(%d)", uid, state);
-
- response = __stt_cb_set_state(uid, state);
+ SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt set state : uid(%d), state(%d)", uid, state);
+ __stt_cb_set_state(uid, state);
} else {
SLOG(LOG_ERROR, TAG_STTC, "<<<< stt set state : invalid uid or state");
}
- reply = dbus_message_new_method_return(msg);
-
- if (NULL != reply) {
- dbus_message_append_args(reply, DBUS_TYPE_INT32, &response, DBUS_TYPE_INVALID);
-
- if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set state : fail to send reply");
- }
-
- dbus_connection_flush(conn);
- dbus_message_unref(reply);
- } else {
- SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set state : fail to create reply message");
- }
-
SLOG(LOG_DEBUG, TAG_STTC, "=====");
SLOG(LOG_DEBUG, TAG_STTC, " ");
} /* STTD_METHOD_SET_STATE */
-
else if (dbus_message_is_method_call(msg, if_name, STTD_METHOD_GET_STATE)) {
SLOG(LOG_DEBUG, TAG_STTC, "===== Get state");
int uid = 0;
if (NULL != reply) {
dbus_message_append_args(reply, DBUS_TYPE_INT32, &response, DBUS_TYPE_INVALID);
- if (!dbus_connection_send(conn, reply, NULL))
+ if (!dbus_connection_send(g_conn_listener, reply, NULL))
SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get state : fail to send reply");
else
SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt get state : result(%d)", response);
- dbus_connection_flush(conn);
+ dbus_connection_flush(g_conn_listener);
dbus_message_unref(reply);
} else {
SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get hello : fail to create reply message");
DBUS_TYPE_INVALID);
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_STTC, "<<<< stt Get Error message : Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, TAG_STTC, "<<<< stt Get Error message : Get arguments error (%s)", err.message);
dbus_error_free(&err);
} else {
- SECURE_SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt Get Error message : uid(%d), reason(%d), msg(%s)\n", uid, reason, err_msg);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt Get Error message : uid(%d), reason(%d), msg(%s)", uid, reason, err_msg);
__stt_cb_error(uid, reason);
}
- reply = dbus_message_new_method_return(msg);
-
- if (NULL != reply) {
- if (!dbus_connection_send(conn, reply, NULL))
- SLOG(LOG_ERROR, TAG_STTC, ">>>> stt Error message : fail to send reply");
- else
- SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt Error message");
-
- dbus_connection_flush(conn);
- dbus_message_unref(reply);
- } else {
- SLOG(LOG_ERROR, TAG_STTC, ">>>> stt Error message : fail to create reply message");
- }
-
SLOG(LOG_DEBUG, TAG_STTC, "=====");
SLOG(LOG_DEBUG, TAG_STTC, " ");
}/* STTD_METHOD_ERROR */
int stt_dbus_open_connection()
{
- if (NULL != g_conn) {
+ if (NULL != g_conn_sender && NULL != g_conn_listener) {
SLOG(LOG_WARN, TAG_STTC, "already existed connection ");
return 0;
}
DBusError err;
- int ret;
/* initialise the error value */
dbus_error_init(&err);
/* connect to the DBUS system bus, and check for errors */
- g_conn = dbus_bus_get_private(DBUS_BUS_SYSTEM, &err);
+ g_conn_sender = dbus_bus_get_private(DBUS_BUS_SYSTEM, &err);
+ if (dbus_error_is_set(&err)) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Dbus Connection Error (%s)", err.message);
+ dbus_error_free(&err);
+ }
+
+ if (NULL == g_conn_sender) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] fail to get dbus connection");
+ return STT_ERROR_OPERATION_FAILED;
+ }
+
+ dbus_connection_set_exit_on_disconnect(g_conn_sender, false);
+
+ /* connect to the DBUS system bus, and check for errors */
+ g_conn_listener = dbus_bus_get_private(DBUS_BUS_SYSTEM, &err);
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_STTC, "Dbus Connection Error (%s)\n", err.message);
+ SLOG(LOG_ERROR, TAG_STTC, "Dbus Connection Error (%s)", err.message);
dbus_error_free(&err);
}
- if (NULL == g_conn) {
+ if (NULL == g_conn_listener) {
SLOG(LOG_ERROR, TAG_STTC, "Fail to get dbus connection");
return STT_ERROR_OPERATION_FAILED;
}
char service_name[64];
memset(service_name, '\0', 64);
- snprintf(service_name, 64, "%s%d", STT_CLIENT_SERVICE_NAME, pid);
+ snprintf(service_name, 64, "%s", STT_CLIENT_SERVICE_NAME);
SECURE_SLOG(LOG_DEBUG, TAG_STTC, "service name is %s\n", service_name);
/* register our name on the bus, and check for errors */
- ret = dbus_bus_request_name(g_conn, service_name, DBUS_NAME_FLAG_REPLACE_EXISTING , &err);
+ dbus_bus_request_name(g_conn_listener, service_name, DBUS_NAME_FLAG_REPLACE_EXISTING , &err);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "Name Error (%s)\n", err.message);
dbus_error_free(&err);
}
- if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) {
- SLOG(LOG_ERROR, TAG_STTC, "[Dbus ERROR] Fail to be primary owner");
- return -2;
- }
-
- if( NULL != g_fd_handler ) {
- SLOG(LOG_WARN, TAG_STTC, "The handler already exists.");
- return 0;
- }
-
char rule[128];
- snprintf(rule, 128, "type='signal',interface='%s%d'", STT_CLIENT_SERVICE_INTERFACE, pid);
+ snprintf(rule, 128, "type='signal',interface='%s'", STT_CLIENT_SERVICE_INTERFACE);
/* add a rule for which messages we want to see */
- dbus_bus_add_match(g_conn, rule, &err);
- dbus_connection_flush(g_conn);
+ dbus_bus_add_match(g_conn_listener, rule, &err);
+ dbus_connection_flush(g_conn_listener);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "Match Error (%s)\n", err.message);
}
int fd = 0;
- if (1 != dbus_connection_get_unix_fd(g_conn, &fd)) {
- SLOG(LOG_ERROR, TAG_STTC, "fail to get fd from dbus");
+ if (true != dbus_connection_get_unix_fd(g_conn_listener, &fd)) {
+ SLOG(LOG_ERROR, TAG_STTC, "Fail to get fd from dbus");
return STT_ERROR_OPERATION_FAILED;
} else {
- SECURE_SLOG(LOG_DEBUG, TAG_STTC, "Get fd from dbus : %d\n", fd);
+ SLOG(LOG_DEBUG, TAG_STTC, "Get fd from dbus : %d", fd);
}
- g_fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)listener_event_callback, g_conn, NULL, NULL);
-
+ g_fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)listener_event_callback, g_conn_listener, NULL, NULL);
if (NULL == g_fd_handler) {
SLOG(LOG_ERROR, TAG_STTC, "fail to get fd handler from ecore");
return STT_ERROR_OPERATION_FAILED;
DBusError err;
dbus_error_init(&err);
+ if (NULL != g_fd_handler) {
+ ecore_main_fd_handler_del(g_fd_handler);
+ g_fd_handler = NULL;
+ }
+
int pid = getpid();
char service_name[64];
memset(service_name, '\0', 64);
- snprintf(service_name, 64, "%s%d", STT_CLIENT_SERVICE_NAME, pid);
-
- dbus_bus_release_name (g_conn, service_name, &err);
+ snprintf(service_name, 64, "%s", STT_CLIENT_SERVICE_NAME);
+ dbus_bus_release_name (g_conn_listener, service_name, &err);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Release name Error (%s)", err.message);
dbus_error_free(&err);
}
- dbus_connection_close(g_conn);
-
- g_fd_handler = NULL;
- g_conn = NULL;
+ g_conn_sender = NULL;
+ g_conn_listener = NULL;
return 0;
}
int stt_dbus_reconnect()
{
- bool connected = dbus_connection_get_is_connected(g_conn);
- SECURE_SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] %s", connected ? "Connected" : "Not connected");
+ bool sender_connected = dbus_connection_get_is_connected(g_conn_sender);
+ bool listener_connected = dbus_connection_get_is_connected(g_conn_listener);
+ SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] Sender(%s) Listener(%s)",
+ sender_connected ? "Connected" : "Not connected", listener_connected ? "Connected" : "Not connected");
- if (false == connected) {
+ if (false == sender_connected || false == listener_connected) {
stt_dbus_close_connection();
if(0 != stt_dbus_open_connection()) {
return STT_ERROR_OPERATION_FAILED;
}
- if (NULL == g_conn) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection is NOT valid");
- dbus_message_unref(msg);
- return STT_ERROR_INVALID_STATE;
- }
-
DBusError err;
dbus_error_init(&err);
DBusMessage* result_msg = NULL;
- int result = STT_DAEMON_NORMAL;
+ int result = 0;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_short_time, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_short_time, &err);
dbus_message_unref(msg);
if (dbus_error_is_set(&err)) {
dbus_error_free(&err);
}
- int status = 0;
if (NULL != result_msg) {
- dbus_message_get_args(result_msg, &err,
- DBUS_TYPE_INT32, &status,
- DBUS_TYPE_INVALID);
-
dbus_message_unref(result_msg);
if (dbus_error_is_set(&err)) {
dbus_error_free(&err);
}
- SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt hello - %d", status);
- result = status;
+ SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt hello");
} else {
result = STT_ERROR_TIMED_OUT;
}
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt initialize : uid(%d)", uid);
}
- if (NULL == g_conn) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection is NOT valid");
- dbus_message_unref(msg);
- return STT_ERROR_INVALID_STATE;
- }
-
int pid = getpid();
dbus_message_append_args( msg,
DBUS_TYPE_INT32, &pid,
DBusMessage* result_msg;
int result = STT_ERROR_OPERATION_FAILED;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err);
dbus_message_unref(msg);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message);
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt finalize : uid(%d)", uid);
}
- if (NULL == g_conn) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection is NOT valid");
- dbus_message_unref(msg);
- return STT_ERROR_INVALID_STATE;
- }
-
dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
DBusError err;
DBusMessage* result_msg;
int result = STT_ERROR_OPERATION_FAILED;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_short_time, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_short_time, &err);
dbus_message_unref(msg);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message);
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt set engine : uid(%d)", uid);
}
- if (NULL == g_conn) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection is NOT valid");
- dbus_message_unref(msg);
- return STT_ERROR_INVALID_STATE;
- }
-
dbus_message_append_args( msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_STRING, &engine_id,
DBusMessage* result_msg;
int result = STT_ERROR_OPERATION_FAILED;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err);
dbus_message_unref(msg);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message);
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt check app agreed : uid(%d) appid(%s)", uid, appid);
}
- if (NULL == g_conn) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection is NOT valid");
- dbus_message_unref(msg);
- return STT_ERROR_INVALID_STATE;
- }
-
dbus_message_append_args(msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_STRING, &appid,
int result = STT_ERROR_OPERATION_FAILED;
int available = -1;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err);
dbus_message_unref(msg);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message);
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt get supported languages : uid(%d)", uid);
}
- if (NULL == g_conn) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection is NOT valid");
- dbus_message_unref(msg);
- return STT_ERROR_INVALID_STATE;
- }
-
dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
DBusError err;
DBusMessageIter args;
int result = STT_ERROR_OPERATION_FAILED;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err );
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err);
dbus_message_unref(msg);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message);
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt get default language : uid(%d)", uid);
}
- if (NULL == g_conn) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection is NOT valid");
- dbus_message_unref(msg);
- return STT_ERROR_INVALID_STATE;
- }
-
dbus_message_append_args( msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_INVALID);
int result = STT_ERROR_OPERATION_FAILED;
char* temp_lang = NULL;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err);
dbus_message_unref(msg);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message);
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt is recognition type supported : uid(%d) type(%s)", uid, type);
}
- if (NULL == g_conn) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection is NOT valid");
- dbus_message_unref(msg);
- return STT_ERROR_INVALID_STATE;
- }
-
dbus_message_append_args( msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_STRING, &type,
int result = STT_ERROR_OPERATION_FAILED;
int result_support = -1;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err);
dbus_message_unref(msg);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message);
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt set start sound : uid(%d) file(%s)", uid, file);
}
- if (NULL == g_conn) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection is NOT valid");
- dbus_message_unref(msg);
- return STT_ERROR_INVALID_STATE;
- }
-
dbus_message_append_args( msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_STRING, &file,
DBusMessage* result_msg;
int result = STT_ERROR_OPERATION_FAILED;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err);
dbus_message_unref(msg);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message);
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt unset start sound : uid(%d)", uid);
}
- if (NULL == g_conn) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection is NOT valid");
- dbus_message_unref(msg);
- return STT_ERROR_INVALID_STATE;
- }
-
dbus_message_append_args( msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_INVALID);
DBusMessage* result_msg;
int result = STT_ERROR_OPERATION_FAILED;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err);
dbus_message_unref(msg);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message);
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt set stop sound : uid(%d) file(%s)", uid, file);
}
- if (NULL == g_conn) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection is NOT valid");
- dbus_message_unref(msg);
- return STT_ERROR_INVALID_STATE;
- }
-
dbus_message_append_args( msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_STRING, &file,
DBusMessage* result_msg;
int result = STT_ERROR_OPERATION_FAILED;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err);
dbus_message_unref(msg);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message);
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt unset stop sound : uid(%d)", uid);
}
- if (NULL == g_conn) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection is NOT valid");
- dbus_message_unref(msg);
- return STT_ERROR_INVALID_STATE;
- }
-
dbus_message_append_args( msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_INVALID);
DBusMessage* result_msg;
int result = STT_ERROR_OPERATION_FAILED;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err);
dbus_message_unref(msg);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message);
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt start : uid(%d), language(%s), type(%s)", uid, lang, type);
}
- if (NULL == g_conn) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection is NOT valid");
- dbus_message_unref(msg);
- return STT_ERROR_INVALID_STATE;
- }
-
dbus_message_append_args( msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_STRING, &lang,
DBusMessage* result_msg;
int result = STT_ERROR_OPERATION_FAILED;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err);
dbus_message_unref(msg);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message);
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt stop : uid(%d)", uid);
}
- if (NULL == g_conn) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection is NOT valid");
- dbus_message_unref(msg);
- return STT_ERROR_INVALID_STATE;
- }
-
dbus_message_append_args(msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_INVALID);
DBusMessage* result_msg;
int result = STT_ERROR_OPERATION_FAILED;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err);
dbus_message_unref(msg);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message);
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt cancel : uid(%d)", uid);
}
- if (NULL == g_conn) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection is NOT valid");
- dbus_message_unref(msg);
- return STT_ERROR_INVALID_STATE;
- }
-
dbus_message_append_args(msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_INVALID);
DBusMessage* result_msg;
int result = STT_ERROR_OPERATION_FAILED;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err);
dbus_message_unref(msg);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message);
handle = dlopen (filepath, RTLD_LAZY);
if (!handle) {
- SECURE_SLOG(LOG_WARN, TAG_STTFC, "[Engine Agent] Invalid engine : %s", filepath);
- return -1;
+ SECURE_SLOG(LOG_WARN, TAG_STTFC, "[Engine Agent] Invalid engine : %s", filepath);
+ return STT_FILE_ERROR_ENGINE_NOT_FOUND;
}
/* link engine to daemon */
if ((error = dlerror()) != NULL) {
SLOG(LOG_WARN, TAG_STTFC, "[Engine Agent] Invalid engine. Fail to open sttp_load_engine : %s", error);
dlclose(handle);
- return -1;
+ return STT_FILE_ERROR_ENGINE_NOT_FOUND;
}
dlsym(handle, "sttp_unload_engine");
if ((error = dlerror()) != NULL) {
SLOG(LOG_WARN, TAG_STTFC, "[Engine Agent] Invalid engine. Fail to open sttp_unload_engine : %s", error);
dlclose(handle);
- return -1;
+ return STT_FILE_ERROR_ENGINE_NOT_FOUND;
}
int (*get_engine_info)(sttpe_engine_info_cb callback, void* user_data);
sttengine_info_s* temp;
temp = (sttengine_info_s*)calloc(1, sizeof(sttengine_info_s));
+ if (NULL == temp) {
+ SLOG(LOG_ERROR, TAG_STTFC, "[Engine Agent ERROR] Fail to allocate memory");
+ dlclose(handle);
+ return STT_FILE_ERROR_OUT_OF_MEMORY;
+ }
/* get engine info */
if (0 != get_engine_info(__stt_file_engine_info_cb, (void*)temp)) {
SLOG(LOG_ERROR, TAG_STTFC, "[Engine Agent ERROR] Fail to get engine info from engine");
dlclose(handle);
free(temp);
- return -1;
+ return STT_FILE_ERROR_ENGINE_NOT_FOUND;
}
/* close engine */
*info = temp;
- return 0;
+ return STT_FILE_ERROR_NONE;
}
static bool __stt_file_is_engine(const char* filepath)
#include "stt_defs.h"
#include "stt_config_parser.h"
-#define VCONFKEY_VOICE_INPUT_LANGUAGE "db/voice_input/language"
typedef struct {
int uid;
int __stt_config_set_auto_language()
{
char* value = NULL;
- value = vconf_get_str(VCONFKEY_VOICE_INPUT_LANGUAGE);
+ char candidate_lang[6] = {'\0', };
+
+ value = vconf_get_str(VCONFKEY_LANGSET);
if (NULL == value) {
- SLOG(LOG_ERROR, stt_tag(), "[Config ERROR] Fail to get voice input language");
+ SLOG(LOG_ERROR, stt_tag(), "[Config ERROR] Fail to get display language");
return -1;
}
- char candidate_lang[6] = {'\0', };
-
- /* Check auto is on or not */
- if (0 == strncmp(value, "auto", 4)) {
- free(value);
-
- value = vconf_get_str(VCONFKEY_LANGSET);
- if (NULL == value) {
- SLOG(LOG_ERROR, stt_tag(), "[Config ERROR] Fail to get display language");
- return -1;
- }
-
- strncpy(candidate_lang, value, 5);
- free(value);
+ strncpy(candidate_lang, value, 5);
+ free(value);
- /* Check current language */
- if (0 == strncmp(g_config_info->language, candidate_lang, 5)) {
- SECURE_SLOG(LOG_DEBUG, stt_tag(), "[Config] Language is auto. STT language(%s) is same with display lang", g_config_info->language);
- return 0;
- } else {
- SECURE_SLOG(LOG_DEBUG, stt_tag(), "[Config] Display language : %s", candidate_lang);
- }
+ /* Check current language */
+ if (0 == strncmp(g_config_info->language, candidate_lang, 5)) {
+ SLOG(LOG_DEBUG, stt_tag(), "[Config] Language is auto. STT language(%s) is same with display lang", g_config_info->language);
+ return 0;
} else {
- strncpy(candidate_lang, value, 5);
- SECURE_SLOG(LOG_DEBUG, stt_tag(), "[Config] Voice input language is NOT auto. Voice input language : %s", candidate_lang);
-
- free(value);
+ SLOG(LOG_DEBUG, stt_tag(), "[Config] Display language : %s", candidate_lang);
}
if (true == __stt_config_mgr_check_lang_is_valid(g_config_info->engine_id, candidate_lang)) {
return;
}
+void __stt_config_release_client(int uid)
+{
+ GSList *iter = NULL;
+ stt_config_client_s* temp_client = NULL;
+
+ if (0 < g_slist_length(g_config_client_list)) {
+ /* Check uid */
+ iter = g_slist_nth(g_config_client_list, 0);
+
+ while (NULL != iter) {
+ temp_client = iter->data;
+
+ if (NULL != temp_client) {
+ if (uid == temp_client->uid) {
+ g_config_client_list = g_slist_remove(g_config_client_list, temp_client);
+ free(temp_client);
+ temp_client = NULL;
+ break;
+ }
+ }
+
+ iter = g_slist_next(iter);
+ }
+ }
+
+ if (0 < g_slist_length(g_config_client_list)) {
+ SLOG(LOG_DEBUG, stt_tag(), "Client count (%d)", g_slist_length(g_config_client_list));
+ }
+}
+
+void __stt_config_release_engine()
+{
+ GSList *iter = NULL;
+ stt_engine_info_s *engine_info = NULL;
+
+ if (0 < g_slist_length(g_engine_list)) {
+
+ /* Get a first item */
+ iter = g_slist_nth(g_engine_list, 0);
+
+ while (NULL != iter) {
+ engine_info = iter->data;
+
+ if (NULL != engine_info) {
+ g_engine_list = g_slist_remove(g_engine_list, engine_info);
+
+ stt_parser_free_engine_info(engine_info);
+ }
+
+ iter = g_slist_nth(g_engine_list, 0);
+ }
+ }
+}
+
+int __stt_config_mgr_check_engine_is_valid(const char* engine_id)
+{
+ if (NULL == engine_id) {
+ SLOG(LOG_ERROR, stt_tag(), "Input parameter is NULL");
+ return STT_CONFIG_ERROR_INVALID_PARAMETER;
+ }
+
+ GSList *iter = NULL;
+ stt_engine_info_s *engine_info = NULL;
+
+ if (0 >= g_slist_length(g_engine_list)) {
+ SLOG(LOG_ERROR, stt_tag(), "There is no engine!!");
+ return STT_CONFIG_ERROR_ENGINE_NOT_FOUND;
+ }
+
+ /* Get a first item */
+ iter = g_slist_nth(g_engine_list, 0);
+
+ while (NULL != iter) {
+ engine_info = iter->data;
+
+ if (NULL == engine_info) {
+ SLOG(LOG_ERROR, stt_tag(), "engine info is NULL");
+ return STT_CONFIG_ERROR_ENGINE_NOT_FOUND;
+ }
+
+ if (0 == strcmp(engine_id, engine_info->uuid)) {
+ SLOG(LOG_DEBUG, stt_tag(), "Default engine is valid : %s", engine_id);
+ return STT_CONFIG_ERROR_NONE;
+ }
+
+ iter = g_slist_next(iter);
+ }
+
+ /* Change default engine */
+ iter = g_slist_nth(g_engine_list, 0);
+ engine_info = iter->data;
+ if (NULL == engine_info) {
+ SLOG(LOG_ERROR, stt_tag(), "[ERROR] Engine info is NULL");
+ return STT_CONFIG_ERROR_ENGINE_NOT_FOUND;
+ }
+
+ if (NULL != g_config_info->engine_id) {
+ free(g_config_info->engine_id);
+ g_config_info->engine_id = NULL;
+ }
+ if (NULL != g_config_info->setting) {
+ free(g_config_info->setting);
+ g_config_info->setting = NULL;
+ }
+
+ if (NULL != engine_info->uuid) {
+ g_config_info->engine_id = strdup(engine_info->uuid);
+ }
+
+ if (NULL != engine_info->setting) {
+ g_config_info->setting = strdup(engine_info->setting);
+ }
+
+ /* Engine is valid*/
+ GSList *iter_lang = NULL;
+ char* lang;
+ bool is_valid_lang = false;
+
+ if (0 >= g_slist_length(engine_info->languages)) {
+ SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty supported language");
+ return STT_CONFIG_ERROR_ENGINE_NOT_FOUND;
+ }
+
+ /* Get a first item */
+ iter_lang = g_slist_nth(engine_info->languages, 0);
+
+ while (NULL != iter_lang) {
+ /*Get handle data from list*/
+ lang = iter_lang->data;
+
+ SLOG(LOG_DEBUG, stt_tag(), " %s", lang);
+ if (NULL != lang) {
+ if (0 == strcmp(lang, g_config_info->language)) {
+ /* language is valid */
+ is_valid_lang = true;
+ break;
+ }
+ }
+
+ /*Get next item*/
+ iter_lang = g_slist_next(iter_lang);
+ }
+
+ if (false == is_valid_lang) {
+ iter_lang = g_slist_nth(engine_info->languages, 0);
+ if (NULL != iter_lang) {
+ lang = iter_lang->data;
+ if (NULL != lang) {
+ if (NULL != g_config_info->language)
+ free(g_config_info->language);
+ g_config_info->language = strdup(lang);
+ }
+ }
+ }
+
+ /* Check options */
+ if (false == engine_info->support_silence_detection) {
+ if (true == g_config_info->silence_detection)
+ g_config_info->silence_detection = false;
+ }
+
+ SLOG(LOG_DEBUG, stt_tag(), "[Config] Engine changed");
+ SLOG(LOG_DEBUG, stt_tag(), " Engine : %s", g_config_info->engine_id);
+ SLOG(LOG_DEBUG, stt_tag(), " Setting : %s", g_config_info->setting);
+ SLOG(LOG_DEBUG, stt_tag(), " language : %s", g_config_info->language);
+ SLOG(LOG_DEBUG, stt_tag(), " Silence detection : %s", g_config_info->silence_detection ? "on" : "off");
+
+ if ( 0 != stt_parser_set_engine(g_config_info->engine_id, g_config_info->setting, g_config_info->language,
+ g_config_info->silence_detection)) {
+ SLOG(LOG_ERROR, stt_tag(), " Fail to save config");
+ return STT_CONFIG_ERROR_OPERATION_FAILED;
+ }
+
+ return STT_CONFIG_ERROR_NONE;
+}
+
int stt_config_mgr_initialize(int uid)
{
GSList *iter = NULL;
}
temp_client = (stt_config_client_s*)calloc(1, sizeof(stt_config_client_s));
+ if (NULL == temp_client) {
+ SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory");
+ return STT_CONFIG_ERROR_OUT_OF_MEMORY;
+ }
temp_client->uid = uid;
temp_client->bool_cb = NULL;
temp_client->engine_cb = NULL;
if (0 != stt_parser_load_config(&g_config_info)) {
SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to parse configure information");
- return -1;
+ __stt_config_release_client(uid);
+ __stt_config_release_engine();
+ return STT_CONFIG_ERROR_OPERATION_FAILED;
+ }
+
+ /* Check whether engine id is valid */
+ if (0 != __stt_config_mgr_check_engine_is_valid(g_config_info->engine_id)) {
+ SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to get default engine");
+ __stt_config_release_client(uid);
+ __stt_config_release_engine();
+ stt_parser_unload_config(g_config_info);
+ return STT_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
if (true == g_config_info->auto_lang) {
char* tmp_language;
if (0 != __stt_config_mgr_select_lang(g_config_info->engine_id, &tmp_language)) {
SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to select language");
- return -1;
+ __stt_config_release_client(uid);
+ __stt_config_release_engine();
+ stt_parser_unload_config(g_config_info);
+ return STT_CONFIG_ERROR_OPERATION_FAILED;
}
if (NULL != tmp_language) {
if (0 != __stt_config_mgr_register_config_event()) {
SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to register config event");
+ __stt_config_release_client(uid);
+ __stt_config_release_engine();
+ stt_parser_unload_config(g_config_info);
return STT_CONFIG_ERROR_OPERATION_FAILED;
}
/* Register to detect display language change */
vconf_notify_key_changed(VCONFKEY_LANGSET, __stt_config_language_changed_cb, NULL);
- vconf_notify_key_changed(VCONFKEY_VOICE_INPUT_LANGUAGE, __stt_config_language_changed_cb, NULL);
temp_client = (stt_config_client_s*)calloc(1, sizeof(stt_config_client_s));
+ if (NULL == temp_client) {
+ SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory");
+ return STT_CONFIG_ERROR_OUT_OF_MEMORY;
+ }
temp_client->uid = uid;
temp_client->bool_cb = NULL;
temp_client->engine_cb = NULL;
}
vconf_ignore_key_changed(VCONFKEY_LANGSET, __stt_config_language_changed_cb);
- vconf_ignore_key_changed(VCONFKEY_VOICE_INPUT_LANGUAGE, __stt_config_language_changed_cb);
__stt_config_mgr_unregister_config_event();
if (NULL == engine) {
current_engine = strdup(g_config_info->engine_id);
+ if (NULL == current_engine) {
+ SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory");
+ return STT_CONFIG_ERROR_OUT_OF_MEMORY;;
+ }
} else {
current_engine = strdup(engine);
+ if (NULL == current_engine) {
+ SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory");
+ return STT_CONFIG_ERROR_OUT_OF_MEMORY;;
+ }
}
/* Get a first item */
}
stt_result_time_info_s *info = (stt_result_time_info_s*)calloc(1, sizeof(stt_result_time_info_s));
-
+ if (NULL == info) {
+ SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory");
+ return STT_CONFIG_ERROR_OUT_OF_MEMORY;
+ }
info->index = index;
info->event = event;
if (NULL != text) {
/* alloc engine info */
stt_engine_info_s* temp;
temp = (stt_engine_info_s*)calloc(1, sizeof(stt_engine_info_s));
+ if (NULL == temp) {
+ xmlFreeDoc(doc);
+ SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory");
+ return -1;
+ }
temp->name = NULL;
temp->uuid = NULL;
/* alloc engine info */
stt_config_s* temp;
temp = (stt_config_s*)calloc(1, sizeof(stt_config_s));
+ if (NULL == temp) {
+ xmlFreeDoc(doc);
+ SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory");
+ return -1;
+ }
temp->engine_id = NULL;
temp->setting = NULL;
* Definition for Dbus
*******************************************************************************************/
-#define STT_CLIENT_SERVICE_NAME "org.tizen.voice.sttclient"
-#define STT_CLIENT_SERVICE_OBJECT_PATH "/org/tizen/voice/sttclient"
-#define STT_CLIENT_SERVICE_INTERFACE "org.tizen.voice.sttclient"
+#define STT_CLIENT_SERVICE_NAME "org.tizen.stt.client"
+#define STT_CLIENT_SERVICE_OBJECT_PATH "/org/tizen/stt/client"
+#define STT_CLIENT_SERVICE_INTERFACE "org.tizen.stt.client"
-#define STT_SERVER_SERVICE_NAME "service.connect.sttserver"
+#define STT_SERVER_SERVICE_NAME "org.tizen.voice.sttserver"
#define STT_SERVER_SERVICE_OBJECT_PATH "/org/tizen/voice/sttserver"
#define STT_SERVER_SERVICE_INTERFACE "org.tizen.voice.sttserver"
#define STT_AUDIO_VOLUME_PATH "/tmp/stt_vol"
-#define STT_PID_FILE_PATH "/opt/home/app/.voice/sttd_info"
-
#define STT_TIME_INFO_PATH "/opt/home/app/.voice/stt-time.xml"
#define STT_USR_BASE "/usr/lib/voice"
#define STT_BASE_LANGUAGE "en_US"
+#define STT_RETRY_COUNT 5
+
#define STT_FEATURE_PATH "tizen.org/feature/speech.recognition"
#define STT_MIC_FEATURE_PATH "tizen.org/feature/microphone"
/* allocation memory */
engine = (sttengine_s*)calloc(1, sizeof(sttengine_s));
+ if (NULL == engine) {
+ SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory");
+ return STTP_ERROR_OUT_OF_MEMORY;
+ }
/* load engine */
char *error;
}
engine->pefuncs = (sttpe_funcs_s*)calloc(1, sizeof(sttpe_funcs_s));
+ if (NULL == engine->pefuncs) {
+ SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory");
+ dlclose(engine->handle);
+ free(engine);
+ return STTP_ERROR_OUT_OF_MEMORY;
+ }
engine->pdfuncs = (sttpd_funcs_s*)calloc(1, sizeof(sttpd_funcs_s));
+ if (NULL == engine->pdfuncs) {
+ SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory");
+ dlclose(engine->handle);
+ free(engine->pefuncs);
+ free(engine);
+ return STTP_ERROR_OUT_OF_MEMORY;
+ }
engine->sttp_unload_engine = NULL;
engine->sttp_load_engine = NULL;
--- /dev/null
+[D-BUS Service]
+Name=org.tizen.voice.sttserver
+Exec=/usr/bin/stt-daemon
+User=root
+Group=root
Name: stt
Summary: Speech To Text client library and daemon
-Version: 0.2.53
+Version: 0.2.54
Release: 1
-Group: Graphics & UI Framework/Libraries
+Group: Graphics & UI Framework/Voice Framework
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
Source1001: %{name}.manifest
%postun -p /sbin/ldconfig
-/usr/bin/vconftool set -t string db/voice_input/language "auto" -g 5000 -f -s system::vconf_inhouse
-
%files
%manifest %{name}.manifest
%license LICENSE.APLv2
%{_libdir}/libstt_setting.so
/usr/lib/voice/stt/1.0/stt-config.xml
%{_bindir}/stt-daemon
+/etc/dbus-1/system.d/stt-server.conf
+/usr/share/dbus-1/system-services/org.tizen.voice.sttserver.service
/opt/usr/devel/bin/stt-test
/usr/share/license/%{name}
}
client_info_s *info = (client_info_s*)calloc(1, sizeof(client_info_s));
+ if (NULL == info) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] Fail to allocate memory");
+ return STTD_ERROR_OUT_OF_MEMORY;
+ }
info->pid = pid;
info->uid = uid;
int *tmp;
tmp = (int*)calloc(count, sizeof(int));
-
+ if (NULL == tmp) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] Fail to allocate memory");
+ return STTD_ERROR_OUT_OF_MEMORY;
+ }
+
GSList *iter = NULL;
client_info_s *data = NULL;
int i = 0;
#include "sttd_dbus_server.h"
#include "stt_defs.h"
-static DBusConnection* g_conn;
+static DBusConnection* g_conn_sender = NULL;
+static DBusConnection* g_conn_listener = NULL;
+
+static Ecore_Fd_Handler* g_dbus_fd_handler = NULL;
+
static int g_waiting_time = 3000;
+
int sttdc_send_hello(int uid)
{
int pid = sttd_client_get_pid(uid);
-
if (0 > pid) {
SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] pid is NOT valid");
- return -1;
+ return STTD_ERROR_INVALID_PARAMETER;
}
char service_name[64];
memset(service_name, 0, 64);
- snprintf(service_name, 64, "%s%d", STT_CLIENT_SERVICE_NAME, pid);
+ snprintf(service_name, 64, "%s", STT_CLIENT_SERVICE_NAME);
char target_if_name[128];
- snprintf(target_if_name, sizeof(target_if_name), "%s%d", STT_CLIENT_SERVICE_INTERFACE, pid);
+ snprintf(target_if_name, sizeof(target_if_name), "%s", STT_CLIENT_SERVICE_INTERFACE);
- DBusMessage* msg;
+ DBusMessage* msg = NULL;
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] Send hello message : uid(%d)", uid);
target_if_name,
STTD_METHOD_HELLO);
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to create message");
- return -1;
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to create message");
+ return STTD_ERROR_OUT_OF_MEMORY;
}
dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
DBusError err;
dbus_error_init(&err);
-
- DBusMessage* result_msg;
int result = -1;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
+ DBusMessage* result_msg = NULL;
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err);
dbus_message_unref(msg);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Send error (%s)", err.message);
dbus_message_unref(result_msg);
} else {
SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] Result message is NULL. Client is not available");
- result = 0;
}
return result;
}
+int sttdc_send_set_state(int uid, int state)
+{
+ int pid = sttd_client_get_pid(uid);
+
+ if (0 > pid) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] pid is NOT valid");
+ return -1;
+ }
+
+ char service_name[64];
+ memset(service_name, 0, 64);
+ snprintf(service_name, 64, "%s", STT_CLIENT_SERVICE_NAME);
+
+ char target_if_name[128];
+ snprintf(target_if_name, sizeof(target_if_name), "%s", STT_CLIENT_SERVICE_INTERFACE);
+
+ DBusMessage* msg;
+
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] Send change state message : uid(%d), state(%d)", uid, state);
+
+ msg = dbus_message_new_method_call(
+ service_name,
+ STT_CLIENT_SERVICE_OBJECT_PATH,
+ target_if_name,
+ STTD_METHOD_SET_STATE);
+
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to create message");
+ return -1;
+ }
+
+ dbus_message_append_args(msg,
+ DBUS_TYPE_INT32, &uid,
+ DBUS_TYPE_INT32, &state,
+ DBUS_TYPE_INVALID);
+
+ dbus_message_set_no_reply(msg, TRUE);
+
+ if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to send message : Out Of Memory !");
+ }
+ else {
+ SLOG(LOG_DEBUG, TAG_STTD, "<<<< Send error message : uid(%d), state(%d)", uid, state);
+ dbus_connection_flush(g_conn_sender);
+ }
+
+ dbus_connection_flush(g_conn_sender);
+ dbus_message_unref(msg);
+
+ return 0;
+}
int sttdc_send_get_state(int uid, int* state)
{
int pid = sttd_client_get_pid(uid);
char service_name[64];
memset(service_name, 0, 64);
- snprintf(service_name, 64, "%s%d", STT_CLIENT_SERVICE_NAME, pid);
+ snprintf(service_name, 64, "%s", STT_CLIENT_SERVICE_NAME);
char target_if_name[128];
- snprintf(target_if_name, sizeof(target_if_name), "%s%d", STT_CLIENT_SERVICE_INTERFACE, pid);
+ snprintf(target_if_name, sizeof(target_if_name), "%s", STT_CLIENT_SERVICE_INTERFACE);
DBusMessage* msg;
int tmp = -1;
int result = 0;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err);
dbus_message_unref(msg);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Send error (%s)", err.message);
int sttdc_send_result(int uid, int event, const char** data, int data_count, const char* result_msg)
{
int pid = sttd_client_get_pid(uid);
-
if (0 > pid) {
SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] pid is NOT valid" );
- return -1;
+ return STTD_ERROR_INVALID_PARAMETER;
}
char service_name[64];
memset(service_name, 0, 64);
- snprintf(service_name, 64, "%s%d", STT_CLIENT_SERVICE_NAME, pid);
+ snprintf(service_name, 64, "%s", STT_CLIENT_SERVICE_NAME);
char target_if_name[128];
- snprintf(target_if_name, sizeof(target_if_name), "%s%d", STT_CLIENT_SERVICE_INTERFACE, pid);
+ memset(target_if_name, 0, 128);
+ snprintf(target_if_name, sizeof(target_if_name), "%s", STT_CLIENT_SERVICE_INTERFACE);
- DBusMessage* msg;
-
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] send result signal : uid(%d), event(%d), result count(%d)", uid, event, data_count);
+ DBusMessage* msg = NULL;
+ SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] send result signal : uid(%d), event(%d), result count(%d)", uid, event, data_count);
msg = dbus_message_new_method_call(
service_name,
target_if_name,
STTD_METHOD_RESULT);
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to create message");
- return -1;
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to create message");
+ return STTD_ERROR_OUT_OF_MEMORY;
}
DBusMessageIter args;
if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &data[i])) {
SLOG(LOG_ERROR, TAG_STTD, "[Dbus] response message : Fail to append result data");
- return -1;
+ dbus_message_unref(msg);
+ return STTD_ERROR_OPERATION_FAILED;
}
} else {
int reason = (int)STTD_ERROR_OPERATION_FAILED;
sttd_client_delete(uid);
}
- SECURE_SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Result from engine is NULL(%d)", i);
- return -1;
+ dbus_message_unref(msg);
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Result from engine is NULL(%d)", i);
+ return STTD_ERROR_OPERATION_FAILED;
}
}
-
- if (!dbus_connection_send(g_conn, msg, NULL)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to send message : Out Of Memory !");
- return -1;
+
+ dbus_message_set_no_reply(msg, TRUE);
+
+ if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to send message : Out Of Memory !");
}
- dbus_connection_flush(g_conn);
+ dbus_connection_flush(g_conn_sender);
dbus_message_unref(msg);
return 0;
}
int pid = sttd_client_get_pid(uid);
-
if (0 > pid) {
SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] pid is NOT valid" );
- return -1;
+ return STTD_ERROR_INVALID_PARAMETER;
}
char service_name[64];
memset(service_name, 0, 64);
- snprintf(service_name, 64, "%s%d", STT_CLIENT_SERVICE_NAME, pid);
+ snprintf(service_name, 64, "%s", STT_CLIENT_SERVICE_NAME);
char target_if_name[128];
- snprintf(target_if_name, sizeof(target_if_name), "%s%d", STT_CLIENT_SERVICE_INTERFACE, pid);
-
- DBusMessage* msg;
- SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] send error signal : reason(%d), Error Msg(%s)", reason, err_msg);
+ snprintf(target_if_name, sizeof(target_if_name), "%s", STT_CLIENT_SERVICE_INTERFACE);
+ DBusMessage* msg = NULL;
msg = dbus_message_new_method_call(
service_name,
STT_CLIENT_SERVICE_OBJECT_PATH,
target_if_name,
STTD_METHOD_ERROR);
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to create message");
- return -1;
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to create message");
+ return STTD_ERROR_OUT_OF_MEMORY;
}
dbus_message_append_args(msg,
DBUS_TYPE_INT32, &reason,
DBUS_TYPE_STRING, &err_msg,
DBUS_TYPE_INVALID);
-
- DBusError err;
- dbus_error_init(&err);
-
- DBusMessage* result_msg;
-
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
- dbus_message_unref(msg);
- if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Send error (%s)", err.message);
- dbus_error_free(&err);
- }
- if (NULL != result_msg) {
- dbus_message_unref(result_msg);
+ if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] <<<< error message : Out Of Memory !");
} else {
- SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] Result message is NULL.");
- }
-
- return 0;
-}
-
-int sttdc_send_set_state(int uid, int state)
-{
- int pid = sttd_client_get_pid(uid);
-
- if (0 > pid) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] pid is NOT valid");
- return -1;
- }
-
- char service_name[64];
- memset(service_name, 0, 64);
- snprintf(service_name, 64, "%s%d", STT_CLIENT_SERVICE_NAME, pid);
-
- char target_if_name[128];
- snprintf(target_if_name, sizeof(target_if_name), "%s%d", STT_CLIENT_SERVICE_INTERFACE, pid);
-
- DBusMessage* msg;
-
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] Send change state message : uid(%d), state(%d)", uid, state);
-
- msg = dbus_message_new_method_call(
- service_name,
- STT_CLIENT_SERVICE_OBJECT_PATH,
- target_if_name,
- STTD_METHOD_SET_STATE);
-
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to create message");
- return -1;
+ SLOG(LOG_DEBUG, TAG_STTD, "<<<< Send error message : uid(%d), reason(%d), err_msg(%s)", uid, reason, err_msg);
+ dbus_connection_flush(g_conn_sender);
}
- dbus_message_append_args(msg,
- DBUS_TYPE_INT32, &uid,
- DBUS_TYPE_INT32, &state,
- DBUS_TYPE_INVALID);
-
- if (!dbus_connection_send(g_conn, msg, NULL)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to send message : Out Of Memory !");
- return -1;
- }
-
- dbus_connection_flush(g_conn);
dbus_message_unref(msg);
return 0;
static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handler)
{
- DBusConnection* conn = (DBusConnection*)data;
- DBusMessage* msg = NULL;
+ if (NULL == g_conn_listener) return ECORE_CALLBACK_RENEW;
- if (NULL == conn)
- return ECORE_CALLBACK_RENEW;
+ dbus_connection_read_write_dispatch(g_conn_listener, 50);
- dbus_connection_read_write_dispatch(conn, 50);
-
- msg = dbus_connection_pop_message(conn);
+ DBusMessage* msg = NULL;
+ msg = dbus_connection_pop_message(g_conn_listener);
- if (true != dbus_connection_get_is_connected(conn)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Conn is disconnected");
+ if (true != dbus_connection_get_is_connected(g_conn_listener)) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Connection is disconnected");
return ECORE_CALLBACK_RENEW;
}
/* client event */
if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_HELLO))
- sttd_dbus_server_hello(conn, msg);
+ sttd_dbus_server_hello(g_conn_listener, msg);
else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_INITIALIZE))
- sttd_dbus_server_initialize(conn, msg);
-
+ sttd_dbus_server_initialize(g_conn_listener, msg);
+
else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_FINALIZE))
- sttd_dbus_server_finalize(conn, msg);
+ sttd_dbus_server_finalize(g_conn_listener, msg);
else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_SET_CURRENT_ENGINE))
- sttd_dbus_server_set_current_engine(conn, msg);
+ sttd_dbus_server_set_current_engine(g_conn_listener, msg);
else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_CHECK_APP_AGREED))
- sttd_dbus_server_check_app_agreed(conn, msg);
+ sttd_dbus_server_check_app_agreed(g_conn_listener, msg);
else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_GET_SUPPORT_LANGS))
- sttd_dbus_server_get_support_lang(conn, msg);
+ sttd_dbus_server_get_support_lang(g_conn_listener, msg);
else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_GET_CURRENT_LANG))
- sttd_dbus_server_get_default_lang(conn, msg);
+ sttd_dbus_server_get_default_lang(g_conn_listener, msg);
else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_IS_TYPE_SUPPORTED))
- sttd_dbus_server_is_recognition_type_supported(conn, msg);
+ sttd_dbus_server_is_recognition_type_supported(g_conn_listener, msg);
else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_SET_START_SOUND))
- sttd_dbus_server_set_start_sound(conn, msg);
+ sttd_dbus_server_set_start_sound(g_conn_listener, msg);
else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_UNSET_START_SOUND))
- sttd_dbus_server_unset_start_sound(conn, msg);
+ sttd_dbus_server_unset_start_sound(g_conn_listener, msg);
else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_SET_STOP_SOUND))
- sttd_dbus_server_set_stop_sound(conn, msg);
+ sttd_dbus_server_set_stop_sound(g_conn_listener, msg);
else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_UNSET_STOP_SOUND))
- sttd_dbus_server_unset_stop_sound(conn, msg);
+ sttd_dbus_server_unset_stop_sound(g_conn_listener, msg);
- else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_START))
- sttd_dbus_server_start(conn, msg);
-
- else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_STOP))
- sttd_dbus_server_stop(conn, msg);
+ else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_START))
+ sttd_dbus_server_start(g_conn_listener, msg);
+
+ else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_STOP))
+ sttd_dbus_server_stop(g_conn_listener, msg);
- else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_CANCEL))
- sttd_dbus_server_cancel(conn, msg);
+ else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_CANCEL))
+ sttd_dbus_server_cancel(g_conn_listener, msg);
/* free the message */
int ret;
+ /* Create connection for sender */
+ g_conn_sender = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
+ if (dbus_error_is_set(&err)) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail dbus_bus_get : %s", err.message);
+ dbus_error_free(&err);
+ }
+
+ if (NULL == g_conn_sender) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to get dbus connection sender");
+ return STTD_ERROR_OPERATION_FAILED;
+ }
+
/* connect to the bus and check for errors */
- g_conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
+ g_conn_listener = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail dbus_bus_get : %s", err.message);
dbus_error_free(&err);
}
- if (NULL == g_conn) {
+ if (NULL == g_conn_listener) {
SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to get dbus connection" );
- return -1;
+ return STTD_ERROR_OPERATION_FAILED;
}
/* request our name on the bus and check for errors */
- ret = dbus_bus_request_name(g_conn, STT_SERVER_SERVICE_NAME, DBUS_NAME_FLAG_REPLACE_EXISTING , &err);
+ ret = dbus_bus_request_name(g_conn_listener, STT_SERVER_SERVICE_NAME, DBUS_NAME_FLAG_REPLACE_EXISTING, &err);
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to be primary owner");
- return -1;
+ return STTD_ERROR_OPERATION_FAILED;
}
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] dbus_bus_request_name() : %s", err.message);
- dbus_error_free(&err);
- return -1;
+ dbus_error_free(&err);
+ return STTD_ERROR_OPERATION_FAILED;
}
/* add a rule for getting signal */
snprintf(rule, 128, "type='signal',interface='%s'", STT_SERVER_SERVICE_INTERFACE);
/* add a rule for which messages we want to see */
- dbus_bus_add_match(g_conn, rule, &err); /* see signals from the given interface */
- dbus_connection_flush(g_conn);
+ dbus_bus_add_match(g_conn_listener, rule, &err); /* see signals from the given interface */
+ dbus_connection_flush(g_conn_listener);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] dbus_bus_add_match() : %s", err.message);
- return -1;
+ return STTD_ERROR_OPERATION_FAILED;
}
int fd = 0;
- dbus_connection_get_unix_fd(g_conn, &fd);
+ dbus_connection_get_unix_fd(g_conn_listener, &fd);
- if (!ecore_init()) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] ecore_init()");
- return -1;
- }
-
- Ecore_Fd_Handler* fd_handler;
- fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ , (Ecore_Fd_Cb)listener_event_callback, g_conn, NULL, NULL);
-
- if (NULL == fd_handler) {
+ g_dbus_fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)listener_event_callback, g_conn_listener, NULL, NULL);
+ if (NULL == g_dbus_fd_handler) {
SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to get fd handler");
- return -1;
+ return STTD_ERROR_OPERATION_FAILED;
}
return 0;
DBusError err;
dbus_error_init(&err);
- dbus_bus_release_name (g_conn, STT_SERVER_SERVICE_NAME, &err);
+ if (NULL != g_dbus_fd_handler) {
+ ecore_main_fd_handler_del(g_dbus_fd_handler);
+ g_dbus_fd_handler = NULL;
+ }
+
+ dbus_bus_release_name(g_conn_listener, STT_SERVER_SERVICE_NAME, &err);
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] dbus_bus_release_name() : %s", err.message);
- dbus_error_free(&err);
- return -1;
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] dbus_bus_release_name() : %s", err.message);
+ dbus_error_free(&err);
}
+ g_conn_listener = NULL;
+ g_conn_sender = NULL;
+
return 0;
}
int sttdc_send_get_state(int uid, int* state);
+int sttdc_send_set_state(int uid, int state);
+
int sttdc_send_result(int uid, int event, const char** data, int data_count, const char* result_msg);
int sttdc_send_error_signal(int uid, int reason, const char *err_msg);
-int sttdc_send_set_state(int uid, int state);
-
#ifdef __cplusplus
}
DBusMessage* reply;
reply = dbus_message_new_method_return(msg);
-
- int status = -1;
- if (EINA_TRUE == sttd_get_daemon_exist()) {
- status = STTD_DAEMON_NORMAL;
- } else {
- status = STTD_DAEMON_ON_TERMINATING;
- }
-
if (NULL != reply) {
- dbus_message_append_args(reply, DBUS_TYPE_INT32, &status, DBUS_TYPE_INVALID);
-
if (!dbus_connection_send(conn, reply, NULL)) {
SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Out Of Memory!");
}
handle = dlopen (filepath, RTLD_LAZY);
if (!handle) {
- SECURE_SLOG(LOG_WARN, TAG_STTD, "[Engine Agent] Invalid engine : %s", filepath);
- return -1;
+ SECURE_SLOG(LOG_WARN, TAG_STTD, "[Engine Agent] Invalid engine : %s", filepath);
+ return STTD_ERROR_ENGINE_NOT_FOUND;
}
/* link engine to daemon */
if ((error = dlerror()) != NULL) {
SLOG(LOG_WARN, TAG_STTD, "[Engine Agent] Invalid engine. Fail to open sttp_load_engine : %s", error);
dlclose(handle);
- return -1;
+ return STTD_ERROR_ENGINE_NOT_FOUND;
}
dlsym(handle, "sttp_unload_engine");
if ((error = dlerror()) != NULL) {
SLOG(LOG_WARN, TAG_STTD, "[Engine Agent] Invalid engine. Fail to open sttp_unload_engine : %s", error);
dlclose(handle);
- return -1;
+ return STTD_ERROR_ENGINE_NOT_FOUND;
}
int (*get_engine_info)(sttpe_engine_info_cb callback, void* user_data);
if ((error = dlerror()) != NULL || NULL == get_engine_info) {
SLOG(LOG_WARN, TAG_STTD, "[Engine Agent WARNING] Invalid engine. Fail to open sttp_get_engine_info : %s", error);
dlclose(handle);
- return -1;
+ return STTD_ERROR_ENGINE_NOT_FOUND;
}
sttengine_info_s* temp;
temp = (sttengine_info_s*)calloc(1, sizeof(sttengine_info_s));
+ if (NULL == temp) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to allocate memory");
+ dlclose(handle);
+ return STTD_ERROR_OUT_OF_MEMORY;
+ }
/* get engine info */
if (0 != get_engine_info(__engine_info_cb, (void*)temp)) {
SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to get engine info from engine");
dlclose(handle);
free(temp);
- return -1;
+ return STTD_ERROR_ENGINE_NOT_FOUND;
}
/* close engine */
*info = temp;
- return 0;
+ return STTD_ERROR_NONE;
}
bool __is_engine(const char* filepath)
if (NULL == client) {
client = (sttengine_client_s*)calloc(1, sizeof(sttengine_client_s));
-
+ if (NULL == client) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to allocate memory");
+ return STTD_ERROR_OUT_OF_MEMORY;
+ }
+
/* initialize */
client->uid = uid;
client->engine_id = -1;
engine_s* temp_engine;
temp_engine = (engine_s*)calloc(1, sizeof(engine_s));
+ if (NULL == temp_engine) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to allocate memory");
+ return STTD_ERROR_OUT_OF_MEMORY;
+ }
data = iter->data;
static Ecore_Timer* g_check_client_timer = NULL;
-static int __save_stt_daemon_info()
-{
- FILE* fp;
- int pid = getpid();
- fp = fopen(STT_PID_FILE_PATH, "w");
- if (NULL == fp) {
- SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Fail to make pid file");
- return -1;
- }
- fprintf(fp, "%d", pid);
- fclose(fp);
- return 0;
-}
-
-static int __delete_stt_daemon_info()
-{
- if (0 == access(STT_PID_FILE_PATH, R_OK)) {
- if (0 != remove(STT_PID_FILE_PATH)) {
- SLOG(LOG_WARN, TAG_STTD, "[WARN] Fail to remove pid file");
- return -1;
- }
- }
- return 0;
-}
-
int main(int argc, char** argv)
{
SLOG(LOG_DEBUG, TAG_STTD, " ");
return EXIT_FAILURE;
}
- __save_stt_daemon_info();
-
stt_network_initialize();
g_check_client_timer = ecore_timer_add(CLIENT_CLEAN_UP_TIME, sttd_cleanup_client, NULL);
ecore_timer_del(g_check_client_timer);
}
- sttd_dbus_close_connection();
-
- __delete_stt_daemon_info();
-
stt_network_finalize();
sttd_finalize();
char* ug_name;
}engine_s;
-typedef enum {
- STTD_DAEMON_NORMAL = 0,
- STTD_DAEMON_ON_TERMINATING = -1
-} sttd_daemon_status_e;
-
-
#ifdef __cplusplus
}
#endif
stt_recorder_s* recorder;
recorder = (stt_recorder_s*)calloc(1, sizeof(stt_recorder_s));
+ if (NULL == recorder) {
+ audio_in_destroy(temp_in_h);
+ SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to allocate memory");
+ return STTD_ERROR_OUT_OF_MEMORY;
+ }
recorder->engine_id = engine_id;
recorder->audio_h = temp_in_h;
static float get_volume_decibel(char* data, int size, sttp_audio_type_e type)
{
- #define MAX_AMPLITUDE_MEAN_16 23170.115738161934
- #define MAX_AMPLITUDE_MEAN_08 89.803909382810
+ #define MAX_AMPLITUDE_MEAN_16 32768
+ #define MAX_AMPLITUDE_MEAN_08 128
int i, depthByte;
int count = 0;
Ecore_Timer* g_recording_timer = NULL;
Ecore_Timer* g_processing_timer = NULL;
-static Eina_Bool g_stt_daemon_exist = EINA_TRUE;
-
static int g_recording_log_count = 0;
/*
* STT Server Callback Functions
*/
-Eina_Bool sttd_get_daemon_exist()
-{
- return g_stt_daemon_exist;
-}
-
Eina_Bool __stop_by_silence(void *data)
{
SLOG(LOG_DEBUG, TAG_STTD, "===== Stop by silence detection");
/* unload engine, if ref count of client is 0 */
if (0 == sttd_client_get_ref_count()) {
- g_stt_daemon_exist = EINA_FALSE;
+ sttd_dbus_close_connection();
ecore_timer_add(0, __quit_ecore_loop, NULL);
}
--- /dev/null
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+<!-- root can own the service -->
+ <policy user="default">
+ <allow own_prefix="org.tizen.stt.client"/>
+ <allow send_destination="org.tizen.stt.client"/>
+ <allow receive_sender="org.tizen.stt.client"/>
+ </policy>
+
+ <policy user="root">
+ <allow own_prefix="org.tizen.stt.client"/>
+ <allow send_destination="org.tizen.stt.client"/>
+ <allow receive_sender="org.tizen.stt.client"/>
+ </policy>
+
+ <policy context="default">
+ <allow own_prefix="org.tizen.stt.client"/>
+ <allow send_destination="org.tizen.stt.client"/>
+ <allow receive_sender="org.tizen.stt.client"/>
+ </policy>
+
+ <policy user="default">
+ <allow own="org.tizen.voice.sttserver"/>
+ <allow send_destination="org.tizen.voice.sttserver"/>
+ <allow receive_sender="org.tizen.voice.sttserver"/>
+ </policy>
+
+ <policy user="root">
+ <allow own="org.tizen.voice.sttserver"/>
+ <allow send_destination="org.tizen.voice.sttserver"/>
+ <allow receive_sender="org.tizen.voice.sttserver"/>
+ </policy>
+
+ <policy user="system">
+ <allow own="org.tizen.voice.sttserver"/>
+ <allow send_destination="org.tizen.voice.sttserver"/>
+ <allow receive_sender="org.tizen.voice.sttserver"/>
+ </policy>
+
+
+ <!--
+ <policy context="default">
+ <check send_destination="org.tizen.voice.sttserver"
+ send_interface="org.tizen.voice.sttserver"
+ privilege="(n/a)" />
+ </policy>
+ -->
+
+ <!--
+ <policy context="default">
+ <check send_destination="org.tizen.voice.sttserver"
+ send_interface="org.tizen.voice.sttserver"
+ privilege="http://tizen.org/privilege/recorder" />
+ </policy>
+ -->
+</busconfig>