core-legacy/include/models/relay.h
2020-05-06 01:05:36 +02:00

54 lines
933 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();
cJSON*
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();
relay_t**
relay_get_by_controller_id(int controller_id);
#endif /* CORE_RELAY_H */