From: Somin Kim Date: Tue, 18 Apr 2017 07:42:17 +0000 (+0900) Subject: [History] Added context_history_is_supported() X-Git-Tag: submit/tizen/20170608.120410^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F37%2F125637%2F2;p=platform%2Fcore%2Fapi%2Fcontext.git [History] Added context_history_is_supported() Change-Id: I1a6a22349b33abd1dc2899db061187e8976c476e Signed-off-by: Somin Kim --- diff --git a/include/context_history.h b/include/context_history.h index 751c3e1..fdd1374 100644 --- a/include/context_history.h +++ b/include/context_history.h @@ -311,6 +311,20 @@ int context_history_filter_set_int(context_history_filter_h filter, context_hist */ int context_history_filter_set_string(context_history_filter_h filter, context_history_filter_e filter_type, const char* value) TIZEN_DEPRECATED_API; +/** + * @brief Checks whether a history data type is supported in the current device. + * @since_tizen 4.0 + * + * @param[in] data_type Type of history data + * @param[out] supported If supported, @c true; Otherwise, @c false + * + * @return @c 0 on success, otherwise a negative error value + * @retval #CONTEXT_TRIGGER_ERROR_NONE Successful + * @retval #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONTEXT_TRIGGER_ERROR_OPERATION_FAILED Operation failed + */ +int context_history_is_supported(context_history_data_e data_type, bool* supported); + /** * @brief Reads context statistics or patterns. * @details Retrieves a given type of context statistics or patterns list. diff --git a/src/context_history.cpp b/src/context_history.cpp index e87a15d..bf76835 100644 --- a/src/context_history.cpp +++ b/src/context_history.cpp @@ -144,6 +144,22 @@ EXPORT_API int context_history_filter_set_string(context_history_filter_h filter return CONTEXT_HISTORY_ERROR_NONE; } +EXPORT_API int context_history_is_supported(context_history_data_e data_type, bool* supported) +{ + ASSERT_NOT_NULL(supported); + + if (history_is_deprecated(data_type)) { + _W(HISTORY_DEPRECATED_DATA); + } + + std::string data_type_str = convert_data_to_string(data_type); + if (data_type_str.empty()) { + return CONTEXT_HISTORY_ERROR_INVALID_PARAMETER; + } + + return ctx_history_is_supported(data_type_str.c_str(), supported); +} + EXPORT_API int context_history_get_list(context_history_h handle, context_history_data_e data_type, context_history_filter_h filter, context_history_list_h* list) { ASSERT_NOT_NULL(handle);