64 lines
1 KiB
C
64 lines
1 KiB
C
#ifndef CORE_SCHEDULE_H
|
|
#define CORE_SCHEDULE_H
|
|
|
|
#include <uuid/uuid.h>
|
|
|
|
#include <cJSON.h>
|
|
#include <constants.h>
|
|
#include <models/period.h>
|
|
|
|
typedef struct
|
|
{
|
|
int id;
|
|
uuid_t uid;
|
|
char name[MAX_NAME_LENGTH + 1];
|
|
uint16_t periods_count;
|
|
period_t *periods;
|
|
} schedule_t;
|
|
|
|
int
|
|
schedule_save(schedule_t *schedule);
|
|
|
|
int
|
|
schedule_remove(schedule_t *schedule);
|
|
|
|
int
|
|
schedule_is_protected(schedule_t *schedule);
|
|
|
|
void
|
|
schedule_free(schedule_t *schedule);
|
|
|
|
void
|
|
schedule_free_list(schedule_t **schedule);
|
|
|
|
cJSON*
|
|
schedule_to_json(schedule_t *schedule);
|
|
|
|
void
|
|
schedule_free_list(schedule_t **schedules_list);
|
|
|
|
uint16_t*
|
|
schedule_periods_to_blob(schedule_t *schedule);
|
|
|
|
schedule_t*
|
|
schedule_get_by_id_or_off(int id);
|
|
|
|
schedule_t*
|
|
schedule_get_by_id(int id);
|
|
|
|
schedule_t*
|
|
schedule_get_by_uid_or_off(uuid_t uid);
|
|
|
|
schedule_t*
|
|
schedule_get_by_uid(uuid_t uid);
|
|
|
|
schedule_t**
|
|
schedule_get_all();
|
|
|
|
int
|
|
schedule_uid_parse(const char *uid_str, uuid_t result);
|
|
|
|
void
|
|
schedule_uid_unparse(const uuid_t uid, char *result);
|
|
|
|
#endif /* CORE_SCHEDULE_H */
|