From: sooyeon.kim Date: Mon, 18 Apr 2016 00:44:41 +0000 (+0900) Subject: check and revise by coding rule X-Git-Tag: accepted/tizen/common/20160418.141650~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fstt.git;a=commitdiff_plain;h=c310764dac3605c159a7617807968a00e869e5a9 check and revise by coding rule Change-Id: I6d29fa37159b39299ceb652a1b4c51ab82879b99 Signed-off-by: sooyeon.kim --- diff --git a/client/stt.c b/client/stt.c old mode 100644 new mode 100755 index 91f6fc1..4394ae9 --- a/client/stt.c +++ b/client/stt.c @@ -605,7 +605,7 @@ int stt_unprepare(stt_h stt) SLOG(LOG_WARN, TAG_STTC, "[WARNING] State changed callback is null"); } - if(g_connect_timer) { + if (g_connect_timer) { ecore_timer_del(g_connect_timer); g_connect_timer = NULL; } @@ -1488,7 +1488,7 @@ static Eina_Bool __stt_notify_error(void *data) 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"); return -1; } diff --git a/client/stt_client.h b/client/stt_client.h old mode 100644 new mode 100755 index de6242d..9a1ad35 --- a/client/stt_client.h +++ b/client/stt_client.h @@ -28,7 +28,7 @@ typedef enum { STT_INTERNAL_STATE_STARTING = 1, STT_INTERNAL_STATE_STOPING = 2, STT_INTERNAL_STATE_CANCELING = 3 -}stt_internal_state_e; +} stt_internal_state_e; typedef struct { /* base info */ @@ -76,7 +76,7 @@ typedef struct { /* error data */ int reason; -}stt_client_s; +} stt_client_s; typedef bool (*stt_time_cb)(int index, int event, const char* text, long start_time, long end_time, void *user_data); diff --git a/client/stt_dbus.c b/client/stt_dbus.c old mode 100644 new mode 100755 index a7fc25d..2981b98 --- a/client/stt_dbus.c +++ b/client/stt_dbus.c @@ -85,8 +85,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle response = 1; else response = 0; - } - else { + } else { SLOG(LOG_ERROR, TAG_STTC, "<<<< stt get hello : invalid uid"); } @@ -102,8 +101,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle dbus_connection_flush(g_conn_listener); dbus_message_unref(reply); - } - else { + } else { SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get hello : fail to create reply message"); } @@ -129,8 +127,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle if (uid > 0 && state >= 0) { SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt set state : uid(%d), state(%d)", uid, state); __stt_cb_set_state(uid, state); - } - else { + } else { SLOG(LOG_ERROR, TAG_STTC, "<<<< stt set state : invalid uid or state"); } @@ -244,7 +241,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle SLOG(LOG_DEBUG, TAG_STTC, "====="); SLOG(LOG_DEBUG, TAG_STTC, " "); - }/* STTD_METHOD_RESULT */ + } /* STTD_METHOD_RESULT */ else if (dbus_message_is_signal(msg, if_name, STTD_METHOD_ERROR)) { SLOG(LOG_DEBUG, TAG_STTC, "===== Get Error"); @@ -261,15 +258,14 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle 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); - } - else { + } else { 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 */ else { SLOG(LOG_DEBUG, TAG_STTC, "Message is NOT valid"); @@ -279,7 +275,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle /* free the message */ dbus_message_unref(msg); - }/* while */ + } /* while */ return ECORE_CALLBACK_RENEW; } @@ -442,7 +438,7 @@ int stt_dbus_request_hello() DBusMessage* result_msg = NULL; int result = 0; - if(g_conn_sender) { + if (g_conn_sender) { result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_short_time, &err); dbus_message_unref(msg); if (dbus_error_is_set(&err)) { @@ -461,7 +457,7 @@ int stt_dbus_request_hello() } else { result = STT_ERROR_TIMED_OUT; } - }else { + } else { SLOG(LOG_WARN, TAG_STTC, "[WARN] dbus connection handle is null (%p)", g_conn_sender); result = STT_ERROR_OPERATION_FAILED; } @@ -499,7 +495,7 @@ int stt_dbus_request_initialize(int uid, bool* silence_supported) DBusMessage* result_msg; int result = STT_ERROR_OPERATION_FAILED; - if(g_conn_sender) { + if (g_conn_sender) { result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err); dbus_message_unref(msg); if (dbus_error_is_set(&err)) { @@ -1237,7 +1233,7 @@ int stt_dbus_request_start(int uid, const char* lang, const char* type, int sile DBUS_TYPE_STRING, &appid, DBUS_TYPE_INVALID); #if 1 - if(g_conn_sender) { + if (g_conn_sender) { dbus_message_set_no_reply(msg, TRUE); if (!dbus_connection_send(g_conn_sender, msg, NULL)) { @@ -1318,7 +1314,7 @@ int stt_dbus_request_stop(int uid) DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID); #if 1 - if(g_conn_sender) { + if (g_conn_sender) { dbus_message_set_no_reply(msg, TRUE); if (!dbus_connection_send(g_conn_sender, msg, NULL)) { @@ -1398,7 +1394,7 @@ int stt_dbus_request_cancel(int uid) DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID); #if 1 - if(g_conn_sender) { + if (g_conn_sender) { dbus_message_set_no_reply(msg, TRUE); if (!dbus_connection_send(g_conn_sender, msg, NULL)) { diff --git a/client/stt_file_client.h b/client/stt_file_client.h old mode 100644 new mode 100755 index 9a675df..2991e4f --- a/client/stt_file_client.h +++ b/client/stt_file_client.h @@ -53,7 +53,7 @@ typedef struct { /* error data */ int reason; -}stt_file_client_s; +} stt_file_client_s; int stt_file_client_new(); diff --git a/common/stt_config_mgr.h b/common/stt_config_mgr.h old mode 100644 new mode 100755 index 010f80e..614b666 --- a/common/stt_config_mgr.h +++ b/common/stt_config_mgr.h @@ -32,11 +32,11 @@ typedef enum { STT_CONFIG_ERROR_INVALID_LANGUAGE = TIZEN_ERROR_STT | 0x02, /**< Invalid language */ STT_CONFIG_ERROR_ENGINE_NOT_FOUND = TIZEN_ERROR_STT | 0x03, /**< No available engine */ STT_CONFIG_ERROR_OPERATION_FAILED = TIZEN_ERROR_STT | 0x04, /**< Operation failed */ -}stt_config_error_e; +} stt_config_error_e; typedef enum { STT_CONFIG_TYPE_OPTION_SILENCE_DETECTION -}stt_config_type_e; +} stt_config_type_e; typedef bool (*stt_config_supported_engine_cb)(const char* engine_id, const char* engine_name, const char* setting, bool support_silence, void* user_data); diff --git a/common/stt_config_parser.h b/common/stt_config_parser.h old mode 100644 new mode 100755 index 6fa65ad..8b626f2 --- a/common/stt_config_parser.h +++ b/common/stt_config_parser.h @@ -30,7 +30,7 @@ typedef struct { char* agreement; GSList* languages; bool support_silence_detection; -}stt_engine_info_s; +} stt_engine_info_s; typedef struct { char* engine_id; @@ -38,7 +38,7 @@ typedef struct { bool auto_lang; char* language; bool silence_detection; -}stt_config_s; +} stt_config_s; typedef struct { int index; @@ -46,7 +46,7 @@ typedef struct { char* text; long start_time; long end_time; -}stt_result_time_info_s; +} stt_result_time_info_s; /* Get engine information */ int stt_parser_get_engine_info(const char* path, stt_engine_info_s** engine_info); diff --git a/include/stt.h b/include/stt.h old mode 100644 new mode 100755 index 2687939..cb5fb23 --- a/include/stt.h +++ b/include/stt.h @@ -52,7 +52,7 @@ typedef enum { STT_ERROR_ENGINE_NOT_FOUND = TIZEN_ERROR_STT | 0x03, /**< No available engine */ STT_ERROR_OPERATION_FAILED = TIZEN_ERROR_STT | 0x04, /**< Operation failed */ STT_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_STT | 0x05 /**< Not supported feature of current engine */ -}stt_error_e; +} stt_error_e; /** * @brief Definition for free form dictation and default type. @@ -136,7 +136,7 @@ typedef enum { STT_STATE_READY = 1, /**< 'READY' state */ STT_STATE_RECORDING = 2, /**< 'RECORDING' state */ STT_STATE_PROCESSING = 3 /**< 'PROCESSING' state*/ -}stt_state_e; +} stt_state_e; /** * @brief Enumeration for result event. @@ -146,7 +146,7 @@ typedef enum { STT_RESULT_EVENT_FINAL_RESULT = 0, /**< Event when the recognition full or last result is ready */ STT_RESULT_EVENT_PARTIAL_RESULT, /**< Event when the recognition partial result is ready */ STT_RESULT_EVENT_ERROR /**< Event when the recognition has failed */ -}stt_result_event_e; +} stt_result_event_e; /** * @brief Enumeration for result time callback event. @@ -156,7 +156,7 @@ typedef enum { STT_RESULT_TIME_EVENT_BEGINNING = 0, /**< Event when the token is beginning type */ STT_RESULT_TIME_EVENT_MIDDLE = 1, /**< Event when the token is middle type */ STT_RESULT_TIME_EVENT_END = 2 /**< Event when the token is end type */ -}stt_result_time_event_e; +} stt_result_time_event_e; /** * @brief Enumeration for silence detection type. @@ -166,7 +166,7 @@ typedef enum { STT_OPTION_SILENCE_DETECTION_FALSE = 0, /**< Silence detection type - False */ STT_OPTION_SILENCE_DETECTION_TRUE = 1, /**< Silence detection type - True */ STT_OPTION_SILENCE_DETECTION_AUTO = 2 /**< Silence detection type - Auto */ -}stt_option_silence_detection_e; +} stt_option_silence_detection_e; /** * @brief A structure of STT handler. diff --git a/include/stt_file.h b/include/stt_file.h old mode 100644 new mode 100755 index 45bb97a..eb06246 --- a/include/stt_file.h +++ b/include/stt_file.h @@ -45,7 +45,7 @@ typedef enum { STT_FILE_ERROR_OPERATION_FAILED = -0x0100000 | 0x34, /**< Operation failed */ STT_FILE_ERROR_NOT_SUPPORTED_FEATURE = -0x0100000 | 0x35, /**< Not supported feature of current engine */ STT_FILE_ERROR_NOT_AGREE_SERVICE = -0x0100000 | 0x36 /**< Not agreed service of engine*/ -}stt_file_error_e; +} stt_file_error_e; /** * @brief Enumerations of state. @@ -54,7 +54,7 @@ typedef enum { STT_FILE_STATE_NONE = 0, /**< 'NONE' state */ STT_FILE_STATE_READY = 1, /**< 'READY' state */ STT_FILE_STATE_PROCESSING = 2, /**< 'PROCESSING' state */ -}stt_file_state_e; +} stt_file_state_e; /** * @brief Enumerations of audio type. @@ -63,7 +63,7 @@ typedef enum { STT_FILE_AUDIO_TYPE_RAW_S16 = 0, /**< Signed 16-bit audio sample */ STT_FILE_AUDIO_TYPE_RAW_U8, /**< Unsigned 8-bit audio sample */ STT_FILE_AUDIO_TYPE_MAX -}stt_file_audio_type_e; +} stt_file_audio_type_e; /** * @brief Enumerations of result event. @@ -72,7 +72,7 @@ typedef enum { STT_FILE_RESULT_EVENT_FINAL_RESULT = 0, /**< Event when the recognition full or last result is ready */ STT_FILE_RESULT_EVENT_PARTIAL_RESULT, /**< Event when the recognition partial result is ready */ STT_FILE_RESULT_EVENT_ERROR /**< Event when the recognition has failed */ -}stt_file_result_event_e; +} stt_file_result_event_e; /** * @brief Enumerations of result time callback event. @@ -81,7 +81,7 @@ typedef enum { STT_FILE_RESULT_TIME_EVENT_BEGINNING = 0, /**< Event when the token is beginning type */ STT_FILE_RESULT_TIME_EVENT_MIDDLE = 1, /**< Event when the token is middle type */ STT_FILE_RESULT_TIME_EVENT_END = 2 /**< Event when the token is end type */ -}stt_file_result_time_event_e; +} stt_file_result_time_event_e; /** * @brief Recognition type : Continuous free dictation. diff --git a/include/stt_setting.h b/include/stt_setting.h old mode 100644 new mode 100755 index 1733858..352a43a --- a/include/stt_setting.h +++ b/include/stt_setting.h @@ -47,7 +47,7 @@ typedef enum { STT_SETTING_ERROR_ENGINE_NOT_FOUND = TIZEN_ERROR_STT | 0x03, /**< No available engine */ STT_SETTING_ERROR_OPERATION_FAILED = TIZEN_ERROR_STT | 0x04, /**< Operation failed */ STT_SETTING_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_STT | 0x05 /**< Not supported feature of current engine */ -}stt_setting_error_e; +} stt_setting_error_e; /** * @brief Enumerations of setting state. diff --git a/server/sttd_client_data.h b/server/sttd_client_data.h old mode 100644 new mode 100755 index ba03259..c5115d9 --- a/server/sttd_client_data.h +++ b/server/sttd_client_data.h @@ -27,7 +27,7 @@ typedef enum { APP_STATE_READY = 1, APP_STATE_RECORDING = 2, APP_STATE_PROCESSING = 3 -}app_state_e; +} app_state_e; typedef struct { int pid; @@ -39,7 +39,7 @@ typedef struct { /* Ecore_Timer* timer; */ bool app_agreed; -}client_info_s; +} client_info_s; typedef struct { int index; @@ -47,7 +47,7 @@ typedef struct { char* text; long start_time; long end_time; -}result_time_info_s; +} result_time_info_s; typedef bool (*time_callback)(int index, int event, const char* text, long start_time, long end_time, void *user_data); diff --git a/server/sttd_dbus.c b/server/sttd_dbus.c old mode 100644 new mode 100755 index ed0ab08..a74e046 --- a/server/sttd_dbus.c +++ b/server/sttd_dbus.c @@ -261,7 +261,7 @@ int sttdc_send_result(int uid, int event, const char** data, int data_count, con SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] result size (%d)", data_count); for (i = 0; i < data_count; i++) { if (NULL != data[i]) { - SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] result (%d, %s)", i, data[i] ); + 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"); diff --git a/server/sttd_main.h b/server/sttd_main.h old mode 100644 new mode 100755 index 96704c6..0b907ef --- a/server/sttd_main.h +++ b/server/sttd_main.h @@ -39,32 +39,32 @@ extern "C" { //#define CLIENT_DATA_DEBUG typedef enum { - STTD_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ - STTD_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */ - STTD_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */ - STTD_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,/**< Invalid parameter */ - STTD_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< No answer from the daemon */ - STTD_ERROR_RECORDER_BUSY = TIZEN_ERROR_RESOURCE_BUSY, /**< Device or resource busy */ - STTD_ERROR_OUT_OF_NETWORK = TIZEN_ERROR_NETWORK_DOWN, /**< Network is down */ - STTD_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,/**< Permission denied */ - STTD_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< STT NOT supported */ - STTD_ERROR_INVALID_STATE = TIZEN_ERROR_STT | 0x01, /**< Invalid state */ - STTD_ERROR_INVALID_LANGUAGE = TIZEN_ERROR_STT | 0x02, /**< Invalid language */ - STTD_ERROR_ENGINE_NOT_FOUND = TIZEN_ERROR_STT | 0x03, /**< No available engine */ - STTD_ERROR_OPERATION_FAILED = TIZEN_ERROR_STT | 0x04, /**< Operation failed */ - STTD_ERROR_NOT_SUPPORTED_FEATURE= TIZEN_ERROR_STT | 0x05 /**< Not supported feature of current engine */ -}stt_error_e; + STTD_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ + STTD_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */ + STTD_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */ + STTD_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,/**< Invalid parameter */ + STTD_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< No answer from the daemon */ + STTD_ERROR_RECORDER_BUSY = TIZEN_ERROR_RESOURCE_BUSY, /**< Device or resource busy */ + STTD_ERROR_OUT_OF_NETWORK = TIZEN_ERROR_NETWORK_DOWN, /**< Network is down */ + STTD_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,/**< Permission denied */ + STTD_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< STT NOT supported */ + STTD_ERROR_INVALID_STATE = TIZEN_ERROR_STT | 0x01, /**< Invalid state */ + STTD_ERROR_INVALID_LANGUAGE = TIZEN_ERROR_STT | 0x02, /**< Invalid language */ + STTD_ERROR_ENGINE_NOT_FOUND = TIZEN_ERROR_STT | 0x03, /**< No available engine */ + STTD_ERROR_OPERATION_FAILED = TIZEN_ERROR_STT | 0x04, /**< Operation failed */ + STTD_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_STT | 0x05 /**< Not supported feature of current engine */ +} stt_error_e; typedef enum { STTD_RESULT_STATE_DONE = 0, /**< Sync state change */ STTD_RESULT_STATE_NOT_DONE = 1 /**< Async state change */ -}sttd_result_state_e; +} sttd_result_state_e; typedef struct { char* engine_id; char* engine_name; char* ug_name; -}engine_s; +} engine_s; #ifdef __cplusplus } diff --git a/server/sttd_recorder.c b/server/sttd_recorder.c old mode 100644 new mode 100755 index 6318419..c34683d --- a/server/sttd_recorder.c +++ b/server/sttd_recorder.c @@ -126,7 +126,7 @@ int sttd_recorder_initialize(stt_recorder_audio_cb audio_cb, stt_recorder_interr return STTD_ERROR_INVALID_STATE; } - if( 0 != pthread_mutex_init(&sttd_audio_in_handle_mutex, NULL)) { + if (0 != pthread_mutex_init(&sttd_audio_in_handle_mutex, NULL)) { SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to initialize audio in handle mutex."); } @@ -144,7 +144,7 @@ int sttd_recorder_initialize(stt_recorder_audio_cb audio_cb, stt_recorder_interr int sttd_recorder_deinitialize() { - if( 0 != pthread_mutex_destroy(&sttd_audio_in_handle_mutex)) { + if (0 != pthread_mutex_destroy(&sttd_audio_in_handle_mutex)) { SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to destroy audio in handle mutex."); } diff --git a/server/sttd_server.c b/server/sttd_server.c old mode 100644 new mode 100755 index 62c1d0e..b36f8a2 --- a/server/sttd_server.c +++ b/server/sttd_server.c @@ -425,11 +425,11 @@ int sttd_initialize() { int ret = 0; - if( 0 != pthread_mutex_init(&sttpe_result_mutex, NULL)) { + if (0 != pthread_mutex_init(&sttpe_result_mutex, NULL)) { SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to initialize sttpe result mutex."); } - if( 0 != pthread_mutex_init(&sttpe_result_time_mutex, NULL)) { + if (0 != pthread_mutex_init(&sttpe_result_time_mutex, NULL)) { SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to initialize sttpe sttpe_result_time_mutex."); } @@ -469,11 +469,11 @@ int sttd_initialize() int sttd_finalize() { - if( 0 != pthread_mutex_destroy(&sttpe_result_mutex)) { + if (0 != pthread_mutex_destroy(&sttpe_result_mutex)) { SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to destroy sttpe result mutex."); } - if( 0 != pthread_mutex_destroy(&sttpe_result_time_mutex)) { + if (0 != pthread_mutex_destroy(&sttpe_result_time_mutex)) { SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to destroy sttpe_result_time_mutex."); } @@ -554,7 +554,7 @@ Eina_Bool sttd_cleanup_client(void *data) __read_proc(); - for (i = 0;i < client_count;i++) { + for (i = 0; i < client_count; i++) { int pid = sttd_client_get_pid(client_list[i]); if (0 > pid) { SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Invalid pid"); diff --git a/server/sttp.h b/server/sttp.h old mode 100644 new mode 100755 index d78698a..cd20c6b --- a/server/sttp.h +++ b/server/sttp.h @@ -30,16 +30,16 @@ extern "C" { * @brief Enumerations of error codes. */ typedef enum { - STTP_ERROR_NONE = 0, /**< Successful */ - STTP_ERROR_OUT_OF_MEMORY = -ENOMEM, /**< Out of Memory */ - STTP_ERROR_IO_ERROR = -EIO, /**< I/O error */ - STTP_ERROR_INVALID_PARAMETER = -EINVAL, /**< Invalid parameter */ - STTP_ERROR_OUT_OF_NETWORK = -ENETDOWN, /**< Out of network */ - STTP_ERROR_INVALID_STATE = -0x0100031, /**< Invalid state */ - STTP_ERROR_INVALID_LANGUAGE = -0x0100032, /**< Invalid language */ - STTP_ERROR_OPERATION_FAILED = -0x0100034, /**< Operation failed */ - STTP_ERROR_NOT_SUPPORTED_FEATURE= -0x0100035 /**< Not supported feature */ -}sttp_error_e; + STTP_ERROR_NONE = 0, /**< Successful */ + STTP_ERROR_OUT_OF_MEMORY = -ENOMEM, /**< Out of Memory */ + STTP_ERROR_IO_ERROR = -EIO, /**< I/O error */ + STTP_ERROR_INVALID_PARAMETER = -EINVAL, /**< Invalid parameter */ + STTP_ERROR_OUT_OF_NETWORK = -ENETDOWN, /**< Out of network */ + STTP_ERROR_INVALID_STATE = -0x0100031, /**< Invalid state */ + STTP_ERROR_INVALID_LANGUAGE = -0x0100032, /**< Invalid language */ + STTP_ERROR_OPERATION_FAILED = -0x0100034, /**< Operation failed */ + STTP_ERROR_NOT_SUPPORTED_FEATURE = -0x0100035 /**< Not supported feature */ +} sttp_error_e; /** * @brief Enumerations of audio type. @@ -47,7 +47,7 @@ typedef enum { typedef enum { STTP_AUDIO_TYPE_PCM_S16_LE = 0, /**< Signed 16bit audio type, Little endian */ STTP_AUDIO_TYPE_PCM_U8 /**< Unsigned 8bit audio type */ -}sttp_audio_type_e; +} sttp_audio_type_e; /** * @brief Enumerations of callback event. @@ -56,7 +56,7 @@ typedef enum { STTP_RESULT_EVENT_FINAL_RESULT = 0, /**< Event when the recognition full or last result is ready */ STTP_RESULT_EVENT_PARTIAL_RESULT, /**< Event when the recognition partial result is ready */ STTP_RESULT_EVENT_ERROR /**< Event when the recognition has failed */ -}sttp_result_event_e; +} sttp_result_event_e; /** * @brief Enumerations of result time callback event. @@ -65,7 +65,7 @@ typedef enum { STTP_RESULT_TIME_EVENT_BEGINNING = 0, /**< Event when the token is beginning type */ STTP_RESULT_TIME_EVENT_MIDDLE, /**< Event when the token is middle type */ STTP_RESULT_TIME_EVENT_END /**< Event when the token is end type */ -}sttp_result_time_event_e; +} sttp_result_time_event_e; /** * @brief Enumerations of silence type. @@ -73,7 +73,7 @@ typedef enum { typedef enum { STTP_SILENCE_TYPE_NO_RECORD_TIMEOUT = 0, /**< No sound is recorded */ STTP_SILENCE_TYPE_END_OF_SPEECH_DETECTED /**< End of speech is detected */ -}sttp_silence_type_e; +} sttp_silence_type_e; /** * @brief Recognition type : free form dictation and default type. @@ -214,7 +214,7 @@ typedef bool (*sttpe_supported_language_cb)(const char* language, void* user_dat * * @see sttpe_deinitialize() */ -typedef int (* sttpe_initialize)(sttpe_result_cb result_cb, sttpe_silence_detected_cb silence_cb); +typedef int (*sttpe_initialize)(sttpe_result_cb result_cb, sttpe_silence_detected_cb silence_cb); /** * @brief Deinitializes the engine @@ -225,7 +225,7 @@ typedef int (* sttpe_initialize)(sttpe_result_cb result_cb, sttpe_silence_detect * * @see sttpe_initialize() */ -typedef int (* sttpe_deinitialize)(void); +typedef int (*sttpe_deinitialize)(void); /** * @brief Retrieves all supported languages of the engine. @@ -242,7 +242,7 @@ typedef int (* sttpe_deinitialize)(void); * * @see sttpe_supported_language_cb() */ -typedef int (* sttpe_foreach_supported_langs)(sttpe_supported_language_cb callback, void* user_data); +typedef int (*sttpe_foreach_supported_langs)(sttpe_supported_language_cb callback, void* user_data); /** * @brief Checks whether a language is valid or not. @@ -253,7 +253,7 @@ typedef int (* sttpe_foreach_supported_langs)(sttpe_supported_language_cb callba * * @see sttpe_foreach_supported_languages() */ -typedef bool (* sttpe_is_valid_language)(const char* language); +typedef bool (*sttpe_is_valid_language)(const char* language); /** * @brief Gets whether the engine supports silence detection. @@ -262,7 +262,7 @@ typedef bool (* sttpe_is_valid_language)(const char* language); * * @see sttpe_set_silence_detection() */ -typedef bool (* sttpe_support_silence_detection)(void); +typedef bool (*sttpe_support_silence_detection)(void); /** * @brief Gets supporting recognition type. @@ -270,7 +270,7 @@ typedef bool (* sttpe_support_silence_detection)(void); * @return @c true to support recognition type, \n @c false not to support recognition type. * */ -typedef bool (* sttpe_support_recognition_type)(const char* type); +typedef bool (*sttpe_support_recognition_type)(const char* type); /** * @brief Gets recording format of the engine. @@ -283,7 +283,7 @@ typedef bool (* sttpe_support_recognition_type)(const char* type); * @retval #STTP_ERROR_NONE Successful * @retval #STTP_ERROR_INVALID_STATE Not initialized */ -typedef int (* sttpe_get_recording_format)(sttp_audio_type_e* types, int* rate, int* channels); +typedef int (*sttpe_get_recording_format)(sttp_audio_type_e* types, int* rate, int* channels); /** * @brief Sets silence detection option. @@ -295,7 +295,7 @@ typedef int (* sttpe_get_recording_format)(sttp_audio_type_e* types, int* rate, * @retval #STTP_ERROR_INVALID_STATE Not initialized * @retval #STTP_ERROR_NOT_SUPPORTED_FEATURE Not supported feature */ -typedef int (* sttpe_set_silence_detection)(bool value); +typedef int (*sttpe_set_silence_detection)(bool value); /** * @brief Gets whether application is agreed to get engine service. @@ -308,7 +308,7 @@ typedef int (* sttpe_set_silence_detection)(bool value); * @retval #STTP_ERROR_INVALID_STATE Not initialized * @retval #STTP_ERROR_NOT_SUPPORTED_FEATURE Not supported feature */ -typedef int (* sttpe_check_app_agreed)(const char* appid, bool* value); +typedef int (*sttpe_check_app_agreed)(const char* appid, bool* value); /** * @brief Retrieves result time info in recognition callback of daemon. @@ -326,7 +326,7 @@ typedef int (* sttpe_check_app_agreed)(const char* appid, bool* value); * * @see sttpe_result_time_cb() */ -typedef int (* sttpe_foreach_result_time)(void* time_info, sttpe_result_time_cb callback, void* user_data); +typedef int (*sttpe_foreach_result_time)(void* time_info, sttpe_result_time_cb callback, void* user_data); /** * @brief Start recognition. @@ -349,7 +349,7 @@ typedef int (* sttpe_foreach_result_time)(void* time_info, sttpe_result_time_cb * @see sttpe_stop() * @see sttpe_cancel() */ -typedef int (* sttpe_start)(const char* language, const char* type, void *user_data); +typedef int (*sttpe_start)(const char* language, const char* type, void *user_data); /** * @brief Sets recording data for speech recognition from recorder. @@ -372,7 +372,7 @@ typedef int (* sttpe_start)(const char* language, const char* type, void *user_d * @see sttpe_cancel() * @see sttpe_stop() */ -typedef int (* sttpe_set_recording_data)(const void* data, unsigned int length); +typedef int (*sttpe_set_recording_data)(const void* data, unsigned int length); /** * @brief Stops to set recording data. @@ -391,7 +391,7 @@ typedef int (* sttpe_set_recording_data)(const void* data, unsigned int length); * @see sttpe_result_cb() * @see sttpe_cancel() */ -typedef int (* sttpe_stop)(void); +typedef int (*sttpe_stop)(void); /** * @brief Cancels the recognition process. @@ -404,7 +404,7 @@ typedef int (* sttpe_stop)(void); * @see sttpe_start() * @see sttpe_stop() */ -typedef int (* sttpe_cancel)(void); +typedef int (*sttpe_cancel)(void); /** * @brief Start recognition of file. @@ -428,7 +428,7 @@ typedef int (* sttpe_cancel)(void); * * @see sttpe_cancel_file() */ -typedef int (* sttpe_start_file)(const char* language, const char* type, const char* filepath, +typedef int (*sttpe_start_file)(const char* language, const char* type, const char* filepath, sttp_audio_type_e audio_type, int sample_rate, void *user_data); /** @@ -441,7 +441,7 @@ typedef int (* sttpe_start_file)(const char* language, const char* type, const c * * @see sttpe_start_file() */ -typedef int (* sttpe_cancel_file)(void); +typedef int (*sttpe_cancel_file)(void); /** * @brief A structure of the engine functions. diff --git a/test/test_main.c b/test/test_main.c old mode 100644 new mode 100755 index 7e80ad1..03a99c8 --- a/test/test_main.c +++ b/test/test_main.c @@ -204,7 +204,7 @@ static void __stt_recognition_result_cb(stt_h stt, stt_result_event_e event, con 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");