Update Makefile.conf and Libraries

This commit is contained in:
2020-05-04 22:01:48 +02:00
parent dd7ae1cb73
commit 2d9621f1f1
12 changed files with 23 additions and 49 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
#include "Bluetooth/Device.h" #include "Bluetooth/Device.h"
#include "UniFi/Device.h" #include "UniFi/Device.h"
#include "Util/StaticDevice.h" #include "Util/StaticDevice.h"
#include "Util/INIh.h"
#include <clipp.h> #include <clipp.h>
#include <INIReader.h>
#include <Logging.h> #include <Logging.h>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
@@ -32,7 +32,7 @@ int main(int argc, char** argv)
return 1; return 1;
} }
PresenceDetection::Util::INIReader iniReader("PresenceDetection.ini"); INIReader iniReader("PresenceDetection.ini");
if (iniReader.ParseError() != 0) if (iniReader.ParseError() != 0)
{ {
std::cerr << "Can't read PresenceDetection.ini" << std::endl; std::cerr << "Can't read PresenceDetection.ini" << std::endl;
+2 -2
View File
@@ -1,4 +1,4 @@
#include "Util/INIh.h" #include <INIReader.h>
#include <Timer.h> #include <Timer.h>
#include <unistd.h> #include <unistd.h>
#include <algorithm> #include <algorithm>
@@ -16,7 +16,7 @@ void print()
void TestINIReader() void TestINIReader()
{ {
PresenceDetection::Util::INIReader reader("PresenceDetection.ini"); INIReader reader("PresenceDetection.ini");
std::string target = reader.Get("PresenceDetection", "Target", ""); std::string target = reader.Get("PresenceDetection", "Target", "");
if (!target.empty()) if (!target.empty())
+2 -2
View File
@@ -1,6 +1,6 @@
#include "Device.h" #include "Device.h"
#include "Functions.h" #include "Functions.h"
#include "Util/JSON.h" #include <json.hpp>
#include <Logging.h> #include <Logging.h>
#include <algorithm> #include <algorithm>
#include <sstream> #include <sstream>
@@ -87,7 +87,7 @@ void Device::UpdateDevicesFromInventory()
try try
{ {
std::string devices = m_httpClient.GetUrlContents(m_inventoryURL); std::string devices = m_httpClient.GetUrlContents(m_inventoryURL);
Util::JSON json = Util::JSON::parse(devices); nlohmann::json json = nlohmann::json::parse(devices);
m_dynamicDevices.clear(); m_dynamicDevices.clear();
for (auto& element : json) for (auto& element : json)
-1
View File
@@ -1 +0,0 @@
../../../Libraries/inih/INIReader.h
-1
View File
@@ -1 +0,0 @@
../../Libraries/json/include
+1 -1
View File
@@ -1 +1 @@
../../Libraries/clipp/include ../../Libraries/clipp
+1
View File
@@ -0,0 +1 @@
../../Libraries/inih
+1
View File
@@ -0,0 +1 @@
../../Libraries/json
+9 -4
View File
@@ -2,7 +2,7 @@
# Makefile.conf # Makefile.conf
# #
LFLAGS += -lHttp LFLAGS += -lHttp -lcrypto -lcurl -lssl -lz
LFLAGS += -L$(ROOTPATH)/Libraries/Http/lib/$(ARCH) LFLAGS += -L$(ROOTPATH)/Libraries/Http/lib/$(ARCH)
CFLAGS += -I$(ROOTPATH)/Libraries/Http/include CFLAGS += -I$(ROOTPATH)/Libraries/Http/include
@@ -18,8 +18,13 @@ LFLAGS += -lUtilities
LFLAGS += -L$(ROOTPATH)/Libraries/Utilities/lib/$(ARCH) LFLAGS += -L$(ROOTPATH)/Libraries/Utilities/lib/$(ARCH)
CFLAGS += -I$(ROOTPATH)/Libraries/Utilities/include CFLAGS += -I$(ROOTPATH)/Libraries/Utilities/include
CFLAGS += -I$(ROOTPATH)/Libraries/clipp CFLAGS += -I$(ROOTPATH)/Libraries/clipp/include
CFLAGS += -I$(ROOTPATH)/Libraries/inih
CFLAGS += -I$(ROOTPATH)/Libraries/json/include/nlohmann -I$(ROOTPATH)/Libraries/json/include
LFLAGS += -lbluetooth
LFLAGS += -lpthread
CFLAGS += -I$(ROOTPATH) -I$(ROOTPATH)/Libraries
LFLAGS += -lpthread -lm -lssl -lcrypto -lcurl -lz -ldl -lbluetooth
CFLAGS += -I$(ROOTPATH) -I$(ROOTPATH)/Libraries -I$(ROOTPATH)/Libraries/JSON
DEBUGDIR := .debug DEBUGDIR := .debug
+5 -5
View File
@@ -1,5 +1,5 @@
#include "Device.h" #include "Device.h"
#include "Util/JSON.h" #include <json.hpp>
#include <Logging.h> #include <Logging.h>
#include <algorithm> #include <algorithm>
#include <sstream> #include <sstream>
@@ -59,7 +59,7 @@ bool Device::Login()
std::stringstream url; std::stringstream url;
url << "https://" << m_hostname << ":" << m_port << "/api/login"; url << "https://" << m_hostname << ":" << m_port << "/api/login";
Util::JSON json; nlohmann::json json;
json["password"] = m_password; json["password"] = m_password;
json["username"] = m_username; json["username"] = m_username;
@@ -71,7 +71,7 @@ bool Device::Login()
std::stringstream output; std::stringstream output;
output << m_httpClient.GetUrlPostContents(url.str(), headers, m_cookieFile, json.dump()); output << m_httpClient.GetUrlPostContents(url.str(), headers, m_cookieFile, json.dump());
Util::JSON outputJSON = Util::JSON::parse(output); nlohmann::json outputJSON = nlohmann::json::parse(output);
if (outputJSON["meta"]["rc"] != "ok") if (outputJSON["meta"]["rc"] != "ok")
{ {
@@ -154,7 +154,7 @@ void Device::UpdateDevicesFromInventory()
try try
{ {
std::string devices = m_httpClient.GetUrlContents(m_inventoryURL); std::string devices = m_httpClient.GetUrlContents(m_inventoryURL);
Util::JSON json = Util::JSON::parse(devices); nlohmann::json json = nlohmann::json::parse(devices);
m_devices.clear(); m_devices.clear();
for (auto& element : json) for (auto& element : json)
@@ -198,7 +198,7 @@ void Device::UpdatePresentDevices()
std::stringstream output; std::stringstream output;
output << m_httpClient.GetUrlContents(url.str(), m_cookieFile); output << m_httpClient.GetUrlContents(url.str(), m_cookieFile);
Util::JSON json = Util::JSON::parse(output); nlohmann::json json = nlohmann::json::parse(output);
if (json["meta"]["rc"] != "ok") if (json["meta"]["rc"] != "ok")
{ {
-15
View File
@@ -1,15 +0,0 @@
#ifndef UTIL_INIH_H
#define UTIL_INIH_H
#include "Libraries/INIh/INIReader.h"
namespace PresenceDetection {
namespace Util {
using ::INIReader;
} // namespace Util
} // namespace PresenceDetection
#endif // UTIL_INIH_H
-16
View File
@@ -1,16 +0,0 @@
#ifndef UTIL_JSON_H
#define UTIL_JSON_H
#include "Libraries/JSON/nlohmann/json.hpp"
namespace PresenceDetection {
namespace Util {
using namespace nlohmann;
typedef json JSON;
} // namespace Util
} // namespace DomoticaServer
#endif // UTIL_JSON_H