[History] Added context_history_is_supported() 37/125637/2
authorSomin Kim <somin926.kim@samsung.com>
Tue, 18 Apr 2017 07:42:17 +0000 (16:42 +0900)
committerSomin Kim <somin926.kim@samsung.com>
Thu, 20 Apr 2017 01:30:25 +0000 (18:30 -0700)
Change-Id: I1a6a22349b33abd1dc2899db061187e8976c476e
Signed-off-by: Somin Kim <somin926.kim@samsung.com>
include/context_history.h
src/context_history.cpp

index 751c3e1..fdd1374 100644 (file)
@@ -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
index e87a15d..bf76835 100644 (file)
@@ -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);