From: Ji-hoon Lee Date: Mon, 30 Mar 2020 06:40:52 +0000 (+0900) Subject: Adopt function name changes in API Review process X-Git-Tag: submit/tizen_5.5/20200409.014144^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af7aabbfc24183f780c8ad5b34e96d18bd1fe17f;p=platform%2Fcore%2Fuifw%2Fmulti-assistant.git Adopt function name changes in API Review process The function 'ma_set_assistant_language' has been renamed to 'ma_set_assistant_wakeup_language' during the Tizen API 6.0 review phase. In order to provide a functionality with the same name, while also supporting backward compatibility, decided to temporarily provide an alias function with the name that the function had before. Change-Id: Ia62fe1ab176c9d6b96f5478d84f687488a0af4f1 --- diff --git a/client/ma.c b/client/ma.c index 27eb0b4..041aadf 100644 --- a/client/ma.c +++ b/client/ma.c @@ -2160,12 +2160,23 @@ int ma_unset_preprocessing_result_received_cb(void) int ma_set_assistant_language(const char* language) { MA_SLOGD("[Manager] Set assistant language"); + return ma_set_assistant_wakeup_language(language); +} + +int ma_set_assistant_wakeup_language(const char* 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"); @@ -2179,13 +2190,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 ceeadc0..b2724c5 100644 --- a/client/ma_dbus.c +++ b/client/ma_dbus.c @@ -1579,7 +1579,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; @@ -1591,13 +1591,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 3456a50..c646763 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_internal.h b/include/multi_assistant_internal.h index 9e16dc0..097b191 100644 --- a/include/multi_assistant_internal.h +++ b/include/multi_assistant_internal.h @@ -24,10 +24,14 @@ extern "C" #endif /** - * @brief Sets the voice language for the current assistant. + * @brief An alias for 'ma_set_assistant_wakeup_language' function. + * @details Since the function name has been change from 'ma_set_assistant_language' + * to 'ma_set_assistant_wakeup_language' during the API review phase, + * this function should be provided for supporting backward compatibility. + * It will be removed all references are replaced with the newly added API. * @since_tizen 5.5 * - * @param[in] language The language that will be used for the current assistant + * @param[in] language The language configuration that will be used for wake word detection. * 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. @@ -37,10 +41,31 @@ extern "C" * @retval #MA_ERROR_NOT_SUPPORTED Not supported * @retval #MA_ERROR_INVALID_STATE Invalid state * - * @pre The state should be #MA_STATE_INITIALIZED. + * @pre The state should be #MA_STATE_READY. */ int ma_set_assistant_language(const char* language); +/** + * @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 5.5 + * + * @param[in] language The language configuration that will be used for wake word detection. + * 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_READY. + */ +int ma_set_assistant_wakeup_language(const char* language); + /** * @brief Enumerations for multi-assistant service state. * @since_tizen 5.5