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>
|
|
|
|
#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>
|
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
|
|
|
|
|
|
|
char id[33];
|
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**
|
2019-07-20 21:33:17 +00:00
|
|
|
get_by_simple(const char *key, const void *value, intptr_t bind_func);
|
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
|
|
|
|
command(int command_code, const char *payload);
|
|
|
|
|
|
|
|
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
|