From: Ji-hoon Lee Date: Mon, 18 Nov 2019 10:55:26 +0000 (+0900) Subject: Add API : ma_set_assistant_wakeup_language X-Git-Tag: submit/tizen/20200408.110745~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7de61ab465a39cb04ef6c6eb72005c8d7994992e;p=platform%2Fcore%2Fuifw%2Fmulti-assistant.git Add API : ma_set_assistant_wakeup_language Change-Id: I22c5d1ed9ce9126e7bb5a226608728c4f4c6592c --- diff --git a/client/ma.c b/client/ma.c index 673d282..b56f729 100644 --- a/client/ma.c +++ b/client/ma.c @@ -2120,15 +2120,20 @@ int ma_unset_preprocessing_result_received_cb(void) return MA_ERROR_NONE; } -int ma_set_assistant_language(const char* language) +int ma_set_assistant_wakeup_language(const char* language) { - MA_SLOGD("[Manager] Set assistant language"); + MA_SLOGD("[Manager] Set assistant wakeup language"); if (0 != __ma_get_feature_enabled()) { MA_SLOGD("@@@ [Manager] not supported"); return MA_ERROR_NOT_SUPPORTED; } + if (NULL == language) { + MA_SLOGE("[ERROR] Invalid parameter"); //LCOV_EXCL_LINE + return MA_ERROR_INVALID_PARAMETER; + } + ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { MA_SLOGE("[ERROR] A handle is not available"); @@ -2142,13 +2147,13 @@ int ma_set_assistant_language(const char* language) return MA_ERROR_INVALID_STATE; } - MA_SLOGI("[Client DEBUG] Set assistant language : %s", language); + MA_SLOGI("[Client DEBUG] Set assistant wakeup language : %s", language); /* Set assistant language */ int pid = getpid(); - int ret = ma_dbus_set_assistant_language(pid, language); + int ret = ma_dbus_set_assistant_wakeup_language(pid, language); if (0 != ret) { - MA_SLOGW("[WARNING] Failed to set assistant language"); + MA_SLOGW("[WARNING] Failed to set assistant wakeup language"); } else { MA_SLOGD("[DEBUG] Success to set"); } diff --git a/client/ma_dbus.c b/client/ma_dbus.c index f7acf8f..221232d 100644 --- a/client/ma_dbus.c +++ b/client/ma_dbus.c @@ -1560,7 +1560,7 @@ int ma_dbus_set_wake_word_audio_require_flag(int pid, bool require) return 0; } -int ma_dbus_set_assistant_language(int pid, const char* language) +int ma_dbus_set_assistant_wakeup_language(int pid, const char* language) { if (0 != __dbus_check()) { return MA_ERROR_OPERATION_FAILED; @@ -1572,13 +1572,13 @@ int ma_dbus_set_assistant_language(int pid, const char* language) MA_SERVER_SERVICE_NAME, MA_SERVER_SERVICE_OBJECT_PATH, MA_SERVER_SERVICE_INTERFACE, - MA_METHOD_SET_ASSISTANT_LANGUAGE); + MA_METHOD_SET_ASSISTANT_WAKEUP_LANGUAGE); if (NULL == msg) { - MA_SLOGE("@@ Request multi-assistant set assistant language : Fail to make message"); //LCOV_EXCL_LINE + MA_SLOGE("@@ Request multi-assistant set assistant wakeup language : Fail to make message"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - MA_SLOGD("[DEBUG] multi-assistant set assistant language"); + MA_SLOGD("[DEBUG] multi-assistant set assistant wakeup language"); } char* tmp_language = NULL; diff --git a/client/ma_dbus.h b/client/ma_dbus.h index 3048479..f74a1b5 100644 --- a/client/ma_dbus.h +++ b/client/ma_dbus.h @@ -63,7 +63,7 @@ int ma_dbus_send_preprocessing_result(int pid, bool result); int ma_dbus_set_wake_word_audio_require_flag(int pid, bool require); -int ma_dbus_set_assistant_language(int pid, const char* language); +int ma_dbus_set_assistant_wakeup_language(int pid, const char* language); #ifdef __cplusplus } diff --git a/common/ma_defs.h b/common/ma_defs.h index 55a7cfd..e76b7fe 100644 --- a/common/ma_defs.h +++ b/common/ma_defs.h @@ -81,7 +81,7 @@ extern "C" #define MA_METHOD_SET_PREPROCESSING_ALLOW_MODE "ma_method_set_preprocessing_allow_mode" #define MA_METHOD_SEND_PREPROCESSING_RESULT "ma_method_send_preprocessing_result" #define MA_METHOD_SET_WAKE_WORD_AUDIO_REQUIRE_FLAG "ma_method_set_wake_word_audio_require_flag" -#define MA_METHOD_SET_ASSISTANT_LANGUAGE "ma_method_set_assistant_language" +#define MA_METHOD_SET_ASSISTANT_WAKEUP_LANGUAGE "ma_method_set_assistant_wakeup_language" #define MA_METHOD_ERROR "ma_method_error" #define MA_UI_METHOD_INITIALIZE "ma_ui_method_initialize" diff --git a/include/multi_assistant.h b/include/multi_assistant.h index 55d2704..b5781c6 100644 --- a/include/multi_assistant.h +++ b/include/multi_assistant.h @@ -693,6 +693,28 @@ int ma_set_audio_streaming_data_section_changed_cb(ma_audio_streaming_data_secti */ int ma_unset_audio_streaming_data_section_changed_cb(void); +/** + * @brief Sets the language configuration for wake word detection. + * @details The language configuration of the assistant that invoked + * this function will be changed and language configurations + * of other assistants will remain unchanged. + * @since_tizen 6.0 + * + * @param[in] language The language configuration that will be used for wake word detection. + * It should be denoted by two-letter code defined by ISO 639-1, + * optionally combined with two-letter code defined by ISO 3166. + * For example, "ko_KR" for Korean, "en_US" for American English. + * + * @return @c 0 on success, otherwise a negative error value + * @retval #MA_ERROR_NONE Successful + * @retval #MA_ERROR_NOT_SUPPORTED Not supported + * @retval #MA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MA_ERROR_INVALID_STATE Invalid state + * + * @pre The state should be #MA_STATE_READY. + */ +int ma_set_assistant_wakeup_language(const char* language); + #ifdef __cplusplus } #endif diff --git a/include/multi_assistant_internal.h b/include/multi_assistant_internal.h index aa80310..790f07b 100644 --- a/include/multi_assistant_internal.h +++ b/include/multi_assistant_internal.h @@ -23,24 +23,6 @@ extern "C" { #endif -/** - * @brief Sets the voice language for the current assistant. - * @since_tizen 5.5 - * - * @param[in] language The language that will be used for the current assistant - * It should be denoted by two-letter code defined by IS 639-1, - * optionally combined with two-letter code defined by ISO 3166. - * For example, "ko_KR" for Korean, "en_US" for American English. - * - * @return @c 0 on success, otherwise a negative error value - * @retval #MA_ERROR_NONE Successful - * @retval #MA_ERROR_NOT_SUPPORTED Not supported - * @retval #MA_ERROR_INVALID_STATE Invalid state - * - * @pre The state should be #MA_STATE_INITIALIZED. - */ -int ma_set_assistant_language(const char* language); - /** * @brief Enumerations for multi-assistant service state. * @since_tizen 5.5