Files
amnezia-client/client/mozilla/networkwatcherimpl.h
T

52 lines
1.5 KiB
C++
Raw Normal View History

2023-07-15 14:19:48 -07:00
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef NETWORKWATCHERIMPL_H
#define NETWORKWATCHERIMPL_H
2024-05-08 22:02:02 +01:00
#include <QNetworkInformation>
2023-07-15 14:19:48 -07:00
#include <QObject>
class NetworkWatcherImpl : public QObject {
2024-05-08 22:02:02 +01:00
Q_OBJECT
Q_DISABLE_COPY_MOVE(NetworkWatcherImpl)
2023-07-15 14:19:48 -07:00
2024-05-08 22:02:02 +01:00
public:
NetworkWatcherImpl(QObject* parent) : QObject(parent) {}
2023-07-15 14:19:48 -07:00
2024-05-08 22:02:02 +01:00
virtual ~NetworkWatcherImpl() = default;
2023-07-15 14:19:48 -07:00
2024-05-08 22:02:02 +01:00
virtual void initialize() = 0;
2023-07-15 14:19:48 -07:00
2024-05-08 22:02:02 +01:00
virtual void start() { m_active = true; }
virtual void stop() { m_active = false; }
2023-07-15 14:19:48 -07:00
2024-05-08 22:02:02 +01:00
bool isActive() const { return m_active; }
2023-07-15 14:19:48 -07:00
2024-05-08 22:02:02 +01:00
enum TransportType {
TransportType_Unknown = 0,
TransportType_Ethernet = 1,
TransportType_WiFi = 2,
TransportType_Cellular = 3, // In Case the API does not retun the gsm type
TransportType_Other = 4, // I.e USB thethering
TransportType_None = 5 // I.e Airplane Mode or no active network device
};
Q_ENUM(TransportType);
2023-07-15 14:19:48 -07:00
2024-05-08 22:02:02 +01:00
signals:
// Fires when the Device Connects to an unsecured Network
void unsecuredNetwork(const QString& networkName, const QString& networkId);
// Fires on when the connected WIFI Changes
// TODO: Only windows-networkwatcher has this, the other plattforms should
// too.
void networkChanged(QString newBSSID);
2026-02-19 13:21:49 +01:00
void wakeup();
2023-07-15 14:19:48 -07:00
2024-05-08 22:02:02 +01:00
private:
bool m_active = false;
2023-07-15 14:19:48 -07:00
};
#endif // NETWORKWATCHERIMPL_H