Tobias Reisinger
51ab1d7982
add: some progress to new discovery add: some tests remove: migrations. restarting for now
58 lines
1 KiB
C++
58 lines
1 KiB
C++
#ifndef EMGAUWA_CORE_RELAY_DBO_H
|
|
#define EMGAUWA_CORE_RELAY_DBO_H
|
|
|
|
#include <string>
|
|
#include <sqlite3.h>
|
|
#include <json/value.h>
|
|
#include <uuid/uuid.h>
|
|
#include <helpers.h>
|
|
#include "schedule_dbo.h"
|
|
|
|
class relay_dbo
|
|
{
|
|
public:
|
|
|
|
int id;
|
|
char name[128];
|
|
int number;
|
|
uuid_t controller_id;
|
|
uuid_t active_schedule_id;
|
|
char tag[64];
|
|
schedule_dbo *active_schedule;
|
|
|
|
void
|
|
reload_active_schedule();
|
|
|
|
bool
|
|
update();
|
|
|
|
bool
|
|
insert();
|
|
|
|
bool
|
|
remove();
|
|
|
|
Json::Value
|
|
to_json();
|
|
|
|
static void
|
|
free_list(relay_dbo **relays_list);
|
|
|
|
static relay_dbo**
|
|
get_by_simple(const char *key, const void *value, intptr_t bind_func, int bind_func_param);
|
|
|
|
static relay_dbo**
|
|
get_by(helpers::sql_filter_builder **filters);
|
|
|
|
static relay_dbo*
|
|
get_relay_for_controller(uuid_t controller_id, int relay_num);
|
|
|
|
static bool
|
|
valid_num_for_controller(uuid_t search_controller_id, int relay_num);
|
|
|
|
static relay_dbo**
|
|
get_all();
|
|
};
|
|
|
|
|
|
#endif //EMGAUWA_CORE_RELAY_DBO_H
|