File indexing completed on 2024-04-14 04:51:45
0001 /** 0002 * SPDX-FileCopyrightText: 2021 David Shlemayev <david.shlemayev@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #pragma once 0008 0009 #include <core/kdeconnectplugin.h> 0010 0011 /** 0012 * Packet used to report the current connectivity state 0013 * <p> 0014 * The body should contain a key "signalStrengths" which has a dict that maps 0015 * a SubscriptionID (opaque value) to a dict with the connection info (See below) 0016 * <p> 0017 * For example: 0018 * { 0019 * "signalStrengths": { 0020 * "6": { 0021 * "networkType": "4G", 0022 * "signalStrength": 3 0023 * }, 0024 * "17": { 0025 * "networkType": "HSPA", 0026 * "signalStrength": 2 0027 * }, 0028 * ... 0029 * } 0030 * } 0031 */ 0032 #define PACKET_TYPE_CONNECTIVITY_REPORT QStringLiteral("kdeconnect.connectivity_report") 0033 0034 class ConnectivityReportPlugin : public KdeConnectPlugin 0035 { 0036 Q_OBJECT 0037 Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.connectivity_report") 0038 Q_PROPERTY(QString cellularNetworkType READ cellularNetworkType NOTIFY refreshed) 0039 Q_PROPERTY(int cellularNetworkStrength READ cellularNetworkStrength NOTIFY refreshed) 0040 0041 public: 0042 using KdeConnectPlugin::KdeConnectPlugin; 0043 0044 void receivePacket(const NetworkPacket &np) override; 0045 QString dbusPath() const override; 0046 0047 QString cellularNetworkType() const; 0048 int cellularNetworkStrength() const; 0049 0050 Q_SIGNALS: 0051 Q_SCRIPTABLE void refreshed(QString cellularNetworkType, int cellularNetworkStrength); 0052 0053 private: 0054 QString m_cellularNetworkType; 0055 int m_cellularNetworkStrength = -1; 0056 };