add: more basic macro stuff
add: more efficient relay loading (only ids)
This commit is contained in:
parent
f67b7e9e0f
commit
0103b0b2ff
7 changed files with 555 additions and 7 deletions
include
|
@ -36,7 +36,6 @@ void
|
|||
cache_invalidate_relay(int relay_id, int status_relay);
|
||||
|
||||
|
||||
|
||||
void
|
||||
cache_put_json_controller(int controller_id, char *controller_json);
|
||||
|
||||
|
@ -47,6 +46,16 @@ void
|
|||
cache_invalidate_controller(int controller_id);
|
||||
|
||||
|
||||
void
|
||||
cache_put_json_macro(int macro_id, char *macro_json);
|
||||
|
||||
char*
|
||||
cache_get_json_macro(int macro_id);
|
||||
|
||||
void
|
||||
cache_invalidate_macro(int macro_id);
|
||||
|
||||
|
||||
|
||||
void
|
||||
cache_invalidate_tagged(int tag_id);
|
||||
|
|
|
@ -10,4 +10,7 @@ junction_relay_schedule_remove_for_relay(int relay_id);
|
|||
int
|
||||
junction_relay_schedule_insert_weekdays(int relay_id, int *schedule_ids);
|
||||
|
||||
int*
|
||||
junction_relay_schedule_get_relay_ids_with_schedule(int schedule_id);
|
||||
|
||||
#endif /* CORE_MODELS_JUNCTION_RELAY_SCHEDULE_H */
|
||||
|
|
45
include/models/macro.h
Normal file
45
include/models/macro.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
#ifndef CORE_MACRO_H
|
||||
#define CORE_MACRO_H
|
||||
|
||||
#include <uuid/uuid.h>
|
||||
|
||||
#include <cJSON.h>
|
||||
|
||||
#include <constants.h>
|
||||
#include <models/period.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int id;
|
||||
uuid_t uid;
|
||||
char name[MAX_NAME_LENGTH + 1];
|
||||
} macro_t;
|
||||
|
||||
int
|
||||
macro_save(macro_t *macro);
|
||||
|
||||
int
|
||||
macro_remove(macro_t *macro);
|
||||
|
||||
void
|
||||
macro_free(macro_t *macro);
|
||||
|
||||
void
|
||||
macro_free_list(macro_t **macro);
|
||||
|
||||
cJSON*
|
||||
macro_to_json(macro_t *macro);
|
||||
|
||||
void
|
||||
macro_free_list(macro_t **macros_list);
|
||||
|
||||
macro_t*
|
||||
macro_get_by_id(int id);
|
||||
|
||||
macro_t*
|
||||
macro_get_by_uid(uuid_t uid);
|
||||
|
||||
macro_t**
|
||||
macro_get_all();
|
||||
|
||||
#endif /* CORE_MACRO_H */
|
Loading…
Add table
Add a link
Reference in a new issue