#ifndef __CAPI_CONTEXT_JOB_SCHEDULER_INTERNAL_H__
#define __CAPI_CONTEXT_JOB_SCHEDULER_INTERNAL_H__
+#include <glib.h>
#include <tizen.h>
+#include <bundle.h>
+#include <app_control.h>
#include <job_scheduler_types_internal.h>
#ifdef __cplusplus
{
#endif
-int ctx_job_scheduler_test();
+typedef struct _ctx_sched_s* ctx_sched_h;
+
+typedef struct _ctx_sched_job_s* ctx_sched_job_h;
+
+typedef struct _ctx_sched_job_context_s* ctx_sched_job_context_h;
+
+
+typedef bool (*ctx_sched_foreach_job_cb)(ctx_sched_h scheduler, ctx_sched_job_h job, void* user_data);
+
+typedef bool (*ctx_sched_stop_job_cb)(ctx_sched_h scheduler, ctx_sched_job_h job, void* user_data);
+
+
+int ctx_sched_create(ctx_sched_h* scheduler);
+
+int ctx_sched_destroy(ctx_sched_h scheduler);
+
+
+int ctx_sched_schedule(ctx_sched_h scheduler, ctx_sched_job_h job, int* job_id);
+
+int ctx_sched_cancel(ctx_sched_h scheduler, int job_id);
+
+int ctx_sched_cancel_all(ctx_sched_h scheduler);
+
+
+int ctx_sched_add_job(ctx_sched_h scheduler, ctx_sched_job_h job, int* job_id);
+
+int ctx_sched_start_job(ctx_sched_h scheduler, int job_id);
+
+int ctx_sched_stop_job(ctx_sched_h scheduler, int job_id);
+
+int ctx_sched_remove_job(ctx_sched_h scheduler, int job_id);
+
+
+int ctx_sched_get_job(ctx_sched_h scheduler, int job_id, ctx_sched_job_h* job);
+
+int ctx_sched_foreach_job(ctx_sched_h scheduler, ctx_sched_foreach_job_cb callback, void* user_data);
+
+
+int ctx_sched_set_stop_job_cb(ctx_sched_h scheduler, ctx_sched_stop_job_cb callback, void* user_data);
+
+
+int ctx_sched_declare_context(ctx_sched_h scheduler, const char* uri);
+
+int ctx_sched_undeclare_context(ctx_sched_h scheduler, const char* uri);
+
+int ctx_sched_publish_context_json(ctx_sched_h scheduler, const char* uri, const char* json_payload);
+
+
+int ctx_sched_job_create_periodic(unsigned int interval, time_t anchor, ctx_sched_job_h* job);
+
+int ctx_sched_job_create_on_demand(ctx_sched_job_h* job);
+
+int ctx_sched_job_destroy(ctx_sched_job_h job);
+
+
+int ctx_sched_job_add_trigger(ctx_sched_job_h job, ctx_sched_job_context_h trigger);
+
+int ctx_sched_job_add_requirement(ctx_sched_job_h job, ctx_sched_job_context_h requirement);
+
+int ctx_sched_job_set_requirement_timeout(ctx_sched_job_h job, unsigned int timeout);
+
+int ctx_sched_job_set_persistent(ctx_sched_job_h job, bool persistent);
+
+int ctx_sched_job_set_one_time(ctx_sched_job_h job, bool one_time);
+
+int ctx_sched_job_set_app_control(ctx_sched_job_h job, app_control_h app_control);
+
+int ctx_sched_job_set_dbus(ctx_sched_job_h job, const char* bus_name,
+ const char* object_path, const char* interface, const char* method, GVariant* parameters);
+
+int ctx_sched_job_set_bundle(ctx_sched_job_h job, bundle* user_bundle);
+
+
+int ctx_sched_job_is_started(ctx_sched_job_h job, bool* started);
+
+int ctx_sched_job_get_id(ctx_sched_job_h job, int* job_id);
+
+int ctx_sched_job_get_bundle(ctx_sched_job_h job, bundle** user_bundle);
+
+
+int ctx_sched_job_trigger_is_supported(const char* uri, bool* supported);
+
+int ctx_sched_job_trigger_create(const char* uri, ctx_sched_job_context_h* job_context);
+
+int ctx_sched_job_requirement_is_supported(const char* uri, bool* supported);
+
+int ctx_sched_job_requirement_create(const char* uri, bool optional, ctx_sched_job_context_h* job_context);
+
+int ctx_sched_job_context_prepare_attribute(ctx_sched_job_context_h job_context, const char* attribute);
+
+
+int ctx_sched_job_context_attribute_add_eq_int(ctx_sched_job_context_h job_context, const char* attribute, int value);
+
+int ctx_sched_job_context_attribute_add_eq_str(ctx_sched_job_context_h job_context, const char* attribute, const char* value);
+
+int ctx_sched_job_context_attribute_add_ne_int(ctx_sched_job_context_h job_context, const char* attribute, int value);
+
+int ctx_sched_job_context_attribute_add_ne_str(ctx_sched_job_context_h job_context, const char* attribute, const char* value);
+
+int ctx_sched_job_context_attribute_set_gt_int(ctx_sched_job_context_h job_context, const char* attribute, int value);
+
+int ctx_sched_job_context_attribute_set_ge_int(ctx_sched_job_context_h job_context, const char* attribute, int value);
+
+int ctx_sched_job_context_attribute_set_lt_int(ctx_sched_job_context_h job_context, const char* attribute, int value);
+
+int ctx_sched_job_context_attribute_set_le_int(ctx_sched_job_context_h job_context, const char* attribute, int value);
+
+int ctx_sched_job_context_destroy(ctx_sched_job_context_h job_context);
+
+
+// Logical-disjunction modifiers to support legacy Context-Trigger API.
+// NOT recommended to use.
+int ctx_sched_job_set_disjunction(ctx_sched_job_h job, bool disjunction);
+
+int ctx_sched_job_context_set_disjunction(ctx_sched_job_context_h job_context, bool disjunction);
+
+int ctx_sched_job_context_attribute_set_disjunction(ctx_sched_job_context_h job_context, const char* attribute, bool disjunction);
+
#ifdef __cplusplus
}
#define __CAPI_CONTEXT_JOB_SCHEDULER_TYPES_INTERNAL_H__
+#define CTX_SCHED_URI_PREFIX "http://tizen.org/context/"
+
+#define CTX_SCHED_URI_BATTERY CTX_SCHED_URI_PREFIX "state/battery"
+#define CTX_SCHED_URI_CHARGER CTX_SCHED_URI_PREFIX "state/charger"
+#define CTX_SCHED_URI_GPS CTX_SCHED_URI_PREFIX "state/gps"
+#define CTX_SCHED_URI_NPS CTX_SCHED_URI_PREFIX "state/nps"
+#define CTX_SCHED_URI_EARJACK CTX_SCHED_URI_PREFIX "state/earjack"
+#define CTX_SCHED_URI_USB CTX_SCHED_URI_PREFIX "state/usb"
+#define CTX_SCHED_URI_WIFI CTX_SCHED_URI_PREFIX "state/wifi"
+#define CTX_SCHED_URI_DISPLAY CTX_SCHED_URI_PREFIX "state/display"
+#define CTX_SCHED_URI_POWERSAVE CTX_SCHED_URI_PREFIX "state/powersave"
+
+#define CTX_SCHED_URI_STATIONARY CTX_SCHED_URI_PREFIX "event/stationary"
+#define CTX_SCHED_URI_WALKING CTX_SCHED_URI_PREFIX "event/walking"
+#define CTX_SCHED_URI_RUNNING CTX_SCHED_URI_PREFIX "event/running"
+#define CTX_SCHED_URI_IN_VEHICLE CTX_SCHED_URI_PREFIX "event/in_vehicle"
+#define CTX_SCHED_URI_GEOFENCE CTX_SCHED_URI_PREFIX "event/geofence"
+
+#define CTX_SCHED_URI_CONTACTS_DB CTX_SCHED_URI_PREFIX "event/contacts_db"
+#define CTX_SCHED_URI_CALENDAR_DB CTX_SCHED_URI_PREFIX "event/calendar_db"
+#define CTX_SCHED_URI_PLACE_DB CTX_SCHED_URI_PREFIX "event/place_db"
+
+
#endif