[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 751c3e1db5e533fd56e0a946437b9969e18ff00b..fdd1374e9abd94a2e3fa58ca9e7efa1893eeab87 100644 (file)
@@ -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.
index e87a15d6c0d37034a9b2a61a92070b0f68cdcc8d..bf76835ae0d47df3dd8c9ba2f40035fd0f49a643 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);