add: controller/..../relays endpoints

add: relay functions
remove: drivers
This commit is contained in:
Tobias Reisinger 2020-05-06 22:49:22 +02:00
parent f040cd8b21
commit 0edb16a2d5
15 changed files with 587 additions and 44 deletions

View file

@ -9,12 +9,14 @@
#include <helpers.h>
#include <models/relay.h>
#define IP_LENGTH 16
typedef struct
{
int id;
uuid_t uid;
char name[MAX_NAME_LENGTH + 1];
char ip[17];
char ip[IP_LENGTH + 1];
int active;
int port;
int relay_count;

View file

@ -27,9 +27,15 @@ 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);
@ -40,10 +46,7 @@ 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_get_for_controller(int controller_id, int relay_num);
relay_t**
relay_get_all();

View file

@ -46,6 +46,9 @@ schedule_get_by_id_or_off(int id);
schedule_t*
schedule_get_by_id(int id);
schedule_t*
schedule_get_by_uid_or_off(uuid_t uid);
schedule_t*
schedule_get_by_uid(uuid_t uid);