diff --git a/Application/PresenceDetection.cc b/Application/PresenceDetection.cc index c74ee31..afb0c10 100644 --- a/Application/PresenceDetection.cc +++ b/Application/PresenceDetection.cc @@ -1,8 +1,8 @@ #include "Bluetooth/Device.h" #include "UniFi/Device.h" #include "Util/StaticDevice.h" -#include "Util/INIh.h" #include +#include #include #include #include @@ -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; diff --git a/Application/Test.cc b/Application/Test.cc index 5b38fc9..3e89afc 100644 --- a/Application/Test.cc +++ b/Application/Test.cc @@ -1,4 +1,4 @@ -#include "Util/INIh.h" +#include #include #include #include @@ -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()) diff --git a/Bluetooth/Device.cpp b/Bluetooth/Device.cpp index 78f2f33..34a9c93 100644 --- a/Bluetooth/Device.cpp +++ b/Bluetooth/Device.cpp @@ -1,6 +1,6 @@ #include "Device.h" #include "Functions.h" -#include "Util/JSON.h" +#include #include #include #include @@ -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) diff --git a/Libraries/INIh/INIReader.h b/Libraries/INIh/INIReader.h deleted file mode 120000 index 17148ff..0000000 --- a/Libraries/INIh/INIReader.h +++ /dev/null @@ -1 +0,0 @@ -../../../Libraries/inih/INIReader.h \ No newline at end of file diff --git a/Libraries/JSON b/Libraries/JSON deleted file mode 120000 index ee95d0c..0000000 --- a/Libraries/JSON +++ /dev/null @@ -1 +0,0 @@ -../../Libraries/json/include \ No newline at end of file diff --git a/Libraries/clipp b/Libraries/clipp index e67602a..ffe3902 120000 --- a/Libraries/clipp +++ b/Libraries/clipp @@ -1 +1 @@ -../../Libraries/clipp/include \ No newline at end of file +../../Libraries/clipp \ No newline at end of file diff --git a/Libraries/inih b/Libraries/inih new file mode 120000 index 0000000..f48979f --- /dev/null +++ b/Libraries/inih @@ -0,0 +1 @@ +../../Libraries/inih \ No newline at end of file diff --git a/Libraries/json b/Libraries/json new file mode 120000 index 0000000..e497e2b --- /dev/null +++ b/Libraries/json @@ -0,0 +1 @@ +../../Libraries/json \ No newline at end of file diff --git a/Makefile.conf b/Makefile.conf index 683b1a4..3aaf78b 100644 --- a/Makefile.conf +++ b/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 diff --git a/UniFi/Device.cpp b/UniFi/Device.cpp index 9394340..b6780a4 100644 --- a/UniFi/Device.cpp +++ b/UniFi/Device.cpp @@ -1,5 +1,5 @@ #include "Device.h" -#include "Util/JSON.h" +#include #include #include #include @@ -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") { diff --git a/Util/INIh.h b/Util/INIh.h deleted file mode 100644 index d79e9e8..0000000 --- a/Util/INIh.h +++ /dev/null @@ -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 diff --git a/Util/JSON.h b/Util/JSON.h deleted file mode 100644 index aa17f4c..0000000 --- a/Util/JSON.h +++ /dev/null @@ -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