1/*
2 SPDX-FileCopyrightText: 2009, 2011 Will Stephenson <wstephenson@kde.org>
3 SPDX-FileCopyrightText: 2011-2013 Lamarque V. Souza <lamarque@kde.org>
4 SPDX-FileCopyrightText: 2013 Jan Grulich <jgrulich@redhat.com>
5
6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7*/
8
9#ifndef NETWORKMANAGERQT_WIRELESSNETWORK_H
10#define NETWORKMANAGERQT_WIRELESSNETWORK_H
11
12#include "accesspoint.h"
13#include <networkmanagerqt/networkmanagerqt_export.h>
14
15#include <QObject>
16#include <QSharedPointer>
17
18namespace NetworkManager
19{
20class WirelessDevice;
21class WirelessNetworkPrivate;
22
23/*!
24 * \class NetworkManager::WirelessNetwork
25 * \inheaderfile NetworkManagerQt/WirelessNetwork
26 * \inmodule NetworkManagerQt
27 *
28 * \brief This class represents a wireless network, which aggregates all
29 * access points with the same SSID.
30 */
31class NETWORKMANAGERQT_EXPORT WirelessNetwork : public QObject
32{
33 Q_OBJECT
34 friend class WirelessDevice;
35 friend class WirelessDevicePrivate;
36
37public:
38 /*!
39 * \typedef NetworkManager::WirelessNetwork::Ptr
40 */
41 typedef QSharedPointer<WirelessNetwork> Ptr;
42 /*!
43 * \typedef NetworkManager::WirelessNetwork::List
44 */
45 typedef QList<Ptr> List;
46 ~WirelessNetwork() override;
47 /*!
48 * ESSID of the network
49 */
50 QString ssid() const;
51
52 /*!
53 * Signal strength of the network. Syntactic sugar around tracking the reference access
54 * point and watching its signal strength
55 */
56 int signalStrength() const;
57
58 /*!
59 * The uni of the current 'best' (strongest) Access Point. Note that this may change or disappear over time.
60 * Get the Access Point object using \ WirelessDevice::findAccessPoint() on the NetworkInterface this network was obtained from.
61 * Use \ WirelessDevice::accessPointDisappeared() or
62 * WirelessNetwork::referenceAccessPointChanged() to detect this.
63 */
64 AccessPoint::Ptr referenceAccessPoint() const;
65
66 /*!
67 * List of access points
68 * \warning Subject to change, do not store!
69 */
70 AccessPoint::List accessPoints() const;
71
72 /*!
73 * The uni of device associated with this network.
74 */
75 QString device() const;
76
77Q_SIGNALS:
78 /*!
79 * Indicate that the signal strength changed
80 *
81 * \a strength strength as a percentage.
82 */
83 void signalStrengthChanged(int strength);
84 /*!
85 * Indicate that the reference access point changed
86 *
87 * \a apUni new access point or empty string if none
88 */
89 void referenceAccessPointChanged(const QString &apUni);
90 /*!
91 * Indicate that this network has no more access points
92 * (meaning the network has disappeared from view of the network interface)
93 *
94 * \a ssid the SSID of this network
95 */
96 void disappeared(const QString &ssid);
97
98private:
99 Q_DECLARE_PRIVATE(WirelessNetwork)
100 Q_PRIVATE_SLOT(d_func(), void accessPointAppeared(const QString &))
101 Q_PRIVATE_SLOT(d_func(), void accessPointDisappeared(const QString &))
102 Q_PRIVATE_SLOT(d_func(), void updateStrength())
103
104 WirelessNetworkPrivate *const d_ptr;
105
106 NETWORKMANAGERQT_NO_EXPORT explicit WirelessNetwork(const AccessPoint::Ptr &accessPoint, WirelessDevice *device);
107};
108
109}
110#endif // NETWORKMANAGERQT_WIRELESSNETWORK_H
111

source code of networkmanager-qt/src/wirelessnetwork.h