2019-07-12 19:05:56 +00:00
|
|
|
#include <drogon/drogon.h>
|
|
|
|
#include <sqlite3.h>
|
|
|
|
|
|
|
|
#include <models/device_dbo.h>
|
|
|
|
|
|
|
|
#include "globals.h"
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* Open database */
|
|
|
|
rc = sqlite3_open("test.db", &globals::db);
|
|
|
|
|
|
|
|
if( rc ) {
|
|
|
|
fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(globals::db));
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
device_dbo test;
|
|
|
|
strcpy(test.id, "meine-tolle_id-123");
|
|
|
|
strcpy(test.name, "test_device latest name");
|
|
|
|
strcpy(test.ip, "192.168.1.68");
|
|
|
|
test.active = true;
|
|
|
|
|
2019-07-14 22:39:37 +00:00
|
|
|
//test.save();
|
2019-07-12 19:05:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
//Load config file
|
|
|
|
drogon::app().loadConfigFile("../config.json");
|
|
|
|
//Run HTTP framework,the method will block in the internal event loop
|
|
|
|
drogon::app().run();
|
|
|
|
return 0;
|
|
|
|
}
|