core-legacy/include/models/relay.h

50 lines
821 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 <helpers.h>
#include <database.h>
#include <models/schedule.h>
typedef struct
{
int id;
char name[128];
int number;
uuid_t controller_id;
int active_schedule_id;
schedule_t *active_schedule;
schedule_t *schedules[7];
} relay_t;
bool
relay_save();
bool
relay_remove();
char*
relay_to_json();
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_relay_for_controller(uuid_t controller_id, int relay_num);
bool
relay_valid_num_is_for_controller(uuid_t controller_id, int relay_num);
relay_t**
relay_get_all();
#endif /* CORE_RELAY_H */