File indexing completed on 2024-12-01 07:25:49
0001 /* 0002 SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org> 0003 SPDX-License-Identifier: LGPL-2.0-or-later 0004 */ 0005 0006 #ifndef KPUBLICTRANSPORT_WIFIMONITOR_H 0007 #define KPUBLICTRANSPORT_WIFIMONITOR_H 0008 0009 #include <QObject> 0010 0011 #include <memory> 0012 0013 namespace KPublicTransport { 0014 0015 class WifiMonitorBackend; 0016 0017 /** Monitors to which Wifi access point the system is currently connected, if any. */ 0018 class WifiMonitor : public QObject 0019 { 0020 Q_OBJECT 0021 public: 0022 explicit WifiMonitor(QObject *parent = nullptr); 0023 ~WifiMonitor(); 0024 0025 enum Status { 0026 NotAvailable, ///< Wifi monitoring is generally not available on this platform/in this build 0027 Available, ///< Wifi monitoring is available (!= Wifi is available or even in use/enabled) 0028 WifiNotEnabled, ///< Wifi monitoring is not available due to a user-controlled platform setting 0029 LocationServiceNotEnabled, ///< Wifi monitoring is not available due to a user-controlled platform setting 0030 NoPermission, ///< Wifi monitoring is not available due to missing permissions 0031 }; 0032 Q_ENUM(Status) 0033 Status status() const; 0034 0035 QString ssid() const; 0036 void requestPermissions(); 0037 0038 Q_SIGNALS: 0039 void wifiChanged(); 0040 void statusChanged(); 0041 0042 private: 0043 friend class WifiMonitorBackend; 0044 void setSsid(const QString &ssid); 0045 0046 QString m_ssid; 0047 }; 0048 0049 } 0050 0051 #endif // KPUBLICTRANSPORT_WIFIMONITOR_H