From: Ji-hoon Lee Date: Wed, 18 Dec 2019 05:30:04 +0000 (+0900) Subject: Add APIs to provide service_state_changed callback X-Git-Tag: submit/tizen/20200408.110745~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=55f75022025e762e05c2b16a283670cab82760ef;p=platform%2Fcore%2Fuifw%2Fmulti-assistant.git Add APIs to provide service_state_changed callback Change-Id: Ia983bf6d2f8184d7baae9701153e8dededaf7020 --- diff --git a/doc/uix_ma_doc.h b/doc/uix_ma_doc.h index a46a763..ca328ff 100644 --- a/doc/uix_ma_doc.h +++ b/doc/uix_ma_doc.h @@ -26,12 +26,12 @@ * @section CAPI_UIX_MULTI_ASSISTANT_MODULE_HEADER Required Header * \#include
* - * @section CAPI_UIX_MULTI_ASSISTANT_MODULE_STATE_TRANSITIONS State Transitions + * @section CAPI_UIX_MULTI_ASSISTANT_MODULE_CLIENT_STATE_TRANSITIONS Client State Transitions * * * - * - * + * + * * * * @@ -60,14 +60,14 @@ * *
FUNCTIONPRE-STATEPOST-STATEPRE-CLIENT-STATEPOST-CLIENT-STATESYNC TYPE
* -* @section CAPI_UIX_MULTI_ASSISTANT_MODULE_STATE_DEPENDENT_FUNCTION_CALLS State Dependent Function Calls -* The following table shows state-dependent function calls. -* It is forbidden to call functions listed below in wrong states. +* @section CAPI_UIX_MULTI_ASSISTANT_MODULE_CLIENT_STATE_DEPENDENT_FUNCTION_CALLS Client State Dependent Function Calls +* The following table shows client-state-dependent function calls. +* It is forbidden to call functions listed below in wrong client states. * Violation of this rule may result in an unpredictable behavior. * * * -* +* * * * @@ -199,7 +199,7 @@ * ma_set_audio_streaming_data_section_changed_cb()
* ma_unset_audio_streaming_data_section_changed_cb() * -* +* * *
FUNCTIONVALID STATESVALID CLIENT STATESDESCRIPTION
Initialized All callback function should be registered in Initialized state All callback function should be registered in Initialized client state
* diff --git a/include/multi_assistant.h b/include/multi_assistant.h index b5781c6..87eb025 100644 --- a/include/multi_assistant.h +++ b/include/multi_assistant.h @@ -715,6 +715,40 @@ int ma_unset_audio_streaming_data_section_changed_cb(void); */ int ma_set_assistant_wakeup_language(const char* language); +/** + * @brief Sets the service state changed callback. + * @since_tizen 6.0 + * + * @param[in] callback The callback + * @param[in] user_data The user data passed to the callback function + * + * @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_INITIALIZED. + * @see ma_service_state_changed_cb() + * @see ma_unset_service_state_changed_cb() + */ +int ma_set_service_state_changed_cb(ma_service_state_changed_cb callback, void* user_data); + +/** + * @brief Unsets the service state changed callback. + * @since_tizen 6.0 + * + * @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. + * @see ma_service_state_changed_cb() + * @see ma_set_service_state_changed_cb() + */ +int ma_unset_service_state_changed_cb(void); + #ifdef __cplusplus } #endif diff --git a/include/multi_assistant_common.h b/include/multi_assistant_common.h index caca2bb..c81debf 100644 --- a/include/multi_assistant_common.h +++ b/include/multi_assistant_common.h @@ -161,6 +161,18 @@ typedef enum { MA_AUDIO_STREAMING_DATA_SECTION_WAKE_WORD, /**< Wake word section started */ } ma_audio_streaming_data_section_e; +/** + * @brief Enumerations for multi-assistant service state. + * @since_tizen 6.0 + */ +typedef enum { + MA_SERVICE_STATE_INACTIVE = 0, /**< 'Inactive' state */ + MA_SERVICE_STATE_LISTENING = 1, /**< 'Listening' state */ + MA_SERVICE_STATE_UTTERANCE = 2, /**< 'Utterance' state */ + MA_SERVICE_STATE_PROCESSING = 3, /**< 'Processing' state */ + MA_SERVICE_STATE_VOICE_FEEDBACK = 4, /**< 'VoiceFeedback' state */ +} ma_service_state_e; + /** * @brief Called when the client state is changed. * @since_tizen 5.0 @@ -283,6 +295,16 @@ typedef void (*ma_preprocessing_information_changed_cb)(const char* app_id, void */ typedef void (*ma_audio_streaming_data_section_changed_cb)(ma_audio_streaming_data_section_e section, void* user_data); +/** + * @brief Called when the service state is changed. + * @since_tizen 6.0 + * + * @param[in] previous The previous service state + * @param[in] current The new service state + * @param[in] user_data The user data passed from the callback registration function + */ +typedef void (*ma_service_state_changed_cb)(ma_service_state_e previous, ma_service_state_e current, void* user_data); + #ifdef __cplusplus } #endif diff --git a/include/multi_assistant_internal.h b/include/multi_assistant_internal.h index 790f07b..28f9011 100644 --- a/include/multi_assistant_internal.h +++ b/include/multi_assistant_internal.h @@ -23,62 +23,6 @@ extern "C" { #endif -/** - * @brief Enumerations for multi-assistant service state. - * @since_tizen 5.5 - */ -typedef enum { - MA_SERVICE_STATE_INACTIVE = 0, /**< 'Inactive' state */ - MA_SERVICE_STATE_LISTENING = 1, /**< 'Listening' state */ - MA_SERVICE_STATE_UTTERANCE = 2, /**< 'Utterance' state */ - MA_SERVICE_STATE_PROCESSING = 3, /**< 'Processing' state */ - MA_SERVICE_STATE_VOICE_FEEDBACK = 4, /**< 'VoiceFeedback' state */ -} ma_service_state_e; - -/** - * @brief Called when the service state is changed. - * @since_tizen 5.5 - * - * @param[in] previous The previous service state - * @param[in] current The current service state - * @param[in] user_data The user data passed from the callback registration function - */ -typedef void (*ma_service_state_changed_cb)(ma_service_state_e previous, ma_service_state_e current, void* user_data); - -/** - * @brief Sets the service state changed callback. - * @since_tizen 5.5 - * - * @param[in] callback The callback - * @param[in] user_data The user data passed to the callback function - * - * @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_INITIALIZED. - * @see ma_service_state_changed_cb() - * @see ma_unset_service_state_changed_cb() - */ -int ma_set_service_state_changed_cb(ma_service_state_changed_cb callback, void* user_data); - -/** - * @brief Unsets the service state changed callback. - * @since_tizen 5.5 - * - * @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. - * @see ma_service_state_changed_cb() - * @see ma_set_service_state_changed_cb() - */ -int ma_unset_service_state_changed_cb(void); - #ifdef __cplusplus } #endif