summaryrefslogtreecommitdiffstats
path: root/src/network/kernel/qnetworkinformation.h
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2021-09-17 17:30:36 +0200
committerMårten Nordheim <marten.nordheim@qt.io>2021-10-07 19:08:23 +0200
commit7fb855e175df6aa5937b00ea05312cf7ed323afa (patch)
tree545ad7037c85ee39cd4e8b04aae674f2e943fbb1 /src/network/kernel/qnetworkinformation.h
parentd9f6fba3854f778124e6f8b1bda0994b42cd7988 (diff)
QNetworkInfo: Add transport medium detection API
The new public API returns and notifies changes to the currently active transport medium for the application. And there's a new private API to report it, with backends to follow. Task-number: QTBUG-91023 Change-Id: I527985f9dabcd7bc4a32f36597e21bc4ab664c4e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network/kernel/qnetworkinformation.h')
-rw-r--r--src/network/kernel/qnetworkinformation.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/network/kernel/qnetworkinformation.h b/src/network/kernel/qnetworkinformation.h
index 353ffbcd1f..776a063d27 100644
--- a/src/network/kernel/qnetworkinformation.h
+++ b/src/network/kernel/qnetworkinformation.h
@@ -57,6 +57,7 @@ class Q_NETWORK_EXPORT QNetworkInformation : public QObject
Q_PROPERTY(Reachability reachability READ reachability NOTIFY reachabilityChanged)
Q_PROPERTY(bool isBehindCaptivePortal READ isBehindCaptivePortal
NOTIFY isBehindCaptivePortalChanged)
+ Q_PROPERTY(TransportMedium transportMedium READ transportMedium NOTIFY transportMediumChanged)
public:
enum class Reachability {
Unknown,
@@ -67,9 +68,19 @@ public:
};
Q_ENUM(Reachability)
+ enum class TransportMedium {
+ Unknown,
+ Ethernet,
+ Cellular,
+ WiFi,
+ Bluetooth,
+ };
+ Q_ENUM(TransportMedium)
+
enum class Feature {
Reachability = 0x1,
CaptivePortal = 0x2,
+ TransportMedium = 0x4,
};
Q_DECLARE_FLAGS(Features, Feature)
Q_FLAG(Features)
@@ -78,6 +89,8 @@ public:
bool isBehindCaptivePortal() const;
+ TransportMedium transportMedium() const;
+
QString backendName() const;
bool supports(Features features) const;
@@ -90,6 +103,7 @@ public:
Q_SIGNALS:
void reachabilityChanged(Reachability newReachability);
void isBehindCaptivePortalChanged(bool state);
+ void transportMediumChanged(TransportMedium current);
private:
friend struct QNetworkInformationDeleter;