File indexing completed on 2024-04-28 05:34:06

0001 // SPDX-FileCopyrightText: 2023 Yari Polla <skilvingr@gmail.com>
0002 // SPDX-License-Identifier: LGPL-2.0-or-later
0003 
0004 #ifndef WIRELESSSTATUS_H
0005 #define WIRELESSSTATUS_H
0006 
0007 #include <QObject>
0008 
0009 #include <qqmlregistration.h>
0010 
0011 class WirelessStatus : public QObject
0012 {
0013     Q_OBJECT
0014     QML_ELEMENT
0015 
0016     /**
0017      * Returns the SSID of the currently active hotspot, if any, otherwise an empty string
0018      */
0019     Q_PROPERTY(QString hotspotSSID READ hotspotSSID NOTIFY hotspotSSIDChanged)
0020     /**
0021      * Returns the SSID of the currently active wireless connection, if any, otherwise an empty string
0022      */
0023     Q_PROPERTY(QString wifiSSID READ wifiSSID NOTIFY wifiSSIDChanged)
0024 public:
0025     explicit WirelessStatus(QObject *parent = nullptr);
0026     ~WirelessStatus() override;
0027 
0028     QString wifiSSID() const;
0029     QString hotspotSSID() const;
0030 
0031 private Q_SLOTS:
0032     void activeConnectionsChanged();
0033     void stateChanged();
0034 
0035 Q_SIGNALS:
0036     void hotspotSSIDChanged(const QString &ssid);
0037     void wifiSSIDChanged(const QString &ssid);
0038 
0039 private:
0040     QString m_wifiSSID;
0041     QString m_hotspotSSID;
0042 };
0043 
0044 #endif // WIRELESSSTATUS_H