wireless_network.h
Go to the documentation of this file.
/*
* Copyright © 2012-2013 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Thomas Voß <thomas.voss@canonical.com>
*/
#ifndef LOCATION_SERVICE_COM_LOMIRI_LOCATION_CONNECTIVITY_WIRELESS_NETWORK_H_
#define LOCATION_SERVICE_COM_LOMIRI_LOCATION_CONNECTIVITY_WIRELESS_NETWORK_H_
#include <com/lomiri/location/connectivity/bounded_integer.h>
#include <core/property.h>
#include <iosfwd>
#include <string>
namespace com
{
namespace lomiri
{
namespace location
{
namespace connectivity
{
struct WirelessNetwork
{
typedef std::shared_ptr<WirelessNetwork> Ptr;
enum class Mode
{
unknown = 0,
adhoc = 1,
infrastructure = 2
};
struct Tag
{
struct Frequency {};
struct SignalStrength {};
};
typedef BoundedInteger
<
Tag::Frequency,
2412,
5825
> Frequency;
typedef BoundedInteger
<
Tag::SignalStrength,
0,
100
> SignalStrength;
WirelessNetwork() = default;
WirelessNetwork(const WirelessNetwork&) = delete;
WirelessNetwork(WirelessNetwork&&) = delete;
virtual ~WirelessNetwork() = default;
WirelessNetwork& operator=(const WirelessNetwork&) = delete;
WirelessNetwork& operator=(WirelessNetwork&&) = delete;
virtual const core::Property<std::chrono::system_clock::time_point>& last_seen() const = 0;
virtual const core::Property<std::string>& bssid() const = 0;
virtual const core::Property<std::string>& ssid() const = 0;
virtual const core::Property<Mode>& mode() const = 0;
virtual const core::Property<Frequency>& frequency() const = 0;
virtual const core::Property<SignalStrength>& signal_strength() const = 0;
};
std::ostream& operator<<(std::ostream& out, WirelessNetwork::Mode mode);
std::ostream& operator<<(std::ostream& out, const WirelessNetwork& wifi);
}
}
}
}
#endif // LOCATION_SERVICE_COM_LOMIRI_LOCATION_CONNECTIVITY_WIRELESS_NETWORK_H_
bounded_integer.h
com::lomiri::location::connectivity::BoundedInteger
A helper class to handle bounded integer values, with an optional domain for tagging domain-specific ...
Definition bounded_integer.h:38
com::lomiri::location::connectivity
Definition bounded_integer.h:31
com::lomiri::location::connectivity::operator<<
std::ostream & operator<<(std::ostream &out, State state)
Pretty prints the given state to the given output stream.
com::lomiri::location
Definition accuracy.h:28
com::lomiri
Definition accuracy.h:26
com
Definition accuracy.h:24
com::lomiri::location::connectivity::WirelessNetwork
Definition wireless_network.h:37
com::lomiri::location::connectivity::WirelessNetwork::frequency
virtual const core::Property< Frequency > & frequency() const =0
Returns the frequency that the network/AP operates upon.
com::lomiri::location::connectivity::WirelessNetwork::last_seen
virtual const core::Property< std::chrono::system_clock::time_point > & last_seen() const =0
Timestamp when the network became visible.
com::lomiri::location::connectivity::WirelessNetwork::Ptr
std::shared_ptr< WirelessNetwork > Ptr
Definition wireless_network.h:38
com::lomiri::location::connectivity::WirelessNetwork::ssid
virtual const core::Property< std::string > & ssid() const =0
Returns the SSID of the network.
com::lomiri::location::connectivity::WirelessNetwork::SignalStrength
BoundedInteger< Tag::SignalStrength, 0, 100 > SignalStrength
Definition wireless_network.h:75
com::lomiri::location::connectivity::WirelessNetwork::bssid
virtual const core::Property< std::string > & bssid() const =0
Returns the BSSID of the network.
com::lomiri::location::connectivity::WirelessNetwork::Frequency
BoundedInteger< Tag::Frequency, 2412, 5825 > Frequency
Definition wireless_network.h:67
com::lomiri::location::connectivity::WirelessNetwork::signal_strength
virtual const core::Property< SignalStrength > & signal_strength() const =0
Returns the signal quality of the network/AP in percent.
com::lomiri::location::connectivity::WirelessNetwork::mode
virtual const core::Property< Mode > & mode() const =0
Returns the mode of the network.
com::lomiri::location::connectivity::WirelessNetwork::Mode
Mode
Enumerates all known operational modes of networks/aps.
Definition wireless_network.h:42
com::lomiri::location::connectivity::WirelessNetwork::Mode::infrastructure
@ infrastructure
Definition wireless_network.h:48
com::lomiri::location::connectivity::WirelessNetwork::Mode::adhoc
@ adhoc
Definition wireless_network.h:46
com::lomiri::location::connectivity::WirelessNetwork::Mode::unknown
@ unknown
Definition wireless_network.h:44