NetworkManagerQt

wirelessdevice.h
1 /*
2  SPDX-FileCopyrightText: 2008, 2011 Will Stephenson <[email protected]>
3  SPDX-FileCopyrightText: 2011-2013 Lamarque V. Souza <[email protected]>
4  SPDX-FileCopyrightText: 2013 Daniel Nicoletti <[email protected]>
5  SPDX-FileCopyrightText: 2013 Jan Grulich <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
8 */
9 
10 #ifndef NETWORKMANAGERQT_WIRELESSDEVICE_H
11 #define NETWORKMANAGERQT_WIRELESSDEVICE_H
12 
13 #include "accesspoint.h"
14 #include "device.h"
15 #include "wirelessnetwork.h"
16 #include <networkmanagerqt/networkmanagerqt_export.h>
17 
18 #include <QDBusObjectPath>
19 #include <QDBusPendingReply>
20 
21 namespace NetworkManager
22 {
23 class WirelessDevicePrivate;
24 
25 /**
26  * A wireless network interface
27  */
28 class NETWORKMANAGERQT_EXPORT WirelessDevice : public Device
29 {
30  Q_OBJECT
31 
32 public:
34  typedef QList<Ptr> List;
35 
36  /**
37  * The device's current operating mode
38  */
40  Unknown = 0, /**< not associated with a network */
41  Adhoc, /**< part of an adhoc network */
42  Infra, /**< a station in an infrastructure wireless network */
43  ApMode, /**< access point in an infrastructure network */
44  };
45  Q_ENUM(OperationMode)
46  /**
47  * Capabilities (currently all encryption/authentication related) of the device
48  * @note FreqValid, Freq2Ghz, Freq5Ghz are available in runtime NM >= 1.0.2
49  */
50  enum Capability {
51  NoCapability = 0x0, /**< Null capability */
52  Wep40 = 0x1, /**< 40 bit WEP cipher */
53  Wep104 = 0x2, /**< 104 bit WEP cipher */
54  Tkip = 0x4, /**< TKIP encryption cipher */
55  Ccmp = 0x8, /**< CCMP encryption cipher */
56  Wpa = 0x10, /**< WPA authentication protocol */
57  Rsn = 0x20, /**< RSN authethication protocol */
58  ApCap = 0x40, /**< The device supports Access Point mode. */
59  AdhocCap = 0x80, /**< The device supports Ad-Hoc mode. */
60  FreqValid = 0x100, /**< The device properly reports information about supported frequencies */
61  Freq2Ghz = 0x200, /**< The device supports 2.4Ghz frequencies */
62  Freq5Ghz = 0x400, /**< The device supports 5Ghz frequencies */
63  Mesh = 0x1000, /**< The device supports acting as a mesh point */
64  IBSSRsn = 0x2000, /**< device supports WPA2/RSN in an IBSS network */
65  };
66  Q_DECLARE_FLAGS(Capabilities, Capability)
67  /**
68  * Creates a new WirelessDevice object.
69  *
70  * @param path the DBus path of the devise
71  */
72  explicit WirelessDevice(const QString &path, QObject *parent = nullptr);
73  /**
74  * Destroys a WirelessDevice object.
75  */
76  ~WirelessDevice() override;
77  /**
78  * Return the type
79  */
80  Type type() const override;
81  /**
82  * List of wireless networks currently visible to the hardware
83  */
84  QStringList accessPoints() const;
85  /**
86  * Asks the device for a new scan of available wireless networks
87  * @param options Options of scan
88  * No documentation for options yet, see
89  * https://projects.gnome.org/NetworkManager/developers/api/09/spec.html#org.freedesktop.NetworkManager.Device.Wireless
90  */
91  QDBusPendingReply<> requestScan(const QVariantMap &options = QVariantMap());
92  /**
93  * AccessPoint pointer this interface is currently associated with
94  */
95  AccessPoint::Ptr activeAccessPoint() const;
96  /**
97  * The permanent hardware address of the network interface
98  */
99  QString permanentHardwareAddress() const;
100  /**
101  * The hardware address currently used by the network interface
102  */
103  QString hardwareAddress() const;
104 
105  /**
106  * Retrieves the operation mode of this network.
107  *
108  * @return the current mode
109  * @see OperationMode
110  */
111  WirelessDevice::OperationMode mode() const;
112  /**
113  * Retrieves the effective bit rate currently attainable by this device.
114  *
115  * @return the bitrate in Kbit/s
116  */
117  int bitRate() const;
118  /**
119  * The LastScan property value, converted to QDateTime
120  * @since 5.62.0
121  * @note will always return invalid QDateTime when runtime NM < 1.12
122  * @return
123  */
124  QDateTime lastScan() const;
125  /**
126  * The time the last RequestScan function was called
127  * @since 5.62.0
128  * @return
129  */
130  QDateTime lastRequestScan() const;
131  /**
132  * Retrieves the capabilities of this wifi network.
133  *
134  * @return the flag set describing the capabilities
135  * @see Capabilities
136  */
137  WirelessDevice::Capabilities wirelessCapabilities() const;
138 
139  /**
140  * Helper method to convert wire representation of operation mode to enum
141  */
142  static WirelessDevice::OperationMode convertOperationMode(uint);
143  /**
144  * Helper method to convert wire representation of capabilities to enum
145  */
146  static WirelessDevice::Capabilities convertCapabilities(uint);
147  /**
148  * Finds access point object given its Unique Network Identifier.
149  *
150  * @param uni the identifier of the AP to find from this network interface
151  * @returns a valid AccessPoint object if a network having the given UNI for this device is known to the system, 0 otherwise
152  */
153  AccessPoint::Ptr findAccessPoint(const QString &uni);
154 
155  /**
156  * Return the current list of networks
157  */
158  WirelessNetwork::List networks() const;
159 
160  /**
161  * Find a network with the given @p ssid, a Null object is
162  * returned if it can not be found
163  */
164  WirelessNetwork::Ptr findNetwork(const QString &ssid) const;
165 
166 Q_SIGNALS:
167  /**
168  * This signal is emitted when the bitrate of this network has changed.
169  *
170  * @param bitrate the new bitrate value for this network
171  */
172  void bitRateChanged(int bitrate);
173  /**
174  * The active network changed.
175  */
176  void activeAccessPointChanged(const QString &);
177  /**
178  * The device switched operating mode.
179  */
180  void modeChanged(WirelessDevice::OperationMode);
181  /**
182  * The device changed its capabilities
183  */
184  void wirelessCapabilitiesChanged(Capabilities);
185  /**
186  * The device changed its hardware address
187  */
188  void hardwareAddressChanged(const QString &);
189  /**
190  * The device changed its permanent hardware address
191  */
192  void permanentHardwareAddressChanged(const QString &);
193  /**
194  * The device changed its properties
195  */
196  void wirelessPropertiesChanged(uint); // TODO this is bogus, remove
197  /**
198  * A new wireless access point appeared
199  */
200  void accessPointAppeared(const QString &uni);
201  /**
202  * A wireless access point disappeared
203  */
204  void accessPointDisappeared(const QString &uni);
205  /**
206  * A wireless network appeared
207  */
208  void networkAppeared(const QString &ssid);
209  /**
210  * A wireless network disappeared
211  */
212  void networkDisappeared(const QString &ssid);
213  /**
214  * The LastScan property has changed, meaning a scan has just finished
215  * @since 5.62.0
216  * @note will never be emitted when runtime NM < 1.12
217  * @see lastScanTime
218  */
219  void lastScanChanged(const QDateTime &dateTime);
220 
221 private:
222  Q_DECLARE_PRIVATE(WirelessDevice)
223 };
224 
225 } // namespace NetworkManager
226 #endif // NETWORKMANAGERQT_WIRELESSDEVICE_H
This class represents a common device interface.
Definition: device.h:33
A wireless network interface.
@ Adhoc
part of an adhoc network
Capability
Possible device capabilities.
Definition: device.h:166
This class allows querying the underlying system to discover the available network interfaces and rea...
Definition: accesspoint.h:20
@ ApMode
access point in an infrastructure network
@ Infra
a station in an infrastructure wireless network
@ Unknown
the networking system is not active or unable to report its status - proceed with caution
Definition: manager.h:33
OperationMode
The device's current operating mode.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Oct 3 2023 03:57:05 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.