From 7b229a23544146fe989f5a1f16f266134ab4b7b4 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 12 May 2020 18:37:20 +0900 Subject: [PATCH 01/16] Temporary integration with ma_ap library Change-Id: Ib76300f7dfe19072669e43d1b33898a6ff8b5ce8 --- CMakeLists.txt | 4 ++-- packaging/voice-control.spec | 1 + server/vcd_recorder.c | 25 +++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8574677..90fc56b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,12 +48,12 @@ INCLUDE(FindPkgConfig) IF("${_TV_PRODUCT}" STREQUAL "TRUE") pkg_check_modules(pkgs REQUIRED aul buxton2 capi-appfw-app-control capi-appfw-app-manager capi-base-common capi-media-audio-io capi-media-sound-manager ecore-wl2 - capi-network-bluetooth capi-network-bluetooth-tv capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf msfapi farfield-voice-api + capi-network-bluetooth capi-network-bluetooth-tv capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf msfapi farfield-voice-api multi-assistant ) ELSE() pkg_check_modules(pkgs REQUIRED aul buxton2 capi-appfw-app-control capi-appfw-app-manager capi-base-common capi-media-audio-io capi-media-sound-manager ecore-wl2 - capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf + capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf multi-assistant ) ENDIF() diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 1d9f2d3..78801c1 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -40,6 +40,7 @@ BuildRequires: pkgconfig(msfapi) BuildRequires: pkgconfig(farfield-voice-api) %endif BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(multi-assistant) BuildRequires: cmake %description diff --git a/server/vcd_recorder.c b/server/vcd_recorder.c index a2d2648..7a48d61 100644 --- a/server/vcd_recorder.c +++ b/server/vcd_recorder.c @@ -43,6 +43,8 @@ #include "vcd_recorder.h" #include "vcd_main.h" +#include + #define FRAME_LENGTH 160 #define BUFFER_LENGTH FRAME_LENGTH * 2 @@ -258,6 +260,25 @@ static void _ffv_audio_function_cb(void* data, unsigned int length, void* user_d } #endif +void audio_streaming_cb(ma_audio_streaming_event_e event, char* buffer, int len, void* user_data) +{ + if (0 == g_buffer_count || 0 == g_buffer_count % 50) { + SLOG(LOG_INFO, TAG_VCD, "[Recorder INFO] MA_ap audio function callback is invoked"); + + if (100000 == g_buffer_count) { + g_buffer_count = 0; + } + } + + g_buffer_count++; + + if (NULL != g_audio_cb) { + if (0 != g_audio_cb(buffer, len)) { + SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to read audio"); + } + } +} + #if 1 static const char* __get_focus_changed_reason_code(sound_stream_focus_change_reason_e reason) { @@ -504,11 +525,15 @@ int vcd_recorder_create(vcd_recoder_audio_cb audio_cb, vcd_recorder_interrupt_cb SLOG(LOG_INFO, TAG_VCD, "[Recorder] Audio type : %s", g_current_audio_type); + ma_ap_initialize(); + ma_ap_set_audio_streaming_cb(audio_streaming_cb, NULL); + return 0; } int vcd_recorder_destroy() { + ma_ap_deinitialize(); if (VCD_RECORDER_STATE_RECORDING == g_recorder_state) { if (0 == strncmp(VCE_AUDIO_ID_BLUETOOTH, g_current_audio_type, strlen(VCE_AUDIO_ID_BLUETOOTH))) { #ifdef TV_BT_MODE -- 2.7.4 From 2385286d70ecf35b96fbcb4ae46c8d6d416c7e61 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Thu, 9 Jul 2020 10:57:17 +0900 Subject: [PATCH 02/16] Remove unnecessary header Change-Id: Iecef17f7ea56028bea23b250687cb502d4917d69 Signed-off-by: Suyeon Hwang --- server/vcd_recorder.c | 1 - server/vcd_server.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/server/vcd_recorder.c b/server/vcd_recorder.c index 7a48d61..c781470 100644 --- a/server/vcd_recorder.c +++ b/server/vcd_recorder.c @@ -21,7 +21,6 @@ #endif #include -#include #include #include #ifdef TV_PRODUCT diff --git a/server/vcd_server.c b/server/vcd_server.c index b88f356..d675240 100755 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -16,10 +16,6 @@ #include #include -#include -#include -#include -#include #include "vc_cmd_db.h" #include "vc_info_parser.h" -- 2.7.4 From 5db2de67c7f83bcc4ad2ea33cf81203619450e6e Mon Sep 17 00:00:00 2001 From: sungrae jo Date: Thu, 30 Jul 2020 13:36:06 +0900 Subject: [PATCH 03/16] Fixed enum value for vc_tts_utterance_status_e Change-Id: I01fe0b9f25be912764cc8a2aeb98be053e97e8a3 Signed-off-by: sungrae jo --- client/vc_mgr.c | 2 +- include/voice_control_common.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/vc_mgr.c b/client/vc_mgr.c index 7acde3c..3caa9ae 100755 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -4359,7 +4359,7 @@ int vc_mgr_send_utterance_status(int pid, int utt_id, vc_tts_utterance_status_e return VC_ERROR_PERMISSION_DENIED; } - if (VC_TTS_UTTERANCE_NONE > utt_status || VC_TTS_UTTERANCE_CANCELED < utt_status) { + if (VC_TTS_UTTERANCE_NONE > utt_status || VC_TTS_UTTERANCE_CANCELED < utt_status || 0 == utt_status) { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] utt_status is not valid. (%d)", utt_status); return VC_ERROR_INVALID_PARAMETER; } diff --git a/include/voice_control_common.h b/include/voice_control_common.h index f8ca800..136e628 100644 --- a/include/voice_control_common.h +++ b/include/voice_control_common.h @@ -138,7 +138,7 @@ typedef enum { * @since_tizen 5.5 */ typedef enum { - VC_TTS_UTTERANCE_NONE = 0, /**< None */ + VC_TTS_UTTERANCE_NONE = -1, /**< None */ VC_TTS_UTTERANCE_STARTED = 1, /**< Utterance started */ VC_TTS_UTTERANCE_COMPLETED = 2, /**< Utterance completed */ VC_TTS_UTTERANCE_CANCELED = 3 /**< Utterance canceled */ -- 2.7.4 From dc698bfe7e94c9496bdda96f8832329199fc03c7 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Thu, 30 Jul 2020 18:04:47 +0900 Subject: [PATCH 04/16] Add system_background type for vc_mgr_set_command_list_from_file() API Change-Id: I404da413b8981ee1a362d8525397c73d5edf7c73 Signed-off-by: Suyeon Hwang --- common/vc_json_parser.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/vc_json_parser.c b/common/vc_json_parser.c index d6be245..63e838b 100644 --- a/common/vc_json_parser.c +++ b/common/vc_json_parser.c @@ -87,6 +87,8 @@ static int __vc_json_set_commands(JsonObject *root_obj, int type, char* invocati temp_type = strdup("widget"); } else if (VC_COMMAND_TYPE_SYSTEM == type) { temp_type = strdup("system"); + } else if (VC_COMMAND_TYPE_SYSTEM_BACKGROUND == type) { + temp_type = strdup("systemBackground"); } else if (VC_COMMAND_TYPE_EXCLUSIVE == type) { temp_type = strdup("exclusive"); } -- 2.7.4 From 9d346e67c083280b4a399f771ad0a5ab38f4cfd1 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Fri, 31 Jul 2020 13:38:57 +0900 Subject: [PATCH 05/16] Restore neccessary header files Change-Id: I670bd938dd27f0b035b6da899232081a31bb7eb5 Signed-off-by: Suyeon Hwang --- server/vcd_recorder.c | 1 + server/vcd_server.c | 1 + 2 files changed, 2 insertions(+) diff --git a/server/vcd_recorder.c b/server/vcd_recorder.c index c781470..7a48d61 100644 --- a/server/vcd_recorder.c +++ b/server/vcd_recorder.c @@ -21,6 +21,7 @@ #endif #include +#include #include #include #ifdef TV_PRODUCT diff --git a/server/vcd_server.c b/server/vcd_server.c index d675240..cd5e3b4 100755 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -16,6 +16,7 @@ #include #include +#include #include "vc_cmd_db.h" #include "vc_info_parser.h" -- 2.7.4 From 0142ddac3902c466834d6665a0ab99b557537f30 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Fri, 31 Jul 2020 14:24:11 +0900 Subject: [PATCH 06/16] Add to send set volume in audio_streaming_cb Change-Id: If302fa2feebff6fe2f2ac4c54448cdcf9d36f4d5 Signed-off-by: sooyeon.kim --- server/vcd_recorder.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/vcd_recorder.c b/server/vcd_recorder.c index c781470..dddc02c 100644 --- a/server/vcd_recorder.c +++ b/server/vcd_recorder.c @@ -276,6 +276,14 @@ void audio_streaming_cb(ma_audio_streaming_event_e event, char* buffer, int len, SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to read audio"); } } + + /* Set volume */ + if (0 == g_buffer_count % 15) { + float vol_db = get_volume_decibel(buffer, len); + if (0 != vcdc_send_set_volume(vcd_client_manager_get_pid(), vol_db)) { + SLOG(LOG_ERROR, TAG_VCD, "[Recorder] Fail to send recording volume(%f)", vol_db); + } + } } #if 1 -- 2.7.4 From 6593c97c375e67532e6eca421d9889ff3a1d8093 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Fri, 31 Jul 2020 15:04:08 +0900 Subject: [PATCH 07/16] Add to set audio handles as NULL Change-Id: I5bd36e406a7021764fc469b7f639d56e77a89687 Signed-off-by: sooyeon.kim --- server/vcd_recorder.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/vcd_recorder.c b/server/vcd_recorder.c index dddc02c..8695383 100644 --- a/server/vcd_recorder.c +++ b/server/vcd_recorder.c @@ -559,14 +559,17 @@ int vcd_recorder_destroy() int ret = sound_manager_remove_device_connection_changed_cb(g_device_id); if (0 != ret) SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to remove device connection changed callback, ret(%d)", ret); + g_device_id = -1; ret = sound_manager_destroy_stream_information(g_stream_info_h); if (0 != ret) SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to destroy stream info, ret(%d)", ret); + g_stream_info_h = NULL; ret = audio_in_destroy(g_audio_h); if (0 != ret) SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to audio in destroy, ret(%d)", ret); + g_audio_h = NULL; #ifdef TV_FFV_MODE if (NULL != g_farfieldvoice_h) { @@ -679,6 +682,7 @@ int vcd_recorder_set(const char* audio_type, vce_audio_type_e type, int rate, in if (g_audio_type != type || g_audio_rate != rate || g_audio_channel != channel) { SLOG(LOG_INFO, TAG_VCD, "[Recorder] New audio type(%d) rate(%d) channel(%d)", type, rate, channel); audio_in_destroy(g_audio_h); + g_audio_h = NULL; audio_channel_e audio_ch = AUDIO_CHANNEL_MONO; audio_sample_type_e audio_sample_type; @@ -908,6 +912,7 @@ static void __check_audio_format() if (g_audio_type != type || g_audio_rate != rate || g_audio_channel != channel) { SLOG(LOG_INFO, TAG_VCD, "[Recorder] New audio type(%d) rate(%d) channel(%d)", type, rate, channel); audio_in_destroy(g_audio_h); + g_audio_h = NULL; audio_channel_e audio_ch; audio_sample_type_e audio_type; -- 2.7.4 From 7bab32340d618e30ce56c0ebcb84446516fb925d Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Mon, 3 Aug 2020 10:43:19 +0900 Subject: [PATCH 08/16] Version up to 1.60.12 Change-Id: Ia01ceaeb9cbc20a175c2ce036b0ec089133fa722 Signed-off-by: Suyeon Hwang --- CMakeLists.txt | 2 +- packaging/voice-control.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 90fc56b..b93d8c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ PROJECT(vc) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "${PREFIX}") -SET(VERSION 1.60.11) +SET(VERSION 1.60.12) FIND_PROGRAM(UNAME NAMES uname) EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 78801c1..69aa1e1 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -1,6 +1,6 @@ Name: voice-control Summary: Voice control client library and daemon -Version: 1.60.11 +Version: 1.60.12 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Apache-2.0 -- 2.7.4 From 37157c7b737df2acafa2a559773a6f6d1a94a592 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Fri, 11 Sep 2020 14:08:46 +0900 Subject: [PATCH 09/16] Exclude some logs from lcov Change-Id: I54c31c003b4c3060f23ba3cb8116e9b8eaf06776 Signed-off-by: sooyeon.kim --- client/vc.c | 170 +++++++++++++++++++++++++++++++----------------------------- 1 file changed, 89 insertions(+), 81 deletions(-) diff --git a/client/vc.c b/client/vc.c index cd57765..f5ed34d 100644 --- a/client/vc.c +++ b/client/vc.c @@ -76,19 +76,21 @@ static int __vc_get_feature_enabled() if (0 == system_info_get_platform_bool(VC_FEATURE_PATH, &vc_supported)) { if (0 == system_info_get_platform_bool(VC_MIC_FEATURE_PATH, &mic_supported)) { if (false == vc_supported || false == mic_supported) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Voice control feature NOT supported"); g_feature_enabled = 0; return VC_ERROR_NOT_SUPPORTED; + //LCOV_EXCL_STOP } g_feature_enabled = 1; } else { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get feature value"); //LCOV_EXCL_LINE - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } } else { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get feature value"); //LCOV_EXCL_LINE - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } } @@ -111,7 +113,7 @@ static int __check_privilege(const char* uid, const char * privilege) char smack_label[1024] = {'\0',}; if (!p_cynara) { - return false; + return false; //LCOV_EXCL_LINE } fp = fopen(label_path, "r"); @@ -130,7 +132,7 @@ static int __check_privilege(const char* uid, const char * privilege) free(session); if (ret != CYNARA_API_ACCESS_ALLOWED) - return false; + return false; //LCOV_EXCL_LINE return true; } @@ -140,7 +142,7 @@ static void __check_privilege_deinitialize() { int ret = cynara_finish(p_cynara); if (ret != CYNARA_API_SUCCESS) - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] cynara finish %d", ret); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] cynara finish %d", ret); //LCOV_EXCL_LINE } p_cynara = NULL; } @@ -156,9 +158,11 @@ static int __vc_check_privilege() bool ret = true; ret = __check_privilege_initialize(); if (false == ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] privilege initialize is failed"); //LCOV_EXCL_LINE + //LCOV_EXCL_START + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] privilege initialize is failed"); pthread_mutex_unlock(&g_cynara_mutex); return VC_ERROR_PERMISSION_DENIED; + //LCOV_EXCL_STOP } char uid[16]; @@ -167,9 +171,11 @@ static int __vc_check_privilege() ret = __check_privilege(uid, VC_PRIVILEGE); __check_privilege_deinitialize(); if (false == ret) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Permission is denied"); pthread_mutex_unlock(&g_cynara_mutex); return VC_ERROR_PERMISSION_DENIED; + //LCOV_EXCL_STOP } } @@ -320,10 +326,10 @@ static Eina_Bool __focus_changed_cb(void *data, int type, void *event) int vc_initialize(void) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } SLOG(LOG_INFO, TAG_VCC, "@@@ [Client] Initialize"); @@ -412,10 +418,10 @@ int vc_deinitialize(void) int ret = VC_ERROR_NONE; if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } SLOG(LOG_INFO, TAG_VCC, "@@@ [Client] Deinitialize"); @@ -643,10 +649,10 @@ static void __end_prepare_thread(void *data, Ecore_Thread *thread) int vc_prepare(void) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Prepare"); @@ -676,10 +682,10 @@ int vc_prepare(void) int vc_prepare_sync(void) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Prepare"); @@ -717,10 +723,10 @@ int vc_prepare_sync(void) int vc_unprepare(void) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Unprepare"); @@ -752,10 +758,10 @@ int vc_unprepare(void) int vc_foreach_supported_languages(vc_supported_language_cb callback, void* user_data) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Foreach Supported Language"); @@ -789,10 +795,10 @@ int vc_foreach_supported_languages(vc_supported_language_cb callback, void* user int vc_get_current_language(char** language) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Get Current Language"); @@ -825,10 +831,10 @@ int vc_get_current_language(char** language) int vc_get_state(vc_state_e* state) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Get State"); @@ -864,10 +870,10 @@ int vc_get_state(vc_state_e* state) int vc_get_service_state(vc_service_state_e* state) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Get Service State"); @@ -917,10 +923,10 @@ int vc_get_service_state(vc_service_state_e* state) int vc_get_system_command_list(vc_cmd_list_h* vc_sys_cmd_list) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Get system command list"); @@ -1034,10 +1040,10 @@ int vc_get_system_command_list(vc_cmd_list_h* vc_sys_cmd_list) int vc_is_command_format_supported(vc_cmd_format_e format, bool* support) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Is command format supported"); @@ -1087,12 +1093,14 @@ static int __vc_get_invocation_name(char** invocation_name) ret = app_manager_get_app_id(getpid(), &appid); if (0 != ret || NULL == appid) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get appid, ret(%d)", ret); //LCOV_EXCL_LINE if (NULL != appid) { free(appid); appid = NULL; } return VC_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } ret = vc_get_current_language(&lang); @@ -1109,6 +1117,7 @@ static int __vc_get_invocation_name(char** invocation_name) ret = app_info_get_localed_label(appid, lang, &temp_label); if (0 != ret || NULL == temp_label) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get localed label, ret(%d) appid(%s) lang(%s)", ret, appid, lang); //LCOV_EXCL_LINE free(appid); appid = NULL; @@ -1119,6 +1128,7 @@ static int __vc_get_invocation_name(char** invocation_name) temp_label = NULL; } return VC_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } *invocation_name = strdup(temp_label); @@ -1142,10 +1152,10 @@ static int __vc_get_invocation_name(char** invocation_name) int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Set Command list"); @@ -1247,10 +1257,10 @@ int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type) int vc_unset_command_list(int type) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Unset Command list"); @@ -1313,10 +1323,10 @@ int vc_unset_command_list(int type) int vc_set_command_list_from_file(const char* file_path, int type) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Set Command list from file"); @@ -1365,7 +1375,6 @@ int vc_set_command_list_from_file(const char* file_path, int type) do { ret = vc_dbus_request_set_command(g_vc->handle, (vc_cmd_type_e)type); if (0 != ret) { - //LCOV_EXCL_START if (VC_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { vc_client_set_client_state(g_vc, VC_STATE_INITIALIZED); if (0 == vc_prepare_sync()) { @@ -1384,7 +1393,6 @@ int vc_set_command_list_from_file(const char* file_path, int type) break; } } - //LCOV_EXCL_STOP } } while (0 != ret); } @@ -1794,10 +1802,10 @@ void __vc_cb_result(void) int vc_get_result(vc_result_cb callback, void* user_data) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Get result"); @@ -1861,10 +1869,10 @@ int vc_get_result(vc_result_cb callback, void* user_data) int vc_set_result_cb(vc_result_cb callback, void* user_data) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } if (NULL == callback) @@ -1890,10 +1898,10 @@ int vc_set_result_cb(vc_result_cb callback, void* user_data) int vc_unset_result_cb(void) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } vc_state_e state; @@ -1945,7 +1953,6 @@ int __vc_cb_service_state(int state) return 0; } -//LCOV_EXCL_STOP int __vc_cb_manager_pid(int manager_pid) { @@ -1956,14 +1963,15 @@ int __vc_cb_manager_pid(int manager_pid) return 0; } +//LCOV_EXCL_STOP int vc_set_service_state_changed_cb(vc_service_state_changed_cb callback, void* user_data) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } if (NULL == callback) @@ -1989,10 +1997,10 @@ int vc_set_service_state_changed_cb(vc_service_state_changed_cb callback, void* int vc_unset_service_state_changed_cb(void) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } vc_state_e state; @@ -2015,10 +2023,10 @@ int vc_unset_service_state_changed_cb(void) int vc_set_state_changed_cb(vc_state_changed_cb callback, void* user_data) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } if (callback == NULL) @@ -2044,10 +2052,10 @@ int vc_set_state_changed_cb(vc_state_changed_cb callback, void* user_data) int vc_unset_state_changed_cb(void) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } vc_state_e state; @@ -2070,10 +2078,10 @@ int vc_unset_state_changed_cb(void) int vc_set_current_language_changed_cb(vc_current_language_changed_cb callback, void* user_data) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } if (NULL == callback) @@ -2099,10 +2107,10 @@ int vc_set_current_language_changed_cb(vc_current_language_changed_cb callback, int vc_unset_current_language_changed_cb(void) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } vc_state_e state; @@ -2125,10 +2133,10 @@ int vc_unset_current_language_changed_cb(void) int vc_set_error_cb(vc_error_cb callback, void* user_data) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } if (NULL == callback) @@ -2154,10 +2162,10 @@ int vc_set_error_cb(vc_error_cb callback, void* user_data) int vc_unset_error_cb(void) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } vc_state_e state; @@ -2180,10 +2188,10 @@ int vc_unset_error_cb(void) int vc_set_invocation_name(const char* name) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } vc_state_e state; @@ -2218,10 +2226,10 @@ int vc_set_server_dialog(const char* app_id, const char* credential) SLOG(LOG_DEBUG, TAG_VCC, "@@@ Set server dialog, pid(%d), app_id(%s)", getpid(), app_id); if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } if (NULL == credential) { @@ -2309,10 +2317,10 @@ int vc_unset_server_dialog(const char* app_id) SLOG(LOG_DEBUG, TAG_VCC, "@@@ Unset server dialog, pid(%d), app_id(%s)", getpid(), app_id); if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } if (0 != vc_client_get_client_state(g_vc, &state)) { @@ -2398,10 +2406,10 @@ int vc_request_dialog(const char* disp_text, const char* utt_text, bool auto_sta SLOG(LOG_DEBUG, TAG_VCC, "@@@ Request dialog"); if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } if (0 != vc_client_get_client_state(g_vc, &state)) { @@ -3015,10 +3023,10 @@ int vc_tts_request(const char* text, const char* language, bool to_vc_manager, i SLOG(LOG_DEBUG, TAG_VCC, "@@@ Request tts"); if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } if (0 != vc_client_get_client_state(g_vc, &state)) { @@ -3085,10 +3093,10 @@ int vc_tts_cancel(int utt_id) SLOG(LOG_DEBUG, TAG_VCC, "@@@ Cancel tts"); if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } if (0 != vc_client_get_client_state(g_vc, &state)) { @@ -3160,10 +3168,10 @@ int vc_tts_get_synthesized_audio_details(int* rate, vc_audio_channel_e* channel, SLOG(LOG_DEBUG, TAG_VCC, "@@@ Get tts audio format"); if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } if (0 != vc_client_get_client_state(g_vc, &state)) { @@ -3224,10 +3232,10 @@ int vc_tts_get_synthesized_audio_details(int* rate, vc_audio_channel_e* channel, int vc_tts_set_streaming_cb(vc_tts_streaming_cb callback, void* user_data) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } if (NULL == callback) @@ -3253,10 +3261,10 @@ int vc_tts_set_streaming_cb(vc_tts_streaming_cb callback, void* user_data) int vc_tts_unset_streaming_cb(void) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } vc_state_e state; @@ -3298,10 +3306,10 @@ int __vc_cb_utterance_status(int utt_id, int utt_status) int vc_tts_set_utterance_status_cb(vc_tts_utterance_status_cb callback, void* user_data) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } if (NULL == callback) @@ -3327,10 +3335,10 @@ int vc_tts_set_utterance_status_cb(vc_tts_utterance_status_cb callback, void* us int vc_tts_unset_utterance_status_cb(void) { if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; + return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; + return VC_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } vc_state_e state; -- 2.7.4 From 3b3078565a05e00ae492a2e69e0eb928b6b8e579 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 9 Sep 2020 20:48:29 +0900 Subject: [PATCH 10/16] Add unittests Change-Id: I0706d0bfc8ebd75d63b6149e5885b696a9afcaea Signed-off-by: Jihoon Kim --- CMakeLists.txt | 14 +- client/vc_setting.c | 5 - packaging/voice-control.spec | 24 +- tests/CMakeLists.txt | 46 + tests/org.tizen.vc-unittests.manifest | 5 + tests/org.tizen.vc-unittests.xml | 13 + tests/src/cynara_mock.cpp | 34 + tests/src/cynara_mock.h | 87 + tests/src/main.cpp | 7 + tests/src/system_info_mock.cpp | 11 + tests/src/system_info_mock.h | 16 + tests/src/vc_denied_unittests.cpp | 45 + tests/src/vc_unittests.cpp | 3170 +++++++++++++++++++++++++++++++++ 13 files changed, 3468 insertions(+), 9 deletions(-) create mode 100644 tests/CMakeLists.txt create mode 100644 tests/org.tizen.vc-unittests.manifest create mode 100644 tests/org.tizen.vc-unittests.xml create mode 100644 tests/src/cynara_mock.cpp create mode 100644 tests/src/cynara_mock.h create mode 100644 tests/src/main.cpp create mode 100644 tests/src/system_info_mock.cpp create mode 100644 tests/src/system_info_mock.h create mode 100644 tests/src/vc_denied_unittests.cpp create mode 100644 tests/src/vc_unittests.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index b93d8c6..eb9b3f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,12 +48,12 @@ INCLUDE(FindPkgConfig) IF("${_TV_PRODUCT}" STREQUAL "TRUE") pkg_check_modules(pkgs REQUIRED aul buxton2 capi-appfw-app-control capi-appfw-app-manager capi-base-common capi-media-audio-io capi-media-sound-manager ecore-wl2 - capi-network-bluetooth capi-network-bluetooth-tv capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf msfapi farfield-voice-api multi-assistant + capi-network-bluetooth capi-network-bluetooth-tv capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf msfapi farfield-voice-api multi-assistant gmock ) ELSE() pkg_check_modules(pkgs REQUIRED aul buxton2 capi-appfw-app-control capi-appfw-app-manager capi-base-common capi-media-audio-io capi-media-sound-manager ecore-wl2 - capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf multi-assistant + capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf multi-assistant gmock ) ENDIF() @@ -91,3 +91,13 @@ INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/bin/aarch64/vc_getengine DESTINATION ${TZ_S ELSEIF("${ARCH}" MATCHES "^x86_64.*") INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/bin/x86_64/vc_getengine DESTINATION ${TZ_SYS_BIN}) ENDIF() + +## Test +IF(NOT DEFINED MINIMUM_BUILD) +ENABLE_TESTING() +SET(UNITTEST_VC vc-unittests) +ADD_TEST(NAME ${UNITTEST_VC} COMMAND ${UNITTEST_VC} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests) + +ADD_SUBDIRECTORY(tests) +ENDIF(NOT DEFINED MINIMUM_BUILD) diff --git a/client/vc_setting.c b/client/vc_setting.c index cbba8ad..4a8ca0e 100644 --- a/client/vc_setting.c +++ b/client/vc_setting.c @@ -45,11 +45,6 @@ static void* g_enabled_changed_user_data = NULL; static vc_setting_current_language_changed_cb g_current_language_changed_cb = NULL; static void* g_current_language_changed_user_data = NULL; -const char* vc_tag() -{ - return TAG_VCS; -} - void __config_lang_changed_cb(const char* before_lang, const char* current_lang) { SLOG(LOG_DEBUG, TAG_VCS, "Lang changed : before(%s) current(%s)", before_lang, current_lang); diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 69aa1e1..2bdd9e8 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -42,6 +42,12 @@ BuildRequires: pkgconfig(farfield-voice-api) BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(multi-assistant) BuildRequires: cmake +BuildRequires: pkgconfig(gmock) + +%if 0%{?gcov:1} +BuildRequires: lcov +BuildRequires: zip +%endif %description Voice Control client library and daemon @@ -99,6 +105,14 @@ Group: Graphics & UI Framework/Voice Framework Voice control gcov objects %endif +%package unittests +Summary: Voice control tests +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description unittests +GTest for Voice Control + %prep %setup -q -n %{name}-%{version} @@ -116,10 +130,10 @@ export LDFLAGS="$LDFLAGS -lgcov" %if "%{tizen_profile_name}" == "tv" export CFLAGS="$CFLAGS -DTV_PRODUCT" cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DBINDIR=%{_bindir} -DINCLUDEDIR=%{_includedir} \ - -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -D_TV_PRODUCT=TRUE -DTZ_SYS_BIN=%TZ_SYS_BIN + -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -D_TV_PRODUCT=TRUE -DTZ_SYS_BIN=%TZ_SYS_BIN -DTZ_SYS_RO_PACKAGES=%TZ_SYS_RO_PACKAGES -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP %else cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DBINDIR=%{_bindir} -DINCLUDEDIR=%{_includedir} \ - -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -DTZ_SYS_BIN=%TZ_SYS_BIN + -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -DTZ_SYS_BIN=%TZ_SYS_BIN -DTZ_SYS_RO_PACKAGES=%TZ_SYS_RO_PACKAGES -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP %endif make %{?jobs:-j%jobs} @@ -225,3 +239,9 @@ mkdir -p %{_libdir}/voice/vc %files gcov %{_datadir}/gcov/obj/* %endif + +%files unittests +%manifest tests/org.tizen.vc-unittests.manifest +%defattr(-,root,root,-) +%{TZ_SYS_RO_PACKAGES}/org.tizen.vc-unittests.xml +%{TZ_SYS_RO_APP}/org.tizen.vc-unittests/bin/vc-unittests diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..ec00560 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,46 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(gtest-voice-control CXX) + +SET(PKGNAME "org.tizen.vc-unittests") +SET(BINDIR "${TZ_SYS_RO_APP}/${PKGNAME}/bin") + +FOREACH(flag ${pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror") +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIE") +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Werror") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -std=c++11") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") + +SET(SOURCES "") + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include) + +AUX_SOURCE_DIRECTORY(src SOURCES) +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../client VC_CLIENT_SOURCES) +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../common VC_COMMON_SOURCES) + +ADD_DEFINITIONS("-DFULLVER=\"${FULLVER}\"") + +ADD_EXECUTABLE(${UNITTEST_VC} + ${VC_COMMON_SOURCES} + ${VC_CLIENT_SOURCES} + ${SOURCES} + ) +TARGET_LINK_LIBRARIES(${UNITTEST_VC} ${GTEST_LIBRARIES} ${pkgs_LDFLAGS} ${EXTRA_LDFLAGS}) +SET_TARGET_PROPERTIES(${UNITTEST_VC} PROPERTIES + COMPILE_FLAGS "-fPIE" + #Never add any space for LINKFLAGS + LINK_FLAGS "-Wl,\ +--wrap=system_info_get_platform_bool,\ +--wrap=cynara_initialize,\ +--wrap=cynara_finish,\ +--wrap=cynara_session_from_pid,\ +--wrap=cynara_check") + +INSTALL(FILES ${CMAKE_SOURCE_DIR}/tests/${PKGNAME}.xml DESTINATION ${TZ_SYS_RO_PACKAGES}) +INSTALL(TARGETS ${UNITTEST_VC} DESTINATION ${BINDIR}) diff --git a/tests/org.tizen.vc-unittests.manifest b/tests/org.tizen.vc-unittests.manifest new file mode 100644 index 0000000..97e8c31 --- /dev/null +++ b/tests/org.tizen.vc-unittests.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/org.tizen.vc-unittests.xml b/tests/org.tizen.vc-unittests.xml new file mode 100644 index 0000000..663ba43 --- /dev/null +++ b/tests/org.tizen.vc-unittests.xml @@ -0,0 +1,13 @@ + + + + Jihoon Kim + Voice Control unittests + + + + + + http://tizen.org/privilege/recorder + + diff --git a/tests/src/cynara_mock.cpp b/tests/src/cynara_mock.cpp new file mode 100644 index 0000000..ff6e88f --- /dev/null +++ b/tests/src/cynara_mock.cpp @@ -0,0 +1,34 @@ +#include "cynara_mock.h" +#include +#include +#include + +static int check_result = CYNARA_API_ACCESS_ALLOWED; + +void cynara_check_set_result(int result) +{ + check_result = result; +} + +EXPORT_API int __wrap_cynara_initialize(cynara** c, const cynara_configuration* conf) +{ + *c = (void *)0x1; + return 0; +} + +EXPORT_API int __wrap_cynara_finish(cynara* c) +{ + return 0; +} + +EXPORT_API int __wrap_cynara_check(cynara* c, const char* client, const char* client_session, + const char* user, + const char* privilege) +{ + return check_result; +} + +EXPORT_API char *__wrap_cynara_session_from_pid(pid_t pid) +{ + return strdup("session"); +} diff --git a/tests/src/cynara_mock.h b/tests/src/cynara_mock.h new file mode 100644 index 0000000..1becb42 --- /dev/null +++ b/tests/src/cynara_mock.h @@ -0,0 +1,87 @@ +#ifndef MOCK_CYNARA_H_ +#define MOCK_CYNARA_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void cynara; +typedef void* cynara_configuration; + +/*! \brief indicating that API call was interrupted by user*/ +#define CYNARA_API_INTERRUPTED 4 + +/*! \brief indicating access that cannot be resolved without further actions*/ +#define CYNARA_API_ACCESS_NOT_RESOLVED 3 + +/*! \brief indicating access that was checked is allowed */ +#define CYNARA_API_ACCESS_ALLOWED 2 + +/*! \brief indicating that access that was checked is denied */ +#define CYNARA_API_ACCESS_DENIED 1 + +/*! \brief indicating the result of the one specific API is successful */ +#define CYNARA_API_SUCCESS 0 + +/*! \brief indicating that value is not present in cache */ +#define CYNARA_API_CACHE_MISS -1 + +/*! \brief indicating that pending requests reached maximum */ +#define CYNARA_API_MAX_PENDING_REQUESTS -2 + +/*! \brief indicating system is running out of memory state */ +#define CYNARA_API_OUT_OF_MEMORY -3 + +/*! \brief indicating the API's parameter is malformed */ +#define CYNARA_API_INVALID_PARAM -4 + +/*! \brief indicating that service is not available */ +#define CYNARA_API_SERVICE_NOT_AVAILABLE -5 + +/*! \brief indicating that provided method is not supported by library */ +#define CYNARA_API_METHOD_NOT_SUPPORTED -6 + +/*! \brief cynara service does not allow to perform requested operation */ +#define CYNARA_API_OPERATION_NOT_ALLOWED -7 + +/*! \brief cynara service failed to perform requested operation */ +#define CYNARA_API_OPERATION_FAILED -8 + +/*! \brief cynara service hasn't found requested bucket */ +#define CYNARA_API_BUCKET_NOT_FOUND -9 + +/*! \brief indicating an unknown error */ +#define CYNARA_API_UNKNOWN_ERROR -10 + +/*! \brief indicating configuration error */ +#define CYNARA_API_CONFIGURATION_ERROR -11 + +/*! \brief indicating invalid parameter in command-line */ +#define CYNARA_API_INVALID_COMMANDLINE_PARAM -12 + +/*! \brief indicating that provided buffer is too short */ +#define CYNARA_API_BUFFER_TOO_SHORT -13 + +/*! \brief indicating that database is corrupted */ +#define CYNARA_API_DATABASE_CORRUPTED -14 + +/*! \brief indicating that user doesn't have enough permission to perform action */ +#define CYNARA_API_PERMISSION_DENIED -15 + +void cynara_check_set_result(int result); + +int __wrap_cynara_initialize(cynara** c, const cynara_configuration* conf); +int __wrap_cynara_finish(cynara* c); +int __wrap_cynara_check(cynara* c, const char* client, const char* client_session, + const char* user, + const char* privilege); + +char *__wrap_cynara_session_from_pid(pid_t pid); + +#ifdef __cplusplus +} +#endif +#endif /* MOCK_CYNARA_H_ */ diff --git a/tests/src/main.cpp b/tests/src/main.cpp new file mode 100644 index 0000000..a37d671 --- /dev/null +++ b/tests/src/main.cpp @@ -0,0 +1,7 @@ +#include +#include + +int main(int argc, char** argv) { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/tests/src/system_info_mock.cpp b/tests/src/system_info_mock.cpp new file mode 100644 index 0000000..0e00a70 --- /dev/null +++ b/tests/src/system_info_mock.cpp @@ -0,0 +1,11 @@ +#include "system_info_mock.h" +#include +#include + +EXPORT_API int __wrap_system_info_get_platform_bool(const char *key, bool *value) +{ + if (value) + *value = true; + + return 0; +} diff --git a/tests/src/system_info_mock.h b/tests/src/system_info_mock.h new file mode 100644 index 0000000..075c93b --- /dev/null +++ b/tests/src/system_info_mock.h @@ -0,0 +1,16 @@ +#ifndef MOCK_SYSTEM_INFO_H_ +#define MOCK_SYSTEM_INFO_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int __wrap_system_info_get_platform_bool(const char *key, bool *value); + +#ifdef __cplusplus +} +#endif +#endif /* MOCK_SYSTEM_INFO_H_ */ diff --git a/tests/src/vc_denied_unittests.cpp b/tests/src/vc_denied_unittests.cpp new file mode 100644 index 0000000..c133af6 --- /dev/null +++ b/tests/src/vc_denied_unittests.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#include "cynara_mock.h" +#include "system_info_mock.h" + +namespace { + +class VCDeniedTest : public testing::Test { + public: + virtual void SetUp() { + /* start of TC */ + cynara_check_set_result(CYNARA_API_ACCESS_DENIED); + } + virtual void TearDown() { + /* end of TC */ + cynara_check_set_result(CYNARA_API_ACCESS_ALLOWED); + } +}; + +TEST_F(VCDeniedTest, utc_stt_create_denied) +{ + int ret = VC_ERROR_NONE; + + ret = vc_initialize(); + EXPECT_EQ(ret, VC_ERROR_PERMISSION_DENIED); +} + +} // namespace diff --git a/tests/src/vc_unittests.cpp b/tests/src/vc_unittests.cpp new file mode 100644 index 0000000..531f36f --- /dev/null +++ b/tests/src/vc_unittests.cpp @@ -0,0 +1,3170 @@ +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include + +#include +#include "system_info_mock.h" +#include "cynara_mock.h" + +static int g_vc_init = false; +static vc_state_e g_vc_state = VC_STATE_NONE; +static bool g_vc_supported = false; + +static void __vc_result_cb(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char* result, void* user_data) +{ +} + +static void __vc_current_language_changed_cb(const char* previous, const char* current, void* user_data) +{ +} + +static bool __vc_supported_language_cb(const char* language, void* user_data) +{ + return true; +} + +static void __vc_state_changed_cb(vc_state_e previous, vc_state_e current, void* user_data) +{ + g_vc_state = current; +} + +static void __vc_service_state_changed_cb(vc_service_state_e previous, vc_service_state_e current, void* user_data) +{ +} + +static void __vc_error_cb(vc_error_e reason, void* user_data) +{ +} + +static bool __vc_cmd_list_cb(vc_cmd_h vc_command, void* user_data) +{ + return true; +} + +namespace { + +class VCTest : public testing::Test { + public: + virtual void SetUp() { + ecore_init(); + ecore_main_loop_glib_integrate(); + + cynara_check_set_result(CYNARA_API_ACCESS_ALLOWED); + + g_vc_supported = false; + bool mic_supported = false; + bool vc_supported = false; + if (0 == system_info_get_platform_bool("http://tizen.org/feature/speech.control", &vc_supported)) + { + if (0 == system_info_get_platform_bool("http://tizen.org/feature/microphone", &mic_supported)) + { + if (true == vc_supported && true == mic_supported) + { + g_vc_supported = true; + } + } + } + + g_vc_init = false; + if (true == g_vc_supported) + { + int ret = VC_ERROR_NONE; + ret = vc_initialize(); + if (VC_ERROR_NONE == ret) + { + ret = vc_set_state_changed_cb(__vc_state_changed_cb, NULL); + if (VC_ERROR_NONE != ret) + { + g_vc_init = false; + } + else + { + g_vc_init = true; + } + } + else + { + g_vc_init = false; + } + } + } + + virtual void TearDown() + { + if (true == g_vc_supported) + { + vc_unset_state_changed_cb(); + + vc_deinitialize(); + } + + g_vc_init = false; + + ecore_shutdown(); + } +}; + +TEST_F(VCTest, utc_vc_initialize_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + } else { + EXPECT_EQ(g_vc_init, true); + } +} + +/** + * @testcase utc_vc_deinitialize_p + * @since_tizen 2.4 + * @description Positive UTC for deinitialize voice control handle + */ +TEST_F(VCTest, vc_deinitialize_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_deinitialize_n + * @since_tizen 2.4 + * @description Negative UTC for deinitialize voice control handle (Already deinitialized) + */ +TEST_F(VCTest, vc_deinitialize_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_prepare_p + * @since_tizen 2.4 + * @description Positive UTC for connect service daemon + */ +TEST_F(VCTest, vc_prepare_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_prepare_n + * @since_tizen 2.4 + * @description Negative UTC for connect service daemon (Invalid state) + */ +TEST_F(VCTest, vc_prepare_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + vc_deinitialize(); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_unprepare_p + * @since_tizen 2.4 + * @description Positive UTC for disconnect service daemon + */ +TEST_F(VCTest, vc_unprepare_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_unprepare_n + * @since_tizen 2.4 + * @description Negative UTC for disconnect service daemon (Invalid state) + */ +TEST_F(VCTest, vc_unprepare_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_unprepare_n2 + * @since_tizen 2.4 + * @description Negative UTC for disconnect service daemon (Invalid state) + */ +TEST_F(VCTest, vc_unprepare_n2) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_foreach_supported_languages_p + * @since_tizen 2.4 + * @description Positive UTC for get supported language list + */ +TEST_F(VCTest, vc_foreach_supported_languages_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_foreach_supported_languages(__vc_supported_language_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_foreach_supported_languages(__vc_supported_language_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_foreach_supported_languages_n + * @since_tizen 2.4 + * @description Negative UTC for get supported language list (Invalid parameter) + */ +TEST_F(VCTest, vc_foreach_supported_languages_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_foreach_supported_languages(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_foreach_supported_languages(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_foreach_supported_languages_n2 + * @since_tizen 2.4 + * @description Negative UTC for get supported language list (Invalid state) + */ +TEST_F(VCTest, vc_foreach_supported_languages_n2) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_foreach_supported_languages(__vc_supported_language_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_foreach_supported_languages(__vc_supported_language_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_get_current_language_p + * @since_tizen 2.4 + * @description Positive UTC for get current language + */ +TEST_F(VCTest, vc_get_current_language_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + char *lang = NULL; + ret = vc_get_current_language(&lang); + if (NULL != lang) { + free(lang); + lang = NULL; + } + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + char *lang = NULL; + ret = vc_get_current_language(&lang); + if (NULL != lang) { + free(lang); + lang = NULL; + } + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_get_current_language_n + * @since_tizen 2.4 + * @description Negative UTC for get current language (Invalid parameter) + */ +TEST_F(VCTest, vc_get_current_language_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_get_current_language(NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_get_current_language(NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_get_current_language_n2 + * @since_tizen 2.4 + * @description Negative UTC for get current language (Invalid state) + */ +TEST_F(VCTest, vc_get_current_language_n2) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + char *lang = NULL; + ret = vc_get_current_language(&lang); + if (NULL != lang) { + free(lang); + lang = NULL; + } + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + char *lang = NULL; + ret = vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_get_current_language(&lang); + if (NULL != lang) { + free(lang); + lang = NULL; + } + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_get_state_p + * @since_tizen 2.4 + * @description Positive UTC for get current state + */ +TEST_F(VCTest, vc_get_state_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_state_e state = VC_STATE_NONE; + ret = vc_get_state(&state); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_state_e state = VC_STATE_NONE; + ret = vc_get_state(&state); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_get_state_p2 + * @since_tizen 2.4 + * @description Positive UTC for get current state after connection + */ +TEST_F(VCTest, vc_get_state_p2) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_state_e state = VC_STATE_NONE; + ret = vc_get_state(&state); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + vc_state_e state = VC_STATE_NONE; + ret = vc_get_state(&state); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_get_state_n + * @since_tizen 2.4 + * @description Negative UTC for get current state (Invalid parameter) + */ +TEST_F(VCTest, vc_get_state_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_get_state(NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_get_state(NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_get_state_n2 + * @since_tizen 2.4 + * @description Negative UTC for get current state (Invalid state) + */ +TEST_F(VCTest, vc_get_state_n2) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_state_e state = VC_STATE_NONE; + ret = vc_get_state(&state); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_state_e state = VC_STATE_NONE; + ret = vc_get_state(&state); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_get_service_state_p + * @since_tizen 2.4 + * @description Positive UTC for get current state of service daemon + */ +TEST_F(VCTest, vc_get_service_state_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_service_state_e state = VC_SERVICE_STATE_NONE; + ret = vc_get_service_state(&state); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + vc_service_state_e state = VC_SERVICE_STATE_NONE; + ret = vc_get_service_state(&state); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_get_service_state_n + * @since_tizen 2.4 + * @description Negative UTC for get current state of service daemon (Invalid parameter) + */ +TEST_F(VCTest, vc_get_service_state_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_get_service_state(NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_get_service_state(NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_get_service_state_n2 + * @since_tizen 2.4 + * @description Negative UTC for get current state of service daemon (Invalid state) + */ +TEST_F(VCTest, vc_get_service_state_n2) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_service_state_e state = VC_SERVICE_STATE_NONE; + ret = vc_get_service_state(&state); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_service_state_e state = VC_SERVICE_STATE_NONE; + ret = vc_get_service_state(&state); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_get_system_command_list_p + * @since_tizen 3.0 + * @description Positive UTC for get the system command list + */ +TEST_F(VCTest, vc_get_system_command_list_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_get_system_command_list(&list); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + vc_cmd_list_h list = NULL; + ret = vc_get_system_command_list(&list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_get_system_command_list_n + * @since_tizen 3.0 + * @description Negative UTC for get the system command list (Invalid parameter) + */ +TEST_F(VCTest, vc_get_system_command_list_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_get_system_command_list(NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_get_system_command_list(NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_get_system_command_list_n2 + * @since_tizen 3.0 + * @description Negative UTC for get the system command list (Invalid state) + */ +TEST_F(VCTest, vc_get_system_command_list_n2) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_get_system_command_list(&list); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_list_h list = NULL; + ret = vc_get_system_command_list(&list); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_set_command_list_p + * @since_tizen 2.4 + * @description Positive UTC for set command list used as candidate set + */ +TEST_F(VCTest, vc_set_command_list_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_set_command_list(list, VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_create(&list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_set_command(cmd, "voice"); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_set_type(cmd, VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_add(list, cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_set_command_list(list, VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_destroy(list, true); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_set_command_list_n + * @since_tizen 2.4 + * @description Negative UTC for set command list used as candidate set (Invalid parameter) + */ +TEST_F(VCTest, vc_set_command_list_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_command_list(NULL, VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_set_command_list(NULL, VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_set_command_list_n2 + * @since_tizen 2.4 + * @description Negative UTC for set command list used as candidate set (Invalid state) + */ +TEST_F(VCTest, vc_set_command_list_n2) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_set_command_list(list, VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_create(&list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_set_command_list(list, VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + + ret = vc_cmd_list_destroy(list, true); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_set_command_list_n3 + * @since_tizen 2.4 + * @description Negative UTC for set command list used as candidate set (Invalid state) + */ +TEST_F(VCTest, vc_set_command_list_n3) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_set_command_list(list, VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_create(&list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_set_command_list(list, VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + + ret = vc_cmd_list_destroy(list, true); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_unset_command_list_p + * @since_tizen 2.4 + * @description Positive UTC for unset command list used as candidate set + */ +TEST_F(VCTest, vc_unset_command_list_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unset_command_list(VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_create(&list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_set_command(cmd, "voice"); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_set_type(cmd, VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_add(list, cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_set_command_list(list, VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_unset_command_list(VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_destroy(list, true); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_unset_command_list_n + * @since_tizen 2.4 + * @description Negative UTC for unset command list used as candidate set (Invalid state) + */ +TEST_F(VCTest, vc_unset_command_list_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unset_command_list(VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_unset_command_list(VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_unset_command_list_n2 + * @since_tizen 2.4 + * @description Negative UTC for unset command list used as candidate set (Invalid state) + */ +TEST_F(VCTest, vc_unset_command_list_n2) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unset_command_list(VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_unset_command_list(VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_get_result_p + * @since_tizen 3.0 + * @description Positive UTC for getting the recognition result + */ +TEST_F(VCTest, vc_get_result_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_get_result(__vc_result_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + ret = vc_get_result(__vc_result_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_get_result_n + * @since_tizen 3.0 + * @description Negative UTC for getting the recognition result (Invalid parameter) + */ +TEST_F(VCTest, vc_get_result_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_get_result(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + ret = vc_get_result(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_set_result_cb_p + * @since_tizen 2.4 + * @description Positive UTC for set result callback + */ +TEST_F(VCTest, vc_set_result_cb_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_result_cb(__vc_result_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_set_result_cb(__vc_result_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_set_result_cb_n + * @since_tizen 2.4 + * @description Negative UTC for set result callback (Invalid parameter) + */ +TEST_F(VCTest, vc_set_result_cb_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_result_cb(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_set_result_cb(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_set_result_cb_n2 + * @since_tizen 2.4 + * @description Negative UTC for set result callback (Invalid state) + */ +TEST_F(VCTest, vc_set_result_cb_n2) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_result_cb(__vc_result_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_set_result_cb(__vc_result_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_set_result_cb_n3 + * @since_tizen 2.4 + * @description Negative UTC for set result callback (Invalid state) + */ +TEST_F(VCTest, vc_set_result_cb_n3) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_result_cb(__vc_result_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + ret = vc_set_result_cb(__vc_result_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_unset_result_cb_p + * @since_tizen 2.4 + * @description Positive UTC for unset result callback + */ +TEST_F(VCTest, vc_unset_result_cb_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unset_result_cb(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_set_result_cb(__vc_result_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_unset_result_cb(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_unset_result_cb_n + * @since_tizen 2.4 + * @description Negative UTC for unset result callback (Invalid state) + */ +TEST_F(VCTest, vc_unset_result_cb_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unset_result_cb(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_unset_result_cb(); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_unset_result_cb_n2 + * @since_tizen 2.4 + * @description Negative UTC for unset result callback (Invalid state) + */ +TEST_F(VCTest, vc_unset_result_cb_n2) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unset_result_cb(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + ret = vc_unset_result_cb(); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_set_service_state_changed_cb_p + * @since_tizen 2.4 + * @description Positive UTC for set service state changed callback + */ +TEST_F(VCTest, vc_set_service_state_changed_cb_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_service_state_changed_cb(__vc_service_state_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_set_service_state_changed_cb(__vc_service_state_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NONE); + } + + +} + +/** + * @testcase utc_vc_set_service_state_changed_cb_n + * @since_tizen 2.4 + * @description Negative UTC for set service state changed callback (Invalid parameter) + */ +TEST_F(VCTest, vc_set_service_state_changed_cb_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_service_state_changed_cb(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_set_service_state_changed_cb(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_set_service_state_changed_cb_n2 + * @since_tizen 2.4 + * @description Negative UTC for set service state changed callback (Invalid state) + */ +TEST_F(VCTest, vc_set_service_state_changed_cb_n2) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_service_state_changed_cb(__vc_service_state_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_set_service_state_changed_cb(__vc_service_state_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_set_service_state_changed_cb_n3 + * @since_tizen 2.4 + * @description Nagative UTC for set service state changed callback (Invalid state) + */ +TEST_F(VCTest, vc_set_service_state_changed_cb_n3) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_service_state_changed_cb(__vc_service_state_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + ret = vc_set_service_state_changed_cb(__vc_service_state_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_unset_service_state_changed_cb_p + * @since_tizen 2.4 + * @description Positive UTC for unset service state changed callback + */ +TEST_F(VCTest, vc_unset_service_state_changed_cb_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unset_service_state_changed_cb(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_set_service_state_changed_cb(__vc_service_state_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_unset_service_state_changed_cb(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_unset_service_state_changed_cb_n + * @since_tizen 2.4 + * @description Negative UTC for unset service state changed callback (Invalid state) + */ +TEST_F(VCTest, vc_unset_service_state_changed_cb_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unset_service_state_changed_cb(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + vc_deinitialize(); + + int ret = VC_ERROR_NONE; + ret = vc_unset_service_state_changed_cb(); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_unset_service_state_changed_cb_n2 + * @since_tizen 2.4 + * @description Negative UTC for unset service state changed callback (Invalid state) + */ +TEST_F(VCTest, vc_unset_service_state_changed_cb_n2) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unset_service_state_changed_cb(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + ret = vc_unset_service_state_changed_cb(); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_set_state_changed_cb_p + * @since_tizen 2.4 + * @description Positive UTC for set state changed callback + */ +TEST_F(VCTest, vc_set_state_changed_cb_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + int ret = VC_ERROR_NONE; + ret = vc_set_state_changed_cb(__vc_state_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + } +} + +/** + * @testcase utc_vc_set_state_changed_cb_n + * @since_tizen 2.4 + * @description Negative UTC for set state changed callback (Invalid parameter) + */ +TEST_F(VCTest, vc_set_state_changed_cb_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_state_changed_cb(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_set_state_changed_cb(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_set_state_changed_cb_n2 + * @since_tizen 2.4 + * @description Nagative UTC for set state changed callback (Invalid state) + */ +TEST_F(VCTest, vc_set_state_changed_cb_n2) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_state_changed_cb(__vc_state_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_set_state_changed_cb(__vc_state_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_set_state_changed_cb_n3 + * @since_tizen 2.4 + * @description Negative UTC for set state changed callback (Invalid state) + */ +TEST_F(VCTest, vc_set_state_changed_cb_n3) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_state_changed_cb(__vc_state_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + ret = vc_set_state_changed_cb(__vc_state_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_unset_state_changed_cb_p + * @since_tizen 2.4 + * @description Positive UTC for unset state changed callback + */ +TEST_F(VCTest, vc_unset_state_changed_cb_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unset_state_changed_cb(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_unset_state_changed_cb(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_unset_state_changed_cb_n + * @since_tizen 2.4 + * @description Negative UTC for unset state changed callback (Invalid state) + */ +TEST_F(VCTest, vc_unset_state_changed_cb_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unset_state_changed_cb(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + vc_deinitialize(); + + int ret = VC_ERROR_NONE; + ret = vc_unset_state_changed_cb(); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_set_current_language_changed_cb_p + * @since_tizen 2.4 + * @description Positive UTC for set current language changed callback + */ +TEST_F(VCTest, vc_set_current_language_changed_cb_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_current_language_changed_cb(__vc_current_language_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_set_current_language_changed_cb(__vc_current_language_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_set_current_language_changed_cb_n + * @since_tizen 2.4 + * @description Negative UTC for set current language changed callback (invalid parameter) + */ +TEST_F(VCTest, vc_set_current_language_changed_cb_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_current_language_changed_cb(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_set_current_language_changed_cb(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_set_current_language_changed_cb_n2 + * @since_tizen 2.4 + * @description Negative UTC for set current language changed callback (Invalid state) + */ +TEST_F(VCTest, vc_set_current_language_changed_cb_n2) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_current_language_changed_cb(__vc_current_language_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + ret = vc_set_current_language_changed_cb(__vc_current_language_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_set_current_language_changed_cb_n3 + * @since_tizen 2.4 + * @description Negative UTC for set current language changed callback (Invalid state) + */ +TEST_F(VCTest, vc_set_current_language_changed_cb_n3) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_current_language_changed_cb(__vc_current_language_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_set_current_language_changed_cb(__vc_current_language_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_unset_current_language_changed_cb_p + * @since_tizen 2.4 + * @description Positive UTC for unset current language changed callback + */ +TEST_F(VCTest, vc_unset_current_language_changed_cb_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unset_current_language_changed_cb(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_set_current_language_changed_cb(__vc_current_language_changed_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_unset_current_language_changed_cb(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_unset_current_language_changed_cb_n + * @since_tizen 2.4 + * @description Negative UTC for unset current language changed callback (Invalid state) + */ +TEST_F(VCTest, vc_unset_current_language_changed_cb_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unset_current_language_changed_cb(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + vc_deinitialize(); + + int ret = VC_ERROR_NONE; + ret = vc_unset_current_language_changed_cb(); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_unset_current_language_changed_cb_n2 + * @since_tizen 2.4 + * @description Negative UTC for unset current language changed callback (Invalid state) + */ +TEST_F(VCTest, vc_unset_current_language_changed_cb_n2) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unset_current_language_changed_cb(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + ret = vc_unset_current_language_changed_cb(); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_set_error_cb_p + * @since_tizen 2.4 + * @description Positive UTC for set error callback + */ +TEST_F(VCTest, vc_set_error_cb_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_error_cb(__vc_error_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_set_error_cb(__vc_error_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_set_error_cb_n + * @since_tizen 2.4 + * @description Negative UTC for set error callback (Invalid parameter) + */ +TEST_F(VCTest, vc_set_error_cb_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_error_cb(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_set_error_cb(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_set_error_cb_n2 + * @since_tizen 2.4 + * @description Negative UTC for set error callback (Invalid state) + */ +TEST_F(VCTest, vc_set_error_cb_n2) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_error_cb(__vc_error_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_deinitialize(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_set_error_cb(__vc_error_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_set_error_cb_n3 + * @since_tizen 2.4 + * @description Negative UTC for set error callback (Invalid state) + */ +TEST_F(VCTest, vc_set_error_cb_n3) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_set_error_cb(__vc_error_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + ret = vc_set_error_cb(__vc_error_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_unset_error_cb_p + * @since_tizen 2.4 + * @description Positive UTC for unset error callback + */ +TEST_F(VCTest, vc_unset_error_cb_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unset_error_cb(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_set_error_cb(__vc_error_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_unset_error_cb(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_unset_error_cb_n + * @since_tizen 2.4 + * @description Negative UTC for unset error callback (Invalid state) + */ +TEST_F(VCTest, vc_unset_error_cb_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unset_error_cb(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + vc_deinitialize(); + + int ret = VC_ERROR_NONE; + ret = vc_unset_error_cb(); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_unset_error_cb_n2 + * @since_tizen 2.4 + * @description Negative UTC for unset error callback (Invalid state) + */ +TEST_F(VCTest, vc_unset_error_cb_n2) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_unset_error_cb(); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + ret = vc_unset_error_cb(); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_set_invocation_name_p + * @since_tizen 3.0 + * @description Positive UTC for setting the invocation name + */ +TEST_F(VCTest, vc_set_invocation_name_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + const char* invoc_name = "testapp"; + ret = vc_set_invocation_name(invoc_name); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + const char* invoc_name = "testapp"; + + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + ret = vc_set_invocation_name(invoc_name); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_set_invocation_name_n + * @since_tizen 3.0 + * @description Negative UTC for setting the invocation name (Invalid state) + */ +TEST_F(VCTest, vc_set_invocation_name_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + const char* invoc_name = "testapp"; + ret = vc_set_invocation_name(invoc_name); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + const char* invoc_name = "testapp"; + + ret = vc_set_invocation_name(invoc_name); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_request_dialog_p + * @since_tizen 3.0 + * @description Positive UTC for requesting the dialog + */ +TEST_F(VCTest, vc_request_dialog_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + const char* disp_txt = "test"; + const char* utt_txt = "test"; + bool is_auto_start = true; + ret = vc_request_dialog(disp_txt, utt_txt, is_auto_start); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + const char* disp_txt = "test"; + const char* utt_txt = "test"; + bool is_auto_start = true; + + ret = vc_prepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + + while (VC_STATE_READY != g_vc_state) { + ecore_main_loop_iterate(); + } + + ret = vc_request_dialog(disp_txt, utt_txt, is_auto_start); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_unprepare(); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_request_dialog_n + * @since_tizen 3.0 + * @description Negative UTC for requesting the dialog (Invalid state) + */ +TEST_F(VCTest, vc_request_dialog_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + const char* disp_txt = "voice control test"; + const char* utt_txt = "This is a test for requesting the dialog"; + bool is_auto_start = true; + ret = vc_request_dialog(disp_txt, utt_txt, is_auto_start); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + vc_deinitialize(); + + int ret = VC_ERROR_NONE; + const char* disp_txt = "voice control test"; + const char* utt_txt = "This is a test for requesting the dialog"; + bool is_auto_start = true; + ret = vc_request_dialog(disp_txt, utt_txt, is_auto_start); + EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + } +} + +/** + * @testcase utc_vc_cmd_list_create_p + * @since_tizen 2.4 + * @description Positive UTC for create command list handle + */ +TEST_F(VCTest, vc_cmd_list_create_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_create(&list); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_create(&list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_list_destroy(list, false); + } +} + +/** + * @testcase utc_vc_cmd_list_create_n + * @since_tizen 2.4 + * @description Negative UTC for create command list handle (Invalid parameter) + */ +TEST_F(VCTest, vc_cmd_list_create_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_create(NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_create(NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_list_destroy_p + * @since_tizen 2.4 + * @description Positive UTC for destroy command list handle + */ +TEST_F(VCTest, vc_cmd_list_destroy_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_destroy(list, false); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_create(&list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_destroy(list, false); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_cmd_list_destroy_n + * @since_tizen 2.4 + * @description Negative UTC for destroy command list handle (Invalid parameter) + */ +TEST_F(VCTest, vc_cmd_list_destroy_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_destroy(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_destroy(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_list_get_count_p + * @since_tizen 2.4 + * @description Positive UTC for get count of command in command list + */ +TEST_F(VCTest, vc_cmd_list_get_count_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + int cnt = -1; + ret = vc_cmd_list_get_count(list, &cnt); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_create(&list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + int cnt = -1; + ret = vc_cmd_list_get_count(list, &cnt); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_list_destroy(list, false); + } +} + +/** + * @testcase utc_vc_cmd_list_get_count_n + * @since_tizen 2.4 + * @description Negative UTC for get count of command in command list (Invalid parameter) + */ +TEST_F(VCTest, vc_cmd_list_get_count_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_get_count(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_get_count(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_list_add_p + * @since_tizen 2.4 + * @description Positive UTC for add command in command list + */ +TEST_F(VCTest, vc_cmd_list_add_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + vc_cmd_h cmd = NULL; + ret = vc_cmd_list_add(list, cmd); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_create(&list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_add(list, cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_list_destroy(list, true); + } +} + +/** + * @testcase utc_vc_cmd_list_add_n + * @since_tizen 2.4 + * @description Negative UTC for add command in command list (Invalid parameter) + */ +TEST_F(VCTest, vc_cmd_list_add_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_add(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_add(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_list_remove_p + * @since_tizen 2.4 + * @description Positive UTC for remove command in command list + */ +TEST_F(VCTest, vc_cmd_list_remove_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + vc_cmd_h cmd = NULL; + ret = vc_cmd_list_remove(list, cmd); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_create(&list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_add(list, cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_remove(list, cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_list_destroy(list, true); + } +} + +/** + * @testcase utc_vc_cmd_list_remove_n + * @since_tizen 2.4 + * @description Negative UTC for remove command in command list (Invalid parameter) + */ +TEST_F(VCTest, vc_cmd_list_remove_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_remove(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_remove(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_list_foreach_commands_p + * @since_tizen 2.4 + * @description Positive UTC for get whole command in command list + */ +TEST_F(VCTest, vc_cmd_list_foreach_commands_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_foreach_commands(list, __vc_cmd_list_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_create(&list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_add(list, cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_foreach_commands(list, __vc_cmd_list_cb, NULL); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_list_destroy(list, true); + } +} + +/** + * @testcase utc_vc_cmd_list_foreach_commands_n + * @since_tizen 2.4 + * @description Negative UTC for get whole command in command list (Invalid parameter) + */ +TEST_F(VCTest, vc_cmd_list_foreach_commands_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_foreach_commands(NULL, NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_foreach_commands(NULL, NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_list_first_p + * @since_tizen 2.4 + * @description Positive UTC for move pointer to the first of command list + */ +TEST_F(VCTest, vc_cmd_list_first_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_first(list); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_create(&list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_add(list, cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_first(list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_list_destroy(list, true); + } +} + +/** + * @testcase utc_vc_cmd_list_first_n + * @since_tizen 2.4 + * @description Negative UTC for move pointer to the first of command list (Invalid parameter) + */ +TEST_F(VCTest, vc_cmd_list_first_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_first(NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_first(NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_list_last_p + * @since_tizen 2.4 + * @description Positive UTC for move pointer to the last of command list + */ +TEST_F(VCTest, vc_cmd_list_last_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_last(list); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_create(&list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_add(list, cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_last(list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_list_destroy(list, true); + } +} + +/** + * @testcase utc_vc_cmd_list_last_n + * @since_tizen 2.4 + * @description Negative UTC for move pointer to the last of command list (Invalid parameter) + */ +TEST_F(VCTest, vc_cmd_list_last_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_last(NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_last(NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_list_next_p + * @since_tizen 2.4 + * @description Positive UTC for move pointer to next command in command list + */ +TEST_F(VCTest, vc_cmd_list_next_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_next(list); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_create(&list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_h cmd = NULL; + int i; + for (i = 0; i < 2; i++) { + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_add(list, cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + } + + ret = vc_cmd_list_first(list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_next(list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_list_destroy(list, true); + } +} + +/** + * @testcase utc_vc_cmd_list_next_n + * @since_tizen 2.4 + * @description Negative UTC for move pointer to next command in command list (Invalid parameter) + */ +TEST_F(VCTest, vc_cmd_list_next_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_next(NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_next(NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_list_prev_p + * @since_tizen 2.4 + * @description Positive UTC for move pointer to previous command in command list + */ +TEST_F(VCTest, vc_cmd_list_prev_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_prev(list); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_create(&list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_h cmd = NULL; + int i; + for (i = 0; i < 2; i++) { + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_add(list, cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + } + + ret = vc_cmd_list_last(list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_prev(list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_list_destroy(list, true); + } +} + +/** + * @testcase utc_vc_cmd_list_prev_n + * @since_tizen 2.4 + * @description Negative UTC for move pointer to previous command in command list (Invalid parameter) + */ +TEST_F(VCTest, vc_cmd_list_prev_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_prev(NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_prev(NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_list_get_current_p + * @since_tizen 2.4 + * @description Positive UTC for get command handle of current pointer + */ +TEST_F(VCTest, vc_cmd_list_get_current_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + vc_cmd_h cur = NULL; + ret = vc_cmd_list_get_current(list, &cur); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_list_h list = NULL; + ret = vc_cmd_list_create(&list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_add(list, cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_list_first(list); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_h cur = NULL; + ret = vc_cmd_list_get_current(list, &cur); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_list_destroy(list, true); + } +} + +/** + * @testcase utc_vc_cmd_list_get_current_n + * @since_tizen 2.4 + * @description Negative UTC for get command handle of current pointer (Invalid parameter) + */ +TEST_F(VCTest, vc_cmd_list_get_current_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_get_current(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_list_get_current(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_create_p + * @since_tizen 2.4 + * @description Positive UTC for create command handle + */ +TEST_F(VCTest, vc_cmd_create_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_destroy(cmd); + } +} + +/** + * @testcase utc_vc_cmd_create_n + * @since_tizen 2.4 + * @description Negative UTC for create command handle + */ +TEST_F(VCTest, vc_cmd_create_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_create(NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_create(NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_destroy_p + * @since_tizen 2.4 + * @description Positive UTC for destroy command handle + */ +TEST_F(VCTest, vc_cmd_destroy_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_h cmd = NULL; + ret = vc_cmd_destroy(cmd); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_destroy(cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + } +} + +/** + * @testcase utc_vc_cmd_destroy_n + * @since_tizen 2.4 + * @description Negative UTC for destroy command handle (Invalid parameter) + */ +TEST_F(VCTest, vc_cmd_destroy_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_destroy(NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_destroy(NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_set_command_p + * @since_tizen 2.4 + * @description Positive UTC for set command text in handle + */ +TEST_F(VCTest, vc_cmd_set_command_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_h cmd = NULL; + ret = vc_cmd_set_command(cmd, "voice"); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_set_command(cmd, "voice"); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_destroy(cmd); + } +} + +/** + * @testcase utc_vc_cmd_set_command_n + * @since_tizen 2.4 + * @description Negative UTC for set command text in handle (Invalid parameter) + */ +TEST_F(VCTest, vc_cmd_set_command_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_set_command(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_set_command(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_get_command_p + * @since_tizen 2.4 + * @description Positive UTC for get command text in handle + */ +TEST_F(VCTest, vc_cmd_get_command_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_h cmd = NULL; + char *text = NULL; + ret = vc_cmd_get_command(cmd, &text); + if (NULL != text) { + free(text); + text = NULL; + } + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_set_command(cmd, "voice"); + EXPECT_EQ(ret, VC_ERROR_NONE); + + char *text = NULL; + ret = vc_cmd_get_command(cmd, &text); + if (NULL != text) { + free(text); + text = NULL; + } + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_destroy(cmd); + } +} + +/** + * @testcase utc_vc_cmd_get_command_n + * @since_tizen 2.4 + * @description Negative UTC for get command text in handle (Invalid parameter) + */ +TEST_F(VCTest, vc_cmd_get_command_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_get_command(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_get_command(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_get_unfixed_command_p + * @since_tizen 3.0 + * @description Positive UTC for getting the unfixed command text in handle + */ +TEST_F(VCTest, vc_cmd_get_unfixed_command_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_h cmd = NULL; + char *text = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + + ret = vc_cmd_get_unfixed_command(cmd, &text); + if (NULL != text) { + free(text); + text = NULL; + } + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + char *text = NULL; + ret = vc_cmd_get_unfixed_command(cmd, &text); + if (NULL != text) { + free(text); + text = NULL; + } + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_destroy(cmd); + } +} + +/** + * @testcase utc_vc_cmd_get_unfixed_command_n + * @since_tizen 3.0 + * @description Negative UTC for getting the unfixed command text in handle (Invalid parameter) + */ +TEST_F(VCTest, vc_cmd_get_unfixed_command_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_get_unfixed_command(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_get_unfixed_command(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_set_type_p + * @since_tizen 2.4 + * @description Positive UTC for set command type in handle + */ +TEST_F(VCTest, vc_cmd_set_type_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_h cmd = NULL; + ret = vc_cmd_set_type(cmd, VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_set_type(cmd, VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_destroy(cmd); + } +} + +/** + * @testcase utc_vc_cmd_set_type_n + * @since_tizen 2.4 + * @description Negative UTC for set command type in handle (Invalid parameter) + */ +TEST_F(VCTest, vc_cmd_set_type_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_set_type(NULL, VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_set_type(NULL, VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_get_type_p + * @since_tizen 2.4 + * @description Positive UTC for get command type in handle + */ +TEST_F(VCTest, vc_cmd_get_type_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_h cmd = NULL; + int type; + ret = vc_cmd_get_type(cmd, &type); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_set_type(cmd, VC_COMMAND_TYPE_BACKGROUND); + EXPECT_EQ(ret, VC_ERROR_NONE); + + int type; + ret = vc_cmd_get_type(cmd, &type); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_destroy(cmd); + } +} + +/** + * @testcase utc_vc_cmd_get_type_n + * @since_tizen 2.4 + * @description Negative UTC for get command type in handle (invalid parameter) + */ +TEST_F(VCTest, vc_cmd_get_type_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_get_type(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_get_type(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_set_format_p + * @since_tizen 3.0 + * @description Positive UTC for setting command format in handle + */ +TEST_F(VCTest, vc_cmd_set_format_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + + ret = vc_cmd_set_format(cmd, VC_COMMAND_FORMAT_FIXED); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + + vc_cmd_destroy(cmd); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_set_format(cmd, VC_COMMAND_FORMAT_FIXED); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_destroy(cmd); + } +} + +/** + * @testcase utc_vc_cmd_set_format_n + * @since_tizen 3.0 + * @description Negative UTC for setting command format in handle (Invalid parameter) + */ +TEST_F(VCTest, vc_cmd_set_format_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_set_format(NULL, VC_COMMAND_FORMAT_FIXED); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_set_format(NULL, VC_COMMAND_FORMAT_FIXED); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +/** + * @testcase utc_vc_cmd_get_format_p + * @since_tizen 3.0 + * @description Positive UTC for getting command format in handle + */ +TEST_F(VCTest, vc_cmd_get_format_p) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + vc_cmd_h cmd = NULL; + int format; + ret = vc_cmd_get_format(cmd, &format); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + vc_cmd_h cmd = NULL; + ret = vc_cmd_create(&cmd); + EXPECT_EQ(ret, VC_ERROR_NONE); + + ret = vc_cmd_set_format(cmd, VC_COMMAND_FORMAT_FIXED); + EXPECT_EQ(ret, VC_ERROR_NONE); + + int format; + ret = vc_cmd_get_format(cmd, &format); + EXPECT_EQ(ret, VC_ERROR_NONE); + + vc_cmd_destroy(cmd); + } +} + +/** + * @testcase utc_vc_cmd_get_format_n + * @since_tizen 3.0 + * @description Negative UTC for getting command format in handle(invalid parameter) + */ +TEST_F(VCTest, vc_cmd_get_format_n) +{ + if (false == g_vc_supported) { + EXPECT_EQ(g_vc_init, false); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_get_format(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); + } else { + EXPECT_EQ(g_vc_init, true); + + int ret = VC_ERROR_NONE; + ret = vc_cmd_get_format(NULL, NULL); + EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + } +} + +} // namespace -- 2.7.4 From af8d8eec7e40d47070813f3f467175b0d137d096 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Mon, 28 Sep 2020 16:55:10 +0900 Subject: [PATCH 11/16] Correct wrong expression on header file Change-Id: I20ec5e27df90f3d249662b3ce72106161e53b105 --- include/voice_control_command.h | 10 +++++----- include/voice_control_manager.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/voice_control_command.h b/include/voice_control_command.h index 06b899a..d5fcfc2 100644 --- a/include/voice_control_command.h +++ b/include/voice_control_command.h @@ -337,7 +337,7 @@ int vc_cmd_set_command(vc_cmd_h vc_command, const char* command); /** * @brief Gets command. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif - * @remark If the function succeeds, @a command must be released with free() by you if they are not NULL. + * @remarks If the function succeeds, @a command must be released with free() by you if they are not NULL. * @param[in] vc_command The command handle * @param[out] command The command text * @return @c 0 on success, @@ -354,7 +354,7 @@ int vc_cmd_get_command(vc_cmd_h vc_command, char** command); /** * @brief Gets the unfixed command. * @since_tizen 3.0 - * @remark If the function succeeds, the @a command must be released with free() if it is not NULL. + * @remarks If the function succeeds, the @a command must be released with free() if it is not NULL. * If the command of the given @a vc_command is NULL (@a vc_command is NOT NULL), @a command will be also NULL. * This function should be used for commands which have non-fixed format. * @param[in] vc_command The command handle @@ -372,7 +372,7 @@ int vc_cmd_get_unfixed_command(vc_cmd_h vc_command, char** command); /** * @brief Sets command type. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif - * @remark If you do not set the command type, the default value is @c -1. + * @remarks If you do not set the command type, the default value is @c -1. * You should set type if command is valid * @param[in] vc_command The command handle * @param[in] type The command type @@ -406,7 +406,7 @@ int vc_cmd_get_type(vc_cmd_h vc_command, int* type); /** * @brief Sets the command format. * @since_tizen 3.0 - * @remark The default format is #VC_COMMAND_FORMAT_FIXED. + * @remarks The default format is #VC_COMMAND_FORMAT_FIXED. * @param[in] vc_command The command handle * @param[in] format The command format * @return @c 0 on success, @@ -423,7 +423,7 @@ int vc_cmd_set_format(vc_cmd_h vc_command, int format); /** * @brief Gets the command format. * @since_tizen 3.0 - * @remark The default format is #VC_COMMAND_FORMAT_FIXED. + * @remarks The default format is #VC_COMMAND_FORMAT_FIXED. * @param[in] vc_command The command handle * @param[out] format The command format * @return @c 0 on success, diff --git a/include/voice_control_manager.h b/include/voice_control_manager.h index 49defd3..c728910 100644 --- a/include/voice_control_manager.h +++ b/include/voice_control_manager.h @@ -745,7 +745,7 @@ int vc_mgr_get_audio_type(char **audio_id); * * @pre The state should be #VC_STATE_READY and the service state should be #VC_SERVICE_STATE_READY. * - * @see vc_mgr_set_recognition_mode() + * @see vc_mgr_get_recognition_mode() */ int vc_mgr_set_recognition_mode(vc_recognition_mode_e mode); @@ -768,7 +768,7 @@ int vc_mgr_set_recognition_mode(vc_recognition_mode_e mode); * * @pre The state should be #VC_STATE_READY. * - * @see vc_mgr_get_recognition_mode() + * @see vc_mgr_set_recognition_mode() */ int vc_mgr_get_recognition_mode(vc_recognition_mode_e *mode); -- 2.7.4 From f71e51fb87d8ff9d3f651c8b8133db3c6992d2f9 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Tue, 1 Dec 2020 13:36:46 +0900 Subject: [PATCH 12/16] Fix defects from static analysis tool Change-Id: Ib30853516b665e935974b938b6217df583f7510e --- client/vc.c | 91 ++++++++++++++++---------------------------------------- common/vc_main.h | 4 +++ 2 files changed, 30 insertions(+), 65 deletions(-) diff --git a/client/vc.c b/client/vc.c index f5ed34d..2cb5930 100644 --- a/client/vc.c +++ b/client/vc.c @@ -128,8 +128,7 @@ static int __check_privilege(const char* uid, const char * privilege) char *session = cynara_session_from_pid(pid); int ret = cynara_check(p_cynara, smack_label, session, uid, privilege); SLOG(LOG_DEBUG, TAG_VCC, "[Client]cynara_check returned %d(%s)", ret, (CYNARA_API_ACCESS_ALLOWED == ret) ? "Allowed" : "Denied"); - if (session) - free(session); + FREE(session); if (ret != CYNARA_API_ACCESS_ALLOWED) return false; //LCOV_EXCL_LINE @@ -1095,10 +1094,7 @@ static int __vc_get_invocation_name(char** invocation_name) if (0 != ret || NULL == appid) { //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get appid, ret(%d)", ret); //LCOV_EXCL_LINE - if (NULL != appid) { - free(appid); - appid = NULL; - } + FREE(appid); return VC_ERROR_OPERATION_FAILED; //LCOV_EXCL_STOP } @@ -1106,12 +1102,8 @@ static int __vc_get_invocation_name(char** invocation_name) ret = vc_get_current_language(&lang); if (0 != ret || NULL == lang) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get current language, ret(%d)", ret); //LCOV_EXCL_LINE - free(appid); - appid = NULL; - if (NULL != lang) { - free(lang); - lang = NULL; - } + FREE(appid); + FREE(lang); return VC_ERROR_OPERATION_FAILED; } @@ -1119,14 +1111,9 @@ static int __vc_get_invocation_name(char** invocation_name) if (0 != ret || NULL == temp_label) { //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get localed label, ret(%d) appid(%s) lang(%s)", ret, appid, lang); //LCOV_EXCL_LINE - free(appid); - appid = NULL; - free(lang); - lang = NULL; - if (NULL != temp_label) { - free(temp_label); - temp_label = NULL; - } + FREE(appid); + FREE(lang); + FREE(temp_label); return VC_ERROR_OPERATION_FAILED; //LCOV_EXCL_STOP } @@ -1134,15 +1121,15 @@ static int __vc_get_invocation_name(char** invocation_name) *invocation_name = strdup(temp_label); if (NULL == *invocation_name) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE + FREE(appid); + FREE(lang); + FREE(temp_label); return VC_ERROR_OUT_OF_MEMORY; } - free(appid); - appid = NULL; - free(lang); - lang = NULL; - free(temp_label); - temp_label = NULL; + FREE(appid); + FREE(lang); + FREE(temp_label); } SLOG(LOG_DEBUG, TAG_VCC, "Get invocation name(%s)", *invocation_name); @@ -1241,10 +1228,7 @@ int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type) } while (0 != ret); } - if (NULL != invocation_name) { - free(invocation_name); - invocation_name = NULL; - } + FREE(invocation_name); if (VC_COMMAND_TYPE_BACKGROUND == type) g_backup = true; @@ -1397,10 +1381,7 @@ int vc_set_command_list_from_file(const char* file_path, int type) } while (0 != ret); } - if (NULL != invocation_name) { - free(invocation_name); - invocation_name = NULL; - } + FREE(invocation_name); SLOG(LOG_DEBUG, TAG_VCC, "@@@"); return ret; @@ -1784,9 +1765,7 @@ static Eina_Bool __vc_notify_result(void *data) vc_cmd_list = NULL; /* Release result */ - if (temp_text) - free(temp_text); - temp_text = NULL; + FREE(temp_text); return EINA_FALSE; } @@ -1856,10 +1835,7 @@ int vc_get_result(vc_result_cb callback, void* user_data) vc_cmd_list = NULL; /* Release result */ - if (NULL != temp_text) { - free(temp_text); - temp_text = NULL; - } + FREE(temp_text); SLOG(LOG_DEBUG, TAG_VCC, "@@@"); @@ -2264,8 +2240,7 @@ int vc_set_server_dialog(const char* app_id, const char* credential) ret = app_manager_get_app_id(getpid(), &tmp_appid); if (0 != ret || NULL == tmp_appid) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] app_id is NULL"); - if (NULL != tmp_appid) - free(tmp_appid); + FREE(tmp_appid); return VC_ERROR_INVALID_PARAMETER; } } else { @@ -2301,9 +2276,7 @@ int vc_set_server_dialog(const char* app_id, const char* credential) } } while (0 != ret); - - if (NULL != tmp_appid) - free(tmp_appid); + FREE(tmp_appid); SLOG(LOG_DEBUG, TAG_VCC, "@@@"); @@ -2350,8 +2323,7 @@ int vc_unset_server_dialog(const char* app_id) ret = app_manager_get_app_id(getpid(), &tmp_appid); if (0 != ret || NULL == tmp_appid) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] app_id is NULL"); - if (NULL != tmp_appid) - free(tmp_appid); + FREE(tmp_appid); return VC_ERROR_INVALID_PARAMETER; } } else { @@ -2388,11 +2360,8 @@ int vc_unset_server_dialog(const char* app_id) } } while (0 != ret); - - if (NULL != tmp_appid) - free(tmp_appid); - if (NULL != credential) - free(credential); + FREE(tmp_appid); + FREE(credential); SLOG(LOG_DEBUG, TAG_VCC, "@@@"); @@ -2946,12 +2915,10 @@ static void __start_tts_streaming_thread(void* data, Ecore_Thread* thread) /* If no tts data and EVENT_FINISH */ if (0 >= vc_data_get_tts_data_size() && VC_TTS_EVENT_FINISH == tts_data->event) { SLOG(LOG_INFO, TAG_VCC, "[INFO] Finish tts"); - free(tts_data); - tts_data = NULL; + FREE(tts_data) break; } - free(tts_data); - tts_data = NULL; + FREE(tts_data); } } } @@ -2995,14 +2962,8 @@ int __vc_cb_tts_streaming(int utt_id, vc_tts_event_e event, char* buffer, int le int ret = vc_data_add_tts_data(temp_tts_data); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to add tts data"); - if (NULL != temp_tts_data->data) { - free(temp_tts_data->data); - temp_tts_data->data = NULL; - } - if (NULL != temp_tts_data) { - free(temp_tts_data); - temp_tts_data = NULL; - } + FREE(temp_tts_data->data); + FREE(temp_tts_data); } bool is_canceled = ecore_thread_check(g_tts_thread); diff --git a/common/vc_main.h b/common/vc_main.h index 061155e..9ed4128 100644 --- a/common/vc_main.h +++ b/common/vc_main.h @@ -53,6 +53,10 @@ struct vc_s { typedef struct vc_s *vc_h; +/* Define Macro */ +#define FREE(x) { if (NULL != x) { free(x); x = NULL; } } +#define G_FREE(x) { if (NULL != x) { g_free(x); x = NULL; } } + #ifdef __cplusplus } #endif -- 2.7.4 From 099a6c1b091d05d5fc8bf33b63d069f3b8e3204e Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Thu, 3 Dec 2020 16:35:57 +0900 Subject: [PATCH 13/16] Fix Native API references Change-Id: Ic5937ee1a244f02f2bee64c3a2488d258096a02f Signed-off-by: sooyeon.kim --- include/vce.h | 121 ++++---- include/voice_control.h | 3 - include/voice_control_manager.h | 619 ++++++++++++++++++++-------------------- 3 files changed, 371 insertions(+), 372 deletions(-) diff --git a/include/vce.h b/include/vce.h index 9f4d614..fab8f26 100644 --- a/include/vce.h +++ b/include/vce.h @@ -198,8 +198,8 @@ typedef struct vce_cmd_s* vce_cmd_h; * For example, "ko_KR" for Korean, "en_US" for American English. * @param[in] user_data The user data passed from the foreach function * @return @c true to continue with the next iteration of the loop \n @c false to break out of the loop - * @pre vce_foreach_supported_languages() will invoke this callback. - * @see vce_foreach_supported_languages() + * @pre vce_foreach_supported_languages_cb() will invoke this callback. + * @see vce_foreach_supported_languages_cb() */ typedef bool (*vce_supported_language_cb)(const char* language, void* user_data); @@ -297,8 +297,8 @@ typedef int (*vce_set_language_cb)(const char* language); * @retval #VCE_ERROR_INVALID_STATE Invalid state * @retval #VCE_ERROR_OPERATION_FAILED Operation failed * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported command type - * @post vce_start() is called after this function is successful. - * @see vce_start() + * @post vce_start_cb() is called after this function is successful. + * @see vce_start_cb() * @see vcd_foreach_command() * @see vce_unset_commands() * @see vce_get_command_count() @@ -334,8 +334,8 @@ typedef int (*vce_unset_commands_cb)(void); * @retval #VCE_ERROR_OPERATION_FAILED Operation failed * @pre vcd_foreach_command() is successful. * @see vce_set_recording_data_cb() - * @see vce_stop() - * @see vce_cancel() + * @see vce_stop_cb() + * @see vce_cancel_cb() */ typedef int (*vce_start_cb)(bool stop_by_silence); @@ -353,10 +353,10 @@ typedef int (*vce_start_cb)(bool stop_by_silence); * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_INVALID_STATE Invalid state * @retval #VCE_ERROR_OPERATION_FAILED Operation failed - * @pre vce_start() is successful. - * @see vce_start() - * @see vce_cancel() - * @see vce_stop() + * @pre vce_start_cb() is successful. + * @see vce_start_cb() + * @see vce_cancel_cb() + * @see vce_stop_cb() */ typedef int(*vce_set_recording_data_cb)(const void* data, unsigned int length, vce_speech_detect_e* speech_detected); @@ -368,11 +368,11 @@ typedef int(*vce_set_recording_data_cb)(const void* data, unsigned int length, v * @retval #VCE_ERROR_INVALID_STATE Invalid state * @retval #VCE_ERROR_OPERATION_FAILED Operation failed * @retval #VCE_ERROR_OUT_OF_NETWORK Out of network - * @pre vce_set_recording_data() is successful. - * @see vce_start() - * @see vce_set_recording_data() - * @see vce_result_cb() - * @see vce_cancel() + * @pre vce_set_recording_data_cb() is successful. + * @see vce_start_cb() + * @see vce_set_recording_data_cb() + * @see vce_send_result() + * @see vce_cancel_cb() */ typedef int (*vce_stop_cb)(void); @@ -382,9 +382,9 @@ typedef int (*vce_stop_cb)(void); * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful. * @retval #VCE_ERROR_INVALID_STATE Invalid state. - * @pre vce_start() is successful. - * @see vce_start() - * @see vce_stop() + * @pre vce_start_cb() is successful. + * @see vce_start_cb() + * @see vce_stop_cb() */ typedef int (*vce_cancel_cb)(void); @@ -407,8 +407,8 @@ typedef int (*vce_set_audio_type_cb)(const char* audio_type); * @param[in] credential Credential key. * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful. - * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied. + * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. */ typedef int (*vce_set_server_dialog_cb)(const char* app_id, const char* credential); @@ -618,7 +618,7 @@ typedef int (*vce_cancel_tts_cb)(int pid, int utt_id, void* user_data); * @pre An application registers callback function using vce_set_tts_audio_format_request_cb(). * * @see vce_set_tts_audio_format_request_cb() - * @see vce_unset_tts_audio_format_request_cb() + * @see vce_unset_get_tts_audio_format_cb() */ typedef int (*vce_tts_audio_format_request_cb)(int* rate, int* channel, int* audio_type, void* user_data); @@ -629,10 +629,10 @@ typedef int (*vce_tts_audio_format_request_cb)(int* rate, int* channel, int* aud * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @remarks You must register all callbacks except optional callbacks for operating VC engine.\n * The following callbacks are optional callbacks : \n - * - vce_private_data_set_cb \n - * - vce_private_data_requested_cb \n - * - vce_nlu_base_info_requested_cb \n - * - vce_specific_engine_request_cb \n + * - vce_private_data_set_cb() \n + * - vce_private_data_requested_cb() \n + * - vce_nlu_base_info_requested_cb() \n + * - vce_specific_engine_request_cb() \n * If you want to use the optional callbacks, you can set them using vce_set_private_data_set_cb(), vce_set_private_data_requested_cb(), vce_set_nlu_base_info_requested_cb(), and vce_set_specific_engine_request_cb() functions. * * @see vce_main() @@ -691,14 +691,13 @@ typedef struct { * @param[in] callback The structure of engine request callback function * @return This function returns @c zero on success, or negative with error code on failure * @retval #VCE_ERROR_NONE Successful - * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory - * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory * @retval #VCE_ERROR_OPERATION_FAILED Operation failed - * @pre The vce_get_engine_info() should be successful. - * @see vce_get_engine_info() - * @see vce_unload_engine() + * @pre The vce_get_info_cb() should be successful. + * @see vce_get_info_cb() * @see vce_request_callback_s * @code #include @@ -900,9 +899,9 @@ int vce_send_error(vce_error_e error, const char* msg, void* user_data); * @param[in] callback_func vce_private_data_set event callback function * @return @c 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful - * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OPERATION_FAILED Operation failure * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature * @pre The vce_main() function should be invoked before this function is called. @@ -919,9 +918,9 @@ int vce_set_private_data_set_cb(vce_private_data_set_cb callback_func); * @param[in] callback_func vce_private_data_requested event callback function * @return @c 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful - * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OPERATION_FAILED Operation failure * @see vce_private_data_requested_cb() */ @@ -949,8 +948,8 @@ int vce_set_nlu_base_info_requested_cb(vce_nlu_base_info_requested_cb callback_f * * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful - * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * * @see vce_unset_specific_engine_request_cb() */ @@ -961,8 +960,8 @@ int vce_set_specific_engine_request_cb(vce_specific_engine_request_cb callback_f * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * * @return 0 on success, otherwise a negative error value - * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported * * @see vce_set_specific_engine_request_cb() */ @@ -972,7 +971,7 @@ int vce_unset_specific_engine_request_cb(void); * @brief Retrieves all commands using callback function. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * - * @param[in] vce_command The handle to be passed to the vce_set_commands() function + * @param[in] vce_command The handle to be passed to the vce_set_commands_cb() function * @param[in] callback The callback function to invoke * @param[in] user_data The user data to be passed to the callback function * @@ -982,8 +981,8 @@ int vce_unset_specific_engine_request_cb(void); * @retval #VCE_ERROR_OPERATION_FAILED Operation failure * @retval #VCE_ERROR_INVALID_STATE Invalid state * @post This function invokes vce_command_cb() repeatedly for getting commands. - * @see vce_foreach_command_cb() - * @see vce_set_commands() + * @see vce_command_cb() + * @see vce_set_commands_cb() */ int vce_get_foreach_command(vce_cmd_h vce_command, vce_command_cb callback, void* user_data); @@ -991,14 +990,14 @@ int vce_get_foreach_command(vce_cmd_h vce_command, vce_command_cb callback, void * @brief Gets command length. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * - * @param[in] vce_command The handle to be passed to the vce_set_commands() function + * @param[in] vce_command The handle to be passed to the vce_set_commands_cb() function * @param[out] count The command count value * * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OPERATION_FAILED Operation failure - * @see vce_set_commands() + * @see vce_set_commands_cb() */ int vce_get_command_count(vce_cmd_h vce_command, int* count); @@ -1011,9 +1010,9 @@ int vce_get_command_count(vce_cmd_h vce_command, int* count); * @param[in] audio_type Current audio type (e.g. #VCE_AUDIO_ID_BLUETOOTH or #VCE_AUDIO_ID_WIFI) * @return the value greater than 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful - * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter */ int vce_get_audio_type(char** audio_type); @@ -1026,11 +1025,11 @@ int vce_get_audio_type(char** audio_type); * @param[in] data Private data * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful - * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_INVALID_STATE Invalid state - * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied - * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory * @retval #VCE_ERROR_OPERATION_FAILED Operation failed */ int vce_set_private_data(const char* key, const char* data); @@ -1045,11 +1044,11 @@ int vce_set_private_data(const char* key, const char* data); * @param[out] data Private data * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful - * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory - * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_INVALID_STATE Invalid state + * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory * @retval #VCE_ERROR_OPERATION_FAILED Operation failed */ int vce_get_private_data(const char* key, char** data); @@ -1061,8 +1060,8 @@ int vce_get_private_data(const char* key, char** data); * @privilege %http://tizen.org/privilege/recorder * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful - * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_OPERATION_FAILED Operation failure * @retval #VCE_ERROR_RECORDER_BUSY Busy recorder */ @@ -1075,8 +1074,8 @@ int vce_start_recording(void); * @privilege %http://tizen.org/privilege/recorder * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful - * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_OPERATION_FAILED Operation failure */ int vce_stop_recording(void); @@ -1124,8 +1123,8 @@ int vce_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int le * * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful - * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * * @see vce_request_tts_cb() * @see vce_unset_request_tts_cb() @@ -1137,8 +1136,8 @@ int vce_set_request_tts_cb(vce_request_tts_cb callback_func, void* user_data); * @since_tizen 5.0 * * @return 0 on success, otherwise a negative error value - * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported * * @see vce_set_request_tts_cb() */ @@ -1153,8 +1152,8 @@ int vce_unset_request_tts_cb(void); * * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful - * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * * @see vce_cancel_tts_cb() * @see vce_unset_cancel_tts_cb() @@ -1166,8 +1165,8 @@ int vce_set_cancel_tts_cb(vce_cancel_tts_cb callback_func, void* user_data); * @since_tizen 5.0 * * @return 0 on success, otherwise a negative error value - * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported * * @see vce_set_cancel_tts_cb() */ @@ -1182,8 +1181,8 @@ int vce_unset_cancel_tts_cb(void); * * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful - * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * * @see vce_tts_audio_format_request_cb() * @see vce_unset_get_tts_audio_format_cb() @@ -1195,10 +1194,10 @@ int vce_set_tts_audio_format_request_cb(vce_tts_audio_format_request_cb callback * @since_tizen 5.0 * * @return 0 on success, otherwise a negative error value - * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported * - * @see vce_set_tts_audio_format_cb() + * @see vce_set_tts_audio_format_request_cb() */ int vce_unset_get_tts_audio_format_cb(void); diff --git a/include/voice_control.h b/include/voice_control.h index 5e28d19..69172d2 100644 --- a/include/voice_control.h +++ b/include/voice_control.h @@ -232,9 +232,6 @@ int vc_get_state(vc_state_e* state); * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED Not supported * @pre The state should be #VC_STATE_READY. - * @see vc_request_start() - * @see vc_request_stop() - * @see vc_request_cancel() * @see vc_set_service_state_changed_cb() * @see vc_unset_service_state_changed_cb() */ diff --git a/include/voice_control_manager.h b/include/voice_control_manager.h index c728910..f14e5f6 100644 --- a/include/voice_control_manager.h +++ b/include/voice_control_manager.h @@ -193,19 +193,19 @@ typedef bool (*vc_mgr_all_result_cb)(vc_result_event_e event, vc_cmd_list_h vc_c typedef void (*vc_mgr_pre_result_cb)(vc_pre_result_event_e event, const char *result, void *user_data); /** -* @brief Called when client gets the specific engine's result from vc-service. -* @since_tizen 5.0 -* -* @param[in] engine_app_id The specific engine's app id -* @param[in] event The specific engine event type -* @param[in] result The specific engine result -* @param[in] user_data The user data passed from the callback registration function -* -* @pre An application registers callback function using vc_mgr_set_specific_engine_result_cb(). -* -* @see vc_mgr_set_specific_engine_result_cb() -* @see vc_mgr_unset_specific_engine_result_cb() -*/ + * @brief Called when client gets the specific engine's result from vc-service. + * @since_tizen 5.0 + * + * @param[in] engine_app_id The specific engine's app id + * @param[in] event The specific engine event type + * @param[in] result The specific engine result + * @param[in] user_data The user data passed from the callback registration function + * + * @pre An application registers callback function using vc_mgr_set_specific_engine_result_cb(). + * + * @see vc_mgr_set_specific_engine_result_cb() + * @see vc_mgr_unset_specific_engine_result_cb() + */ typedef void (*vc_mgr_specific_engine_result_cb)(const char* engine_app_id, const char* event, const char* result, void *user_data); /** @@ -277,7 +277,7 @@ typedef int (*vc_mgr_private_data_requested_cb)(const char *key, char **data, vo /* for TTS feedback */ /** - * @brief Called when engine sends audio formats necessary for playing TTS feedback + * @brief Called when engine sends audio formats necessary for playing TTS feedback. * @since_tizen 5.0 * * @param[in] rate Audio sampling rate @@ -293,7 +293,7 @@ typedef int (*vc_mgr_private_data_requested_cb)(const char *key, char **data, vo typedef void (*vc_mgr_feedback_audio_format_cb)(int rate, vc_audio_channel_e channel, vc_audio_type_e audio_type, void *user_data); /** - * @brief Called when engine sends audio streaming for TTS feedback + * @brief Called when engine sends audio streaming for TTS feedback. * @since_tizen 5.0 * * @remarks The @a buffer must be released with free() by you when you no longer need it. @@ -311,7 +311,7 @@ typedef void (*vc_mgr_feedback_audio_format_cb)(int rate, vc_audio_channel_e cha typedef void (*vc_mgr_feedback_streaming_cb)(vc_feedback_event_e event, char* buffer, int len, void *user_data); /** - * @brief Called when the vc client sends audio streaming for TTS feedback + * @brief Called when the vc client sends audio streaming for TTS feedback. * @since_tizen 5.0 * * @remarks The @a buffer must be released with free() by you when you no longer need it. @@ -345,10 +345,10 @@ typedef void (*vc_mgr_vc_tts_streaming_cb)(int pid, int utt_id, vc_feedback_even * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_OUT_OF_MEMORY Out of memory * @retval #VC_ERROR_OPERATION_FAILED Operation fail - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_NONE. * @post If this function is called, the state will be #VC_STATE_INITIALIZED. @@ -367,9 +367,9 @@ int vc_mgr_initialize(void); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @post If this function is called, the state will be #VC_STATE_NONE. * @@ -387,9 +387,9 @@ int vc_mgr_deinitialize(void); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre The state should be #VC_STATE_INITIALIZED. * @post If this function is called, the state will be #VC_STATE_READY. @@ -408,9 +408,9 @@ int vc_mgr_prepare(void); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre The state should be #VC_STATE_READY. * @post If this function is called, the state will be #VC_STATE_INITIALIZED. @@ -432,11 +432,11 @@ int vc_mgr_unprepare(void); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_OPERATION_FAILED Operation failure * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should NOT be #VC_SERVICE_STATE_NONE. * @post This function invokes vc_supported_language_cb() for each supported language. @@ -462,12 +462,12 @@ int vc_mgr_foreach_supported_languages(vc_supported_language_cb callback, void * * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_OUT_OF_MEMORY Out of memory * @retval #VC_ERROR_OPERATION_FAILED Operation failure * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should NOT be #VC_SERVICE_STATE_NONE. * @@ -487,10 +487,10 @@ int vc_mgr_get_current_language(char **language); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should NOT be #VC_SERVICE_STATE_NONE. * @@ -511,11 +511,11 @@ int vc_mgr_get_state(vc_state_e *state); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state * @retval #VC_ERROR_OPERATION_FAILED Operation failure - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_READY. * @@ -542,10 +542,10 @@ int vc_mgr_get_service_state(vc_service_state_e *state); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_READY. */ @@ -566,10 +566,10 @@ int vc_mgr_is_command_format_supported(int format, bool *support); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_READY. * @@ -589,9 +589,9 @@ int vc_mgr_set_command_list(vc_cmd_list_h vc_cmd_list); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre The state should be #VC_STATE_READY. * @@ -614,11 +614,11 @@ int vc_mgr_unset_command_list(void); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state * @retval #VC_ERROR_OPERATION_FAILED Operation failure - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_READY. * @@ -641,11 +641,11 @@ int vc_mgr_set_command_list_from_file(const char *file_path, int type); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state * @retval #VC_ERROR_OPERATION_FAILED Operation failure - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_READY. * @@ -667,11 +667,11 @@ int vc_mgr_set_preloaded_commands_from_file(const char *file_path); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state * @retval #VC_ERROR_OPERATION_FAILED Operation failure - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_READY and the service state should be #VC_SERVICE_STATE_READY. */ @@ -689,11 +689,11 @@ int vc_mgr_get_current_commands(vc_cmd_list_h *vc_cmd_list); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state * @retval #VC_ERROR_OPERATION_FAILED Operation failure - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_READY and the service state should be #VC_SERVICE_STATE_READY. * @@ -715,10 +715,10 @@ int vc_mgr_set_audio_type(const char *audio_id); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_READY and the service state should be #VC_SERVICE_STATE_READY. * @@ -738,10 +738,10 @@ int vc_mgr_get_audio_type(char **audio_id); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_READY and the service state should be #VC_SERVICE_STATE_READY. * @@ -761,10 +761,10 @@ int vc_mgr_set_recognition_mode(vc_recognition_mode_e mode); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_READY. * @@ -787,11 +787,11 @@ int vc_mgr_get_recognition_mode(vc_recognition_mode_e *mode); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The service state should be #VC_SERVICE_STATE_READY. */ @@ -813,11 +813,11 @@ int vc_mgr_set_private_data(const char *key, const char *data); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The service state should be #VC_SERVICE_STATE_READY. */ @@ -836,37 +836,37 @@ int vc_mgr_get_private_data(const char *key, char **data); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The service state should be #VC_SERVICE_STATE_READY. */ int vc_mgr_do_action(vc_send_event_type_e type, char *send_event); /** -* @platform -* @brief Sends the specific engine request to the vc-service. -* @since_tizen 5.0 -* -* @privlevel platform -* @privilege %http://tizen.org/privilege/voicecontrol.manager -* -* @param[in] engine_app_id A specific engine's app id -* @param[in] event A engine service user request event -* @param[in] request A engine service user request text -* -* @return 0 on success, otherwise a negative error value -* @retval #VC_ERROR_NONE Successful -* @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory -* @retval #VC_ERROR_INVALID_STATE Invalid state -* @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VC_ERROR_OPERATION_FAILED Operation failure -* @retval #VC_ERROR_PERMISSION_DENIED Permission denied -* @retval #VC_ERROR_NOT_SUPPORTED VC not supported -*/ + * @platform + * @brief Sends the specific engine request to the vc-service. + * @since_tizen 5.0 + * + * @privlevel platform + * @privilege %http://tizen.org/privilege/voicecontrol.manager + * + * @param[in] engine_app_id A specific engine's app id + * @param[in] event A engine service user request event + * @param[in] request A engine service user request text + * + * @return 0 on success, otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory + * @retval #VC_ERROR_INVALID_STATE Invalid state + * @retval #VC_ERROR_OPERATION_FAILED Operation failure + */ int vc_mgr_send_specific_engine_request(const char* engine_app_id, const char* event, const char* request); /** @@ -884,12 +884,12 @@ int vc_mgr_send_specific_engine_request(const char* engine_app_id, const char* e * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter. * @retval #VC_ERROR_INVALID_STATE Invalid state * @retval #VC_ERROR_OPERATION_FAILED Operation failure * @retval #VC_ERROR_IN_PROGRESS_TO_RECORDING In progress to recording - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_READY and the service state should be #VC_SERVICE_STATE_READY. * @post It will invoke vc_service_state_changed_cb(), if you register a callback with vc_service_state_changed_cb(). \n @@ -913,13 +913,13 @@ int vc_mgr_start(bool exclusive_command_option); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_STATE Invalid state * @retval #VC_ERROR_OPERATION_FAILED Operation failure * @retval #VC_ERROR_IN_PROGRESS_TO_READY In progress to ready * @retval #VC_ERROR_IN_PROGRESS_TO_RECORDING In progress to recording * @retval #VC_ERROR_IN_PROGRESS_TO_PROCESSING In progress to processing - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The service state should be #VC_SERVICE_STATE_RECORDING. * @post It will invoke vc_service_state_changed_cb(), if you register a callback with vc_service_state_changed_cb(). \n @@ -928,7 +928,7 @@ int vc_mgr_start(bool exclusive_command_option); * @see vc_mgr_start() * @see vc_mgr_cancel() * @see vc_service_state_changed_cb() - * @see vc_mgr_result_cb() + * @see vc_result_cb() */ int vc_mgr_stop(void); @@ -942,14 +942,14 @@ int vc_mgr_stop(void); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory * @retval #VC_ERROR_INVALID_STATE Invalid state * @retval #VC_ERROR_OPERATION_FAILED Operation failure * @retval #VC_ERROR_IN_PROGRESS_TO_READY In progress to ready * @retval #VC_ERROR_IN_PROGRESS_TO_RECORDING In progress to recording * @retval #VC_ERROR_IN_PROGRESS_TO_PROCESSING In progress to processing - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The service state should be #VC_SERVICE_STATE_RECORDING or #VC_SERVICE_STATE_PROCESSING. * @post It will invoke vc_service_state_changed_cb(), if you register a callback with vc_service_state_changed_cb(). \n @@ -973,10 +973,10 @@ int vc_mgr_cancel(void); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The service state should be #VC_SERVICE_STATE_RECORDING. * @@ -998,9 +998,9 @@ int vc_mgr_get_recording_volume(float *volume); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre vc_mgr_all_result_cb() should be called * @@ -1022,10 +1022,10 @@ int vc_mgr_set_selected_results(vc_cmd_list_h vc_cmd_list); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1044,9 +1044,9 @@ int vc_mgr_set_all_result_cb(vc_mgr_all_result_cb callback, void *user_data); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1067,10 +1067,10 @@ int vc_mgr_unset_all_result_cb(void); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1089,9 +1089,9 @@ int vc_mgr_set_pre_result_cb(vc_mgr_pre_result_cb callback, void *user_data); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1100,39 +1100,42 @@ int vc_mgr_set_pre_result_cb(vc_mgr_pre_result_cb callback, void *user_data); int vc_mgr_unset_pre_result_cb(void); /** -* @brief Registers a callback function for getting specific engine result. -* @since_tizen 5.0 -* -* @param[in] callback Callback function to register -* @param[in] user_data The user data to be passed to the callback function -* -* @return 0 on success, otherwise a negative error value -* @retval #VC_ERROR_NONE Successful -* @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VC_ERROR_INVALID_STATE Invalid state -* @retval #VC_ERROR_PERMISSION_DENIED Permission denied -* @retval #VC_ERROR_NOT_SUPPORTED Not supported -* -* @pre The state should be #VC_STATE_INITIALIZED. -* -* @see vc_mgr_unset_specific_engine_result_cb() -*/ + * @platform + * @brief Sets a callback function for getting specific engine result. + * @since_tizen 5.0 + * + * @privlevel platform + * @privilege %http://tizen.org/privilege/voicecontrol.manager + * + * @param[in] callback Callback function to register + * @param[in] user_data The user data to be passed to the callback function + * + * @return 0 on success, otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED Not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VC_ERROR_INVALID_STATE Invalid state + * + * @pre The state should be #VC_STATE_INITIALIZED. + * + * @see vc_mgr_unset_specific_engine_result_cb() + */ int vc_mgr_set_specific_engine_result_cb(vc_mgr_specific_engine_result_cb callback, void* user_data); /** -* @brief Unregisters the specific engine result callback function. -* @since_tizen 5.0 -* -* @return 0 on success, otherwise a negative error value -* @retval #VC_ERROR_NONE Successful -* @retval #VC_ERROR_INVALID_STATE Invalid state -* @retval #VC_ERROR_PERMISSION_DENIED Permission denied -* @retval #VC_ERROR_NOT_SUPPORTED Not supported -* -* @pre The state should be #VC_STATE_INITIALIZED. -* -* @see vc_mgr_set_specific_engine_result_cb() -*/ + * @brief Unsets the specific engine result callback function. + * @since_tizen 5.0 + * + * @return 0 on success, otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED Not supported + * @retval #VC_ERROR_INVALID_STATE Invalid state + * + * @pre The state should be #VC_STATE_INITIALIZED. + * + * @see vc_mgr_set_specific_engine_result_cb() + */ int vc_mgr_unset_specific_engine_result_cb(void); /** @@ -1148,10 +1151,10 @@ int vc_mgr_unset_specific_engine_result_cb(void); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1170,9 +1173,9 @@ int vc_mgr_set_result_cb(vc_result_cb callback, void *user_data); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1193,10 +1196,10 @@ int vc_mgr_unset_result_cb(void); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1215,9 +1218,9 @@ int vc_mgr_set_state_changed_cb(vc_state_changed_cb callback, void *user_data); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1238,10 +1241,10 @@ int vc_mgr_unset_state_changed_cb(void); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1260,9 +1263,9 @@ int vc_mgr_set_service_state_changed_cb(vc_service_state_changed_cb callback, vo * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1283,10 +1286,10 @@ int vc_mgr_unset_service_state_changed_cb(void); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1305,9 +1308,9 @@ int vc_mgr_set_speech_detected_cb(vc_mgr_begin_speech_detected_cb callback, void * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1328,10 +1331,10 @@ int vc_mgr_unset_speech_detected_cb(void); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1350,9 +1353,9 @@ int vc_mgr_set_current_language_changed_cb(vc_current_language_changed_cb callba * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1375,12 +1378,12 @@ int vc_mgr_unset_current_language_changed_cb(void); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state * @retval $VC_ERROR_OPERATION_FAILED Operation failure * @retval #VC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @see vc_error_cb() */ @@ -1399,10 +1402,10 @@ int vc_mgr_get_error_message(char **err_msg); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1421,9 +1424,9 @@ int vc_mgr_set_error_cb(vc_error_cb callback, void *user_data); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1445,10 +1448,10 @@ int vc_mgr_unset_error_cb(void); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1466,9 +1469,9 @@ int vc_mgr_set_dialog_request_cb(vc_mgr_dialog_request_cb callback, void *user_d * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1488,10 +1491,10 @@ int vc_mgr_unset_dialog_request_cb(void); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre The state should be #VC_STATE_READY. * @@ -1511,10 +1514,10 @@ int vc_mgr_enable_command_type(int cmd_type); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre The state should be #VC_STATE_READY. * @@ -1535,14 +1538,14 @@ int vc_mgr_disable_command_type(int cmd_type); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_INITIALIZED. * - * @see vc_private_data_set_cb() + * @see vc_mgr_private_data_set_cb() * @see vc_mgr_unset_private_data_set_cb() */ int vc_mgr_set_private_data_set_cb(vc_mgr_private_data_set_cb callback, void *user_data); @@ -1557,9 +1560,9 @@ int vc_mgr_set_private_data_set_cb(vc_mgr_private_data_set_cb callback, void *us * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1580,14 +1583,14 @@ int vc_mgr_unset_private_data_set_cb(void); * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported * * @pre The state should be #VC_STATE_INITIALIZED. * - * @see vc_private_data_requested_cb() + * @see vc_mgr_private_data_requested_cb() * @see vc_mgr_unset_private_data_requested_cb() */ int vc_mgr_set_private_data_requested_cb(vc_mgr_private_data_requested_cb callback, void *user_data); @@ -1602,9 +1605,9 @@ int vc_mgr_set_private_data_requested_cb(vc_mgr_private_data_requested_cb callba * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1614,144 +1617,144 @@ int vc_mgr_unset_private_data_requested_cb(void); /* for TTS feedback */ /** -* @platform -* @brief Sets a callback function to be called when engine sends audio formats necessary for playing TTS feedback. -* @since_tizen 5.0 -* -* @param[in] callback Callback function to set -* @param[in] user_data The user data to be passed to the callback function -* -* @privlevel platform -* @privilege %http://tizen.org/privilege/voicecontrol.manager -* -* @return 0 on success, otherwise a negative error value -* @retval #VC_ERROR_NONE Successful -* @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VC_ERROR_INVALID_STATE Invalid state -* @retval #VC_ERROR_PERMISSION_DENIED Permission denied -* @retval #VC_ERROR_NOT_SUPPORTED VC not supported -* -* @pre The state should be #VC_STATE_INITIALIZED. -* -* @see vc_mgr_feedback_audio_format_cb() -* @see vc_mgr_unset_feedback_audio_format_cb() -*/ + * @platform + * @brief Sets a callback function to be called when engine sends audio formats necessary for playing TTS feedback. + * @since_tizen 5.0 + * + * @privlevel platform + * @privilege %http://tizen.org/privilege/voicecontrol.manager + * + * @param[in] callback Callback function to set + * @param[in] user_data The user data to be passed to the callback function + * + * @return 0 on success, otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VC_ERROR_INVALID_STATE Invalid state + * + * @pre The state should be #VC_STATE_INITIALIZED. + * + * @see vc_mgr_feedback_audio_format_cb() + * @see vc_mgr_unset_feedback_audio_format_cb() + */ int vc_mgr_set_feedback_audio_format_cb(vc_mgr_feedback_audio_format_cb callback, void* user_data); /** -* @platform -* @brief Unsets a callback function to be called when engine sends audio formats necessary for playing TTS feedback. -* @since_tizen 5.0 -* -* @privlevel platform -* @privilege %http://tizen.org/privilege/voicecontrol.manager -* -* @return 0 on success, otherwise a negative error value -* @retval #VC_ERROR_NONE Successful -* @retval #VC_ERROR_INVALID_STATE Invalid state -* @retval #VC_ERROR_PERMISSION_DENIED Permission denied -* @retval #VC_ERROR_NOT_SUPPORTED VC not supported -* -* @pre The state should be #VC_STATE_INITIALIZED. -* -* @see vc_mgr_feedback_audio_format_cb() -* @see vc_mgr_set_feedback_audio_format_cb() -*/ + * @platform + * @brief Unsets a callback function to be called when engine sends audio formats necessary for playing TTS feedback. + * @since_tizen 5.0 + * + * @privlevel platform + * @privilege %http://tizen.org/privilege/voicecontrol.manager + * + * @return 0 on success, otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state + * + * @pre The state should be #VC_STATE_INITIALIZED. + * + * @see vc_mgr_feedback_audio_format_cb() + * @see vc_mgr_set_feedback_audio_format_cb() + */ int vc_mgr_unset_feedback_audio_format_cb(void); /** -* @platform -* @brief Sets a callback function to be called when engine sends audio streaming for TTS feedback. -* @since_tizen 5.0 -* -* @param[in] callback Callback function to set -* @param[in] user_data The user data to be passed to the callback function -* -* @privlevel platform -* @privilege %http://tizen.org/privilege/voicecontrol.manager -* -* @return 0 on success, otherwise a negative error value -* @retval #VC_ERROR_NONE Successful -* @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VC_ERROR_INVALID_STATE Invalid state -* @retval #VC_ERROR_PERMISSION_DENIED Permission denied -* @retval #VC_ERROR_NOT_SUPPORTED VC not supported -* -* @pre The state should be #VC_STATE_INITIALIZED. -* -* @see vc_mgr_feedback_streaming_cb() -* @see vc_mgr_unset_feedback_streaming_cb() -*/ + * @platform + * @brief Sets a callback function to be called when engine sends audio streaming for TTS feedback. + * @since_tizen 5.0 + * + * @privlevel platform + * @privilege %http://tizen.org/privilege/voicecontrol.manager + * + * @param[in] callback Callback function to set + * @param[in] user_data The user data to be passed to the callback function + * + * @return 0 on success, otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VC_ERROR_INVALID_STATE Invalid state + * + * @pre The state should be #VC_STATE_INITIALIZED. + * + * @see vc_mgr_feedback_streaming_cb() + * @see vc_mgr_unset_feedback_streaming_cb() + */ int vc_mgr_set_feedback_streaming_cb(vc_mgr_feedback_streaming_cb callback, void* user_data); /** -* @platform -* @brief Unsets a callback function to be called when engine sends audio streaming for TTS feedback. -* @since_tizen 5.0 -* -* @privlevel platform -* @privilege %http://tizen.org/privilege/voicecontrol.manager -* -* @return 0 on success, otherwise a negative error value -* @retval #VC_ERROR_NONE Successful -* @retval #VC_ERROR_INVALID_STATE Invalid state -* @retval #VC_ERROR_PERMISSION_DENIED Permission denied -* @retval #VC_ERROR_NOT_SUPPORTED VC not supported -* -* @pre The state should be #VC_STATE_INITIALIZED. -* -* @see vc_mgr_feedback_streaming_cb() -* @see vc_mgr_set_feedback_streaming_cb() -*/ + * @platform + * @brief Unsets a callback function to be called when engine sends audio streaming for TTS feedback. + * @since_tizen 5.0 + * + * @privlevel platform + * @privilege %http://tizen.org/privilege/voicecontrol.manager + * + * @return 0 on success, otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state + * + * @pre The state should be #VC_STATE_INITIALIZED. + * + * @see vc_mgr_feedback_streaming_cb() + * @see vc_mgr_set_feedback_streaming_cb() + */ int vc_mgr_unset_feedback_streaming_cb(void); /** -* @platform -* @brief Starts getting TTS feedback streaming data from the buffer. -* @since_tizen 5.0 -* -* @remarks In order to get TTS feedback streaming data, the application should set 'vc_mgr_feedback_streaming_cb()' using vc_mgr_set_feedback_streaming_cb(). -* -* @privlevel platform -* @privilege %http://tizen.org/privilege/voicecontrol.manager -* -* @return 0 on success, otherwise a negative error value -* @retval #VC_ERROR_NONE Successful -* @retval #VC_ERROR_INVALID_STATE Invalid state -* @retval #VC_ERROR_PERMISSION_DENIED Permission denied -* @retval #VC_ERROR_NOT_SUPPORTED VC not supported -* -* @pre The state should be #VC_STATE_READY. \n -* 'vc_mgr_feedback_streaming_cb()' should be registered. -* -* @see vc_mgr_feedback_streaming_cb() -* @see vc_mgr_set_feedback_streaming_cb() -* @see vc_mgr_unset_feedback_streaming_cb() -* @see vc_mgr_stop_feedback() -*/ + * @platform + * @brief Starts getting TTS feedback streaming data from the buffer. + * @since_tizen 5.0 + * + * @privlevel platform + * @privilege %http://tizen.org/privilege/voicecontrol.manager + * + * @remarks In order to get TTS feedback streaming data, the application should set 'vc_mgr_feedback_streaming_cb()' using vc_mgr_set_feedback_streaming_cb(). + * + * @return 0 on success, otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state + * + * @pre The state should be #VC_STATE_READY. \n + * 'vc_mgr_feedback_streaming_cb()' should be registered. + * + * @see vc_mgr_feedback_streaming_cb() + * @see vc_mgr_set_feedback_streaming_cb() + * @see vc_mgr_unset_feedback_streaming_cb() + * @see vc_mgr_stop_feedback() + */ int vc_mgr_start_feedback(void); /** -* @platform -* @brief Stops getting and removes TTS feedback streaming data from the buffer. -* @since_tizen 5.0 -* -* @privlevel platform -* @privilege %http://tizen.org/privilege/voicecontrol.manager -* -* @return 0 on success, otherwise a negative error value -* @retval #VC_ERROR_NONE Successful -* @retval #VC_ERROR_INVALID_STATE Invalid state -* @retval #VC_ERROR_PERMISSION_DENIED Permission denied -* @retval #VC_ERROR_NOT_SUPPORTED VC not supported -* -* @pre The state should be #VC_STATE_READY. -* -* @see vc_mgr_feedback_streaming_cb() -* @see vc_mgr_set_feedback_streaming_cb() -* @see vc_mgr_unset_feedback_streaming_cb() -* @see vc_mgr_start_feedback() -*/ + * @platform + * @brief Stops getting and removes TTS feedback streaming data from the buffer. + * @since_tizen 5.0 + * + * @privlevel platform + * @privilege %http://tizen.org/privilege/voicecontrol.manager + * + * @return 0 on success, otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state + * + * @pre The state should be #VC_STATE_READY. + * + * @see vc_mgr_feedback_streaming_cb() + * @see vc_mgr_set_feedback_streaming_cb() + * @see vc_mgr_unset_feedback_streaming_cb() + * @see vc_mgr_start_feedback() + */ int vc_mgr_stop_feedback(void); /** @@ -1766,11 +1769,11 @@ int vc_mgr_stop_feedback(void); * @param[in] user_data The user data to be passed to the callback function * * @return 0 on success, otherwise a negative error value - * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_INVALID_STATE Invalid state - * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre The state should be #VC_STATE_INITIALIZED. * @@ -1788,10 +1791,10 @@ int vc_mgr_set_vc_tts_streaming_cb(vc_mgr_vc_tts_streaming_cb callback, void* us * @privilege %http://tizen.org/privilege/voicecontrol.manager * * @return 0 on success, otherwise a negative error value - * @retval #VC_ERROR_NONE Successful - * @retval #VC_ERROR_NOT_SUPPORTED VC not supported - * @retval #VC_ERROR_PERMISSION_DENIED Permission denied - * @retval #VC_ERROR_INVALID_STATE Invalid state + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state * * @pre The state should be #VC_STATE_INITIALIZED. * -- 2.7.4 From 558096bb8a3798ca5c99d21929842ee8d5b29515 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Wed, 16 Dec 2020 18:05:27 +0900 Subject: [PATCH 14/16] Remove unnecessary HTML link for feature Change-Id: I8ebae7617e67d030856d3e884766a87a202732e3 Signed-off-by: sooyeon.kim --- doc/uix_vc_doc.h | 4 ++-- doc/uix_vc_engine_main_doc.h | 4 ++-- doc/uix_vc_mgr_doc.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/uix_vc_doc.h b/doc/uix_vc_doc.h index 4d33096..96a4b4a 100644 --- a/doc/uix_vc_doc.h +++ b/doc/uix_vc_doc.h @@ -197,8 +197,8 @@ * * @section CAPI_UIX_VOICE_CONTROL_MODULE_FEATURES Related Features * This API is related with the following features:
- * - http://tizen.org/feature/microphone
- * - http://tizen.org/feature/speech.control
+ * - %http://tizen.org/feature/microphone
+ * - %http://tizen.org/feature/speech.control
* It is recommended to design feature related codes in your application for reliability.
* You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
diff --git a/doc/uix_vc_engine_main_doc.h b/doc/uix_vc_engine_main_doc.h index 6610f0d..222bfcb 100644 --- a/doc/uix_vc_engine_main_doc.h +++ b/doc/uix_vc_engine_main_doc.h @@ -207,8 +207,8 @@ * * @section CAPI_UIX_VOICE_CONTROL_ENGINE_MODULE_FEATURES Related Features * This API is related with the following features:
- * - http://tizen.org/feature/microphone
- * - http://tizen.org/feature/speech.control
+ * - %http://tizen.org/feature/microphone
+ * - %http://tizen.org/feature/speech.control
* It is recommended to design feature related codes in your application for reliability.
* You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
diff --git a/doc/uix_vc_mgr_doc.h b/doc/uix_vc_mgr_doc.h index 3ed28ce..d848f0d 100644 --- a/doc/uix_vc_mgr_doc.h +++ b/doc/uix_vc_mgr_doc.h @@ -275,8 +275,8 @@ * * @section CAPI_UIX_VOICE_CONTROL_MANAGER_MODULE_FEATURES Related Features * This API is related with the following features:
- * - http://tizen.org/feature/microphone
- * - http://tizen.org/feature/speech.control_manager
+ * - %http://tizen.org/feature/microphone
+ * - %http://tizen.org/feature/speech.control_manager
* It is recommended to design feature related codes in your application for reliability.
* You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
-- 2.7.4 From bd5679b8ec678a2cdcd38fd883fa9319326c45a5 Mon Sep 17 00:00:00 2001 From: sungrae jo Date: Tue, 5 Jan 2021 11:18:48 +0900 Subject: [PATCH 15/16] Add mgr dbus for set_audio_streaming_mode Change-Id: I69262206664f94848040a99a11db5ce2cb384016 Signed-off-by: sungrae jo --- client/vc_mgr.c | 34 ++++++++++++++++++++++++++-------- client/vc_mgr_dbus.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- client/vc_mgr_dbus.h | 2 ++ common/vc_defs.h | 1 + server/vcd_config.c | 5 +++++ server/vcd_dbus.c | 3 +++ server/vcd_dbus_server.c | 24 ++++++++++++++++++++++++ server/vcd_dbus_server.h | 2 ++ 8 files changed, 107 insertions(+), 9 deletions(-) diff --git a/client/vc_mgr.c b/client/vc_mgr.c index 3caa9ae..e9703c6 100755 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -4525,20 +4525,38 @@ int vc_mgr_set_audio_streaming_mode(vc_audio_streaming_mode_e mode) return VC_ERROR_INVALID_STATE; } - if (VC_STATE_INITIALIZED != state && VC_SERVICE_STATE_READY != service_state) { + if (VC_STATE_INITIALIZED == state && VC_SERVICE_STATE_NONE == service_state) { + ret = vc_mgr_client_set_audio_streaming_mode(g_vc_m, mode); + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to set multi assistant mode : %s", __vc_mgr_get_error_code(ret)); + return VC_ERROR_INVALID_STATE; + } else { + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Set audio streaming mode in vc mgr client"); + } + } else if (VC_STATE_READY == state && VC_SERVICE_STATE_READY == service_state) { + ret = vc_mgr_client_set_audio_streaming_mode(g_vc_m, mode); + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to set multi assistant mode : %s", __vc_mgr_get_error_code(ret)); + return VC_ERROR_INVALID_STATE; + } else { + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Set audio streaming mode in vc mgr client"); + } + + ret = vc_mgr_dbus_request_set_audio_streaming_mode(g_vc_m->handle, mode); + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to set audio streaming mode : %s", __vc_mgr_get_error_code(ret)); + return VC_ERROR_OPERATION_FAILED; + } else { + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Set audio streaming mode in vc mgr dbus"); + } + } else { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State: Current state is not 'INITIALIZED', state(%d)", state); SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State: Current service state is not 'READY', service_state(%d)", service_state); SLOG(LOG_DEBUG, TAG_VCM, "@@@"); return VC_ERROR_INVALID_STATE; } - ret = vc_mgr_client_set_audio_streaming_mode(g_vc_m, mode); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to set multi assistant mode, ret(%d)", ret); - return VC_ERROR_INVALID_STATE; - } - - return ret; + return VC_ERROR_NONE; } int __vc_change_system_volume(vc_system_volume_event_e volume_event) diff --git a/client/vc_mgr_dbus.c b/client/vc_mgr_dbus.c index f9a5493..7e2b875 100755 --- a/client/vc_mgr_dbus.c +++ b/client/vc_mgr_dbus.c @@ -2107,6 +2107,50 @@ int vc_mgr_dbus_request_cancel(int pid) return result; } +int vc_mgr_dbus_request_set_audio_streaming_mode(int pid, vc_audio_streaming_mode_e mode) +{ + if (0 != __dbus_check()) { + return VC_ERROR_OPERATION_FAILED; + } + + DBusMessage* msg; + + /* create a signal & check for errors */ + msg = dbus_message_new_method_call( + VC_SERVER_SERVICE_NAME, + VC_SERVER_SERVICE_OBJECT_PATH, /* object name of the signal */ + VC_SERVER_SERVICE_INTERFACE, /* interface name of the signal */ + VC_MANAGER_METHOD_SET_AUDIO_STREAMING_MODE); /* name of the signal */ + + if (NULL == msg) { + SLOG(LOG_ERROR, TAG_VCM, "@@ vc mgr set audio streaming mode : Fail to make message "); + return VC_ERROR_OPERATION_FAILED; + } else { + SLOG(LOG_INFO, TAG_VCM, "@@ vc mgr set audio streaming mode : pid(%d) mode(%d)", pid, mode); + } + + dbus_message_append_args(msg, + DBUS_TYPE_INT32, &pid, + DBUS_TYPE_INT32, &mode, + DBUS_TYPE_INVALID); + + dbus_message_set_no_reply(msg, TRUE); + + /* send the message and flush the connection */ + if (1 != dbus_connection_send(g_m_conn_sender, msg, NULL)) { + SLOG(LOG_ERROR, TAG_VCM, "[Dbus ERROR] Fail to set audio streaming mode"); + dbus_message_unref(msg); + return VC_ERROR_OPERATION_FAILED; + } else { + SLOG(LOG_INFO, TAG_VCM, "[Dbus] Success to set audio streaming mode"); + dbus_connection_flush(g_m_conn_sender); + } + + dbus_message_unref(msg); + + return VC_ERROR_NONE; +} + static DBusMessage* __get_message(int pid, const char* method, int type) { char service_name[64]; @@ -2431,4 +2475,3 @@ int vc_mgr_dbus_change_system_volume(int pid, vc_system_volume_event_e volume_ev return result; } - diff --git a/client/vc_mgr_dbus.h b/client/vc_mgr_dbus.h index 7d706f1..c144024 100644 --- a/client/vc_mgr_dbus.h +++ b/client/vc_mgr_dbus.h @@ -78,6 +78,8 @@ int vc_mgr_dbus_send_audio_streaming(int pid, vc_audio_streaming_event_e event, int vc_mgr_dbus_change_system_volume(int pid, vc_system_volume_event_e volume_event); +int vc_mgr_dbus_request_set_audio_streaming_mode(int pid, vc_audio_streaming_mode_e mode); + #ifdef __cplusplus } #endif diff --git a/common/vc_defs.h b/common/vc_defs.h index 4011131..21c2e58 100644 --- a/common/vc_defs.h +++ b/common/vc_defs.h @@ -148,6 +148,7 @@ extern "C" { #define VC_MANAGER_METHOD_START "vc_manager_method_request_start" #define VC_MANAGER_METHOD_STOP "vc_manager_method_request_stop" #define VC_MANAGER_METHOD_CANCEL "vc_manager_method_request_cancel" +#define VC_MANAGER_METHOD_SET_AUDIO_STREAMING_MODE "vc_manager_method_set_audio_streaming_mode" #define VC_MANAGER_METHOD_RESULT_SELECTION "vc_manager_method_result_selection" #define VC_MANAGER_METHOD_SET_DOMAIN "vc_manager_method_set_domain" #define VC_MANAGER_METHOD_DO_ACTION "vc_manager_method_do_action" diff --git a/server/vcd_config.c b/server/vcd_config.c index 0f61317..cdf2f3d 100644 --- a/server/vcd_config.c +++ b/server/vcd_config.c @@ -168,6 +168,11 @@ int vcd_config_get_audio_streaming_mode(vcd_audio_streaming_mode_e* streaming_mo int vcd_config_set_audio_streaming_mode(vcd_audio_streaming_mode_e streaming_mode) { + if (streaming_mode < VCD_AUDIO_STREAMING_MODE_VC_SERVICE || streaming_mode > VCD_AUDIO_STREAMING_MODE_OUTSIDE) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid streaming mode(%d)", streaming_mode); + return -1; + } + g_audio_streaming_mode = streaming_mode; return 0; } diff --git a/server/vcd_dbus.c b/server/vcd_dbus.c index 1ef35c2..7811988 100755 --- a/server/vcd_dbus.c +++ b/server/vcd_dbus.c @@ -1173,6 +1173,9 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_MANAGER_METHOD_CHANGE_SYSTEM_VOLUME)) vcd_dbus_server_mgr_change_system_volume(g_conn_listener, msg); + else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_MANAGER_METHOD_SET_AUDIO_STREAMING_MODE)) + vcd_dbus_server_mgr_set_audio_streaming_mode(g_conn_listener, msg); + /* client event */ else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_METHOD_INITIALIZE)) vcd_dbus_server_initialize(g_conn_listener, msg); diff --git a/server/vcd_dbus_server.c b/server/vcd_dbus_server.c index 119d5f8..d7314de 100755 --- a/server/vcd_dbus_server.c +++ b/server/vcd_dbus_server.c @@ -1126,6 +1126,30 @@ int vcd_dbus_server_mgr_change_system_volume(DBusConnection* conn, DBusMessage* } +int vcd_dbus_server_mgr_set_audio_streaming_mode(DBusConnection* conn, DBusMessage* msg) +{ + DBusError err; + dbus_error_init(&err); + + int pid; + int mode; + dbus_message_get_args(msg, &err, + DBUS_TYPE_INT32, &pid, + DBUS_TYPE_INT32, &mode, + DBUS_TYPE_INVALID); + + SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager set audio streaming mode"); + + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCD, "[IN ERROR] vcd mgr set audio streaming mode : get arguments error (%s)", err.message); + dbus_error_free(&err); + } else { + SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set audio streaming mode : pid(%d) mode(%d)", pid, mode); + vcd_config_set_audio_streaming_mode((vcd_audio_streaming_mode_e)mode); + } + return 0; +} + /* * Dbus Server functions for client */ diff --git a/server/vcd_dbus_server.h b/server/vcd_dbus_server.h index 7890502..dca8add 100644 --- a/server/vcd_dbus_server.h +++ b/server/vcd_dbus_server.h @@ -67,6 +67,8 @@ int vcd_dbus_server_mgr_send_specific_engine_request(DBusConnection* conn, DBusM int vcd_dbus_server_mgr_change_system_volume(DBusConnection* conn, DBusMessage* msg); +int vcd_dbus_server_mgr_set_audio_streaming_mode(DBusConnection* conn, DBusMessage* msg); + /* for TTS feedback */ int vcd_dbus_server_mgr_start_feedback(DBusConnection* conn, DBusMessage* msg); -- 2.7.4 From 4cd168bbcc4fccdcb27116efd3ad8f34f194b77f Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Fri, 26 Mar 2021 15:45:48 +0900 Subject: [PATCH 16/16] Add app_context_destroy() to remove memory leak Change-Id: I515dc3093b77276a802bfbd1230a8f687456b829 Signed-off-by: Suyeon Hwang --- common/vc_cmd_db.c | 9 ++++----- server/vcd_server.c | 6 ++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/common/vc_cmd_db.c b/common/vc_cmd_db.c index 4450794..c5004ef 100644 --- a/common/vc_cmd_db.c +++ b/common/vc_cmd_db.c @@ -596,14 +596,13 @@ static int __vc_db_get_pid(const char* appid, int* pid) } ret = app_context_get_pid(app_context, pid); - if (APP_MANAGER_ERROR_NONE != ret) { - SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to get pid, ret(%d), appid(%s)", ret, appid); - return VC_DB_ERROR_OPERATION_FAILED; + int destroy_ret = app_context_destroy(app_context); + if (APP_MANAGER_ERROR_NONE != destroy_ret) { + SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to destroy app context, ret(%d), appid(%s)", destroy_ret, appid); } - ret = app_context_destroy(app_context); if (APP_MANAGER_ERROR_NONE != ret) { - SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to destroy app context, ret(%d), appid(%s)", ret, appid); + SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to get pid, ret(%d), appid(%s)", ret, appid); return VC_DB_ERROR_OPERATION_FAILED; } } else { diff --git a/server/vcd_server.c b/server/vcd_server.c index cd5e3b4..721b265 100755 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -283,10 +283,16 @@ static int __vcd_resume_app(const char* appid) } ret = app_manager_resume_app(app_context); + int destroy_ret = app_context_destroy(app_context); + if (APP_MANAGER_ERROR_NONE != destroy_ret) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to destroy app_context, ret(%d), appid(%s)", destroy_ret, appid); + } + if (APP_MANAGER_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to resume app, ret(%d), appid(%s)", ret, appid); return VCD_ERROR_OPERATION_FAILED; } + return VCD_ERROR_NONE; } -- 2.7.4