* @return @c 0 on success, otherwise a negative error value
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Not supported
* @retval #CONTEXT_HISTORY_ERROR_OUT_OF_MEMORY Out of memory
*
* @see context_history_destroy()
*
* @return @c 0 on success, otherwise a negative error value
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Not supported
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
*
* @pre context_history_create()
* @return @c 0 on success, otherwise a negative error value
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Not supported
* @retval #CONTEXT_HISTORY_ERROR_OUT_OF_MEMORY Memory allocation failed
*
* @see context_history_filter_destroy()
* @return @c 0 on success, otherwise a negative error value
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Not supported
*
* @pre context_history_filter_create()
*/
* @return @c 0 on success, otherwise a negative error value
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Not supported
*
* @pre context_history_filter_create()
* @see context_history_filter_set_string()
* @return @c 0 on success, otherwise a negative error value
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Not supported
*
* @pre context_history_filter_create()
* @see context_history_filter_set_int()
* @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_HISTORY_ERROR_NOT_SUPPORTED Not supported
* @retval #CONTEXT_TRIGGER_ERROR_OPERATION_FAILED Operation failed
*/
int context_history_is_supported(context_history_data_e data_type, bool* supported);
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CONTEXT_HISTORY_ERROR_PERMISSION_DENIED Permission denied
- * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Unsupported history data
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Not supported
* @retval #CONTEXT_HISTORY_ERROR_OPERATION_FAILED Operation failed
* @retval #CONTEXT_HISTORY_ERROR_OUT_OF_MEMORY Out of memory
* @retval #CONTEXT_HISTORY_ERROR_NO_DATA Requested data does not exist
* @return @c 0 on success, otherwise a negative error value
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Not supported
* @retval #CONTEXT_HISTORY_ERROR_OPERATION_FAILED Operation failed
*
* @pre context_history_get_list()
* @return @c 0 on success, otherwise a negative error value
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Not supported
* @retval #CONTEXT_HISTORY_ERROR_OPERATION_FAILED Operation failed
* @retval #CONTEXT_HISTORY_ERROR_OUT_OF_MEMORY Out of memory
*
* @return @c 0 on success, otherwise a negative error value
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Not supported
*
* @pre context_history_get_list()
* @see context_history_list_get_count()
* @return @c 0 on success, otherwise a negative error value
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Not supported
* @retval #CONTEXT_HISTORY_ERROR_NO_DATA Requested data does not exist
*
* @pre context_history_get_list()
* @return @c 0 on success, otherwise a negative error value
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Not supported
*
* @pre context_history_get_list()
*/
* @return @c 0 on success, otherwise a negative error value
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Not supported
*
* @pre context_history_list_get_current()
* @see context_history_record_get_double()
* @return @c 0 on success, otherwise a negative error value
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Not supported
*
* @pre context_history_list_get_current()
* @see context_history_record_get_int()
* @return @c 0 on success, otherwise a negative error value
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Not supported
*
* @pre context_history_list_get_current()
* @see context_history_record_get_int()
* @return @c 0 on success, otherwise a negative error value
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Not supported
*
* @pre context_history_list_get_current()
*/
#include <map>
#include <json/json.h>
+#include <system_info.h>
#include <ContextTypes.h>
#include <Tuple.h>
#include <app_history_internal.h>
#define ASSERT_ALLOC(X) IF_FAIL_RETURN_TAG(X, E_NO_MEM, _E, "Memory allocation failed")
#define ASSERT_NOT_NULL(X) IF_FAIL_RETURN_TAG(X, E_PARAM, _E, "Parameter null")
+#define APP_HISTORY_FEATURE "http://tizen.org/feature/app_history"
+#define CHECK_APP_HISTORY_SUPPORTED(feature_name) \
+ do { \
+ bool is_supported = false; \
+ if (!system_info_get_platform_bool(feature_name, &is_supported)) { \
+ if (!is_supported) { \
+ _E("[%s] feature is disabled", feature_name); \
+ return CONTEXT_HISTORY_ERROR_NOT_SUPPORTED; \
+ } \
+ } \
+ } while (0)
+
// handles
typedef struct _context_history_handle_s {
/* At this point, this handle has no purpose.
// life-cycle
EXPORT_API int context_history_create(context_history_h* handle)
{
+ CHECK_APP_HISTORY_SUPPORTED(APP_HISTORY_FEATURE);
ASSERT_NOT_NULL(handle);
*handle = new(std::nothrow) _cx_history_handle();
EXPORT_API int context_history_destroy(context_history_h handle)
{
+ CHECK_APP_HISTORY_SUPPORTED(APP_HISTORY_FEATURE);
ASSERT_NOT_NULL(handle);
delete handle;
return CONTEXT_HISTORY_ERROR_NONE;
// Read filter manipulation
EXPORT_API int context_history_filter_create(context_history_filter_h* filter)
{
+ CHECK_APP_HISTORY_SUPPORTED(APP_HISTORY_FEATURE);
ASSERT_NOT_NULL(filter);
*filter = new(std::nothrow) _cx_history_filter_handle();
EXPORT_API int context_history_filter_destroy(context_history_filter_h filter)
{
+ CHECK_APP_HISTORY_SUPPORTED(APP_HISTORY_FEATURE);
ASSERT_NOT_NULL(filter);
delete filter;
EXPORT_API int context_history_filter_set_int(context_history_filter_h filter, context_history_filter_e filter_type, int val)
{
+ CHECK_APP_HISTORY_SUPPORTED(APP_HISTORY_FEATURE);
ASSERT_NOT_NULL(filter);
if (history_filter_is_deprecated(filter_type)) {
EXPORT_API int context_history_filter_set_string(context_history_filter_h filter, context_history_filter_e filter_type, const char* val)
{
+ CHECK_APP_HISTORY_SUPPORTED(APP_HISTORY_FEATURE);
ASSERT_NOT_NULL(filter);
ASSERT_NOT_NULL(val);
EXPORT_API int context_history_is_supported(context_history_data_e data_type, bool* supported)
{
+ CHECK_APP_HISTORY_SUPPORTED(APP_HISTORY_FEATURE);
ASSERT_NOT_NULL(supported);
if (history_is_deprecated(data_type)) {
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)
{
+ CHECK_APP_HISTORY_SUPPORTED(APP_HISTORY_FEATURE);
ASSERT_NOT_NULL(handle);
ASSERT_NOT_NULL(list);
*list = NULL;
// Data object manipulation
EXPORT_API int context_history_list_get_count(context_history_list_h list, int* count)
{
+ CHECK_APP_HISTORY_SUPPORTED(APP_HISTORY_FEATURE);
ASSERT_NOT_NULL(list && count);
unsigned int value;
EXPORT_API int context_history_list_get_current(context_history_list_h list, context_history_record_h* record)
{
+ CHECK_APP_HISTORY_SUPPORTED(APP_HISTORY_FEATURE);
ASSERT_NOT_NULL(list);
ASSERT_NOT_NULL(record);
*record = NULL;
EXPORT_API int context_history_list_move_first(context_history_list_h list)
{
+ CHECK_APP_HISTORY_SUPPORTED(APP_HISTORY_FEATURE);
ASSERT_NOT_NULL(list);
return ctx_history_cursor_first(list->cursor);
}
EXPORT_API int context_history_list_move_next(context_history_list_h list)
{
+ CHECK_APP_HISTORY_SUPPORTED(APP_HISTORY_FEATURE);
ASSERT_NOT_NULL(list);
return ctx_history_cursor_next(list->cursor);
}
EXPORT_API int context_history_list_destroy(context_history_list_h list)
{
+ CHECK_APP_HISTORY_SUPPORTED(APP_HISTORY_FEATURE);
ASSERT_NOT_NULL(list);
ctx_history_cursor_destroy(list->cursor);
delete list;
EXPORT_API int context_history_record_get_int(context_history_record_h record, const char* key, int* val)
{
+ CHECK_APP_HISTORY_SUPPORTED(APP_HISTORY_FEATURE);
ASSERT_NOT_NULL(record && val && key);
// Check key and data type
EXPORT_API int context_history_record_get_double(context_history_record_h record, const char* key, double* val)
{
+ CHECK_APP_HISTORY_SUPPORTED(APP_HISTORY_FEATURE);
ASSERT_NOT_NULL(record && val && key);
// Check key and data type
EXPORT_API int context_history_record_get_string(context_history_record_h record, const char* key, char** val)
{
+ CHECK_APP_HISTORY_SUPPORTED(APP_HISTORY_FEATURE);
ASSERT_NOT_NULL(record && val && key);
// Check key and data type
EXPORT_API int context_history_record_destroy(context_history_record_h record)
{
+ CHECK_APP_HISTORY_SUPPORTED(APP_HISTORY_FEATURE);
ASSERT_NOT_NULL(record);
delete record;