54 lines
935 B
C++
54 lines
935 B
C++
#ifndef EMGAUWA_CORE_controller_DBO_H
|
|
#define EMGAUWA_CORE_controller_DBO_H
|
|
|
|
#include <string>
|
|
#include <uuid/uuid.h>
|
|
#include <sqlite3.h>
|
|
#include <json/value.h>
|
|
#include <helpers.h>
|
|
#include "relay_dbo.h"
|
|
|
|
class controller_dbo
|
|
{
|
|
public:
|
|
|
|
uuid_t id;
|
|
char name[128];
|
|
char ip[17];
|
|
bool active;
|
|
int port;
|
|
int relay_count;
|
|
relay_dbo **relays;
|
|
|
|
~controller_dbo();
|
|
|
|
bool
|
|
update();
|
|
|
|
bool
|
|
insert();
|
|
|
|
bool
|
|
remove();
|
|
|
|
Json::Value
|
|
to_json();
|
|
|
|
static controller_dbo**
|
|
get_by_simple(const char *key, const void *value, intptr_t bind_func, int bind_func_param);
|
|
|
|
static controller_dbo**
|
|
get_by(helpers::sql_filter_builder **filters);
|
|
|
|
static controller_dbo**
|
|
get_all();
|
|
|
|
bool
|
|
command(int command_code, char *payload, uint32_t payload_size);
|
|
|
|
static void
|
|
free_list(controller_dbo **controllers_list);
|
|
};
|
|
|
|
|
|
#endif //EMGAUWA_CORE_controller_DBO_H
|