core-legacy/include/models/relay.h

58 lines
932 B
C
Raw Normal View History

2020-05-05 09:42:02 +00:00
#ifndef CORE_RELAY_H
#define CORE_RELAY_H
#include <string.h>
#include <uuid/uuid.h>
#include <constants.h>
#include <cJSON.h>
2020-05-05 09:42:02 +00:00
#include <helpers.h>
#include <database.h>
#include <models/schedule.h>
typedef struct
{
int id;
char name[MAX_NAME_LENGTH + 1];
2020-05-05 09:42:02 +00:00
int number;
int controller_id;
2020-05-05 09:42:02 +00:00
int active_schedule_id;
schedule_t *active_schedule;
schedule_t *schedules[7];
} relay_t;
int
2020-05-05 09:42:02 +00:00
relay_save();
int
2020-05-05 09:42:02 +00:00
relay_remove();
void
relay_reload_active_schedule(relay_t *relay);
cJSON*
2020-05-05 09:42:02 +00:00
relay_to_json();
void
relay_free(relay_t *relay);
2020-05-05 09:42:02 +00:00
void
relay_free_list(relay_t **relays_list);
relay_t**
relay_get_by_simple(const char *key, const void *value, intptr_t bind_func, int bind_func_param);
relay_t*
relay_get_by_id(int id);
relay_t*
relay_get_for_controller(int controller_id, int relay_num);
2020-05-05 09:42:02 +00:00
relay_t**
relay_get_all();
relay_t**
relay_get_by_controller_id(int controller_id);
2020-05-05 09:42:02 +00:00
#endif /* CORE_RELAY_H */