2019-07-12 19:05:56 +00:00
|
|
|
#ifndef EMGAUWA_CORE_DEVICE_DBO_H
|
|
|
|
#define EMGAUWA_CORE_DEVICE_DBO_H
|
|
|
|
|
|
|
|
#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-12 19:05:56 +00:00
|
|
|
|
|
|
|
class device_dbo
|
|
|
|
{
|
|
|
|
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-07-19 09:41:39 +00:00
|
|
|
bool
|
|
|
|
update();
|
|
|
|
|
|
|
|
bool
|
|
|
|
insert();
|
|
|
|
|
|
|
|
bool
|
|
|
|
remove();
|
|
|
|
|
|
|
|
Json::Value
|
|
|
|
to_json();
|
|
|
|
|
|
|
|
static void
|
|
|
|
free_list(device_dbo **devices_list);
|
|
|
|
|
2019-07-20 21:33:17 +00:00
|
|
|
static device_dbo**
|
|
|
|
get_by_simple(const char *key, const void *value, intptr_t bind_func);
|
2019-07-19 09:41:39 +00:00
|
|
|
|
2019-07-20 22:29:05 +00:00
|
|
|
static device_dbo**
|
|
|
|
get_by(helpers::sql_filter_builder **filters);
|
|
|
|
|
2019-07-19 09:41:39 +00:00
|
|
|
static device_dbo**
|
|
|
|
get_all();
|
2019-07-12 19:05:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //EMGAUWA_CORE_DEVICE_DBO_H
|