Эх сурвалжийг харах

Update Makefile.conf and Libraries

JDierkse 5 жил өмнө
parent
commit
2d9621f1f1

+ 2 - 2
Application/PresenceDetection.cc

@@ -1,8 +1,8 @@
 #include "Bluetooth/Device.h"
 #include "UniFi/Device.h"
 #include "Util/StaticDevice.h"
-#include "Util/INIh.h"
 #include <clipp.h>
+#include <INIReader.h>
 #include <Logging.h>
 #include <unistd.h>
 #include <sys/types.h>
@@ -32,7 +32,7 @@ int main(int argc, char** argv)
 			return 1;
 		}
 
-		PresenceDetection::Util::INIReader iniReader("PresenceDetection.ini");
+		INIReader iniReader("PresenceDetection.ini");
 		if (iniReader.ParseError() != 0)
 		{
 			std::cerr << "Can't read PresenceDetection.ini" << std::endl;

+ 2 - 2
Application/Test.cc

@@ -1,4 +1,4 @@
-#include "Util/INIh.h"
+#include <INIReader.h>
 #include <Timer.h>
 #include <unistd.h>
 #include <algorithm>
@@ -16,7 +16,7 @@ void print()
 
 void TestINIReader()
 {
-	PresenceDetection::Util::INIReader reader("PresenceDetection.ini");
+	INIReader reader("PresenceDetection.ini");
 
 	std::string target = reader.Get("PresenceDetection", "Target", "");
 	if (!target.empty())

+ 2 - 2
Bluetooth/Device.cpp

@@ -1,6 +1,6 @@
 #include "Device.h"
 #include "Functions.h"
-#include "Util/JSON.h"
+#include <json.hpp>
 #include <Logging.h>
 #include <algorithm>
 #include <sstream>
@@ -87,7 +87,7 @@ void Device::UpdateDevicesFromInventory()
 	try
 	{
 		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();
 		for (auto& element : json)

+ 0 - 1
Libraries/INIh/INIReader.h

@@ -1 +0,0 @@
-../../../Libraries/inih/INIReader.h

+ 0 - 1
Libraries/JSON

@@ -1 +0,0 @@
-../../Libraries/json/include

+ 1 - 1
Libraries/clipp

@@ -1 +1 @@
-../../Libraries/clipp/include
+../../Libraries/clipp

+ 1 - 0
Libraries/inih

@@ -0,0 +1 @@
+../../Libraries/inih

+ 1 - 0
Libraries/json

@@ -0,0 +1 @@
+../../Libraries/json

+ 9 - 4
Makefile.conf

@@ -2,7 +2,7 @@
 # Makefile.conf
 #
 
-LFLAGS += -lHttp
+LFLAGS += -lHttp -lcrypto -lcurl -lssl -lz
 LFLAGS += -L$(ROOTPATH)/Libraries/Http/lib/$(ARCH)
 CFLAGS += -I$(ROOTPATH)/Libraries/Http/include
 
@@ -18,8 +18,13 @@ LFLAGS += -lUtilities
 LFLAGS += -L$(ROOTPATH)/Libraries/Utilities/lib/$(ARCH)
 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

+ 5 - 5
UniFi/Device.cpp

@@ -1,5 +1,5 @@
 #include "Device.h"
-#include "Util/JSON.h"
+#include <json.hpp>
 #include <Logging.h>
 #include <algorithm>
 #include <sstream>
@@ -59,7 +59,7 @@ bool Device::Login()
 	std::stringstream url;
 	url << "https://" << m_hostname << ":" << m_port << "/api/login";
 
-	Util::JSON json;
+	nlohmann::json json;
 	json["password"] = m_password;
 	json["username"] = m_username;
 
@@ -71,7 +71,7 @@ bool Device::Login()
 		std::stringstream output;
 		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")
 		{
@@ -154,7 +154,7 @@ void Device::UpdateDevicesFromInventory()
 	try
 	{
 		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();
 		for (auto& element : json)
@@ -198,7 +198,7 @@ void Device::UpdatePresentDevices()
 		std::stringstream output;
 		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")
 		{

+ 0 - 15
Util/INIh.h

@@ -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

+ 0 - 16
Util/JSON.h

@@ -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