add: macro endpoints

add: basic macro support
fix: database locking with lock-pointer
fix: memory leaks
This commit is contained in:
Tobias Reisinger 2020-09-04 00:28:49 +02:00
parent 6a2b94ef1c
commit 9d2c48d645
30 changed files with 606 additions and 213 deletions

View file

@ -1,7 +0,0 @@
#ifndef CORE_JUNCTION_MACRO_H
#define CORE_JUNCTION_MACRO_H
int
junction_macro_insert(int macro_id, int relay_id, int schedule_id, uint8_t weekday);
#endif /* CORE_JUNCTION_MACRO_H */

View file

@ -7,6 +7,7 @@
#include <constants.h>
#include <models/period.h>
#include <models/macro_action.h>
typedef struct
{

View file

@ -0,0 +1,27 @@
#ifndef CORE_MODELS_MACRO_ACTION_H
#define CORE_MODELS_MACRO_ACTION_H
typedef struct
{
int macro_id;
int relay_id;
int schedule_id;
uint8_t weekday;
} macro_action_t;
int
macro_action_insert(macro_action_t *macro_action);
macro_action_t**
macro_action_get_for_macro(int macro_id);
void
macro_action_free_list(macro_action_t **macro_actions);
int*
macro_action_get_macro_ids_with_schedule(int schedule_id);
int*
macro_action_get_macro_ids_with_relay(int relay_id);
#endif /* CORE_MODELS_MACRO_ACTION_H */