Add API : ma_set_assistant_wakeup_language 04/218004/10
authorJi-hoon Lee <dalton.lee@samsung.com>
Mon, 18 Nov 2019 10:55:26 +0000 (19:55 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Fri, 27 Mar 2020 15:28:47 +0000 (00:28 +0900)
Change-Id: I22c5d1ed9ce9126e7bb5a226608728c4f4c6592c

client/ma.c
client/ma_dbus.c
client/ma_dbus.h
common/ma_defs.h
include/multi_assistant.h
include/multi_assistant_internal.h

index 673d2828af81beba6843901149c0c27f588378ab..b56f72938904a91512be9f358419590b167b7e13 100644 (file)
@@ -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");
        }
index f7acf8fce761472f2697c4885983266be1d7a412..221232d952c55b7b057f8f18a629012828eda0c5 100644 (file)
@@ -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;
index 304847935263d4a9bfa8f2c044ea3550b7525901..f74a1b5489f76ec4035cb250cfa0ecf59c75b847 100644 (file)
@@ -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
 }
index 55a7cfd3c56291b6710854540e3cbf4da3566e81..e76b7fede74b2f3e610f9f7ead548081c4cae6d2 100644 (file)
@@ -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"
index 55d270400e477ee4009a4064fa309b17458c0380..b5781c649d9235f2b587d42b146967ed4ea509fd 100644 (file)
@@ -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
index aa80310b324b8c6b94b072374d2a37daaf097b36..790f07bfc0c98156e5241b6c6d107adf0cb7336d 100644 (file)
@@ -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