Update to use Libraries and fix include order

This commit is contained in:
2020-03-07 14:46:26 +01:00
parent 3b7491f57d
commit 157b1ceb51
32 changed files with 114 additions and 1405 deletions
+12 -12
View File
@@ -1,9 +1,9 @@
#include "Device.h"
#include "Functions.h"
#include "Util/JSON.h"
#include <Logging.h>
#include <algorithm>
#include <sstream>
#include "Util/JSON.h"
#include "Util/Logger.h"
#include "Functions.h"
#include "Device.h"
namespace PresenceDetection {
@@ -62,7 +62,7 @@ void Device::ClearDevices()
{
std::stringstream ss;
ss << "Bluetooth::Device::ClearDevices() - Error: " << e.what() << std::endl;
Util::Logger::Log(Util::Logger::Severity::Error, ss.str());
Logging::Log(Logging::Severity::Error, ss.str());
}
}
@@ -78,7 +78,7 @@ void Device::ClearDevices()
{
std::stringstream ss;
ss << "Bluetooth::Device::ClearDevices() - Error: " << e.what() << std::endl;
Util::Logger::Log(Util::Logger::Severity::Error, ss.str());
Logging::Log(Logging::Severity::Error, ss.str());
}
}
}
@@ -104,7 +104,7 @@ void Device::UpdateDevicesFromInventory()
{
std::stringstream ss;
ss << "Bluetooth::Device::GetDevicesFromInventory() - Error: " << e.what() << std::endl;
Util::Logger::Log(Util::Logger::Severity::Error, ss.str());
Logging::Log(Logging::Severity::Error, ss.str());
}
}
@@ -147,7 +147,7 @@ void Device::UpdatePresentDevices(bool updateOnlineDevices)
{
std::stringstream ss;
ss << "Bluetooth::Device::UpdatePresentDevices() - Error: " << e.what() << std::endl;
Util::Logger::Log(Util::Logger::Severity::Error, ss.str());
Logging::Log(Logging::Severity::Error, ss.str());
}
}
@@ -177,7 +177,7 @@ void Device::UpdatePresentDevices(bool updateOnlineDevices)
{
std::stringstream ss;
ss << "Bluetooth::Device::UpdatePresentDevices() - Error: " << e.what() << std::endl;
Util::Logger::Log(Util::Logger::Severity::Error, ss.str());
Logging::Log(Logging::Severity::Error, ss.str());
}
}
}
@@ -204,7 +204,7 @@ void Device::SendStateChange(bool present, const std::string& macAddress)
std::stringstream ss;
ss << "Bluetooth: " << sign << " " << macAddress;
Util::Logger::Log(Util::Logger::Severity::Info, ss.str());
Logging::Log(Logging::Severity::Info, ss.str());
if (!m_target.empty())
{
@@ -219,7 +219,7 @@ void Device::SendStateChange(bool present, const std::string& macAddress)
{
std::stringstream ss;
ss << "Bluetooth::Device::SendStateChange() - Error: " << e.what() << std::endl;
Util::Logger::Log(Util::Logger::Severity::Error, ss.str());
Logging::Log(Logging::Severity::Error, ss.str());
}
}
@@ -256,7 +256,7 @@ void Device::SendStateChange(bool present, const std::string& macAddress)
{
std::stringstream ss;
ss << "Bluetooth::Device::SendStateChange() - Error: " << e.what() << std::endl;
Util::Logger::Log(Util::Logger::Severity::Error, ss.str());
Logging::Log(Logging::Severity::Error, ss.str());
}
}
}
+7 -7
View File
@@ -1,11 +1,11 @@
#ifndef BLUETOOTH_DEVICE_H
#define BLUETOOTH_DEVICE_H
#include "Util/Device.h"
#include <HttpClient.h>
#include <Timer.h>
#include <string>
#include <vector>
#include "Util/Device.h"
#include "Util/Timer.h"
#include "Util/HttpClient.h"
namespace PresenceDetection {
@@ -30,10 +30,10 @@ private:
void SendStateChange(bool present, const std::string& macAddress);
private:
Util::Timer m_onlineDeviceTimer;
Util::Timer m_offlineDeviceTimer;
Util::Timer m_inventoryTimer;
Util::HttpClient m_httpClient;
Timer::Timer m_onlineDeviceTimer;
Timer::Timer m_offlineDeviceTimer;
Timer::Timer m_inventoryTimer;
Http::HttpClient m_httpClient;
std::vector<std::string> m_devices;
+7 -8
View File
@@ -1,15 +1,14 @@
#include <sstream>
#include <vector>
#include <stdexcept>
#include "Functions.h"
#include "Socket.h"
#include <fcntl.h>
#include <unistd.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/l2cap.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/poll.h>
#include "Socket.h"
#include "Functions.h"
#include <sstream>
#include <stdexcept>
#include <vector>
namespace PresenceDetection {
+2 -3
View File
@@ -1,8 +1,8 @@
#include <stdexcept>
#include "Socket.h"
#include <unistd.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include "Socket.h"
#include <stdexcept>
namespace PresenceDetection {
@@ -27,4 +27,3 @@ int Socket::Descriptor() const
} // namespace Bluetooth
} // namespace PresenceDetection