connectivity-cpp  0.0.1
link.h
Go to the documentation of this file.
1 /*
2  * Copyright © 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  * Authors:
17  * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18  */
19 
20 #ifndef COM_UBUNTU_CONNECTIVITY_NETWORKING_LINK
21 #define COM_UBUNTU_CONNECTIVITY_NETWORKING_LINK
22 
23 #include <core/property.h>
24 
25 namespace com {
26 namespace ubuntu {
27 namespace connectivity {
28 namespace networking {
29 
30 #ifndef CONNECTIVITY_CPP_EXPORT
31 #define CONNECTIVITY_CPP_EXPORT __attribute ((visibility ("default")))
32 #endif
33 
35 Link
36 {
37 public:
38  typedef std::shared_ptr<Link> Ptr;
39 
40  Link(const Link&) = delete;
41  virtual ~Link() = default;
42 
43  Link& operator=(const Link&) = delete;
44  bool operator==(const Link&) const = delete;
45 
47  enum class Type
48  {
49  wifi,
50  wired,
51  wwan,
52  service
53  };
54 
56  enum class Status
57  {
58  disabled,
59  offline,
60  connecting, // link is in process of becoming online
61  connected, // the link is up, but not fully configured yet
62  // happens with wifi for example when captive portal
63  // login is required
64  online
65  };
66 
71  enum Characteristics : std::uint32_t
72  {
74  empty = 0,
75 
80  has_monetary_costs = 1 << 0,
81 
86  is_volume_limited = 1 << 1,
87 
92  is_bandwidth_limited = 1 << 2
93  };
94 
96  virtual void enable() = 0;
97 
99  virtual void disable() = 0;
100 
102  virtual Type type() const = 0;
103 
105  virtual const core::Property<std::uint32_t>& characteristics() = 0;
106 
108  virtual const core::Property<Status>& status() = 0;
109 
111  typedef unsigned int Id;
112 
114  virtual Id id() const = 0;
115 
117  virtual std::string name() const = 0;
118 
119 protected:
121  Link() = default;
122 };
123 
124 }
125 }
126 }
127 }
128 
129 #endif