*/
int ctx_sched_job_destroy(ctx_sched_job_h job);
+/**
+ * @brief Serializes a job handle.
+ * @remarks This function is not thread safe.
+ * @param[in] job Job handle
+ * @return The Json representation of @c job
+ */
+const char* ctx_sched_job_serialize(ctx_sched_job_h job);
+
/**
* @brief Adds a trigger context to a job.
*/
#include <algorithm>
+#include <json/json.h>
#include <JobSchedulerTypesPrivate.h>
#include <job_scheduler_internal.h>
#include <JobInfo.h>
return E_NONE;
}
+EXPORT_API const char* ctx_sched_job_serialize(ctx_sched_job_h job)
+{
+ static std::string serialized;
+
+ Json::Value jsonRoot;
+ Json::StyledWriter writer;
+
+ job->jobInfo->toJson(jsonRoot);
+ serialized = writer.write(jsonRoot);
+
+ return serialized.c_str();
+}
+
EXPORT_API int ctx_sched_job_add_trigger(ctx_sched_job_h job, ctx_sched_job_context_h trigger)
{
IF_FAIL_RETURN(job && trigger, E_PARAM);