core-legacy/include/models/relay.h
Tobias Reisinger 5a19e99627 add: temporary CORS headers
add: better sql calls with JOIN
2020-05-20 00:51:16 +02:00

60 lines
985 B
C

#ifndef CORE_RELAY_H
#define CORE_RELAY_H
#include <string.h>
#include <uuid/uuid.h>
#include <constants.h>
#include <cJSON.h>
#include <helpers.h>
#include <database.h>
#include <models/schedule.h>
typedef struct
{
int id;
char name[MAX_NAME_LENGTH + 1];
int number;
int controller_id;
int active_schedule_id;
schedule_t *active_schedule;
schedule_t *schedules[7];
} relay_t;
int
relay_save();
int
relay_remove();
void
relay_reload_active_schedule(relay_t *relay);
cJSON*
relay_to_json();
void
relay_free(relay_t *relay);
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);
relay_t**
relay_get_with_schedule(int schedule_id);
relay_t**
relay_get_all();
relay_t**
relay_get_by_controller_id(int controller_id);
#endif /* CORE_RELAY_H */