185 lines
3.3 KiB
C++
185 lines
3.3 KiB
C++
#include "StaticDevice.h"
|
|
#include <algorithm>
|
|
|
|
|
|
namespace PresenceDetection {
|
|
namespace Util {
|
|
|
|
StaticDevice::StaticDevice(const std::string& wifiMac, const std::string& bluetoothMac) :
|
|
m_probeCounter(0),
|
|
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);
|
|
}
|
|
|
|
StaticDevice::StaticDevice(const StaticDevice &other) :
|
|
m_probeCounter(other.m_probeCounter),
|
|
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)
|
|
{
|
|
}
|
|
|
|
StaticDevice::~StaticDevice()
|
|
{
|
|
}
|
|
|
|
int StaticDevice::ProbeCounter() const
|
|
{
|
|
return m_probeCounter;
|
|
}
|
|
|
|
void StaticDevice::IncrementProbeCounter()
|
|
{
|
|
++m_probeCounter;
|
|
}
|
|
|
|
void StaticDevice::ResetProbeCounter()
|
|
{
|
|
m_probeCounter = 0;
|
|
}
|
|
|
|
bool StaticDevice::HasWifiMac() const
|
|
{
|
|
return !m_wifiMac.empty();
|
|
}
|
|
|
|
std::string StaticDevice::WifiMac() const
|
|
{
|
|
return m_wifiMac;
|
|
}
|
|
|
|
void StaticDevice::SetWifiState(bool present)
|
|
{
|
|
m_wifiState = present;
|
|
}
|
|
|
|
bool StaticDevice::GetWifiState() const
|
|
{
|
|
return m_wifiState;
|
|
}
|
|
|
|
bool StaticDevice::HasBluetoothMac() const
|
|
{
|
|
return !m_bluetoothMac.empty();
|
|
}
|
|
|
|
std::string StaticDevice::BluetoothMac() const
|
|
{
|
|
return m_bluetoothMac;
|
|
}
|
|
|
|
void StaticDevice::SetBluetoothState(bool present)
|
|
{
|
|
m_bluetoothState = present;
|
|
}
|
|
|
|
bool StaticDevice::GetBluetoothState() const
|
|
{
|
|
return m_bluetoothState;
|
|
}
|
|
|
|
bool StaticDevice::HasOnlineURL() const
|
|
{
|
|
return !m_onlineURL.empty();
|
|
}
|
|
|
|
void StaticDevice::SetOnlineURL(const std::string& url)
|
|
{
|
|
m_onlineURL = url;
|
|
}
|
|
|
|
std::string StaticDevice::OnlineURL() const
|
|
{
|
|
return m_onlineURL;
|
|
}
|
|
|
|
bool StaticDevice::HasWifiOnlineURL() const
|
|
{
|
|
return !m_wifiOnlineURL.empty();
|
|
}
|
|
|
|
void StaticDevice::SetWifiOnlineURL(const std::string& url)
|
|
{
|
|
m_wifiOnlineURL = url;
|
|
}
|
|
|
|
std::string StaticDevice::WifiOnlineURL() const
|
|
{
|
|
return m_wifiOnlineURL;
|
|
}
|
|
|
|
bool StaticDevice::HasBluetoothOnlineURL() const
|
|
{
|
|
return !m_bluetoothOnlineURL.empty();
|
|
}
|
|
|
|
void StaticDevice::SetBluetoothOnlineURL(const std::string& url)
|
|
{
|
|
m_bluetoothOnlineURL = url;
|
|
}
|
|
|
|
std::string StaticDevice::BluetoothOnlineURL() const
|
|
{
|
|
return m_bluetoothOnlineURL;
|
|
}
|
|
|
|
bool StaticDevice::HasOfflineURL() const
|
|
{
|
|
return !m_offlineURL.empty();
|
|
}
|
|
|
|
void StaticDevice::SetOfflineURL(const std::string& url)
|
|
{
|
|
m_offlineURL = url;
|
|
}
|
|
|
|
std::string StaticDevice::OfflineURL() const
|
|
{
|
|
return m_offlineURL;
|
|
}
|
|
|
|
bool StaticDevice::HasWifiOfflineURL() const
|
|
{
|
|
return !m_wifiOfflineURL.empty();
|
|
}
|
|
|
|
void StaticDevice::SetWifiOfflineURL(const std::string& url)
|
|
{
|
|
m_wifiOfflineURL = url;
|
|
}
|
|
|
|
std::string StaticDevice::WifiOfflineURL() const
|
|
{
|
|
return m_wifiOfflineURL;
|
|
}
|
|
|
|
bool StaticDevice::HasBluetoothOfflineURL() const
|
|
{
|
|
return !m_bluetoothOfflineURL.empty();
|
|
}
|
|
|
|
void StaticDevice::SetBluetoothOfflineURL(const std::string& url)
|
|
{
|
|
m_bluetoothOfflineURL = url;
|
|
}
|
|
|
|
std::string StaticDevice::BluetoothOfflineURL() const
|
|
{
|
|
return m_bluetoothOfflineURL;
|
|
}
|
|
|
|
} // namespace Util
|
|
} // namespace PresenceDetection
|