From ff4b02ffbb7f77e0d9f70942fe79c3ee2d0d67d5 Mon Sep 17 00:00:00 2001 From: sungrae jo Date: Wed, 25 Mar 2020 11:02:28 +0900 Subject: [PATCH] Added platform tag and error check logic Change-Id: I1bfbd4ddd2631bd9f9b6876eae0bfa3d9dc47e43 Signed-off-by: sungrae jo --- client/vc_mgr.c | 22 ++++++++++++++++++++++ include/voice_control_manager.h | 12 ++++++++++++ 2 files changed, 34 insertions(+) diff --git a/client/vc_mgr.c b/client/vc_mgr.c index 53c8c32..d7879ae 100755 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -4059,6 +4059,17 @@ int vc_mgr_unset_feedback_streaming_cb() int vc_mgr_set_vc_tts_streaming_cb(vc_mgr_vc_tts_streaming_cb callback, void* user_data) { + SLOG(LOG_INFO, TAG_VCM, "@@@ [Manager] set vc tts streaming callback"); + + if (0 != __vc_mgr_get_feature_enabled()) { + SLOG(LOG_DEBUG, TAG_VCM, "@@@ [Manager] not supported"); + return VC_ERROR_NOT_SUPPORTED; + } + + if (0 != __vc_mgr_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } + if (NULL == callback) return VC_ERROR_INVALID_PARAMETER; @@ -4089,6 +4100,17 @@ int vc_mgr_set_vc_tts_streaming_cb(vc_mgr_vc_tts_streaming_cb callback, void* us int vc_mgr_unset_vc_tts_streaming_cb() { + SLOG(LOG_INFO, TAG_VCM, "@@@ [Manager] unset vc tts streaming callback"); + + if (0 != __vc_mgr_get_feature_enabled()) { + SLOG(LOG_DEBUG, TAG_VCM, "@@@ [Manager] not supported"); + return VC_ERROR_NOT_SUPPORTED; + } + + if (0 != __vc_mgr_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } + pthread_mutex_lock(&g_vc_tts_streaming_cb_mutex); vc_state_e state; diff --git a/include/voice_control_manager.h b/include/voice_control_manager.h index 3d4ece3..728c4f2 100644 --- a/include/voice_control_manager.h +++ b/include/voice_control_manager.h @@ -1725,14 +1725,20 @@ int vc_mgr_start_feedback(void); int vc_mgr_stop_feedback(void); /** + * @platform * @brief Sets TTS streaming callback function. * @since_tizen 5.0 * + * @privlevel platform + * @privilege %http://tizen.org/privilege/voicecontrol.manager + * * @param[in] callback The callback function * @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 * @@ -1744,11 +1750,17 @@ int vc_mgr_stop_feedback(void); int vc_mgr_set_vc_tts_streaming_cb(vc_mgr_vc_tts_streaming_cb callback, void* user_data); /** + * @platform * @brief Unsets TTS streaming callback function. * @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. -- 2.7.4