| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
#ifndef QDECLARATIVENETWORKINFO_P_H |
| 52 |
#define QDECLARATIVENETWORKINFO_P_H |
| 53 |
|
| 54 |
#include <qnetworkinfo.h> |
| 55 |
|
| 56 |
QT_BEGIN_NAMESPACE |
| 57 |
|
| 58 |
class QDeclarativeNetworkInfo : 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 |
|
| 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 = QNetworkInfo::UnknownDataTechnology, |
| 84 |
GprsDataTechnology = QNetworkInfo::GprsDataTechnology, |
| 85 |
EdgeDataTechnology = QNetworkInfo::EdgeDataTechnology, |
| 86 |
UmtsDataTechnology = QNetworkInfo::UmtsDataTechnology, |
| 87 |
HspaDataTechnology = QNetworkInfo::HspaDataTechnology |
| 88 |
}; |
| 89 |
|
| 90 |
enum NetworkMode { |
| 91 |
UnknownMode = QNetworkInfo::UnknownMode, |
| 92 |
GsmMode = QNetworkInfo::GsmMode, |
| 93 |
CdmaMode = QNetworkInfo::CdmaMode, |
| 94 |
WcdmaMode = QNetworkInfo::WcdmaMode, |
| 95 |
WlanMode = QNetworkInfo::WlanMode, |
| 96 |
EthernetMode = QNetworkInfo::EthernetMode, |
| 97 |
BluetoothMode = QNetworkInfo::BluetoothMode, |
| 98 |
WimaxMode = QNetworkInfo::WimaxMode, |
| 99 |
LteMode = QNetworkInfo::LteMode, |
| 100 |
TdscdmaMode = QNetworkInfo::TdscdmaMode |
| 101 |
}; |
| 102 |
|
| 103 |
enum NetworkStatus { |
| 104 |
UnknownStatus = QNetworkInfo::UnknownStatus, |
| 105 |
NoNetworkAvailable = QNetworkInfo::NoNetworkAvailable, |
| 106 |
EmergencyOnly = QNetworkInfo::EmergencyOnly, |
| 107 |
Searching = QNetworkInfo::Searching, |
| 108 |
Busy = QNetworkInfo::Busy, |
| 109 |
Denied = QNetworkInfo::Denied, |
| 110 |
HomeNetwork = QNetworkInfo::HomeNetwork, |
| 111 |
Roaming = QNetworkInfo::Roaming |
| 112 |
}; |
| 113 |
|
| 114 |
QDeclarativeNetworkInfo(QObject *parent = 0); |
| 115 |
virtual ~QDeclarativeNetworkInfo(); |
| 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, QNetworkInfo::CellDataTechnology tech); |
| 187 |
void _q_networkInterfaceCountChanged(QNetworkInfo::NetworkMode mode, int count); |
| 188 |
void _q_networkSignalStrengthChanged(QNetworkInfo::NetworkMode mode, int interface, int strength); |
| 189 |
void _q_networkStatusChanged(QNetworkInfo::NetworkMode mode, int interface, QNetworkInfo::NetworkStatus status); |
| 190 |
void _q_networkNameChanged(QNetworkInfo::NetworkMode mode, int interface, const QString &name); |
| 191 |
|
| 192 |
private: |
| 193 |
QNetworkInfo *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 |