#define ML_INF_FEATURE_PATH "tizen.org/feature/machine_learning.inference"
#define check_feature_state() \
- if (ML_ERROR_NONE != ml_get_feature_enabled()) \
- return ML_ERROR_NOT_SUPPORTED;
+ int feature_ret = ml_get_feature_enabled(); \
+ if (ML_ERROR_NONE != feature_ret) \
+ return feature_ret;
#if defined(__TIZEN__)
#include <dlog.h>
* @retval #ML_ERROR_NOT_SUPPORTED Not supported.
* @retval #ML_ERROR_INVALID_PARAMETER Fail. The parameter is invalid.
* @retval #ML_ERROR_STREAMS_PIPE Failed to start the pipeline.
+ * @retval #ML_ERROR_PERMISSION_DENIED The application does not have the privilege to access to the media storage or external storage.
*/
int ml_single_open (ml_single_h *single, const char *model, const ml_tensors_info_h input_info, const ml_tensors_info_h output_info, ml_nnfw_type_e nnfw, ml_nnfw_hw_e hw);
ML_ERROR_UNKNOWN = TIZEN_ERROR_UNKNOWN, /**< Unknown error */
ML_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< Time out */
ML_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< The feature is not supported */
+ ML_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
} ml_error_e;
/**
* @retval #ML_ERROR_NOT_SUPPORTED Not supported.
* @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid. (pipe is NULL?)
* @retval #ML_ERROR_STREAMS_PIPE Pipeline construction is failed because of wrong parameter or initialization failure.
+ * @retval #ML_ERROR_PERMISSION_DENIED The application does not have the privilege to access to the media storage or external storage.
*/
int ml_pipeline_construct (const char *pipeline_description, ml_pipeline_state_cb cb, void *user_data, ml_pipeline_h *pipe);
#define TIZEN_ERROR_TRY_AGAIN (-EAGAIN)\n\
#define TIZEN_ERROR_UNKNOWN (-1073741824LL)\n\
#define TIZEN_ERROR_TIMED_OUT (TIZEN_ERROR_UNKNOWN + 1)\n\
-#define TIZEN_ERROR_NOT_SUPPORTED (TIZEN_ERROR_UNKNOWN + 2)\
+#define TIZEN_ERROR_NOT_SUPPORTED (TIZEN_ERROR_UNKNOWN + 2)\n\
+#define TIZEN_ERROR_PERMISSION_DENIED (-EACCES)\
|" include/nnstreamer.h
#if defined(__TIZEN__)
{
+ int ret;
int feature_enabled;
g_mutex_lock (&feature_info->mutex);
return ML_ERROR_NOT_SUPPORTED;
} else if (-1 == feature_enabled) {
bool ml_inf_supported = false;
- if (0 == system_info_get_platform_bool(ML_INF_FEATURE_PATH, &ml_inf_supported)) {
+ ret = system_info_get_platform_bool(ML_INF_FEATURE_PATH, &ml_inf_supported);
+ if (0 == ret) {
if (false == ml_inf_supported) {
ml_loge ("machine_learning.inference NOT supported");
ml_set_feature_status (0);
ml_set_feature_status (1);
} else {
- ml_loge ("failed to get feature value of machine_learning.inference");
- return ML_ERROR_NOT_SUPPORTED;
+ switch (ret) {
+ case SYSTEM_INFO_ERROR_INVALID_PARAMETER:
+ ml_loge ("failed to get feature value because feature key is not vaild");
+ ret = ML_ERROR_NOT_SUPPORTED;
+ break;
+
+ case SYSTEM_INFO_ERROR_IO_ERROR:
+ ml_loge ("failed to get feature value because of input/output error");
+ ret = ML_ERROR_NOT_SUPPORTED;
+ break;
+
+ case SYSTEM_INFO_ERROR_PERMISSION_DENIED:
+ ml_loge ("failed to get feature value because of permission denied");
+ ret = ML_ERROR_PERMISSION_DENIED;
+ break;
+
+ default:
+ ml_loge ("failed to get feature value because of unknown error");
+ ret = ML_ERROR_NOT_SUPPORTED;
+ break;
+ }
+ return ret;
}
}
}