/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
#include <fcntl.h>
#include <pthread.h>
#include <sys/stat.h>
-#include <sys/types.h>
+#include <sys/types.h>
#include <sys/wait.h>
#include <system_info.h>
#include <unistd.h>
static const char* __stt_get_error_code(stt_error_e err)
{
- switch(err) {
+ switch (err) {
case STT_ERROR_NONE: return "STT_ERROR_NONE";
case STT_ERROR_OUT_OF_MEMORY: return "STT_ERROR_OUT_OF_MEMORY";
case STT_ERROR_IO_ERROR: return "STT_ERROR_IO_ERROR";
}
}
- return;
+ return;
}
int stt_create(stt_h* stt)
SLOG(LOG_DEBUG, TAG_STTC, " ");
return STT_ERROR_INVALID_PARAMETER;
}
-
+
stt_client_s* client = stt_client_get(stt);
/* check handle */
} else {
SLOG(LOG_WARN, TAG_STTC, "No registered callback function of supported engine");
}
-
+
return false;
}
if (STT_ERROR_ENGINE_NOT_FOUND == ret) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to initialize : %s", __stt_get_error_code(ret));
-
+
client->reason = STT_ERROR_ENGINE_NOT_FOUND;
ecore_timer_add(0, __stt_notify_error, (void*)client);
*state = client->current_state;
- switch(*state) {
+ switch (*state) {
case STT_STATE_CREATED: SLOG(LOG_DEBUG, TAG_STTC, "Current state is 'CREATED'"); break;
case STT_STATE_READY: SLOG(LOG_DEBUG, TAG_STTC, "Current state is 'Ready'"); break;
case STT_STATE_RECORDING: SLOG(LOG_DEBUG, TAG_STTC, "Current state is 'Recording'"); break;
if (true == client->silence_supported) {
if (type >= STT_OPTION_SILENCE_DETECTION_FALSE && type <= STT_OPTION_SILENCE_DETECTION_AUTO) {
- client->silence = type;
+ client->silence = type;
} else {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Type is invalid");
return STT_ERROR_INVALID_PARAMETER;
}
} else {
- return STT_ERROR_NOT_SUPPORTED_FEATURE;
+ return STT_ERROR_NOT_SUPPORTED_FEATURE;
}
return STT_ERROR_NONE;
while (0 != ret) {
ret = stt_dbus_request_start(client->uid, temp, type, client->silence, appid);
if (0 > ret) {
- /* Failure */
+ /* Failure */
if (STT_ERROR_TIMED_OUT != ret) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to start : %s", __stt_get_error_code(ret));
if (NULL != temp) free(temp);
SLOG(LOG_DEBUG, TAG_STTC, "=====");
SLOG(LOG_DEBUG, TAG_STTC, " ");
return STT_ERROR_INVALID_PARAMETER;
- }
-
+ }
+
/* check state */
if (client->current_state != STT_STATE_RECORDING) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Current state is NOT RECORDING");
while (0 != ret) {
ret = stt_dbus_request_stop(client->uid);
if (0 > ret) {
- /* Failure */
+ /* Failure */
if (STT_ERROR_TIMED_OUT != ret) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to stop : %s", __stt_get_error_code(ret));
return ret;
SLOG(LOG_DEBUG, TAG_STTC, "=====");
SLOG(LOG_DEBUG, TAG_STTC, " ");
return STT_ERROR_INVALID_PARAMETER;
- }
+ }
/* check state */
if (STT_STATE_RECORDING != client->current_state && STT_STATE_PROCESSING != client->current_state) {
int count = 0;
while (0 != ret) {
ret = stt_dbus_request_cancel(client->uid);
- if (0 != ret) {
- /* Failure */
+ if (0 != ret) {
+ /* Failure */
if (STT_ERROR_TIMED_OUT != ret) {
SLOG(LOG_DEBUG, TAG_STTC, "[ERROR] Fail to cancel : %s", __stt_get_error_code(ret));
return ret;
if (NULL == client) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] A handle is not available");
return STT_ERROR_INVALID_PARAMETER;
- }
-
+ }
+
if (STT_STATE_RECORDING != client->current_state) {
SLOG(LOG_DEBUG, TAG_STTC, "[ERROR] Invalid state : NO 'Recording' state");
return STT_ERROR_INVALID_STATE;
- }
-
+ }
+
int ret = 0;
ret = __stt_get_audio_volume(volume);
if (0 != ret) {
return STT_ERROR_NONE;
}
-bool __stt_result_time_cb(int index, int event, const char* text, long start_time, long end_time, void* user_data)
+bool __stt_result_time_cb(int index, int event, const char* text, long start_time, long end_time, void* user_data)
{
stt_client_s* client = (stt_client_s*)user_data;
if (NULL != client->error_cb) {
stt_client_use_callback(client);
- client->error_cb(client->stt, client->reason, client->error_user_data);
+ client->error_cb(client->stt, client->reason, client->error_user_data);
stt_client_not_use_callback(client);
SLOG(LOG_DEBUG, TAG_STTC, "Error callback is called");
} else {
int __stt_cb_error(int uid, int reason)
{
stt_client_s* client = stt_client_get_by_uid(uid);
- if( NULL == client ) {
+ if (NULL == client) {
SLOG(LOG_ERROR, TAG_STTC, "Handle not found\n");
return -1;
}
ecore_timer_add(0, __stt_notify_error, client);
} else {
SLOG(LOG_WARN, TAG_STTC, "[WARNING] Error callback is null");
- }
+ }
return 0;
}
temp = client->data_list;
int i = 0;
- for (i = 0;i < client->data_count;i++) {
+ for (i = 0; i < client->data_count; i++) {
if (NULL != temp[i]) {
free(temp[i]);
temp[i] = NULL;
client->data_count = 0;
stt_config_mgr_remove_time_info_file();
-
+
if (STT_RESULT_EVENT_FINAL_RESULT == client->event || STT_RESULT_EVENT_ERROR == client->event) {
client->before_state = client->current_state;
client->current_state = STT_STATE_READY;
int __stt_cb_result(int uid, int event, char** data, int data_count, const char* msg)
{
stt_client_s* client = NULL;
-
+
client = stt_client_get_by_uid(uid);
if (NULL == client) {
SLOG(LOG_ERROR, TAG_STTC, "Handle is NOT valid");
if (NULL != msg) SLOG(LOG_DEBUG, TAG_STTC, "Recognition Result Message = %s", msg);
- int i=0;
- for (i = 0;i < data_count;i++) {
+ int i = 0;
+ for (i = 0; i < data_count; i++) {
if (NULL != data[i]) SECURE_SLOG(LOG_DEBUG, TAG_STTC, "Recognition Result[%d] = %s", i, data[i]);
- }
+ }
if (NULL != client->recognition_result_cb) {
client->event = event;
return STT_ERROR_OUT_OF_MEMORY;
}
- for (i = 0;i < data_count;i++) {
- if(NULL != data[i])
+ for (i = 0; i < data_count; i++) {
+ if (NULL != data[i])
temp[i] = strdup(data[i]);
- else
+ else
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Result data is error");
}
int __stt_cb_set_state(int uid, int state)
{
stt_client_s* client = stt_client_get_by_uid(uid);
- if( NULL == client ) {
+ if (NULL == client) {
SLOG(LOG_ERROR, TAG_STTC, "Handle not found");
return -1;
}
/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
/* initialize client data */
client->stt = temp;
- client->pid = getpid();
+ client->pid = getpid();
client->uid = temp->handle;
-
+
client->recognition_result_cb = NULL;
client->recognition_result_user_data = NULL;
client->state_changed_cb = NULL;
*stt = temp;
- return 0;
+ return 0;
}
int stt_client_destroy(stt_h stt)
if (stt->handle == data->stt->handle) {
g_client_list = g_list_remove_link(g_client_list, iter);
- while (0 != data->cb_ref_count)
- {
+ while (0 != data->cb_ref_count) {
/* wait for release callback function */
}
-
+
if (NULL != data->current_engine_id) {
free(data->current_engine_id);
}
while (NULL != iter) {
data = iter->data;
if (NULL != data) {
- if (stt->handle == data->stt->handle)
+ if (stt->handle == data->stt->handle)
return data;
}
/* Next item */
/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
}
/* loop again if we haven't read a message */
- if (NULL == msg) {
+ if (NULL == msg) {
return ECORE_CALLBACK_RENEW;
}
if (uid > 0) {
SECURE_SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt get hello : uid(%d)", uid);
-
+
/* check uid */
stt_client_s* client = stt_client_get_by_uid(uid);
- if( NULL != client )
+ if (NULL != client)
response = 1;
- else
+ else
response = 0;
} else {
SLOG(LOG_ERROR, TAG_STTC, "<<<< stt get hello : invalid uid");
}
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(g_conn_listener, reply, NULL))
SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get hello : fail to send reply");
- else
+ else
SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt get hello : result(%d)", response);
dbus_connection_flush(g_conn_listener);
- dbus_message_unref(reply);
+ dbus_message_unref(reply);
} else {
SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get hello : fail to create reply message");
}
-
+
SLOG(LOG_DEBUG, TAG_STTC, "=====");
SLOG(LOG_DEBUG, TAG_STTC, " ");
} /* STTD_METHOD_HELLO */
/* check state */
stt_client_s* client = stt_client_get_by_uid(uid);
- if( NULL != client )
+ if (NULL != client)
response = client->current_state;
- else
+ else
SLOG(LOG_ERROR, TAG_STTC, "invalid uid");
-
+
} else {
SLOG(LOG_ERROR, TAG_STTC, "<<<< stt get state : invalid uid");
}
if (!dbus_connection_send(g_conn_listener, reply, NULL))
SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get state : fail to send reply");
- else
+ else
SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt get state : result(%d)", response);
dbus_connection_flush(g_conn_listener);
- dbus_message_unref(reply);
+ dbus_message_unref(reply);
} else {
SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get hello : fail to create reply message");
}
SLOG(LOG_DEBUG, TAG_STTC, "===== Get Result");
int uid = 0;
DBusMessageIter args;
-
+
dbus_message_iter_init(msg, &args);
-
+
/* Get result */
if (DBUS_TYPE_INT32 == dbus_message_iter_get_arg_type(&args)) {
dbus_message_iter_get_basic(&args, &uid);
dbus_message_iter_next(&args);
}
-
+
if (uid > 0) {
char** temp_result = NULL;
char* temp_msg = NULL;
}
if (DBUS_TYPE_STRING == dbus_message_iter_get_arg_type(&args)) {
- dbus_message_iter_get_basic(&args, &(temp_msg) );
+ dbus_message_iter_get_basic(&args, &(temp_msg));
dbus_message_iter_next(&args);
}
SLOG(LOG_ERROR, TAG_STTC, "Fail : memory allocation error");
} else {
int i = 0;
- for (i = 0;i < temp_count;i++) {
- dbus_message_iter_get_basic(&args, &(temp_char) );
+ for (i = 0; i < temp_count; i++) {
+ dbus_message_iter_get_basic(&args, &(temp_char));
dbus_message_iter_next(&args);
if (NULL != temp_char) {
__stt_cb_result(uid, temp_event, temp_result, temp_count, temp_msg);
- for (i = 0;i < temp_count;i++) {
+ for (i = 0; i < temp_count; i++) {
if (NULL != temp_result[i])
free(temp_result[i]);
}
SLOG(LOG_DEBUG, TAG_STTC, "=====");
SLOG(LOG_DEBUG, TAG_STTC, " ");
- }/* STTD_METHOD_RESULT */
+ } /* STTD_METHOD_RESULT */
else if (dbus_message_is_method_call(msg, if_name, STTD_METHOD_ERROR)) {
SLOG(LOG_DEBUG, TAG_STTC, "===== Get Error");
DBUS_TYPE_STRING, &err_msg,
DBUS_TYPE_INVALID);
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "<<<< stt Get Error message : Get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
} else {
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);
SLOG(LOG_DEBUG, TAG_STTC, "=====");
SLOG(LOG_DEBUG, TAG_STTC, " ");
- }/* STTD_METHOD_ERROR */
+ } /* STTD_METHOD_ERROR */
/* free the message */
dbus_message_unref(msg);
/* 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)", err.message);
+ if (dbus_error_is_set(&err)) {
+ SLOG(LOG_ERROR, TAG_STTC, "Dbus Connection Error (%s)", err.message);
dbus_error_free(&err);
}
if (NULL == g_conn_listener) {
SLOG(LOG_ERROR, TAG_STTC, "Fail to get dbus connection");
- return STT_ERROR_OPERATION_FAILED;
+ return STT_ERROR_OPERATION_FAILED;
}
int pid = getpid();
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);
+ SLOG(LOG_ERROR, TAG_STTC, "Name Error (%s)\n", err.message);
+ dbus_error_free(&err);
}
char rule[128];
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_listener, rule, &err);
+ dbus_bus_add_match(g_conn_listener, rule, &err);
dbus_connection_flush(g_conn_listener);
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "Match Error (%s)\n", err.message);
dbus_error_free(&err);
- return STT_ERROR_OPERATION_FAILED;
+ return STT_ERROR_OPERATION_FAILED;
}
int fd = 0;
memset(service_name, '\0', 64);
snprintf(service_name, 64, "%s", STT_CLIENT_SERVICE_NAME);
- dbus_bus_release_name (g_conn_listener, service_name, &err);
+ 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);
if (false == sender_connected || false == listener_connected) {
stt_dbus_close_connection();
- if(0 != stt_dbus_open_connection()) {
+ if (0 != stt_dbus_open_connection()) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to reconnect");
return -1;
- }
+ }
SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] Reconnect");
}
-
+
return 0;
}
STT_SERVER_SERVICE_INTERFACE,
STT_METHOD_HELLO);
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTC, ">>>> Request stt hello : Fail to make message");
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> Request stt hello : Fail to make message");
return STT_ERROR_OPERATION_FAILED;
- }
+ }
DBusError err;
dbus_error_init(&err);
STT_SERVER_SERVICE_INTERFACE,
STT_METHOD_INITIALIZE);
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTC, ">>>> stt initialize : Fail to make message");
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt initialize : Fail to make message");
return STT_ERROR_OPERATION_FAILED;
} else {
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt initialize : uid(%d)", uid);
}
int pid = getpid();
- dbus_message_append_args( msg,
+ dbus_message_append_args(msg,
DBUS_TYPE_INT32, &pid,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_INVALID);
DBUS_TYPE_INT32, silence_supported,
DBUS_TYPE_INVALID);
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)\n", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
result = STT_ERROR_OPERATION_FAILED;
}
STT_SERVER_SERVICE_INTERFACE,
STT_METHOD_FINALIZE);
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTC, ">>>> stt finalize : Fail to make message");
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt finalize : Fail to make message");
return STT_ERROR_OPERATION_FAILED;
} else {
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt finalize : uid(%d)", uid);
DBUS_TYPE_INT32, &result,
DBUS_TYPE_INVALID);
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
result = STT_ERROR_OPERATION_FAILED;
}
STT_SERVER_SERVICE_INTERFACE,
STT_METHOD_SET_CURRENT_ENGINE);
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set engine : Fail to make message");
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set engine : Fail to make message");
return STT_ERROR_OPERATION_FAILED;
} else {
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt set engine : uid(%d)", uid);
}
- dbus_message_append_args( msg,
+ dbus_message_append_args(msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_STRING, &engine_id,
DBUS_TYPE_INVALID);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)\n", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
result = STT_ERROR_OPERATION_FAILED;
}
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
result = STT_ERROR_OPERATION_FAILED;
}
dbus_message_unref(result_msg);
STT_SERVER_SERVICE_INTERFACE,
STT_METHOD_GET_SUPPORT_LANGS);
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get supported languages : Fail to make message");
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get supported languages : Fail to make message");
return STT_ERROR_OPERATION_FAILED;
} else {
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt get supported languages : uid(%d)", uid);
SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt get support languages : result = %d", result);
/* Get voice size */
- int size = 0;
+ int size = 0;
if (DBUS_TYPE_INT32 == dbus_message_iter_get_arg_type(&args)) {
dbus_message_iter_get_basic(&args, &size);
dbus_message_iter_next(&args);
if (0 >= size) {
SLOG(LOG_ERROR, TAG_STTC, "<<<< stt size of language error : size = %d", size);
} else {
- int i=0;
+ int i = 0;
char* temp_lang;
- for (i=0 ; i<size ; i++) {
+ for (i = 0; i < size; i++) {
dbus_message_iter_get_basic(&args, &(temp_lang));
dbus_message_iter_next(&args);
} else {
SLOG(LOG_ERROR, TAG_STTC, "<<<< stt get support languages : result = %d", result);
}
- }
+ }
dbus_message_unref(result_msg);
} else {
SLOG(LOG_ERROR, TAG_STTC, "<<<< stt get support languages : result message is NULL");
STT_SERVER_SERVICE_INTERFACE,
STT_METHOD_GET_CURRENT_LANG);
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get default language : Fail to make message");
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get default language : Fail to make message");
return STT_ERROR_OPERATION_FAILED;
} else {
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt get default language : uid(%d)", uid);
}
- dbus_message_append_args( msg,
+ dbus_message_append_args(msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_INVALID);
DBUS_TYPE_STRING, &temp_lang,
DBUS_TYPE_INVALID);
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
result = STT_ERROR_OPERATION_FAILED;
}
dbus_message_unref(result_msg);
STT_SERVER_SERVICE_INTERFACE,
STT_METHOD_IS_TYPE_SUPPORTED);
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTC, ">>>> stt is partial result supported : Fail to make message");
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt is partial result supported : Fail to make message");
return STT_ERROR_OPERATION_FAILED;
} else {
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt is recognition type supported : uid(%d) type(%s)", uid, type);
}
- dbus_message_append_args( msg,
+ dbus_message_append_args(msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_STRING, &type,
DBUS_TYPE_INVALID);
DBUS_TYPE_INT32, &result_support,
DBUS_TYPE_INVALID);
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
result = STT_ERROR_OPERATION_FAILED;
}
dbus_message_unref(result_msg);
STT_SERVER_SERVICE_INTERFACE,
STT_METHOD_SET_START_SOUND);
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set start sound : Fail to make message");
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set start sound : Fail to make message");
return STT_ERROR_OPERATION_FAILED;
} else {
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt set start sound : uid(%d) file(%s)", uid, file);
}
- dbus_message_append_args( msg,
+ dbus_message_append_args(msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_STRING, &file,
DBUS_TYPE_INVALID);
DBUS_TYPE_INT32, &result,
DBUS_TYPE_INVALID);
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
result = STT_ERROR_OPERATION_FAILED;
}
dbus_message_unref(result_msg);
STT_SERVER_SERVICE_INTERFACE,
STT_METHOD_UNSET_START_SOUND);
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTC, ">>>> stt unset start sound : Fail to make message");
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt unset start sound : Fail to make message");
return STT_ERROR_OPERATION_FAILED;
} else {
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt unset start sound : uid(%d)", uid);
}
- dbus_message_append_args( msg,
+ dbus_message_append_args(msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_INVALID);
DBUS_TYPE_INT32, &result,
DBUS_TYPE_INVALID);
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
result = STT_ERROR_OPERATION_FAILED;
}
dbus_message_unref(result_msg);
STT_SERVER_SERVICE_INTERFACE,
STT_METHOD_SET_STOP_SOUND);
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set stop sound : Fail to make message");
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set stop sound : Fail to make message");
return STT_ERROR_OPERATION_FAILED;
} else {
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt set stop sound : uid(%d) file(%s)", uid, file);
}
- dbus_message_append_args( msg,
+ dbus_message_append_args(msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_STRING, &file,
DBUS_TYPE_INVALID);
DBUS_TYPE_INT32, &result,
DBUS_TYPE_INVALID);
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
result = STT_ERROR_OPERATION_FAILED;
}
dbus_message_unref(result_msg);
STT_SERVER_SERVICE_INTERFACE,
STT_METHOD_UNSET_STOP_SOUND);
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTC, ">>>> stt unset stop sound : Fail to make message");
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt unset stop sound : Fail to make message");
return STT_ERROR_OPERATION_FAILED;
} else {
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt unset stop sound : uid(%d)", uid);
}
- dbus_message_append_args( msg,
+ dbus_message_append_args(msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_INVALID);
DBUS_TYPE_INT32, &result,
DBUS_TYPE_INVALID);
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
result = STT_ERROR_OPERATION_FAILED;
}
dbus_message_unref(result_msg);
STT_SERVER_SERVICE_INTERFACE,
STT_METHOD_START);
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTC, ">>>> stt start : Fail to make message");
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt start : Fail to make message");
return STT_ERROR_OPERATION_FAILED;
} else {
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt start : uid(%d), language(%s), type(%s)", uid, lang, type);
}
- dbus_message_append_args( msg,
+ dbus_message_append_args(msg,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_STRING, &lang,
DBUS_TYPE_STRING, &type,
DBUS_TYPE_INT32, &result,
DBUS_TYPE_INVALID);
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
result = STT_ERROR_OPERATION_FAILED;
}
dbus_message_unref(result_msg);
STT_SERVER_SERVICE_INTERFACE,
STT_METHOD_STOP);
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTC, ">>>> stt stop : Fail to make message");
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt stop : Fail to make message");
return STT_ERROR_OPERATION_FAILED;
} else {
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt stop : uid(%d)", uid);
DBUS_TYPE_INT32, &result,
DBUS_TYPE_INVALID);
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
result = STT_ERROR_OPERATION_FAILED;
}
dbus_message_unref(result_msg);
STT_SERVER_SERVICE_INTERFACE, /* interface name of the signal */
STT_METHOD_CANCEL); /* name of the signal */
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTC, ">>>> stt cancel : Fail to make message");
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt cancel : Fail to make message");
return STT_ERROR_OPERATION_FAILED;
} else {
SECURE_SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt cancel : uid(%d)", uid);
DBUS_TYPE_INT32, &result,
DBUS_TYPE_INVALID);
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
result = STT_ERROR_OPERATION_FAILED;
}
dbus_message_unref(result_msg);
/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
bool use_network;
bool is_loaded;
-}sttengine_info_s;
+} sttengine_info_s;
static GSList* g_engine_list;
static const char* __stt_file_get_error_code(stt_file_error_e err)
{
- switch(err) {
+ switch (err) {
case STT_FILE_ERROR_NONE: return "STT_FILE_ERROR_NONE";
case STT_FILE_ERROR_OUT_OF_MEMORY: return "STT_FILE_ERROR_OUT_OF_MEMORY";
case STT_FILE_ERROR_IO_ERROR: return "STT_FILE_ERROR_IO_ERROR";
void __stt_file_engine_info_cb(const char* engine_uuid, const char* engine_name, const char* setting_ug_name,
bool use_network, void* user_data)
{
- sttengine_info_s* temp = (sttengine_info_s*)user_data;
+ sttengine_info_s* temp = (sttengine_info_s*)user_data;
temp->engine_uuid = g_strdup(engine_uuid);
temp->engine_name = g_strdup(engine_name);
static int __stt_file_get_engine_info(const char* filepath, sttengine_info_s** info)
{
if (NULL == filepath || NULL == info) {
- SLOG(LOG_ERROR, TAG_STTFC, "[Engine Agent ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTFC, "[Engine Agent ERROR] Invalid Parameter");
return STT_FILE_ERROR_INVALID_PARAMETER;
}
char *error;
void* handle;
- handle = dlopen (filepath, RTLD_LAZY);
+ handle = dlopen(filepath, RTLD_LAZY);
if (!handle) {
SECURE_SLOG(LOG_WARN, TAG_STTFC, "[Engine Agent] Invalid engine : %s", filepath);
/* link engine to daemon */
dlsym(handle, "sttp_load_engine");
if ((error = dlerror()) != NULL) {
- SLOG(LOG_WARN, TAG_STTFC, "[Engine Agent] Invalid engine. Fail to open sttp_load_engine : %s", error);
+ SLOG(LOG_WARN, TAG_STTFC, "[Engine Agent] Invalid engine. Fail to open sttp_load_engine : %s", error);
dlclose(handle);
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);
+ SLOG(LOG_WARN, TAG_STTFC, "[Engine Agent] Invalid engine. Fail to open sttp_unload_engine : %s", error);
dlclose(handle);
return STT_FILE_ERROR_ENGINE_NOT_FOUND;
}
get_engine_info = (int (*)(sttpe_engine_info_cb, void*))dlsym(handle, "sttp_get_engine_info");
if ((error = dlerror()) != NULL || NULL == get_engine_info) {
- SLOG(LOG_WARN, TAG_STTFC, "[Engine Agent WARNING] Invalid engine. Fail to open sttp_get_engine_info : %s", error);
+ SLOG(LOG_WARN, TAG_STTFC, "[Engine Agent WARNING] Invalid engine. Fail to open sttp_get_engine_info : %s", error);
dlclose(handle);
return -1;
}
/* 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");
+ SLOG(LOG_ERROR, TAG_STTFC, "[Engine Agent ERROR] Fail to get engine info from engine");
dlclose(handle);
free(temp);
return STT_FILE_ERROR_ENGINE_NOT_FOUND;
SECURE_SLOG(LOG_DEBUG, TAG_STTFC, "Engine name : %s", temp->engine_name);
SECURE_SLOG(LOG_DEBUG, TAG_STTFC, "Engine path : %s", temp->engine_path);
SECURE_SLOG(LOG_DEBUG, TAG_STTFC, "Engine setting path : %s", temp->engine_setting_path);
- SECURE_SLOG(LOG_DEBUG, TAG_STTFC, "Use network : %s", temp->use_network ? "true":"false");
+ SECURE_SLOG(LOG_DEBUG, TAG_STTFC, "Use network : %s", temp->use_network ? "true" : "false");
SLOG(LOG_DEBUG, TAG_STTFC, "-----");
SLOG(LOG_DEBUG, TAG_STTFC, " ");
if (0 == strcmp(engine->engine_path, filepath)) {
return true;
}
-
+
iter = g_slist_next(iter);
}
}
/* Get handle data from list */
engine = iter->data;
g_engine_list = g_slist_remove_link(g_engine_list, iter);
-
+
/* Check engine unload */
if (NULL != engine) {
if (engine->is_loaded) {
SECURE_SLOG(LOG_DEBUG, TAG_STTFC, "[Engine Agent] Unload engine id(%d)", engine->engine_id);
- if (0 != stt_engine_deinitialize(engine->engine_id))
+ if (0 != stt_engine_deinitialize(engine->engine_id))
SECURE_SLOG(LOG_WARN, TAG_STTFC, "[Engine Agent] Fail to deinitialize engine id(%d)", engine->engine_id);
if (0 != stt_engine_unload(engine->engine_id))
data = iter->data;
- if (data->engine_id == engine_id)
+ if (data->engine_id == engine_id)
return data;
iter = g_slist_next(iter);
void __stt_file_result_cb(sttp_result_event_e event, const char* type, const char** data, int data_count,
const char* msg, void* time_info, void *user_data)
{
-
+
SLOG(LOG_DEBUG, TAG_STTFC, "[STT FILE] Result event(%d) type(%s) msg(%s)", event, type, msg);
if (NULL != data) {
int i = 0;
- for (i = 0;i < data_count;i++) {
+ for (i = 0; i < data_count; i++) {
if (NULL != data[i]) {
SLOG(LOG_DEBUG, TAG_STTFC, "[STT FILE] [%d] %s", i, data[i]);
}
if (STTP_RESULT_EVENT_FINAL_RESULT == event || STTP_RESULT_EVENT_ERROR == event) {
SLOG(LOG_DEBUG, TAG_STTFC, "[STT FILE] State change : 'Ready'");
-
+
client->before_state = client->current_state;
client->current_state = STT_FILE_STATE_READY;
if (NULL != client->state_changed_cb) {
stt_file_client_use_callback(client);
- client->state_changed_cb(client->before_state, client->current_state, client->state_changed_user_data);
+ client->state_changed_cb(client->before_state, client->current_state, client->state_changed_user_data);
stt_file_client_not_use_callback(client);
SLOG(LOG_DEBUG, TAG_STTFC, "State changed callback is called");
} else {
closedir(dp);
} else {
- SLOG(LOG_WARN, TAG_STTFC, "[Engine Agent WARNING] Fail to open default directory");
+ SLOG(LOG_WARN, TAG_STTFC, "[Engine Agent WARNING] Fail to open default directory");
}
if (0 >= g_slist_length(g_engine_list)) {
__stt_file_relseae_engine_info();
return STT_FILE_ERROR_OPERATION_FAILED;
}
-
+
SLOG(LOG_DEBUG, TAG_STTFC, "[STT FILE] Get engine id : %s", engine_id);
bool is_found = false;
int stt_file_deinitialize()
{
SLOG(LOG_DEBUG, TAG_STTFC, "===== Deinitialize STT FILE");
-
+
stt_file_client_s* client = stt_file_client_get();
if (NULL == client) {
SLOG(LOG_ERROR, TAG_STTFC, "[STT FILE ERROR] Not initialized");
*state = client->current_state;
- switch(*state) {
+ switch (*state) {
case STT_FILE_STATE_NONE: SLOG(LOG_DEBUG, TAG_STTFC, "Current state is 'NONE'"); break;
case STT_FILE_STATE_READY: SLOG(LOG_DEBUG, TAG_STTFC, "Current state is 'Ready'"); break;
case STT_FILE_STATE_PROCESSING: SLOG(LOG_DEBUG, TAG_STTFC, "Current state is 'Processing'"); break;
SLOG(LOG_DEBUG, TAG_STTFC, "=====");
SLOG(LOG_DEBUG, TAG_STTFC, " ");
-
+
return STT_FILE_ERROR_NONE;
}
}
int stt_file_set_engine(const char* engine_id)
-{
+{
SLOG(LOG_DEBUG, TAG_STTFC, "===== Set current engine");
if (NULL == engine_id) {
break;
}
-
+
iter = g_slist_next(iter);
engine = NULL;
}
-
+
if (NULL == engine) {
SLOG(LOG_ERROR, TAG_STTFC, "[Engine Agent ERROR] Engine id is NOT valid");
return STT_FILE_ERROR_INVALID_PARAMETER;
}
}
- SLOG(LOG_DEBUG, TAG_STTFC, "[START Info] Engine(%d) Lang(%s) Type(%s) Filepath(%s) Audio(%d) Sample rate(%d)"
- ,client->current_engine_id, language, type, filepath, audio_type, sample_rate);
+ SLOG(LOG_DEBUG, TAG_STTFC, "[START Info] Engine(%d) Lang(%s) Type(%s) Filepath(%s) Audio(%d) Sample rate(%d)",
+ , client->current_engine_id, language, type, filepath, audio_type, sample_rate);
int ret = -1;
ret = stt_engine_recognize_start_file(client->current_engine_id, language, type, filepath, audio_type, sample_rate, NULL);
if (NULL != client->state_changed_cb) {
stt_file_client_use_callback(client);
- client->state_changed_cb(client->before_state, client->current_state, client->state_changed_user_data);
+ client->state_changed_cb(client->before_state, client->current_state, client->state_changed_user_data);
stt_file_client_not_use_callback(client);
SLOG(LOG_DEBUG, TAG_STTFC, "State changed callback is called");
} else {
SLOG(LOG_DEBUG, TAG_STTFC, "=====");
SLOG(LOG_DEBUG, TAG_STTFC, " ");
return STT_FILE_ERROR_INVALID_PARAMETER;
- }
+ }
/* check state */
if (STT_FILE_STATE_PROCESSING != client->current_state) {
if (NULL != client->state_changed_cb) {
stt_file_client_use_callback(client);
- client->state_changed_cb(client->before_state, client->current_state, client->state_changed_user_data);
+ client->state_changed_cb(client->before_state, client->current_state, client->state_changed_user_data);
stt_file_client_not_use_callback(client);
SLOG(LOG_DEBUG, TAG_STTFC, "State changed callback is called");
} else {
return STT_FILE_ERROR_NONE;
}
-bool __stt_file_result_time_cb(int index, sttp_result_time_event_e event, const char* text, long start_time, long end_time, void* user_data)
+bool __stt_file_result_time_cb(int index, sttp_result_time_event_e event, const char* text, long start_time, long end_time, void* user_data)
{
SLOG(LOG_DEBUG, TAG_STTFC, "(%d) event(%d) text(%s) start(%ld) end(%ld)",
- index, event, text, start_time, end_time);
+ index, event, text, start_time, end_time);
stt_file_client_s* client = stt_file_client_get();
/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
return STT_SETTING_ERROR_NONE;
}
-int stt_setting_finalize ()
+int stt_setting_finalize()
{
SLOG(LOG_DEBUG, TAG_STTC, "===== Finalize STT Setting");
-
+
stt_config_mgr_finalize(getpid());
g_state = STT_SETTING_STATE_NONE;
SLOG(LOG_DEBUG, TAG_STTC, "=====");
SLOG(LOG_DEBUG, TAG_STTC, " ");
-
+
return ret;
}
if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get current engine : %d", ret);
return -1;
- }
+ }
ret = stt_config_mgr_get_language_list(current_engine, (stt_config_supported_langauge_cb)callback, user_data);
} else {
SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Foreach supported languages");
}
-
+
SLOG(LOG_DEBUG, TAG_STTC, "=====");
SLOG(LOG_DEBUG, TAG_STTC, " ");
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Result : %d", ret);
} else {
/* Copy value */
- SECURE_SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Get auto language (%s)", *value ? "true":"false");
+ SECURE_SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Get auto language (%s)", *value ? "true" : "false");
}
SLOG(LOG_DEBUG, TAG_STTC, "=====");
int ret = stt_config_mgr_get_silence_detection(value);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Result (%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Result (%d)", ret);
} else {
- SECURE_SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Get silence detection(%s)", *value ? "true":"false");
+ SECURE_SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Get silence detection(%s)", *value ? "true" : "false");
}
SLOG(LOG_DEBUG, TAG_STTC, "=====");
int ret = stt_config_mgr_set_silence_detection(value);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Result (%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Result (%d)", ret);
} else {
- SECURE_SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Set silence detection(%s)", value ? "true":"false");
+ SECURE_SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Set silence detection(%s)", value ? "true" : "false");
}
SLOG(LOG_DEBUG, TAG_STTC, "=====");
/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
stt_config_lang_changed_cb lang_cb;
stt_config_bool_changed_cb bool_cb;
void* user_data;
-}stt_config_client_s;
+} stt_config_client_s;
extern const char* stt_tag();
/* Get a first item */
iter_lang = g_slist_nth(engine_info->languages, 0);
- int i = 1;
+ int i = 1;
while (NULL != iter_lang) {
/*Get handle data from list*/
engine_lang = iter_lang->data;
iter = g_slist_next(iter);
continue;
}
-
+
GSList *iter_lang = NULL;
char* engine_lang = NULL;
if (g_slist_length(engine_info->languages) > 0) {
/* Get a first item */
iter_lang = g_slist_nth(engine_info->languages, 0);
-
+
while (NULL != iter_lang) {
engine_lang = iter_lang->data;
if (NULL != engine_lang) {
SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty Inotify event");
SLOG(LOG_DEBUG, stt_tag(), "=====");
SLOG(LOG_DEBUG, stt_tag(), " ");
- return ECORE_CALLBACK_PASS_ON;
+ return ECORE_CALLBACK_PASS_ON;
}
if (IN_MODIFY == event.mask) {
wd = inotify_add_watch(fd, STT_CONFIG, IN_MODIFY);
g_wd_noti = wd;
- g_fd_handler_noti = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)stt_config_mgr_inotify_event_cb, NULL, NULL, NULL);
+ g_fd_handler_noti = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)stt_config_mgr_inotify_event_cb, NULL, NULL, NULL);
if (NULL == g_fd_handler_noti) {
SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to get handler_noti");
return -1;
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,
+ 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;
closedir(dp);
} else {
- SLOG(LOG_WARN, stt_tag(), "[Config WARNING] Fail to open default directory");
+ SLOG(LOG_WARN, stt_tag(), "[Config WARNING] Fail to open default directory");
}
__stt_config_mgr_print_engine_info();
SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to parse configure information");
__stt_config_release_client(uid);
__stt_config_release_engine();
- return STT_CONFIG_ERROR_OPERATION_FAILED;
+ return STT_CONFIG_ERROR_OPERATION_FAILED;
}
/* Check whether engine id is valid */
}
int stt_config_mgr_unset_callback(int uid)
-{
+{
GSList *iter = NULL;
stt_config_client_s* temp_client = NULL;
engine_info->setting, engine_info->support_silence_detection, user_data)) {
break;
}
-
+
iter = g_slist_next(iter);
}
SECURE_SLOG(LOG_DEBUG, stt_tag(), " language : %s", g_config_info->language);
SECURE_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,
+ 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;
SLOG(LOG_ERROR, stt_tag(), "Not initialized");
return STT_CONFIG_ERROR_INVALID_STATE;
}
-
+
if (0 >= g_slist_length(g_engine_list)) {
SLOG(LOG_ERROR, stt_tag(), "There is no engine");
return STT_CONFIG_ERROR_ENGINE_NOT_FOUND;
GSList *iter_lang = NULL;
char* lang;
-
+
/* Get a first item */
iter_lang = g_slist_nth(engine_info->languages, 0);
if (false == callback(engine_info->uuid, lang, user_data))
break;
}
-
+
/*Get next item*/
iter_lang = g_slist_next(iter_lang);
}
return false;
}
- if (0 >= g_slist_length(g_engine_list))
+ if (0 >= g_slist_length(g_engine_list))
return false;
GSList *iter = NULL;
return false;
}
- if (0 >= g_slist_length(g_engine_list))
+ if (0 >= g_slist_length(g_engine_list))
return false;
GSList *iter = NULL;
iter = g_slist_next(iter);
continue;
}
-
+
if (0 != strcmp(g_config_info->engine_id, engine_info->uuid)) {
iter = g_slist_next(iter);
continue;
while (NULL != iter_lang) {
lang = iter_lang->data;
-
+
if (0 == strcmp(language, lang))
return true;
SLOG(LOG_DEBUG, stt_tag(), "--------------- engine list -----------------");
- int i = 1;
+ int i = 1;
while (NULL != iter) {
engine_info = iter->data;
/* Get a first item */
iter_lang = g_slist_nth(engine_info->languages, 0);
- int j = 1;
+ int j = 1;
while (NULL != iter_lang) {
/*Get handle data from list*/
lang = iter_lang->data;
/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_ENGINE_NAME)) {
key = xmlNodeGetContent(cur);
if (NULL != key) {
- // SLOG(LOG_DEBUG, stt_tag(), "Engine name : %s", (char *)key);
+ /* SLOG(LOG_DEBUG, stt_tag(), "Engine name : %s", (char *)key); */
if (NULL != temp->name) free(temp->name);
temp->name = strdup((char*)key);
xmlFree(key);
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_ENGINE_ID)) {
key = xmlNodeGetContent(cur);
if (NULL != key) {
- // SLOG(LOG_DEBUG, stt_tag(), "Engine uuid : %s", (char *)key);
+ /* SLOG(LOG_DEBUG, stt_tag(), "Engine uuid : %s", (char *)key); */
if (NULL != temp->uuid) free(temp->uuid);
temp->uuid = strdup((char*)key);
xmlFree(key);
lang_node = cur->xmlChildrenNode;
while (lang_node != NULL) {
- if (0 == xmlStrcmp(lang_node->name, (const xmlChar *)STT_TAG_ENGINE_LANGUAGE)){
+ if (0 == xmlStrcmp(lang_node->name, (const xmlChar *)STT_TAG_ENGINE_LANGUAGE)) {
key = xmlNodeGetContent(lang_node);
if (NULL != key) {
- // SLOG(LOG_DEBUG, stt_tag(), "language : %s", (char *)key);
+ /* SLOG(LOG_DEBUG, stt_tag(), "language : %s", (char *)key); */
temp_lang = strdup((char*)key);
temp->languages = g_slist_append(temp->languages, temp_lang);
xmlFree(key);
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_ENGINE_SILENCE_SUPPORT)) {
key = xmlNodeGetContent(cur);
if (NULL != key) {
- //SLOG(LOG_DEBUG, stt_tag(), "silence-detection-support : %s", (char *)key);
+ /*SLOG(LOG_DEBUG, stt_tag(), "silence-detection-support : %s", (char *)key); */
if (0 == xmlStrcmp(key, (const xmlChar *)"true"))
temp->support_silence_detection = true;
else
temp->support_silence_detection = false;
-
+
xmlFree(key);
} else {
SECURE_SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_SILENCE_SUPPORT);
int i ;
char *temp_lang;
- for (i = 0;i < count ;i++) {
+ for (i = 0; i < count ; i++) {
temp_lang = g_slist_nth_data(engine_info->languages, 0);
if (NULL != temp_lang) {
if (NULL != temp_lang)
free(temp_lang);
- }
+ }
}
if (NULL != engine_info) free(engine_info);
- return 0;
+ return 0;
}
int stt_parser_print_engine_info(stt_engine_info_s* engine_info)
/* Get a first item */
iter = g_slist_nth(engine_info->languages, 0);
- int i = 1;
+ int i = 1;
while (NULL != iter) {
/*Get handle data from list*/
lang = iter->data;
if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_ENGINE_ID)) {
key = xmlNodeGetContent(cur);
if (NULL != key) {
- //SLOG(LOG_DEBUG, stt_tag(), "Engine id : %s", (char *)key);
+ /*SLOG(LOG_DEBUG, stt_tag(), "Engine id : %s", (char *)key); */
if (NULL != temp->engine_id) free(temp->engine_id);
temp->engine_id = strdup((char*)key);
xmlFree(key);
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_ENGINE_SETTING)) {
key = xmlNodeGetContent(cur);
if (NULL != key) {
- //SECURE_SLOG(LOG_DEBUG, stt_tag(), "Setting path : %s", (char *)key);
+ /*SECURE_SLOG(LOG_DEBUG, stt_tag(), "Setting path : %s", (char *)key); */
if (NULL != temp->setting) free(temp->setting);
temp->setting = strdup((char*)key);
xmlFree(key);
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_AUTO_LANGUAGE)) {
key = xmlNodeGetContent(cur);
if (NULL != key) {
- //SECURE_SLOG(LOG_DEBUG, stt_tag(), "Auto language : %s", (char *)key);
+ /*SECURE_SLOG(LOG_DEBUG, stt_tag(), "Auto language : %s", (char *)key); */
if (0 == xmlStrcmp(key, (const xmlChar *)"on")) {
temp->auto_lang = true;
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_LANGUAGE)) {
key = xmlNodeGetContent(cur);
if (NULL != key) {
- //SLOG(LOG_DEBUG, stt_tag(), "language : %s", (char *)key);
+ /*SLOG(LOG_DEBUG, stt_tag(), "language : %s", (char *)key); */
if (NULL != temp->language) free(temp->language);
temp->language = strdup((char*)key);
xmlFree(key);
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_SILENCE_DETECTION)) {
key = xmlNodeGetContent(cur);
if (NULL != key) {
- //SLOG(LOG_DEBUG, stt_tag(), "silence-detection : %s", (char *)key);
+ /*SLOG(LOG_DEBUG, stt_tag(), "silence-detection : %s", (char *)key); */
if (0 == xmlStrcmp(key, (const xmlChar *)"on"))
temp->silence_detection = true;
if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_SILENCE_DETECTION)) {
if (true == silence)
xmlNodeSetContent(cur, (const xmlChar *)"on");
- else
+ else
xmlNodeSetContent(cur, (const xmlChar *)"off");
}
while (cur != NULL) {
if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_LANGUAGE)) {
xmlNodeSetContent(cur, (const xmlChar *)language);
- }
+ }
cur = cur->next;
}
if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_SILENCE_DETECTION)) {
if (true == value)
xmlNodeSetContent(cur, (const xmlChar *)"on");
- else
+ else
xmlNodeSetContent(cur, (const xmlChar *)"off");
- }
+ }
cur = cur->next;
}
*silence = 0;
}
}
-
+
xmlFree(key_new);
}
xmlFree(key_old);
cur_new = cur_new->next;
cur_old = cur_old->next;
}
-
+
xmlFreeDoc(g_config_doc);
g_config_doc = doc;
iter = g_slist_nth(time_list, 0);
while (NULL != iter) {
data = iter->data;
-
+
xmlNodePtr temp_node = NULL;
- SLOG(LOG_DEBUG, stt_tag(), "[%d] i(%d) t(%s) s(%d) e(%d)",
- data->index, data->event, data->text, data->start_time, data->end_time);
-
+ SLOG(LOG_DEBUG, stt_tag(), "[%d] i(%d) t(%s) s(%d) e(%d)",
+ data->index, data->event, data->text, data->start_time, data->end_time);
+
temp_node = xmlNewNode(NULL, (const xmlChar*)STT_TAG_TIME_TEXT);
xmlNodeSetContent(temp_node, (const xmlChar*)data->text);
xmlAddChild(inode, temp_node);
-
+
temp_node = xmlNewNode(NULL, (const xmlChar*)STT_TAG_TIME_START);
snprintf(temp_str, 256, "%ld", data->start_time);
xmlNodeSetContent(temp_node, (const xmlChar*)temp_str);
SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_TIME_COUNT);
return -1;
}
-
+
SLOG(LOG_DEBUG, stt_tag(), "Count : %s", (char *)key);
/* Get time count */
time_node = cur->xmlChildrenNode;
int i = 0;
- for (i = 0;i < count;i++) {
+ for (i = 0; i < count; i++) {
/* text */
time_node = time_node->next;
break;
}
}
-
+
/* text */
time_node = time_node->next;
time_node = time_node->next;
/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
int (*sttp_load_engine)(sttpd_funcs_s* pdfuncs, sttpe_funcs_s* pefuncs);
int (*sttp_unload_engine)();
-}sttengine_s;
+} sttengine_s;
extern const char* stt_tag();
static const char* __stt_get_engine_error_code(sttp_error_e err)
{
- switch(err) {
+ switch (err) {
case STTP_ERROR_NONE: return "STTP_ERROR_NONE";
case STTP_ERROR_OUT_OF_MEMORY: return "STTP_ERROR_OUT_OF_MEMORY";
case STTP_ERROR_IO_ERROR: return "STTP_ERROR_IO_ERROR";
int stt_engine_load(int engine_id, const char* filepath)
{
if (NULL == filepath || engine_id < 0) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
return STTP_ERROR_INVALID_PARAMETER;
}
return STTP_ERROR_OPERATION_FAILED;
}
- engine->sttp_load_engine = (int (*)(sttpd_funcs_s*, sttpe_funcs_s*) )dlsym(engine->handle, "sttp_load_engine");
+ engine->sttp_load_engine = (int (*)(sttpd_funcs_s*, sttpe_funcs_s*))dlsym(engine->handle, "sttp_load_engine");
if (NULL != (error = dlerror()) || NULL == engine->sttp_load_engine) {
SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to link daemon to sttp_load_engine() : %s", error);
dlclose(engine->handle);
engine->pdfuncs->version = 1;
engine->pdfuncs->size = sizeof(sttpd_funcs_s);
-
- int ret = engine->sttp_load_engine(engine->pdfuncs, engine->pefuncs);
+
+ int ret = engine->sttp_load_engine(engine->pdfuncs, engine->pefuncs);
if (0 != ret) {
SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail sttp_load_engine() : %s", __stt_get_engine_error_code(ret));
dlclose(engine->handle);
free(engine->engine_path);
free(engine);
- return STTP_ERROR_OPERATION_FAILED;
+ return STTP_ERROR_OPERATION_FAILED;
}
- SECURE_SLOG(LOG_DEBUG, stt_tag(), "[Engine Success] Load engine : version(%d), size(%d)",engine->pefuncs->version, engine->pefuncs->size);
+ SECURE_SLOG(LOG_DEBUG, stt_tag(), "[Engine Success] Load engine : version(%d), size(%d)", engine->pefuncs->version, engine->pefuncs->size);
g_engine_list = g_slist_append(g_engine_list, engine);
/* unload engine */
engine->sttp_unload_engine();
dlclose(engine->handle);
-
+
if (NULL != engine->engine_path) free(engine->engine_path);
if (NULL != engine->pefuncs) free(engine->pefuncs);
if (NULL != engine->pdfuncs) free(engine->pdfuncs);
g_engine_list = g_slist_remove(g_engine_list, engine);
free(engine);
-
+
return 0;
}
int stt_engine_initialize(int engine_id, sttpe_result_cb result_cb, sttpe_silence_detected_cb silence_cb)
{
if (NULL == result_cb || NULL == silence_cb) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
return STTP_ERROR_INVALID_PARAMETER;
}
int stt_engine_get_supported_langs(int engine_id, GSList** lang_list)
{
if (NULL == lang_list) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
return STTP_ERROR_INVALID_PARAMETER;
}
int stt_engine_is_valid_language(int engine_id, const char* language, bool *is_valid)
{
if (NULL == language || NULL == is_valid) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
return STTP_ERROR_INVALID_PARAMETER;
}
SECURE_SLOG(LOG_WARN, stt_tag(), "[Engine WARNING] engine id(%d) is invalid", engine_id);
return STTP_ERROR_INVALID_PARAMETER;
}
-
+
bool result;
result = engine->pefuncs->is_valid_lang(language);
int stt_engine_get_first_language(int engine_id, char** language)
{
if (NULL == language) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
return STTP_ERROR_INVALID_PARAMETER;
}
int stt_engine_support_silence(int engine_id, bool* support)
{
if (NULL == support) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
return STTP_ERROR_INVALID_PARAMETER;
}
int stt_engine_support_recognition_type(int engine_id, const char* type, bool* support)
{
if (NULL == type || NULL == support) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
return STTP_ERROR_INVALID_PARAMETER;
}
int stt_engine_get_audio_type(int engine_id, sttp_audio_type_e* types, int* rate, int* channels)
{
if (NULL == types || NULL == rate || NULL == channels) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
return STTP_ERROR_INVALID_PARAMETER;
}
int ret = engine->pefuncs->set_silence_detection(value);
if (STTP_ERROR_NOT_SUPPORTED_FEATURE == ret) {
- SLOG(LOG_WARN, stt_tag(), "[Engine WARNING] Not support silence detection");
+ SLOG(LOG_WARN, stt_tag(), "[Engine WARNING] Not support silence detection");
return STTP_ERROR_NOT_SUPPORTED_FEATURE;
} else if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to set silence detection : %d", ret);
+ SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to set silence detection : %d", ret);
return STTP_ERROR_OPERATION_FAILED;
}
-
+
return 0;
}
*value = false;
return STTP_ERROR_OPERATION_FAILED;
}
-
+
return 0;
}
int stt_engine_recognize_start(int engine_id, const char* lang, const char* recognition_type, void* user_param)
{
if (NULL == lang || NULL == recognition_type) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
return STTP_ERROR_INVALID_PARAMETER;
}
int stt_engine_set_recording_data(int engine_id, const void* data, unsigned int length)
{
if (NULL == data) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
return STTP_ERROR_INVALID_PARAMETER;
}
SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to foreach result time : %s", __stt_get_engine_error_code(ret));
return STTP_ERROR_OPERATION_FAILED;
}
-
+
return 0;
}
const char* filepath, sttp_audio_type_e audio_type, int sample_rate, void* user_param)
{
if (NULL == filepath || NULL == lang || NULL == recognition_type) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
return STTP_ERROR_INVALID_PARAMETER;
}
/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
int network_status = 0;
vconf_get_int(VCONFKEY_NETWORK_STATUS, &network_status);
- if(network_status == VCONFKEY_NETWORK_OFF){
+ if (network_status == VCONFKEY_NETWORK_OFF) {
SLOG(LOG_WARN, stt_tag(), "[Network] Current network connection is OFF.");
return false;
}
-
+
SLOG(LOG_DEBUG, stt_tag(), "[Network] Network status is %d", network_status);
return true;
/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
/* Get a first item */
iter = g_slist_nth(g_client_list, 0);
- int i = 1;
+ int i = 1;
while (NULL != iter) {
/*Get handle data from list*/
data = iter->data;
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[%dth] uid(%d), state(%d)", i, data->uid, data->state);
-
+
/*Get next item*/
iter = g_slist_next(iter);
i++;
/* Get handle data from list */
data = iter->data;
- if (uid == data->uid)
+ if (uid == data->uid)
return iter;
-
+
iter = g_slist_next(iter);
}
}
/*Check uid is duplicated*/
GSList *tmp = NULL;
tmp = __client_get_item(uid);
-
+
if (NULL != tmp) {
SLOG(LOG_WARN, TAG_STTD, "[Client Data] Client uid is already registered");
return STTD_ERROR_INVALID_PARAMETER;
/* Add item to global list */
g_client_list = g_slist_append(g_client_list, info);
-
+
if (NULL == g_client_list) {
SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] Fail to add new client");
return -1;
#ifdef CLIENT_DATA_DEBUG
client_show_list();
-#endif
+#endif
return 0;
}
#ifdef CLIENT_DATA_DEBUG
client_show_list();
-#endif
+#endif
return 0;
}
if (NULL != hnd->start_beep) {
free(hnd->start_beep);
}
-
+
if (NULL != filename) {
hnd->start_beep = strdup(filename);
SLOG(LOG_DEBUG, TAG_STTD, "[Client Data] Start sound file : %s", hnd->start_beep);
if (NULL != hnd->stop_beep) {
free(hnd->stop_beep);
}
-
+
if (NULL != filename) {
hnd->stop_beep = strdup(filename);
SLOG(LOG_DEBUG, TAG_STTD, "[Client Data] Stop sound file : %s", hnd->stop_beep);
/* Get handle data from list */
data = iter->data;
- if (APP_STATE_RECORDING == data->state)
+ if (APP_STATE_RECORDING == data->state)
return data->uid;
iter = g_slist_next(iter);
/* Get handle data from list */
data = iter->data;
- if (APP_STATE_PROCESSING == data->state)
+ if (APP_STATE_PROCESSING == data->state)
return data->uid;
iter = g_slist_next(iter);
{
if (NULL == uids || NULL == uid_count)
return -1;
-
+
int count = g_slist_length(g_client_list);
if (0 == count)
int i = 0;
iter = g_slist_nth(g_client_list, 0);
- for (i = 0;i < count;i++) {
+ for (i = 0; i < count; i++) {
data = iter->data;
tmp[i] = data->uid;
iter = g_slist_next(iter);
tmp = __client_get_item(uid);
if (NULL == tmp) {
- SECURE_SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] uid(%d) is NOT valid", uid);
+ SECURE_SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] uid(%d) is NOT valid", uid);
return STTD_ERROR_INVALID_PARAMETER;
}
tmp = __client_get_item(uid);
if (NULL == tmp) {
- SECURE_SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] uid(%d) is NOT valid", uid);
+ SECURE_SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] uid(%d) is NOT valid", uid);
return STTD_ERROR_INVALID_PARAMETER;
}
/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
SECURE_SLOG(LOG_DEBUG, TAG_STTD, " type(%d) bool(%s)", type, bool_value ? "on" : "off");
if (STT_CONFIG_TYPE_OPTION_SILENCE_DETECTION == type) {
- if (NULL != g_silence_cb){
+ if (NULL != g_silence_cb) {
g_silence_cb(bool_value, g_user_data);
SLOG(LOG_DEBUG, TAG_STTD, "Call back silence detection changed");
}
/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
if (NULL != result_msg) {
dbus_message_get_args(result_msg, &err, DBUS_TYPE_INT32, &result, DBUS_TYPE_INVALID);
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[Dbus] Get arguments error (%s)\n", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
result = -1;
}
if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to send message : Out Of Memory !");
- }
- else {
+ } else {
SLOG(LOG_DEBUG, TAG_STTD, "<<<< Send error message : uid(%d), state(%d)", uid, state);
dbus_connection_flush(g_conn_sender);
}
target_if_name,
STTD_METHOD_GET_STATE);
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to create message");
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to create message");
return -1;
}
if (NULL != result_msg) {
dbus_message_get_args(result_msg, &err, DBUS_TYPE_INT32, &tmp, DBUS_TYPE_INVALID);
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[Dbus] Get arguments error (%s)\n", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
result = -1;
} else {
*state = tmp;
SLOG(LOG_ERROR, TAG_STTD, "[Dbus] Result message is NULL. Client is not available");
result = -1;
}
-
+
return result;
}
{
int pid = sttd_client_get_pid(uid);
if (0 > pid) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] pid is NOT valid" );
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] pid is NOT valid");
return STTD_ERROR_INVALID_PARAMETER;
}
if (NULL == result_msg) {
msg_temp = strdup("None");
dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &msg_temp);
- SLOG(LOG_WARN, TAG_STTD, "[Dbus] result message is NULL");
+ SLOG(LOG_WARN, TAG_STTD, "[Dbus] result message is NULL");
free(msg_temp);
} else {
- SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] result message(%s)", result_msg );
+ SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] result message(%s)", result_msg);
dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &(result_msg));
}
-
+
/* Append result size */
if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(data_count))) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus] response message : Fail to append result size");
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus] response message : Fail to append result size");
return -1;
}
int i;
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] result size (%d)", data_count);
- for (i = 0;i < data_count;i++) {
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] result size (%d)", data_count);
+ for (i = 0; i < data_count; i++) {
if (NULL != data[i]) {
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] result (%d, %s)", i, data[i] );
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] result (%d, %s)", i, data[i]);
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");
int reason = (int)STTD_ERROR_OPERATION_FAILED;
if (0 != sttdc_send_error_signal(uid, reason, "Fail to get recognition result from engine")) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to send error info. Remove client data");
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to send error info. Remove client data");
/* clean client data */
sttd_client_delete(uid);
int sttdc_send_error_signal(int uid, int reason, const char *err_msg)
{
if (NULL == err_msg) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Input parameter is NULL");
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Input parameter is NULL");
return STTD_ERROR_INVALID_PARAMETER;
}
int pid = sttd_client_get_pid(uid);
if (0 > pid) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] pid is NOT valid" );
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] pid is NOT valid");
return STTD_ERROR_INVALID_PARAMETER;
}
}
/* loop again if we haven't read a message */
- if (NULL == msg) {
+ if (NULL == msg) {
return ECORE_CALLBACK_RENEW;
}
/* connect to the bus and check for errors */
g_conn_listener = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
- if (dbus_error_is_set(&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);
+ dbus_error_free(&err);
}
- if (NULL == g_conn_listener) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to get dbus connection" );
+ if (NULL == g_conn_listener) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to get dbus connection");
return STTD_ERROR_OPERATION_FAILED;
}
return STTD_ERROR_OPERATION_FAILED;
}
- if (dbus_error_is_set(&err)) {
+ 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 STTD_ERROR_OPERATION_FAILED;
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)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] dbus_bus_add_match() : %s", err.message);
return STTD_ERROR_OPERATION_FAILED;
}
/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
/*
* Dbus Client-Daemon Server
-*/
+*/
int sttd_dbus_server_hello(DBusConnection* conn, DBusMessage* msg)
{
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
}
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, ">>>>> STT Initialize");
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[IN ERROR] stt initialize : get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
ret = STTD_ERROR_OPERATION_FAILED;
} else {
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt initialize : pid(%d), uid(%d)", pid , uid);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt initialize : pid(%d), uid(%d)", pid , uid);
ret = sttd_server_initialize(pid, uid, &silence_supported);
}
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d), silence(%d)",
ret, silence_supported);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
}
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, ">>>>> STT Finalize");
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[IN ERROR] stt finalize : get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
ret = STTD_ERROR_OPERATION_FAILED;
} else {
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt finalize : uid(%d)", uid);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt finalize : uid(%d)", uid);
ret = sttd_server_finalize(uid);
}
DBusMessage* reply;
-
+
reply = dbus_message_new_method_return(msg);
if (NULL != reply) {
dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
+ SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
}
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, ">>>>> STT Get supported engines");
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[IN ERROR] stt supported engines : get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
ret = STTD_ERROR_OPERATION_FAILED;
} else {
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt supported engines : uid(%d)", uid);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt supported engines : uid(%d)", uid);
ret = sttd_server_get_supported_engines(uid, &engine_list);
}
dbus_message_iter_init_append(reply, &args);
/* Append result*/
- dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(ret) );
+ dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(ret));
if (0 == ret) {
/* Append size */
engine_list = g_slist_remove_link(engine_list, iter);
iter = g_slist_nth(engine_list, 0);
- }
+ }
}
- SLOG(LOG_DEBUG, TAG_STTD, "[OUT] Result(%d)", ret);
+ SLOG(LOG_DEBUG, TAG_STTD, "[OUT] Result(%d)", ret);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
}
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, ">>>>> STT Set current engine");
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[IN ERROR] stt set current engine : get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
ret = STTD_ERROR_OPERATION_FAILED;
} else {
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt set current engine : uid(%d)", uid);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt set current engine : uid(%d)", uid);
ret = sttd_server_set_current_engine(uid, engine_id, &silence_supported);
}
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d), silence(%d)",
ret, silence_supported);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d) ", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d) ", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
}
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, ">>>>> STT Get current engine");
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[IN ERROR] stt get current engine : get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
ret = STTD_ERROR_OPERATION_FAILED;
} else {
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt get current engine : uid(%d)", uid);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt get current engine : uid(%d)", uid);
ret = sttd_server_get_current_engine(uid, &engine);
}
if (NULL != reply) {
if (0 == ret) {
/* Append result and language */
- dbus_message_append_args( reply,
+ dbus_message_append_args(reply,
DBUS_TYPE_INT32, &ret,
DBUS_TYPE_STRING, &engine,
DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
+ SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
} else {
dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
}
if (NULL != engine) free(engine);
int ret = STTD_ERROR_OPERATION_FAILED;
bool available = false;
- dbus_message_get_args(msg, &err,
+ dbus_message_get_args(msg, &err,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_STRING, &appid,
DBUS_TYPE_INVALID);
SLOG(LOG_DEBUG, TAG_STTD, ">>>>> STT Is engine available");
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[IN ERROR] stt Is engine available : get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
ret = STTD_ERROR_OPERATION_FAILED;
} else {
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt Is engine available : uid(%d)", uid);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt Is engine available : uid(%d)", uid);
ret = sttd_server_check_agg_agreed(uid, appid, &available);
}
DBUS_TYPE_INVALID);
if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
+ SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
}
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, ">>>>> STT Get supported langs");
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[IN ERROR] stt supported langs : get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
ret = STTD_ERROR_OPERATION_FAILED;
} else {
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt supported langs : uid(%d)", uid);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt supported langs : uid(%d)", uid);
ret = sttd_server_get_supported_languages(uid, &lang_list);
}
int size = g_slist_length(lang_list);
if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(size))) {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to append type");
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to append type");
ret = STTD_ERROR_OPERATION_FAILED;
} else {
GSList *iter = NULL;
while (NULL != iter) {
temp_lang = iter->data;
- dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &(temp_lang) );
-
+ dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &(temp_lang));
+
if (NULL != temp_lang)
free(temp_lang);
-
+
lang_list = g_slist_remove_link(lang_list, iter);
iter = g_slist_nth(lang_list, 0);
- }
+ }
}
- SLOG(LOG_DEBUG, TAG_STTD, "[OUT] Result(%d)", ret);
+ SLOG(LOG_DEBUG, TAG_STTD, "[OUT] Result(%d)", ret);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
}
-
+
if (!dbus_connection_send(conn, reply, NULL)) {
SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Out Of Memory!");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
}
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, ">>>>> STT Get default langs");
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[IN ERROR] stt get default lang : get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
ret = STTD_ERROR_OPERATION_FAILED;
} else {
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt get default lang : uid(%d)", uid);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt get default lang : uid(%d)", uid);
ret = sttd_server_get_current_langauage(uid, &lang);
}
if (NULL != reply) {
if (0 == ret) {
/* Append result and language */
- dbus_message_append_args( reply,
+ dbus_message_append_args(reply,
DBUS_TYPE_INT32, &ret,
DBUS_TYPE_STRING, &lang,
DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
+ SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
} else {
dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
}
if (NULL != lang) free(lang);
DBUS_TYPE_INVALID);
if (0 == ret) {
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d), Support(%s)", ret, support ? "true" : "false");
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d), Support(%s)", ret, support ? "true" : "false");
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
}
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
DBUS_TYPE_INVALID);
if (0 == ret) {
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
}
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
DBUS_TYPE_INVALID);
if (0 == ret) {
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
}
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
DBUS_TYPE_INVALID);
if (0 == ret) {
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
}
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
DBUS_TYPE_INVALID);
if (0 == ret) {
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
}
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, ">>>>> STT Start");
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[IN ERROR] stt start : get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
ret = STTD_ERROR_OPERATION_FAILED;
} else {
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt start : uid(%d), lang(%s), type(%s), silence(%d) appid(%s)"
dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
if (0 <= ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
+ SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
}
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, ">>>>> STT Stop");
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[IN ERROR] stt stop : get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
ret = STTD_ERROR_OPERATION_FAILED;
} else {
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt stop : uid(%d)", uid);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt stop : uid(%d)", uid);
ret = sttd_server_stop(uid);
}
dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
if (0 <= ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
+ SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
}
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, ">>>>> STT Cancel");
- if (dbus_error_is_set(&err)) {
+ if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_STTD, "[IN ERROR] stt cancel : get arguments error (%s)", err.message);
- dbus_error_free(&err);
+ dbus_error_free(&err);
ret = STTD_ERROR_OPERATION_FAILED;
} else {
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt cancel : uid(%d)", uid);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt cancel : uid(%d)", uid);
ret = sttd_server_cancel(uid);
}
dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
+ SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
+ SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
}
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
bool use_network;
bool is_loaded;
-
+
/* engine base setting */
char* first_lang;
bool silence_detection;
bool use_network, void* user_data);
/*
-* Internal Interfaces
+* Internal Interfaces
*/
-
+
/** get engine info */
int __internal_get_engine_info(const char* filepath, sttengine_info_s** info);
{
/* initialize static data */
if (NULL == result_cb || NULL == time_cb || NULL == silence_cb) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine agent ERROR] Invalid parameter");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine agent ERROR] Invalid parameter");
return STTD_ERROR_INVALID_PARAMETER;
}
g_recording_engine_id = -1;
if (0 != sttd_config_get_default_language(&(g_default_language))) {
- SLOG(LOG_WARN, TAG_STTD, "[Engine Agent WARNING] There is No default voice in config");
+ SLOG(LOG_WARN, TAG_STTD, "[Engine Agent WARNING] There is No default voice in config");
/* Set default voice */
g_default_language = strdup("en_US");
} else {
int temp;
if (0 != sttd_config_get_default_silence_detection(&temp)) {
- SLOG(LOG_WARN, TAG_STTD, "[Server WARNING] There is no silence detection in config");
+ SLOG(LOG_WARN, TAG_STTD, "[Server WARNING] There is no silence detection in config");
g_default_silence_detected = true;
} else {
g_default_silence_detected = (bool)temp;
client = iter->data;
g_engine_client_list = g_slist_remove_link(g_engine_client_list, iter);
- if (NULL != client)
+ if (NULL != client)
free(client);
iter = g_slist_nth(g_engine_client_list, 0);
/* Get handle data from list */
engine = iter->data;
g_engine_list = g_slist_remove_link(g_engine_list, iter);
-
+
/* Check engine unload */
if (engine->is_loaded) {
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Unload engine id(%d)", engine->engine_id);
- if (0 != stt_engine_deinitialize(engine->engine_id))
+ if (0 != stt_engine_deinitialize(engine->engine_id))
SECURE_SLOG(LOG_WARN, TAG_STTD, "[Engine Agent] Fail to deinitialize engine id(%d)", engine->engine_id);
if (0 != stt_engine_unload(engine->engine_id))
void __engine_info_cb(const char* engine_uuid, const char* engine_name, const char* setting_ug_name,
bool use_network, void* user_data)
{
- sttengine_info_s* temp = (sttengine_info_s*)user_data;
+ sttengine_info_s* temp = (sttengine_info_s*)user_data;
temp->engine_uuid = g_strdup(engine_uuid);
temp->engine_name = g_strdup(engine_name);
int __internal_get_engine_info(const char* filepath, sttengine_info_s** info)
{
if (NULL == filepath || NULL == info) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid Parameter");
return STTD_ERROR_INVALID_PARAMETER;
}
char *error;
void* handle;
- handle = dlopen (filepath, RTLD_LAZY);
+ handle = dlopen(filepath, RTLD_LAZY);
if (!handle) {
SECURE_SLOG(LOG_WARN, TAG_STTD, "[Engine Agent] Invalid engine : %s", filepath);
/* link engine to daemon */
dlsym(handle, "sttp_load_engine");
if ((error = dlerror()) != NULL) {
- SLOG(LOG_WARN, TAG_STTD, "[Engine Agent] Invalid engine. Fail to open sttp_load_engine : %s", error);
+ SLOG(LOG_WARN, TAG_STTD, "[Engine Agent] Invalid engine. Fail to open sttp_load_engine : %s", error);
dlclose(handle);
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);
+ SLOG(LOG_WARN, TAG_STTD, "[Engine Agent] Invalid engine. Fail to open sttp_unload_engine : %s", error);
dlclose(handle);
return STTD_ERROR_ENGINE_NOT_FOUND;
}
get_engine_info = (int (*)(sttpe_engine_info_cb, void*))dlsym(handle, "sttp_get_engine_info");
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);
+ SLOG(LOG_WARN, TAG_STTD, "[Engine Agent WARNING] Invalid engine. Fail to open sttp_get_engine_info : %s", error);
dlclose(handle);
return STTD_ERROR_ENGINE_NOT_FOUND;
}
/* 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");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to get engine info from engine");
dlclose(handle);
free(temp);
return STTD_ERROR_ENGINE_NOT_FOUND;
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "Engine name : %s", temp->engine_name);
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "Engine path : %s", temp->engine_path);
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "Engine setting path : %s", temp->engine_setting_path);
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "Use network : %s", temp->use_network ? "true":"false");
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "Use network : %s", temp->use_network ? "true" : "false");
SLOG(LOG_DEBUG, TAG_STTD, "-----");
SLOG(LOG_DEBUG, TAG_STTD, " ");
if (0 == strcmp(engine->engine_path, filepath)) {
return true;
}
-
+
iter = g_slist_next(iter);
}
}
closedir(dp);
} else {
- SLOG(LOG_WARN, TAG_STTD, "[Engine Agent WARNING] Fail to open default directory");
+ SLOG(LOG_WARN, TAG_STTD, "[Engine Agent WARNING] Fail to open default directory");
}
/* Get file name from downloadable engine directory */
closedir(dp);
} else {
- SLOG(LOG_WARN, TAG_STTD, "[Engine Agent WARNING] Fail to open downloadable directory");
+ SLOG(LOG_WARN, TAG_STTD, "[Engine Agent WARNING] Fail to open downloadable directory");
}
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] No Engine");
- return STTD_ERROR_ENGINE_NOT_FOUND;
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] No Engine");
+ return STTD_ERROR_ENGINE_NOT_FOUND;
}
__log_enginelist();
}
}
- if (cur_engine_uuid != NULL )
+ if (cur_engine_uuid != NULL)
free(cur_engine_uuid);
} else {
- SLOG(LOG_WARN, TAG_STTD, "[Engine Agent WARNING] There is not current engine from config");
+ SLOG(LOG_WARN, TAG_STTD, "[Engine Agent WARNING] There is not current engine from config");
}
if (false == is_default_engine) {
if (false == is_default_engine) {
if (0 != sttd_config_set_default_engine(engine->engine_uuid))
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to set default engine ");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to set default engine ");
}
}
} else {
data = iter->data;
- if (data->engine_id == engine_id)
+ if (data->engine_id == engine_id)
return data;
iter = g_slist_next(iter);
data = iter->data;
- if (0 == strcmp(data->engine_uuid, engine_uuid))
+ if (0 == strcmp(data->engine_uuid, engine_uuid))
return data;
iter = g_slist_next(iter);
/* Get handle data from list */
data = iter->data;
- if (uid == data->uid)
+ if (uid == data->uid)
return data;
iter = g_slist_next(iter);
sttengine_client_s *data;
data = __engine_agent_get_client(uid);
- if (NULL != data)
+ if (NULL != data)
return __engine_agent_get_engine_by_id(data->engine_id);
return NULL;
GSList *iter = NULL;
int client_count = 0;
sttengine_client_s *data = NULL;
-
+
if (0 < g_slist_length(g_engine_client_list)) {
iter = g_slist_nth(g_engine_client_list, 0);
int sttd_engine_agent_load_current_engine(int uid, const char* engine_uuid)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized" );
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
return STTD_ERROR_OPERATION_FAILED;
}
int before_engine = -1;
client = __engine_agent_get_client(uid);
-
+
if (NULL == client) {
client = (sttengine_client_s*)calloc(1, sizeof(sttengine_client_s));
if (NULL == client) {
/* initialize */
client->uid = uid;
client->engine_id = -1;
-
+
g_engine_client_list = g_slist_append(g_engine_client_list, client);
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Registered client(%d)", uid);
- }
+ }
if (NULL == engine_uuid) {
/* Set default engine */
#endif
engine->is_loaded = true;
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent SUCCESS] The %s(%d) has been loaded !!!", engine->engine_name, engine->engine_id);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent SUCCESS] The %s(%d) has been loaded !!!", engine->engine_name, engine->engine_id);
return 0;
}
int sttd_engine_agent_unload_current_engine(int uid)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized ");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized ");
return STTD_ERROR_OPERATION_FAILED;
}
bool sttd_engine_agent_is_default_engine()
{
- if (g_default_engine_id > 0)
+ if (g_default_engine_id > 0)
return true;
return false;
int sttd_engine_agent_get_engine_list(GSList** engine_list)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
return STTD_ERROR_OPERATION_FAILED;
}
iter = g_slist_next(iter);
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, " -- Engine id(%s)", temp_engine->engine_id);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, " -- Engine id(%s)", temp_engine->engine_id);
SECURE_SLOG(LOG_DEBUG, TAG_STTD, " Engine name(%s)", temp_engine->engine_name);
SECURE_SLOG(LOG_DEBUG, TAG_STTD, " Engine ug name(%s)", temp_engine->ug_name);
}
int sttd_engine_agent_get_current_engine(int uid, char** engine_uuid)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized" );
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
return STTD_ERROR_OPERATION_FAILED;
}
if (NULL == engine_uuid) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid parameter" );
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid parameter");
return STTD_ERROR_INVALID_PARAMETER;
}
}
if (false == engine->is_loaded) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
return STTD_ERROR_OPERATION_FAILED;
}
bool sttd_engine_agent_need_network(int uid)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized" );
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
return STTD_ERROR_OPERATION_FAILED;
}
sttengine_info_s* engine;
engine = __engine_agent_get_engine_by_uid(uid);
-
+
if (NULL != engine)
return engine->use_network;
}
if (false == engine->is_loaded) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
return STTD_ERROR_OPERATION_FAILED;
}
int ret = stt_engine_get_supported_langs(engine->engine_id, lang_list);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] get language list error(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] get language list error(%d)", ret);
return STTD_ERROR_OPERATION_FAILED;
}
int sttd_engine_agent_get_default_lang(int uid, char** lang)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
return STTD_ERROR_OPERATION_FAILED;
}
if (NULL == lang) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid Parameter");
return STTD_ERROR_INVALID_PARAMETER;
}
}
if (false == engine->is_loaded) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
return STTD_ERROR_OPERATION_FAILED;
}
if (true == is_valid) {
*lang = strdup(g_default_language);
- } else
+ } else
*lang = strdup(engine->first_lang);
return 0;
}
if (NULL == silence) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid Parameter");
return STTD_ERROR_INVALID_PARAMETER;
}
}
if (false == engine->is_loaded) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
return STTD_ERROR_OPERATION_FAILED;
}
int sttd_engine_agent_is_recognition_type_supported(int uid, const char* type, bool* support)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
return STTD_ERROR_OPERATION_FAILED;
}
if (NULL == type || NULL == support) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid Parameter");
return STTD_ERROR_INVALID_PARAMETER;
}
}
if (false == engine->is_loaded) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
return STTD_ERROR_OPERATION_FAILED;
}
ret = stt_engine_support_recognition_type(engine->engine_id, type, &temp);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to get to support recognition type : %d", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to get to support recognition type : %d", ret);
return STTD_ERROR_OPERATION_FAILED;
}
}
}
}
-
+
return 0;
}
int silence, void* user_param)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
return STTD_ERROR_OPERATION_FAILED;
}
-
+
if (NULL == lang || NULL == recognition_type) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid Parameter");
return STTD_ERROR_INVALID_PARAMETER;
}
}
if (false == engine->is_loaded) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
return STTD_ERROR_OPERATION_FAILED;
}
if (0 != __set_option(engine, silence)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to set options");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to set options");
return STTD_ERROR_OPERATION_FAILED;
}
}
g_recording_engine_id = engine->engine_id;
- SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] g_recording_engine_id : %d", g_recording_engine_id);
+ SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] g_recording_engine_id : %d", g_recording_engine_id);
#endif
return 0;
}
if (false == engine->is_loaded) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
return STTD_ERROR_OPERATION_FAILED;
}
}
g_recording_engine_id = engine->engine_id;
- SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] g_recording_engine_id : %d", g_recording_engine_id);
+ SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] g_recording_engine_id : %d", g_recording_engine_id);
return 0;
}
int sttd_engine_agent_set_recording_data(int uid, const void* data, unsigned int length)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
return STTD_ERROR_OPERATION_FAILED;
}
if (NULL == data || 0 == length) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid Parameter");
return STTD_ERROR_INVALID_PARAMETER;
}
}
if (false == engine->is_loaded) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
return STTD_ERROR_OPERATION_FAILED;
}
int ret = stt_engine_set_recording_data(engine->engine_id, data, length);
if (0 != ret) {
- SLOG(LOG_WARN, TAG_STTD, "[Engine Agent WARNING] set recording error(%d)", ret);
+ SLOG(LOG_WARN, TAG_STTD, "[Engine Agent WARNING] set recording error(%d)", ret);
return STTD_ERROR_OPERATION_FAILED;
}
int sttd_engine_agent_recognize_stop_recorder(int uid)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
return STTD_ERROR_OPERATION_FAILED;
}
}
if (false == engine->is_loaded) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
return STTD_ERROR_OPERATION_FAILED;
}
int ret;
ret = sttd_recorder_stop(engine->engine_id);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to stop recorder : result(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to stop recorder : result(%d)", ret);
return STTD_ERROR_OPERATION_FAILED;
}
int sttd_engine_agent_recognize_stop_engine(int uid)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
return STTD_ERROR_OPERATION_FAILED;
}
}
if (false == engine->is_loaded) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
return STTD_ERROR_OPERATION_FAILED;
}
int ret;
ret = stt_engine_recognize_stop(engine->engine_id);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] stop recognition error(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] stop recognition error(%d)", ret);
return STTD_ERROR_OPERATION_FAILED;
}
int sttd_engine_agent_recognize_cancel(int uid)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
return STTD_ERROR_OPERATION_FAILED;
}
}
if (false == engine->is_loaded) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
return STTD_ERROR_OPERATION_FAILED;
}
int ret;
ret = stt_engine_recognize_cancel(engine->engine_id);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] cancel recognition error(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] cancel recognition error(%d)", ret);
return STTD_ERROR_OPERATION_FAILED;
}
ret = sttd_recorder_stop(engine->engine_id);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to stop recorder : result(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to stop recorder : result(%d)", ret);
return STTD_ERROR_OPERATION_FAILED;
}
int sttd_engine_agent_set_default_engine(const char* engine_uuid)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
return STTD_ERROR_OPERATION_FAILED;
}
if (NULL == engine_uuid) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid Parameter");
return STTD_ERROR_INVALID_PARAMETER;
}
int sttd_engine_agent_set_default_language(const char* language)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
return STTD_ERROR_OPERATION_FAILED;
}
if (NULL == language) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid Parameter");
return STTD_ERROR_INVALID_PARAMETER;
}
int sttd_engine_agent_set_silence_detection(bool value)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
return STTD_ERROR_OPERATION_FAILED;
}
}
if (false == engine->is_loaded) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
return STTD_ERROR_OPERATION_FAILED;
}
int ret;
ret = stt_engine_check_app_agreed(engine->engine_id, appid, result);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] cancel recognition error(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] cancel recognition error(%d)", ret);
return STTD_ERROR_OPERATION_FAILED;
}
-
+
SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Get engine right : %s", *result ? "true" : "false");
return 0;
}
void __detect_silence_cb(sttp_silence_type_e type, void* user_data)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Silence Callback : Not Initialized");
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Silence Callback : Not Initialized");
return;
}
SLOG(LOG_DEBUG, TAG_STTD, "--------------- engine list -------------------");
- int i = 1;
+ int i = 1;
while (NULL != iter) {
/* Get handle data from list */
data = iter->data;
/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
int engine_id;
audio_in_h audio_h;
sttp_audio_type_e audio_type;
-}stt_recorder_s;
+} stt_recorder_s;
static GSList *g_recorder_list;
static FILE* g_pFile;
static int g_count = 1;
-#endif
+#endif
const char* __stt_get_session_interrupt_code(sound_session_interrupted_code_e code)
{
- switch(code) {
+ switch (code) {
case SOUND_SESSION_INTERRUPTED_COMPLETED: return "SOUND_SESSION_INTERRUPTED_COMPLETED";
case SOUND_SESSION_INTERRUPTED_BY_MEDIA: return "SOUND_SESSION_INTERRUPTED_BY_MEDIA";
case SOUND_SESSION_INTERRUPTED_BY_CALL: return "SOUND_SESSION_INTERRUPTED_BY_CALL";
void __sttd_recorder_sound_interrupted_cb(sound_session_interrupted_code_e code, void *user_data)
{
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Get the interrupt code from sound mgr : %s",
- __stt_get_session_interrupt_code(code));
+ SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Get the interrupt code from sound mgr : %s",
+ __stt_get_session_interrupt_code(code));
if (SOUND_SESSION_INTERRUPTED_COMPLETED == code || SOUND_SESSION_INTERRUPTED_BY_EARJACK_UNPLUG == code)
return;
SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Current state of recorder is recording");
return STTD_ERROR_INVALID_STATE;
}
-
+
g_audio_cb = audio_cb;
g_interrupt_cb = interrupt_cb;
g_recorder_state = STTD_RECORDER_STATE_NONE;
if (0 == access(STT_AUDIO_VOLUME_PATH, R_OK)) {
if (0 != remove(STT_AUDIO_VOLUME_PATH)) {
- SLOG(LOG_WARN, TAG_STTD, "[Recorder WARN] Fail to remove volume file");
+ SLOG(LOG_WARN, TAG_STTD, "[Recorder WARN] Fail to remove volume file");
}
}
audio_sample_type_e audio_type;
audio_in_h temp_in_h;
- switch(channel) {
+ switch (channel) {
case 1: audio_ch = AUDIO_CHANNEL_MONO; break;
case 2: audio_ch = AUDIO_CHANNEL_STEREO; break;
default:
recorder->engine_id = engine_id;
recorder->audio_h = temp_in_h;
recorder->audio_type = type;
-
+
g_recorder_list = g_slist_append(g_recorder_list, recorder);
g_recorder_state = STTD_RECORDER_STATE_READY;
/* Audio read log */
if (0 == g_buffer_count % 50) {
SLOG(LOG_DEBUG, TAG_STTD, "[Recorder][%d] Recording... : read_size(%d)", g_buffer_count, read_byte);
-
+
if (100000 == g_buffer_count) {
g_buffer_count = 0;
}
return STTD_ERROR_INVALID_PARAMETER;
}
- int ret = -1;
+ int ret = -1;
ret = audio_in_prepare(recorder->audio_h);
if (AUDIO_IO_ERROR_NONE != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to start audio : %d", ret);
if (!g_pFile) {
SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] File not found!");
return -1;
- }
+ }
#endif
return 0;
return STTD_ERROR_INVALID_PARAMETER;
}
- int ret;
+ int ret;
ret = audio_in_unprepare(recorder->audio_h);
if (AUDIO_IO_ERROR_NONE != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to unprepare audioin : %d", ret);
#ifdef BUF_SAVE_MODE
fclose(g_pFile);
-#endif
+#endif
return 0;
}
/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
int ret;
if (0 != uid) {
- ret = sttd_server_stop(uid);
+ ret = sttd_server_stop(uid);
if (0 > ret) {
return EINA_FALSE;
}
-
+
if (STTD_RESULT_STATE_DONE == ret) {
ret = sttdc_send_set_state(uid, (int)APP_STATE_PROCESSING);
if (0 != ret) {
if (0 != uid) {
ret = sttd_engine_agent_set_recording_data(uid, data, length);
if (ret < 0) {
- ecore_timer_add(0, __cancel_by_error, NULL);
- return -1;
+ ecore_timer_add(0, __cancel_by_error, NULL);
+ return -1;
}
g_recording_log_count++;
if (200 <= g_recording_log_count) {
SLOG(LOG_DEBUG, TAG_STTD, "=====");
SLOG(LOG_DEBUG, TAG_STTD, " ");
-
+
return EINA_FALSE;
}
/* send result to client */
if (STTP_RESULT_EVENT_FINAL_RESULT == event) {
- if (APP_STATE_PROCESSING != state ) {
+ if (APP_STATE_PROCESSING != state) {
SLOG(LOG_WARN, TAG_STTD, "[Server WARNING] Current state is NOT 'Processing'.");
}
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Server] the size of result from engine is '%d'", data_count);
if (NULL == data || 0 == data_count) {
if (0 != sttdc_send_result(uid, event, NULL, 0, msg)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send result");
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send result");
int reason = (int)STTD_ERROR_OPERATION_FAILED;
if (0 != sttdc_send_error_signal(uid, reason, "Fail to send recognition result")) {
}
} else {
if (0 != sttdc_send_result(uid, event, data, data_count, msg)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send result");
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send result");
int reason = (int)STTD_ERROR_OPERATION_FAILED;
if (0 != sttdc_send_error_signal(uid, reason, "Fail to send recognition result")) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send result ");
/* send error msg */
- int reason = (int)STTD_ERROR_INVALID_STATE;
+ int reason = (int)STTD_ERROR_INVALID_STATE;
if (0 != sttdc_send_error_signal(uid, reason, "[ERROR] Fail to send recognition result")) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send error info ");
}
bool __server_result_time_callback(int index, sttp_result_time_event_e event, const char* text, long start_time, long end_time, void* user_data)
{
- SLOG(LOG_DEBUG, TAG_STTD, "[Server] index(%d) event(%d) text(%s) start(%ld) end(%ld)",
- index, event, text, start_time, end_time);
+ SLOG(LOG_DEBUG, TAG_STTD, "[Server] index(%d) event(%d) text(%s) start(%ld) end(%ld)",
+ index, event, text, start_time, end_time);
if (0 == index) {
int ret;
if (0 != ret)
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to set default lang : result(%d)", ret);
}
-
+
ret = sttd_engine_agent_set_silence_detection(support_silence);
if (0 != ret)
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to Result(%d)", ret);
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to engine agent initialize : result(%d)", ret);
return ret;
}
-
+
/* Update engine list */
ret = sttd_engine_agent_initialize_engine_list();
if (0 != ret) {
if (NULL != client_list) {
SLOG(LOG_DEBUG, TAG_STTD, "===== Clean up client ");
- for (i = 0;i < client_count;i++) {
+ for (i = 0; i < client_count; i++) {
result = sttdc_send_hello(client_list[i]);
if (0 == result) {
if (false == sttd_engine_agent_is_default_engine()) {
/* Update installed engine */
sttd_engine_agent_initialize_engine_list();
-
+
if (false == sttd_engine_agent_is_default_engine()) {
SLOG(LOG_WARN, TAG_STTD, "[Server WARNING] No stt-engine");
return STTD_ERROR_ENGINE_NOT_FOUND;
stt_client_unset_current_recognition();
}
-
+
if (0 != sttd_engine_agent_unload_current_engine(uid)) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to unload engine");
}
sttd_dbus_close_connection();
ecore_timer_add(0, __quit_ecore_loop, NULL);
}
-
+
return STTD_ERROR_NONE;
}
SECURE_SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] The state of uid(%d) is not Ready", uid);
return STTD_ERROR_INVALID_STATE;
}
-
+
int ret;
ret = sttd_engine_agent_get_current_engine(uid, engine_id);
if (0 != ret) {
/* Check if uid is valid */
app_state_e state;
if (0 != sttd_client_get_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] uid is NOT valid ");
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] uid is NOT valid ");
return STTD_ERROR_INVALID_PARAMETER;
}
/*get current language from engine */
int ret = sttd_engine_agent_get_default_lang(uid, current_lang);
- if (0 != ret) {
+ if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to get default language :result(%d)", ret);
return STTD_ERROR_OPERATION_FAILED;
}
bool temp;
int ret = sttd_engine_agent_is_recognition_type_supported(uid, type, &temp);
- if (0 != ret) {
+ if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to get recognition type supported : result(%d)", ret);
return STTD_ERROR_OPERATION_FAILED;
}
-
+
*support = (int)temp;
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Server SUCCESS] recognition type supporting is %s", *support ? "true" : "false");
}
int ret = sttd_client_set_start_sound(uid, file);
- if (0 != ret) {
+ if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to set start sound file : result(%d)", ret);
return STTD_ERROR_OPERATION_FAILED;
}
}
int ret = sttd_client_set_stop_sound(uid, file);
- if (0 != ret) {
+ if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to set start sound file : result(%d)", ret);
return STTD_ERROR_OPERATION_FAILED;
}
}
Eina_Bool __check_recording_state(void *data)
-{
+{
/* current uid */
int uid = stt_client_get_current_recognition();
if (0 == uid)
}
/* engine start recognition */
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Server] start : uid(%d), lang(%s), recog_type(%s)",
- uid, lang, recognition_type);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Server] start : uid(%d), lang(%s), recog_type(%s)",
+ uid, lang, recognition_type);
if (NULL != sound)
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Server] start sound : %s", sound);
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send result ");
/* send error msg */
- int reason = (int)STTD_ERROR_TIMED_OUT;
+ int reason = (int)STTD_ERROR_TIMED_OUT;
if (0 != sttdc_send_error_signal(uid, reason, "[ERROR] Fail to send recognition result")) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send error info ");
}
char* sound = NULL;
if (0 != sttd_client_get_stop_sound(uid, &sound)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to get start beep sound");
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to get start beep sound");
return STTD_ERROR_OPERATION_FAILED;
}
if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to stop recorder : result(%d)", ret);
if (0 != sttd_engine_agent_recognize_cancel(uid)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to cancel recognize");
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to cancel recognize");
}
if (NULL != sound) free(sound);
return STTD_ERROR_OPERATION_FAILED;
sttd_client_set_state(uid, APP_STATE_PROCESSING);
SLOG(LOG_DEBUG, TAG_STTD, "[Server SUCCESS] Stop recognition");
-
+
g_processing_timer = ecore_timer_add(g_processing_timeout, __time_out_for_processing, NULL);
return STTD_RESULT_STATE_DONE;
return STTD_ERROR_INVALID_PARAMETER;
}
- /* check uid state */
+ /* check uid state */
if (APP_STATE_READY == state) {
SLOG(LOG_WARN, TAG_STTD, "[Server WARNING] Current state is ready");
return STTD_ERROR_NONE;
if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to unset session : %d", ret);
return STTD_ERROR_OPERATION_FAILED;
- }
+ }
}
/* change uid state */
/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
SLOG(LOG_ERROR, TAG_STT_TEST, "[ERROR] Fail to get engine");
return EINA_FALSE;
}
-
+
if (NULL != cur_engine) {
SLOG(LOG_DEBUG, TAG_STT_TEST, "Current engine - %s", cur_engine);
free(cur_engine);
ecore_timer_add(0, __stt_finalize, NULL);
}
-int main (int argc, char *argv[])
+int main(int argc, char *argv[])
{
if (2 < argc) {
SLOG(LOG_DEBUG, TAG_STT_TEST, "Please check parameter");