#ifndef CORE_RELAY_H #define CORE_RELAY_H #include #include #include #include #include #include #include typedef struct { int id; char name[MAX_NAME_LENGTH + 1]; int number; int controller_id; int active_schedule_id; int is_on; schedule_t *active_schedule; schedule_t *schedules[7]; } relay_t; int relay_save(); void relay_reload_active_schedule(relay_t *relay); void relay_reload_schedules(relay_t *relay); cJSON* relay_to_json(relay_t *relay, int status_relay); cJSON* relay_list_to_json(relay_t **relays, int status_relays); void relay_free(relay_t *relay); void relay_free_list(relay_t **relays_list); relay_t* relay_get_by_id(int id); int relay_get_id_for_controller(int controller_id, int relay_num); relay_t* relay_get_for_controller(int controller_id, int relay_num); relay_t** relay_get_with_schedule(int schedule_id); relay_t** relay_get_all(); relay_t** relay_get_by_controller_id(int controller_id); int relay_get_controller_id_for_relay(int relay_id); #endif /* CORE_RELAY_H */