From 8d05d81612a4d7fdd4ec0a0ba1d0608a045fba0d Mon Sep 17 00:00:00 2001 From: Somin Kim Date: Tue, 18 Apr 2017 16:42:17 +0900 Subject: [PATCH] [History] Added context_history_is_supported() Change-Id: I1a6a22349b33abd1dc2899db061187e8976c476e Signed-off-by: Somin Kim --- include/context_history.h | 14 ++++++++++++++ src/context_history.cpp | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) 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 @@ -312,6 +312,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. * See the programming guide to find available filter type #context_history_filter_e@n 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); -- 2.7.4