Add Static Devices, Timeout and UniFi Port Directive

This commit is contained in:
2020-03-05 16:56:12 +01:00
parent 2fbec833a2
commit 7b8fcc9722
8 changed files with 556 additions and 35 deletions
+167
View File
@@ -0,0 +1,167 @@
#include <algorithm>
#include "Device.h"
namespace PresenceDetection {
namespace Util {
Device::Device(const std::string& wifiMac, const std::string& bluetoothMac) :
m_wifiMac(wifiMac),
m_wifiState(false),
m_bluetoothMac(bluetoothMac),
m_bluetoothState(false)
{
std::transform(m_wifiMac.begin(), m_wifiMac.end(), m_wifiMac.begin(), ::tolower);
std::transform(m_bluetoothMac.begin(), m_bluetoothMac.end(), m_bluetoothMac.begin(), ::tolower);
}
Device::Device(const Device &other) :
m_wifiMac(other.m_wifiMac),
m_wifiState(other.m_wifiState),
m_bluetoothMac(other.m_bluetoothMac),
m_bluetoothState(other.m_bluetoothState),
m_onlineURL(other.m_onlineURL),
m_wifiOnlineURL(other.m_wifiOnlineURL),
m_bluetoothOnlineURL(other.m_bluetoothOnlineURL),
m_offlineURL(other.m_offlineURL),
m_wifiOfflineURL(other.m_wifiOfflineURL),
m_bluetoothOfflineURL(other.m_bluetoothOfflineURL)
{
}
Device::~Device()
{
}
bool Device::HasWifiMac() const
{
return !m_wifiMac.empty();
}
std::string Device::WifiMac() const
{
return m_wifiMac;
}
void Device::SetWifiState(bool present)
{
m_wifiState = present;
}
bool Device::GetWifiState() const
{
return m_wifiState;
}
bool Device::HasBluetoothMac() const
{
return !m_bluetoothMac.empty();
}
std::string Device::BluetoothMac() const
{
return m_bluetoothMac;
}
void Device::SetBluetoothState(bool present)
{
m_bluetoothState = present;
}
bool Device::GetBluetoothState() const
{
return m_bluetoothState;
}
bool Device::HasOnlineURL() const
{
return !m_onlineURL.empty();
}
void Device::SetOnlineURL(const std::string& url)
{
m_onlineURL = url;
}
std::string Device::OnlineURL() const
{
return m_onlineURL;
}
bool Device::HasWifiOnlineURL() const
{
return !m_wifiOnlineURL.empty();
}
void Device::SetWifiOnlineURL(const std::string& url)
{
m_wifiOnlineURL = url;
}
std::string Device::WifiOnlineURL() const
{
return m_wifiOnlineURL;
}
bool Device::HasBluetoothOnlineURL() const
{
return !m_bluetoothOnlineURL.empty();
}
void Device::SetBluetoothOnlineURL(const std::string& url)
{
m_bluetoothOnlineURL = url;
}
std::string Device::BluetoothOnlineURL() const
{
return m_bluetoothOnlineURL;
}
bool Device::HasOfflineURL() const
{
return !m_offlineURL.empty();
}
void Device::SetOfflineURL(const std::string& url)
{
m_offlineURL = url;
}
std::string Device::OfflineURL() const
{
return m_offlineURL;
}
bool Device::HasWifiOfflineURL() const
{
return !m_wifiOfflineURL.empty();
}
void Device::SetWifiOfflineURL(const std::string& url)
{
m_wifiOfflineURL = url;
}
std::string Device::WifiOfflineURL() const
{
return m_wifiOfflineURL;
}
bool Device::HasBluetoothOfflineURL() const
{
return !m_bluetoothOfflineURL.empty();
}
void Device::SetBluetoothOfflineURL(const std::string& url)
{
m_bluetoothOfflineURL = url;
}
std::string Device::BluetoothOfflineURL() const
{
return m_bluetoothOfflineURL;
}
} // namespace Util
} // namespace PresenceDetection