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 
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 {
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
68 
70  typedef BoundedInteger
71  <
72  Tag::SignalStrength,
73  0,
74  100
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_
virtual const core::Property< std::string > & bssid() const =0
Returns the BSSID of the network.
virtual const core::Property< std::chrono::system_clock::time_point > & last_seen() const =0
Timestamp when the network became visible.
Definition: accuracy.h:23
A helper class to handle bounded integer values, with an optional domain for tagging domain-specific ...
virtual const core::Property< Frequency > & frequency() const =0
Returns the frequency that the network/AP operates upon.
Mode
Enumerates all known operational modes of networks/aps.
virtual const core::Property< SignalStrength > & signal_strength() const =0
Returns the signal quality of the network/AP in percent.
BoundedInteger< Tag::Frequency, 2412, 5825 > Frequency
std::ostream & operator<<(std::ostream &out, State state)
Pretty prints the given state to the given output stream.
virtual const core::Property< Mode > & mode() const =0
Returns the mode of the network.
virtual const core::Property< std::string > & ssid() const =0
Returns the SSID of the network.
BoundedInteger< Tag::SignalStrength, 0, 100 > SignalStrength