core-legacy/include/models/schedule.h

72 lines
1.1 KiB
C
Raw Permalink Normal View History

2020-05-05 09:42:02 +00:00
#ifndef CORE_SCHEDULE_H
#define CORE_SCHEDULE_H
#include <uuid/uuid.h>
#include <cJSON.h>
2020-05-05 09:42:02 +00:00
#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);
2020-05-05 20:29:04 +00:00
int
schedule_is_protected(schedule_t *schedule);
2020-05-05 09:42:02 +00:00
void
schedule_free(schedule_t *schedule);
void
schedule_free_list(schedule_t **schedule);
cJSON*
2020-05-05 09:42:02 +00:00
schedule_to_json(schedule_t *schedule);
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);
2020-05-05 20:29:04 +00:00
schedule_t*
schedule_get_by_uid(uuid_t uid);
schedule_t**
schedule_get_relay_weekdays(int relay_id);
2020-05-05 09:42:02 +00:00
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);
2020-11-13 01:06:48 +00:00
void
schedule_get_uid_off(uuid_t target);
void
schedule_get_uid_on(uuid_t target);
2020-05-05 09:42:02 +00:00
#endif /* CORE_SCHEDULE_H */