2019-07-22 20:06:13 +00:00
|
|
|
#ifndef EMGAUWA_CORE_controller_DBO_H
|
|
|
|
#define EMGAUWA_CORE_controller_DBO_H
|
2019-07-12 19:05:56 +00:00
|
|
|
|
|
|
|
#include <string>
|
2020-02-23 19:06:14 +00:00
|
|
|
#include <uuid/uuid.h>
|
2019-07-12 19:05:56 +00:00
|
|
|
#include <sqlite3.h>
|
2019-07-19 09:41:39 +00:00
|
|
|
#include <json/value.h>
|
2019-07-20 22:29:05 +00:00
|
|
|
#include <helpers.h>
|
2020-04-18 19:29:52 +00:00
|
|
|
#include <binn.h>
|
2019-07-29 20:02:38 +00:00
|
|
|
#include "relay_dbo.h"
|
2019-07-12 19:05:56 +00:00
|
|
|
|
2019-07-22 20:06:13 +00:00
|
|
|
class controller_dbo
|
2019-07-12 19:05:56 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-07-19 09:41:39 +00:00
|
|
|
|
2020-02-23 19:06:14 +00:00
|
|
|
uuid_t id;
|
2019-07-12 19:05:56 +00:00
|
|
|
char name[128];
|
|
|
|
char ip[17];
|
|
|
|
bool active;
|
|
|
|
int port;
|
|
|
|
int relay_count;
|
2019-09-24 21:33:35 +00:00
|
|
|
char tag[64];
|
2019-07-29 20:02:38 +00:00
|
|
|
relay_dbo **relays;
|
|
|
|
|
|
|
|
~controller_dbo();
|
2019-07-12 19:05:56 +00:00
|
|
|
|
2019-07-19 09:41:39 +00:00
|
|
|
bool
|
|
|
|
update();
|
|
|
|
|
|
|
|
bool
|
|
|
|
insert();
|
|
|
|
|
|
|
|
bool
|
|
|
|
remove();
|
|
|
|
|
|
|
|
Json::Value
|
|
|
|
to_json();
|
|
|
|
|
2019-07-22 20:06:13 +00:00
|
|
|
static controller_dbo**
|
2020-02-23 19:06:14 +00:00
|
|
|
get_by_simple(const char *key, const void *value, intptr_t bind_func, int bind_func_param);
|
2019-07-19 09:41:39 +00:00
|
|
|
|
2019-07-22 20:06:13 +00:00
|
|
|
static controller_dbo**
|
2019-07-20 22:29:05 +00:00
|
|
|
get_by(helpers::sql_filter_builder **filters);
|
|
|
|
|
2019-07-22 20:06:13 +00:00
|
|
|
static controller_dbo**
|
2019-07-19 09:41:39 +00:00
|
|
|
get_all();
|
2019-07-29 20:02:38 +00:00
|
|
|
|
|
|
|
bool
|
2020-04-18 19:29:52 +00:00
|
|
|
command(binn *payload);
|
2019-07-29 20:02:38 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
free_list(controller_dbo **controllers_list);
|
2019-07-12 19:05:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-07-22 20:06:13 +00:00
|
|
|
#endif //EMGAUWA_CORE_controller_DBO_H
|