| 1 |
/**************************************************************************** |
| 2 |
** |
| 3 |
** Copyright (C) 2018 The Qt Company Ltd and/or its subsidiary(-ies). |
| 4 |
** Contact: http://www.qt-project.org/legal |
| 5 |
** |
| 6 |
** This file is part of the QtSystems module of the Qt Toolkit. |
| 7 |
** |
| 8 |
** $QT_BEGIN_LICENSE:LGPL$ |
| 9 |
** Commercial License Usage |
| 10 |
** Licensees holding valid commercial Qt licenses may use this file in |
| 11 |
** accordance with the commercial license agreement provided with the |
| 12 |
** Software or, alternatively, in accordance with the terms contained in |
| 13 |
** a written agreement between you and The Qt Company. For licensing terms |
| 14 |
** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 |
** information use the contact form at https://www.qt.io/contact-us. |
| 16 |
** |
| 17 |
** GNU Lesser General Public License Usage |
| 18 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 |
** General Public License version 3 as published by the Free Software |
| 20 |
** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 |
** packaging of this file. Please review the following information to |
| 22 |
** ensure the GNU Lesser General Public License version 3 requirements |
| 23 |
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 |
** |
| 25 |
** GNU General Public License Usage |
| 26 |
** Alternatively, this file may be used under the terms of the GNU |
| 27 |
** General Public License version 2.0 or (at your option) the GNU General |
| 28 |
** Public license version 3 or any later version approved by the KDE Free |
| 29 |
** Qt Foundation. The licenses are as published by the Free Software |
| 30 |
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 |
** included in the packaging of this file. Please review the following |
| 32 |
** information to ensure the GNU General Public License requirements will |
| 33 |
** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 |
** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 |
** |
| 36 |
** $QT_END_LICENSE$ |
| 37 |
** |
| 38 |
****************************************************************************/ |
| 39 |
|
| 40 |
// |
| 41 |
// W A R N I N G |
| 42 |
// ------------- |
| 43 |
// |
| 44 |
// This file is not part of the Qt API. It exists purely as an |
| 45 |
// implementation detail. This header file may change from version to |
| 46 |
// version without notice, or even be removed. |
| 47 |
// |
| 48 |
// We mean it. |
| 49 |
// |
| 50 |
|
| 51 |
#ifndef QDECLARATIVENETWORKINFO_P_H |
| 52 |
#define QDECLARATIVENETWORKINFO_P_H |
| 53 |
|
| 54 |
#include <LomiriSystemInfo-Qt6/lomirinetworkinfo.h> |
| 55 |
|
| 56 |
QT_BEGIN_NAMESPACE |
| 57 |
|
| 58 |
class LomiriDeclarativeNetworkInfo : public QObject |
| 59 |
{ |
| 60 |
Q_OBJECT |
| 61 |
|
| 62 |
Q_ENUMS(CellDataTechnology) |
| 63 |
Q_ENUMS(NetworkMode) |
| 64 |
Q_ENUMS(NetworkStatus) |
| 65 |
|
| 66 |
Q_PROPERTY(bool monitorNetworkSignalStrength READ monitorNetworkSignalStrength WRITE setMonitorNetworkSignalStrength NOTIFY monitorNetworkSignalStrengthChanged) |
| 67 |
Q_PROPERTY(bool monitorNetworkStatus READ monitorNetworkStatus WRITE setMonitorNetworkStatus NOTIFY monitorNetworkStatusChanged) |
| 68 |
Q_PROPERTY(bool monitorNetworkName READ monitorNetworkName WRITE setMonitorNetworkName NOTIFY monitorNetworkNameChanged) |
| 69 |
Q_PROPERTY(bool monitorCurrentNetworkMode READ monitorCurrentNetworkMode WRITE setMonitorCurrentNetworkMode NOTIFY monitorCurrentNetworkModeChanged) |
| 70 |
|
| 71 |
Q_PROPERTY(NetworkMode currentNetworkMode READ currentNetworkMode NOTIFY currentNetworkModeChanged) |
| 72 |
|
| 73 |
// obsoleted |
| 74 |
Q_PROPERTY(bool monitorNetworkInterfaceCount READ monitorNetworkInterfaceCount WRITE setMonitorNetworkInterfaceCount NOTIFY monitorNetworkInterfaceCountChanged) |
| 75 |
Q_PROPERTY(bool monitorCurrentCellDataTechnology READ monitorCurrentCellDataTechnology WRITE setMonitorCurrentCellDataTechnology NOTIFY monitorCurrentCellDataTechnologyChanged) |
| 76 |
Q_PROPERTY(bool monitorCellId READ monitorCellId WRITE setMonitorCellId NOTIFY monitorCellIdChanged) |
| 77 |
Q_PROPERTY(bool monitorCurrentMobileCountryCode READ monitorCurrentMobileCountryCode WRITE setMonitorCurrentMobileCountryCode NOTIFY monitorCurrentMobileCountryCodeChanged) |
| 78 |
Q_PROPERTY(bool monitorCurrentMobileNetworkCode READ monitorCurrentMobileNetworkCode WRITE setMonitorCurrentMobileNetworkCode NOTIFY monitorCurrentMobileNetworkCodeChanged) |
| 79 |
Q_PROPERTY(bool monitorLocationAreaCode READ monitorLocationAreaCode WRITE setMonitorLocationAreaCode NOTIFY monitorLocationAreaCodeChanged) |
| 80 |
|
| 81 |
public: |
| 82 |
enum CellDataTechnology { |
| 83 |
UnknownDataTechnology = LomiriNetworkInfo::UnknownDataTechnology, |
| 84 |
GprsDataTechnology = LomiriNetworkInfo::GprsDataTechnology, |
| 85 |
EdgeDataTechnology = LomiriNetworkInfo::EdgeDataTechnology, |
| 86 |
UmtsDataTechnology = LomiriNetworkInfo::UmtsDataTechnology, |
| 87 |
HspaDataTechnology = LomiriNetworkInfo::HspaDataTechnology |
| 88 |
}; |
| 89 |
|
| 90 |
enum NetworkMode { |
| 91 |
UnknownMode = LomiriNetworkInfo::UnknownMode, |
| 92 |
GsmMode = LomiriNetworkInfo::GsmMode, |
| 93 |
CdmaMode = LomiriNetworkInfo::CdmaMode, |
| 94 |
WcdmaMode = LomiriNetworkInfo::WcdmaMode, |
| 95 |
WlanMode = LomiriNetworkInfo::WlanMode, |
| 96 |
EthernetMode = LomiriNetworkInfo::EthernetMode, |
| 97 |
BluetoothMode = LomiriNetworkInfo::BluetoothMode, |
| 98 |
WimaxMode = LomiriNetworkInfo::WimaxMode, |
| 99 |
LteMode = LomiriNetworkInfo::LteMode, |
| 100 |
TdscdmaMode = LomiriNetworkInfo::TdscdmaMode |
| 101 |
}; |
| 102 |
|
| 103 |
enum NetworkStatus { |
| 104 |
UnknownStatus = LomiriNetworkInfo::UnknownStatus, |
| 105 |
NoNetworkAvailable = LomiriNetworkInfo::NoNetworkAvailable, |
| 106 |
EmergencyOnly = LomiriNetworkInfo::EmergencyOnly, |
| 107 |
Searching = LomiriNetworkInfo::Searching, |
| 108 |
Busy = LomiriNetworkInfo::Busy, |
| 109 |
Denied = LomiriNetworkInfo::Denied, |
| 110 |
HomeNetwork = LomiriNetworkInfo::HomeNetwork, |
| 111 |
Roaming = LomiriNetworkInfo::Roaming |
| 112 |
}; |
| 113 |
|
| 114 |
LomiriDeclarativeNetworkInfo(QObject *parent = 0); |
| 115 |
virtual ~LomiriDeclarativeNetworkInfo(); |
| 116 |
|
| 117 |
bool monitorCurrentNetworkMode() const; |
| 118 |
void setMonitorCurrentNetworkMode(bool monitor); |
| 119 |
NetworkMode currentNetworkMode() const; |
| 120 |
|
| 121 |
bool monitorNetworkSignalStrength() const; |
| 122 |
void setMonitorNetworkSignalStrength(bool monitor); |
| 123 |
Q_INVOKABLE int networkSignalStrength(NetworkMode mode, int interface) const; |
| 124 |
|
| 125 |
bool monitorNetworkInterfaceCount() const; |
| 126 |
void setMonitorNetworkInterfaceCount(bool monitor); |
| 127 |
Q_INVOKABLE int networkInterfaceCount(NetworkMode mode) const; |
| 128 |
|
| 129 |
bool monitorCurrentCellDataTechnology() const; |
| 130 |
void setMonitorCurrentCellDataTechnology(bool monitor); |
| 131 |
Q_INVOKABLE int currentCellDataTechnology(int interface) const; |
| 132 |
|
| 133 |
bool monitorNetworkStatus() const; |
| 134 |
void setMonitorNetworkStatus(bool monitor); |
| 135 |
Q_INVOKABLE int networkStatus(NetworkMode mode, int interface) const; |
| 136 |
|
| 137 |
bool monitorCellId() const; |
| 138 |
void setMonitorCellId(bool monitor); |
| 139 |
Q_INVOKABLE QString cellId(int interface) const; |
| 140 |
|
| 141 |
bool monitorCurrentMobileCountryCode() const; |
| 142 |
void setMonitorCurrentMobileCountryCode(bool monitor); |
| 143 |
Q_INVOKABLE QString currentMobileCountryCode(int interface) const; |
| 144 |
|
| 145 |
bool monitorCurrentMobileNetworkCode() const; |
| 146 |
void setMonitorCurrentMobileNetworkCode(bool monitor); |
| 147 |
Q_INVOKABLE QString currentMobileNetworkCode(int interface) const; |
| 148 |
|
| 149 |
bool monitorLocationAreaCode() const; |
| 150 |
void setMonitorLocationAreaCode(bool monitor); |
| 151 |
Q_INVOKABLE QString locationAreaCode(int interface) const; |
| 152 |
|
| 153 |
bool monitorNetworkName() const; |
| 154 |
void setMonitorNetworkName(bool monitor); |
| 155 |
Q_INVOKABLE QString networkName(NetworkMode mode, int interface) const; |
| 156 |
|
| 157 |
Q_INVOKABLE QString homeMobileCountryCode(int interface) const; |
| 158 |
Q_INVOKABLE QString homeMobileNetworkCode(int interface) const; |
| 159 |
Q_INVOKABLE QString imsi(int interface) const; |
| 160 |
Q_INVOKABLE QString macAddress(NetworkMode mode, int interface) const; |
| 161 |
|
| 162 |
Q_SIGNALS: |
| 163 |
void monitorCurrentCellDataTechnologyChanged(); |
| 164 |
void monitorCurrentNetworkModeChanged(); |
| 165 |
void monitorNetworkSignalStrengthChanged(); |
| 166 |
void monitorNetworkInterfaceCountChanged(); |
| 167 |
void monitorNetworkStatusChanged(); |
| 168 |
void monitorCellIdChanged(); |
| 169 |
void monitorCurrentMobileCountryCodeChanged(); |
| 170 |
void monitorCurrentMobileNetworkCodeChanged(); |
| 171 |
void monitorLocationAreaCodeChanged(); |
| 172 |
void monitorNetworkNameChanged(); |
| 173 |
|
| 174 |
void cellIdChanged(int interfaceIndex, const QString &id); |
| 175 |
void currentCellDataTechnologyChanged(int interfaceIndex, int tech); |
| 176 |
void currentMobileCountryCodeChanged(int interfaceIndex, const QString &mcc); |
| 177 |
void currentMobileNetworkCodeChanged(int interfaceIndex, const QString &mnc); |
| 178 |
void currentNetworkModeChanged(); |
| 179 |
void locationAreaCodeChanged(int interfaceIndex, const QString &lac); |
| 180 |
void networkInterfaceCountChanged(int mode, int count); |
| 181 |
void networkNameChanged(int mode, int interfaceIndex, const QString &name); |
| 182 |
void networkSignalStrengthChanged(int mode, int interfaceIndex, int strength); |
| 183 |
void networkStatusChanged(int mode, int interfaceIndex, int status); |
| 184 |
|
| 185 |
private Q_SLOTS: |
| 186 |
void _q_currentCellDataTechnologyChanged(int interface, LomiriNetworkInfo::CellDataTechnology tech); |
| 187 |
void _q_networkInterfaceCountChanged(LomiriNetworkInfo::NetworkMode mode, int count); |
| 188 |
void _q_networkSignalStrengthChanged(LomiriNetworkInfo::NetworkMode mode, int interface, int strength); |
| 189 |
void _q_networkStatusChanged(LomiriNetworkInfo::NetworkMode mode, int interface, LomiriNetworkInfo::NetworkStatus status); |
| 190 |
void _q_networkNameChanged(LomiriNetworkInfo::NetworkMode mode, int interface, const QString &name); |
| 191 |
|
| 192 |
private: |
| 193 |
LomiriNetworkInfo *networkInfo; |
| 194 |
|
| 195 |
bool isMonitorCurrentNetworkMode; |
| 196 |
bool isMonitorNetworkSignalStrength; |
| 197 |
bool isMonitorNetworkInterfaceCount; |
| 198 |
bool isMonitorCurrentCellDataTechnology; |
| 199 |
bool isMonitorNetworkStatus; |
| 200 |
bool isMonitorCellId; |
| 201 |
bool isMonitorCurrentMobileCountryCode; |
| 202 |
bool isMonitorCurrentMobileNetworkCode; |
| 203 |
bool isMonitorLocationAreaCode; |
| 204 |
bool isMonitorNetworkName; |
| 205 |
}; |
| 206 |
|
| 207 |
QT_END_NAMESPACE |
| 208 |
|
| 209 |
#endif // QDECLARATIVENETWORKINFO_P_H |