| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- #include "Device.h"
- #include <algorithm>
- 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
|