ubuntu-location-service: /build/location-service-git/src/location-service/include/location_service/com/ubuntu/location/connectivity/wireless_network.h Source File

ubuntu-location-service .. An aggregating location service providing positioning and geocoding capabilities to applications.

wireless_network.h
Go to the documentation of this file.
1 /*
2 * Copyright © 2012-2013 Canonical Ltd.
3 *
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.
7 *
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.
12 *
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/>.
15 *
16 * Authored by: Thomas Voß <thomas.voss@canonical.com>
17 */
18 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_WIRELESS_NETWORK_H_
19 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_WIRELESS_NETWORK_H_
20
21 #include <com/ubuntu/location/connectivity/bounded_integer.h>
22
23 #include <core/property.h>
24
25 #include <iosfwd>
26 #include <string>
27
28 namespace com
29 {
30 namespace ubuntu
31 {
32 namespace location
33 {
34 namespace connectivity
35 {
36 struct WirelessNetwork
37 {
38 typedef std::shared_ptr<WirelessNetwork> Ptr;
39
41 enum class Mode
42 {
44 unknown = 0,
46 adhoc = 1,
48 infrastructure = 2
49 };
50
52 struct Tag
53 {
55 struct Frequency {};
57 struct SignalStrength {};
58 };
62 typedef BoundedInteger
63 <
64 Tag::Frequency,
65 2412,
66 5825
67 > Frequency;
68
70 typedef BoundedInteger
71 <
72 Tag::SignalStrength,
73 0,
74 100
75 > SignalStrength;
76
78 WirelessNetwork() = default;
79 WirelessNetwork(const WirelessNetwork&) = delete;
80 WirelessNetwork(WirelessNetwork&&) = delete;
81
82 virtual ~WirelessNetwork() = default;
83
84 WirelessNetwork& operator=(const WirelessNetwork&) = delete;
85 WirelessNetwork& operator=(WirelessNetwork&&) = delete;
89 virtual const core::Property<std::chrono::system_clock::time_point>& last_seen() const = 0;
90
92 virtual const core::Property<std::string>& bssid() const = 0;
93
95 virtual const core::Property<std::string>& ssid() const = 0;
96
98 virtual const core::Property<Mode>& mode() const = 0;
99
101 virtual const core::Property<Frequency>& frequency() const = 0;
102
104 virtual const core::Property<SignalStrength>& signal_strength() const = 0;
105 };
106
108 std::ostream& operator<<(std::ostream& out, WirelessNetwork::Mode mode);
109
111 std::ostream& operator<<(std::ostream& out, const WirelessNetwork& wifi);
112 }
113 }
114 }
115 }
116
117 #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_WIRELESS_NETWORK_H_
bounded_integer.h
com::ubuntu::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::ubuntu::location::connectivity::operator<<
std::ostream & operator<<(std::ostream &out, State state)
Pretty prints the given state to the given output stream.
com
Definition: accuracy.h:24
com::ubuntu::location::connectivity::WirelessNetwork
Definition: wireless_network.h:37
com::ubuntu::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::ubuntu::location::connectivity::WirelessNetwork::frequency
virtual const core::Property< Frequency > & frequency() const =0
Returns the frequency that the network/AP operates upon.
com::ubuntu::location::connectivity::WirelessNetwork::Frequency
BoundedInteger< Tag::Frequency, 2412, 5825 > Frequency
Definition: wireless_network.h:67
com::ubuntu::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::ubuntu::location::connectivity::WirelessNetwork::Ptr
std::shared_ptr< WirelessNetwork > Ptr
Definition: wireless_network.h:38
com::ubuntu::location::connectivity::WirelessNetwork::ssid
virtual const core::Property< std::string > & ssid() const =0
Returns the SSID of the network.
com::ubuntu::location::connectivity::WirelessNetwork::mode
virtual const core::Property< Mode > & mode() const =0
Returns the mode of the network.
com::ubuntu::location::connectivity::WirelessNetwork::SignalStrength
BoundedInteger< Tag::SignalStrength, 0, 100 > SignalStrength
Definition: wireless_network.h:75
com::ubuntu::location::connectivity::WirelessNetwork::bssid
virtual const core::Property< std::string > & bssid() const =0
Returns the BSSID of the network.
com::ubuntu::location::connectivity::WirelessNetwork::Mode
Mode
Enumerates all known operational modes of networks/aps.
Definition: wireless_network.h:42
com::ubuntu::location::connectivity::WirelessNetwork::Mode::infrastructure
@ infrastructure
com::ubuntu::location::connectivity::WirelessNetwork::Mode::adhoc
@ adhoc
com::ubuntu::location::connectivity::WirelessNetwork::Mode::unknown
@ unknown