1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). 4 ** Copyright (C) 2014 BlackBerry Limited. All rights reserved. 5 ** Contact: http://www.qt-project.org/legal 6 ** 7 ** This file is part of the QtSystems module of the Qt Toolkit. 8 ** 9 ** $QT_BEGIN_LICENSE:LGPL$ 10 ** Commercial License Usage 11 ** Licensees holding valid commercial Qt licenses may use this file in 12 ** accordance with the commercial license agreement provided with the 13 ** Software or, alternatively, in accordance with the terms contained in 14 ** a written agreement between you and Digia. For licensing terms and 15 ** conditions see http://qt.digia.com/licensing. For further information 16 ** use the contact form at http://qt.digia.com/contact-us. 17 ** 18 ** GNU Lesser General Public License Usage 19 ** Alternatively, this file may be used under the terms of the GNU Lesser 20 ** General Public License version 2.1 as published by the Free Software 21 ** Foundation and appearing in the file LICENSE.LGPL included in the 22 ** packaging of this file. Please review the following information to 23 ** ensure the GNU Lesser General Public License version 2.1 requirements 24 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 ** 26 ** In addition, as a special exception, Digia gives you certain additional 27 ** rights. These rights are described in the Digia Qt LGPL Exception 28 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 ** 30 ** GNU General Public License Usage 31 ** Alternatively, this file may be used under the terms of the GNU 32 ** General Public License version 3.0 as published by the Free Software 33 ** Foundation and appearing in the file LICENSE.GPL included in the 34 ** packaging of this file. Please review the following information to 35 ** ensure the GNU General Public License version 3.0 requirements will be 36 ** met: http://www.gnu.org/copyleft/gpl.html. 37 ** 38 ** 39 ** $QT_END_LICENSE$ 40 ** 41 ****************************************************************************/ 42 43 #ifndef QSYSTEMINFO_SIMULATOR_P_H 44 #define QSYSTEMINFO_SIMULATOR_P_H 45 46 47 // 48 // W A R N I N G 49 // ------------- 50 // 51 // This file is not part of the Qt API. It exists purely as an 52 // implementation detail. This header file may change from version to 53 // version without notice, or even be removed. 54 // 55 // We mean it. 56 // 57 58 #include <qbatteryinfo.h> 59 #include <qdeviceinfo.h> 60 #include <qnetworkinfo.h> 61 62 QT_BEGIN_NAMESPACE 63 64 class QBatteryInfoSimulatorBackend; 65 class QDeviceInfoSimulatorBackend; 66 class QNetworkInfoSimulatorBackend; 67 68 #if !defined(QT_NO_OFONO) 69 class QNetworkInfoPrivate; 70 #endif 71 72 class QBatteryInfoSimulator : public QObject 73 { 74 Q_OBJECT 75 76 public: 77 QBatteryInfoSimulator(QBatteryInfo *parent); 78 QBatteryInfoSimulator(int batteryIndex, QBatteryInfo *parent); 79 ~QBatteryInfoSimulator(); 80 81 int batteryCount(); 82 int batteryIndex() const; 83 bool isValid(); 84 int level(); 85 int currentFlow(int battery); 86 int currentFlow(); 87 int cycleCount(); 88 int maximumCapacity(int battery); 89 int maximumCapacity(); 90 int remainingCapacity(int battery); 91 int remainingCapacity(); 92 int remainingChargingTime(int battery); 93 int remainingChargingTime(); 94 int voltage(int battery); 95 int voltage(); 96 QBatteryInfo::ChargerType chargerType(); 97 QBatteryInfo::ChargingState chargingState(int battery); 98 QBatteryInfo::ChargingState chargingState(); 99 QBatteryInfo::LevelStatus levelStatus(int battery); 100 QBatteryInfo::LevelStatus levelStatus(); 101 QBatteryInfo::Health health(); 102 float temperature(); 103 104 void setBatteryIndex(int batteryIndex); 105 106 Q_SIGNALS: 107 void batteryCountChanged(int count); 108 void batteryIndexChanged(int batteryIndex); 109 void validChanged(bool isValid); 110 void chargerTypeChanged(QBatteryInfo::ChargerType type); 111 void chargingStateChanged(QBatteryInfo::ChargingState state); 112 void levelChanged(int level); 113 void currentFlowChanged(int flow); 114 void cycleCountChanged(int cycleCount); 115 void remainingCapacityChanged(int capacity); 116 void remainingChargingTimeChanged(int seconds); 117 void voltageChanged(int voltage); 118 void levelStatusChanged(QBatteryInfo::LevelStatus levelStatus); 119 120 protected: 121 void connectNotify(const QMetaMethod &signal); 122 void disconnectNotify(const QMetaMethod &signal); 123 124 private: 125 QBatteryInfo * const q_ptr; 126 Q_DECLARE_PUBLIC(QBatteryInfo) 127 128 QBatteryInfoSimulatorBackend *batteryInfoSimulatorBackend; 129 }; 130 131 class QDeviceInfoSimulator : public QObject 132 { 133 Q_OBJECT 134 135 public: 136 QDeviceInfoSimulator(QDeviceInfo *parent); 137 ~QDeviceInfoSimulator(); 138 139 bool hasFeature(QDeviceInfo::Feature feature); 140 int imeiCount(); 141 QDeviceInfo::LockTypeFlags activatedLocks(); 142 QDeviceInfo::LockTypeFlags enabledLocks(); 143 QDeviceInfo::ThermalState thermalState(); 144 QString imei(int interface); 145 QString manufacturer(); 146 QString model(); 147 QString productName(); 148 QString uniqueDeviceID(); 149 QString version(QDeviceInfo::Version type); 150 QString operatingSystemName(); 151 QString boardName(); 152 bool currentBluetoothPowerState(); 153 154 Q_SIGNALS: 155 void activatedLocksChanged(QDeviceInfo::LockTypeFlags types); 156 void enabledLocksChanged(QDeviceInfo::LockTypeFlags types); 157 void thermalStateChanged(QDeviceInfo::ThermalState state); 158 159 protected: 160 void connectNotify(const QMetaMethod &signal); 161 void disconnectNotify(const QMetaMethod &signal); 162 163 private: 164 QDeviceInfo * const q_ptr; 165 Q_DECLARE_PUBLIC(QDeviceInfo) 166 167 QDeviceInfoSimulatorBackend *deviceInfoSimulatorBackend; 168 }; 169 170 class QNetworkInfoSimulator : public QObject 171 { 172 Q_OBJECT 173 174 public: 175 QNetworkInfoSimulator(QNetworkInfo *parent); 176 ~QNetworkInfoSimulator(); 177 178 int networkInterfaceCount(QNetworkInfo::NetworkMode mode); 179 int networkSignalStrength(QNetworkInfo::NetworkMode mode, int interface); 180 QNetworkInfo::CellDataTechnology currentCellDataTechnology(int interface); 181 QNetworkInfo::NetworkMode currentNetworkMode(); 182 QNetworkInfo::NetworkStatus networkStatus(QNetworkInfo::NetworkMode mode, int interface); 183 #ifndef QT_NO_NETWORKINTERFACE 184 QNetworkInterface interfaceForMode(QNetworkInfo::NetworkMode mode, int interface); 185 #endif // QT_NO_NETWORKINTERFACE 186 QString cellId(int interface); 187 QString currentMobileCountryCode(int interface); 188 QString currentMobileNetworkCode(int interface); 189 QString homeMobileCountryCode(int interface); 190 QString homeMobileNetworkCode(int interface); 191 QString imsi(int interface); 192 QString locationAreaCode(int interface); 193 QString macAddress(QNetworkInfo::NetworkMode mode, int interface); 194 QString networkName(QNetworkInfo::NetworkMode mode, int interface); 195 196 Q_SIGNALS: 197 void cellIdChanged(int interface, const QString &id); 198 void currentCellDataTechnologyChanged(int interface, QNetworkInfo::CellDataTechnology tech); 199 void currentMobileCountryCodeChanged(int interface, const QString &mcc); 200 void currentMobileNetworkCodeChanged(int interface, const QString &mnc); 201 void currentNetworkModeChanged(QNetworkInfo::NetworkMode mode); 202 void locationAreaCodeChanged(int interface, const QString &lac); 203 void networkInterfaceCountChanged(QNetworkInfo::NetworkMode mode, int count); 204 void networkNameChanged(QNetworkInfo::NetworkMode mode, int interface, const QString &name); 205 void networkSignalStrengthChanged(QNetworkInfo::NetworkMode mode, int interface, int strength); 206 void networkStatusChanged(QNetworkInfo::NetworkMode mode, int interface, QNetworkInfo::NetworkStatus status); 207 208 protected: 209 void connectNotify(const QMetaMethod &signal); 210 void disconnectNotify(const QMetaMethod &signal); 211 212 private: 213 QNetworkInfo * const q_ptr; 214 Q_DECLARE_PUBLIC(QNetworkInfo) 215 216 QNetworkInfoSimulatorBackend *networkInfoSimulatorBackend; 217 218 #if !defined(QT_NO_OFONO) 219 QNetworkInfoPrivate * const d_ptr; 220 Q_DECLARE_PRIVATE(QNetworkInfo) 221 222 public Q_SLOTS: 223 void onCurrentNetworkModeChanged(QNetworkInfo::NetworkMode mode); 224 void onNetworkInterfaceCountChanged(QNetworkInfo::NetworkMode mode, int count); 225 void onNetworkNameChanged(QNetworkInfo::NetworkMode mode, int interface, const QString &name); 226 void onNetworkSignalStrengthChanged(QNetworkInfo::NetworkMode mode, int interface, int strength); 227 void onNetworkStatusChanged(QNetworkInfo::NetworkMode mode, int interface, QNetworkInfo::NetworkStatus status); 228 #endif 229 }; 230 231 QT_END_NAMESPACE 232 233 #endif /*QSYSTEMINFO_SIMULATOR_P_H*/ 234