2
* Copyright © 2012-2013 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3,
6
* as published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Thomas Voß <thomas.voss@canonical.com>
18
#ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_WIRELESS_NETWORK_H_
19
#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_WIRELESS_NETWORK_H_
21
#include <com/ubuntu/location/connectivity/bounded_integer.h>
23
#include <core/property.h>
34
namespace connectivity
36
struct WirelessNetwork
38
typedef std::shared_ptr<WirelessNetwork> Ptr;
40
/** @brief Enumerates all known operational modes of networks/aps. */
43
/** Mode is unknown. */
45
/** Indicates the object is part of an Ad-Hoc 802.11 network without a central coordinating access point. */
47
/** The wireless device or access point is in infrastructure mode. */
54
/** @brief Tags a frequency measurement for a wireless network. */
56
/** @brief Tags the signal strength of a wireless network. */
57
struct SignalStrength {};
61
/** Frequency that an individual AP operates on. */
62
typedef BoundedInteger
69
/** Strength of signal for an individual AP. */
70
typedef BoundedInteger
78
WirelessNetwork() = default;
79
WirelessNetwork(const WirelessNetwork&) = delete;
80
WirelessNetwork(WirelessNetwork&&) = delete;
82
virtual ~WirelessNetwork() = default;
84
WirelessNetwork& operator=(const WirelessNetwork&) = delete;
85
WirelessNetwork& operator=(WirelessNetwork&&) = delete;
88
/** @brief Timestamp when the network became visible. */
89
virtual const core::Property<std::chrono::system_clock::time_point>& last_seen() const = 0;
91
/** @brief Returns the BSSID of the network */
92
virtual const core::Property<std::string>& bssid() const = 0;
94
/** @brief Returns the SSID of the network. */
95
virtual const core::Property<std::string>& ssid() const = 0;
97
/** @brief Returns the mode of the network. */
98
virtual const core::Property<Mode>& mode() const = 0;
100
/** @brief Returns the frequency that the network/AP operates upon. */
101
virtual const core::Property<Frequency>& frequency() const = 0;
103
/** @brief Returns the signal quality of the network/AP in percent. */
104
virtual const core::Property<SignalStrength>& signal_strength() const = 0;
107
/** @brief Pretty-prints the given mode to the given output stream. */
108
std::ostream& operator<<(std::ostream& out, WirelessNetwork::Mode mode);
110
/** @brief Pretty-prints the given wireless network to the given output stream. */
111
std::ostream& operator<<(std::ostream& out, const WirelessNetwork& wifi);
117
#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_WIRELESS_NETWORK_H_