* @details This function is the main function for operating VC engine.
* @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
* @privlevel public
- * @privilege %http://tizen.org/privilege/recorder
- * %http://tizen.org/privilege/appmanager.launch (Since 7.0)
+ * @privilege %http://tizen.org/privilege/recorder \n
+ * %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n
* %http://tizen.org/privilege/datasharing (Since 7.0)
* @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. \n
* The service_app_main() should be used for working the engine after this function.
* @brief Sends the results to the engine service user.
* @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
* @privlevel public
- * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0)
+ * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n
* %http://tizen.org/privilege/datasharing (Since 7.0)
* @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0.
*
* @param[in] user_data The user data passed from set callback function
* @return @c 0 on success, otherwise a negative error value
* @retval #VCE_ERROR_NONE Successful
+ * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied
* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory
* @retval #VCE_ERROR_INVALID_STATE Invalid state
* @brief Sends the ASR result to the engine service user.
* @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
* @privlevel public
- * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0)
+ * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n
* %http://tizen.org/privilege/datasharing (Since 7.0)
* @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0.
*
* @param[in] user_data The user data passed from the start
* @return @c 0 on success, otherwise a negative error value
* @retval #VCE_ERROR_NONE Successful
+ * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied
* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory
* @retval #VCE_ERROR_OPERATION_FAILED Operation failure
* @brief Sends the NLG (Natural Language Generation) result to the engine service user.
* @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
* @privlevel public
- * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0)
+ * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n
* %http://tizen.org/privilege/datasharing (Since 7.0)
* @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0.
*
* @param[in] user_data The user data passed from the start
* @return @c 0 on success, otherwise a negative error value
* @retval #VCE_ERROR_NONE Successful
+ * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied
* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory
* @retval #VCE_ERROR_OPERATION_FAILED Operation failure
* @brief Sends the specific engine result to the engine service user.
* @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
* @privlevel public
- * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0)
+ * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n
* %http://tizen.org/privilege/datasharing (Since 7.0)
* @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0.
*
*
* @return 0 on success, otherwise a negative error value
* @retval #VCE_ERROR_NONE Successful
+ * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied
* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory
* @retval #VCE_ERROR_OPERATION_FAILED Operation failure
* #VCE_ERROR_TTS_FAILED.
* @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
* @privlevel public
- * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0)
+ * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n
* %http://tizen.org/privilege/datasharing (Since 7.0)
* @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0.
*
* @param[in] user_data The user data passed from set callback function
* @return @c 0 on success, otherwise a negative error value
* @retval #VCE_ERROR_NONE Successful
+ * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied
* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory
* @retval #VCE_ERROR_OPERATION_FAILED Operation failure
* @brief Sets private data to a voice manager client.
* @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
* @privlevel public
- * @privilege %http://tizen.org/privilege/recorder
- * %http://tizen.org/privilege/appmanager.launch (Since 7.0)
+ * @privilege %http://tizen.org/privilege/recorder \n
+ * %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n
* %http://tizen.org/privilege/datasharing (Since 7.0)
* @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0.
*
* @brief Gets private data from a voice manager client.
* @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
* @privlevel public
- * @privilege %http://tizen.org/privilege/recorder
- * %http://tizen.org/privilege/appmanager.launch (Since 7.0)
+ * @privilege %http://tizen.org/privilege/recorder \n
+ * %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n
* %http://tizen.org/privilege/datasharing (Since 7.0)
* @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. \n
* The @a data must be released using free() when it is no longer required.
* @brief Starts recording voice.
* @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
* @privlevel public
- * @privilege %http://tizen.org/privilege/recorder
- * %http://tizen.org/privilege/appmanager.launch (Since 7.0)
+ * @privilege %http://tizen.org/privilege/recorder \n
+ * %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n
* %http://tizen.org/privilege/datasharing (Since 7.0)
* @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0.
*
* @brief Sends audio formats necessary for playing TTS feedback.
* @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
* @privlevel public
- * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0)
+ * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n
* %http://tizen.org/privilege/datasharing (Since 7.0)
* @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0.
*
* @return 0 on success, otherwise a negative error value.
* @retval #VCE_ERROR_NONE Successful
* @retval #VCE_ERROR_NOT_SUPPORTED Not supported
+ * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied
* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #VCE_ERROR_OPERATION_FAILED Operation failure
* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory
* @brief Sends audio streaming necessary for playing TTS feedback.
* @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif
* @privlevel public
- * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0)
+ * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n
* %http://tizen.org/privilege/datasharing (Since 7.0)
* @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0.
*
* @return 0 on success, otherwise a negative error value.
* @retval #VCE_ERROR_NONE Successful
* @retval #VCE_ERROR_NOT_SUPPORTED Not supported
+ * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied
* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #VCE_ERROR_OPERATION_FAILED Operation failure
* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory
//LCOV_EXCL_STOP
}
+ ret = __check_privilege(uid, VC_PRIVILEGE_APPMGR_LAUNCH);
+ if (false == ret) {
+ //LCOV_EXCL_START
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Permission is denied(%s)(%s)", VC_PRIVILEGE_APPMGR_LAUNCH, uid);
+ __check_privilege_deinitialize();
+ g_privilege_allowed = false;
+ pthread_mutex_unlock(&g_cynara_mutex);
+ return VCE_ERROR_PERMISSION_DENIED;
+ //LCOV_EXCL_STOP
+ }
+
+ ret = __check_privilege(uid, VC_PRIVILEGE_DATASHARING);
+ if (false == ret) {
+ //LCOV_EXCL_START
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Permission is denied(%s)(%s)", VC_PRIVILEGE_DATASHARING, uid);
+ __check_privilege_deinitialize();
+ g_privilege_allowed = false;
+ pthread_mutex_unlock(&g_cynara_mutex);
+ return VCE_ERROR_PERMISSION_DENIED;
+ //LCOV_EXCL_STOP
+ }
+
__check_privilege_deinitialize();
}
int vce_send_result(vce_result_event_e event, int* result_id, int count, const char* all_result, const char* non_fixed_result, const char* nlu_result, const char* msg, int* user_info, void *user_data)
{
- if (0 != __vce_get_feature_enabled()) {
- return VCE_ERROR_NOT_SUPPORTED;
- }
-
int ret = VCE_ERROR_NONE;
+ ret = __check_engine_feature_privilege();
+ if (VCE_ERROR_NONE != ret)
+ return ret;
if (event < VCE_RESULT_EVENT_SUCCESS || event > VCE_RESULT_EVENT_ERROR) {
SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid parameter");
int vce_send_asr_result(vce_asr_result_event_e event, const char* asr_result, void *user_data)
{
- if (0 != __vce_get_feature_enabled()) {
- return VCE_ERROR_NOT_SUPPORTED;
- }
-
int ret = VCE_ERROR_NONE;
+ ret = __check_engine_feature_privilege();
+ if (VCE_ERROR_NONE != ret)
+ return ret;
if (event < VCE_ASR_RESULT_EVENT_FINAL_RESULT || event > VCE_ASR_RESULT_EVENT_ERROR) {
SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid parameter");
int vce_send_specific_engine_result(const char* engine_app_id, const char* event, const char* result, void *user_info)
{
- if (0 != __vce_get_feature_enabled()) {
- return VCE_ERROR_NOT_SUPPORTED;
- }
-
int ret = VCE_ERROR_NONE;
+ ret = __check_engine_feature_privilege();
+ if (VCE_ERROR_NONE != ret)
+ return ret;
if (NULL == engine_app_id || NULL == event) {
SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid parameter");
int vce_send_nlg_result(const char* nlg_result, void *user_data)
{
- if (0 != __vce_get_feature_enabled()) {
- return VCE_ERROR_NOT_SUPPORTED;
- }
-
int ret = VCE_ERROR_NONE;
+ ret = __check_engine_feature_privilege();
+ if (VCE_ERROR_NONE != ret)
+ return ret;
if (NULL == nlg_result) {
SLOG(LOG_ERROR, TAG_VCD, "[INFO] Input parameter is NULL. (no result)");
int vce_send_error(vce_error_e error, const char* msg, void *user_data)
{
- if (0 != __vce_get_feature_enabled()) {
- return VCE_ERROR_NOT_SUPPORTED;
- }
-
int ret = VCE_ERROR_NONE;
+ ret = __check_engine_feature_privilege();
+ if (VCE_ERROR_NONE != ret)
+ return ret;
if (NULL == msg) {
SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Input parameter is NULL. (no error message)");
/* for TTS feedback */
int vce_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_audio_type_e audio_type)
{
- if (0 != __vce_get_feature_enabled()) {
- return VCE_ERROR_NOT_SUPPORTED;
- }
-
int ret = VCE_ERROR_NONE;
+ ret = __check_engine_feature_privilege();
+ if (VCE_ERROR_NONE != ret)
+ return ret;
if (channel < VCE_AUDIO_CHANNEL_MONO || channel > VCE_AUDIO_CHANNEL_STEREO) {
SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid parameter");
int vce_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int len)
{
- if (0 != __vce_get_feature_enabled()) {
- return VCE_ERROR_NOT_SUPPORTED;
- }
-
int ret = VCE_ERROR_NONE;
+ ret = __check_engine_feature_privilege();
+ if (VCE_ERROR_NONE != ret)
+ return ret;
if (NULL == buffer) {
SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Input parameter is NULL");