summaryrefslogtreecommitdiffstats
path: root/src/systeminfo/qsysteminfo_simulator_p.h
blob: 5daaf05879f5e05c741c086bc0b1cae62e2a6fda (plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

#ifndef QSYSTEMINFO_SIMULATOR_P_H
#define QSYSTEMINFO_SIMULATOR_P_H


//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//


#include <QObject>
#include <QSize>
#include <QHash>
#include <QStringList>

#include <qmobilityglobal.h>
#include "qsysteminfo.h"
#include "qsysteminfodata_simulator_p.h"


QT_BEGIN_HEADER

class QTimer;

QTM_BEGIN_NAMESPACE

class QSystemNetworkInfo;

class Q_SYSINFO_EXPORT QSystemInfoPrivate : public QObject
{
    Q_OBJECT
public:
    explicit QSystemInfoPrivate(QObject *parent = 0);

    QString currentLanguage() const { return data.currentLanguage; }
    QString currentCountryCode() const { return data.currentCountryCode; }
    QStringList availableLanguages() const { return data.availableLanguages; }
    bool hasFeature(QSystemInfo::Feature f) const { return data.features[f]; }
    bool hasFeatureSupported(QSystemInfo::Feature f) const { return data.features[f]; }
    QString version(QSystemInfo::Version v, const QString &param = "") const { Q_UNUSED(param); return data.versions[v]; }

    void setCurrentLanguage(const QString &v);
    void setCurrentCountryCode(const QString &v);
    void setAvailableLanguages(const QStringList &v);
    void addAvailableLanguage(const QString &v);
    bool removeAvailableLanguage(const QString &v);
    void removeAllAvailableLanguages();
    void setFeature(QSystemInfo::Feature f, bool enabled);
    void setVersion(QSystemInfo::Version v, const QString &to);

    void setInitialData();

signals:
    void currentLanguageChanged(const QString &) const;

private:
    QSystemInfoData data;
};
QSystemInfoPrivate *getSystemInfoPrivate();

class  Q_SYSINFO_EXPORT QSystemNetworkInfoPrivate : public QObject
{
    Q_OBJECT
public:
    explicit QSystemNetworkInfoPrivate(QObject *parent = 0);
    virtual ~QSystemNetworkInfoPrivate();

    int cellId() const { return data.cellId; }
    int locationAreaCode() const { return data.locationAreaCode; }
    QString currentMobileCountryCode() const { return data.currentMobileCountryCode; }
    QString currentMobileNetworkCode() const { return data.currentMobileNetworkCode; }
    QString homeMobileCountryCode() const { return data.homeMobileCountryCode; }
    QString homeMobileNetworkCode() const { return data.homeMobileNetworkCode; }
    QSystemNetworkInfo::NetworkMode currentMode() const { return data.currentMode; }
    QSystemNetworkInfo::CellDataTechnology cellDataTechnology() { return data.cellData; };

    QString networkName(QSystemNetworkInfo::NetworkMode m) const;
    QString macAddress(QSystemNetworkInfo::NetworkMode m) const;
    qint32 networkSignalStrength(QSystemNetworkInfo::NetworkMode m) const;
    QSystemNetworkInfo::NetworkStatus networkStatus(QSystemNetworkInfo::NetworkMode m) const;
    QNetworkInterface interfaceForMode(QSystemNetworkInfo::NetworkMode) const;

    void setCellId(int id);
    void setLocationAreaCode(int code);
    void setCurrentMobileCountryCode(const QString &code);
    void setCurrentMobileNetworkCode(const QString &code);
    void setHomeMobileCountryCode(const QString &code);
    void setHomeMobileNetworkCode(const QString &code);
    void setCurrentMode(QSystemNetworkInfo::NetworkMode m);
    void setCellDataTechnology(QSystemNetworkInfo::CellDataTechnology  cd);

    void setNetworkName(QSystemNetworkInfo::NetworkMode m, const QString &name);
    void setNetworkMacAddress(QSystemNetworkInfo::NetworkMode m, const QString &mac);
    void setNetworkSignalStrength(QSystemNetworkInfo::NetworkMode m, qint32 strength);
    void setNetworkStatus(QSystemNetworkInfo::NetworkMode m, QSystemNetworkInfo::NetworkStatus status);

    void setInitialData();

signals:
    void networkStatusChanged(QSystemNetworkInfo::NetworkMode, QSystemNetworkInfo::NetworkStatus) const;
    void networkSignalStrengthChanged(QSystemNetworkInfo::NetworkMode, int) const;
    void currentMobileCountryCodeChanged(const QString &) const;
    void currentMobileNetworkCodeChanged(const QString &) const;
    void networkNameChanged(QSystemNetworkInfo::NetworkMode, const QString &) const;
    void networkModeChanged(QSystemNetworkInfo::NetworkMode) const;
    void cellIdChanged(int);
    void cellDataTechnologyChanged(QSystemNetworkInfo::CellDataTechnology); //1.2

private:
    QSystemNetworkInfoData data;
};
QSystemNetworkInfoPrivate *getSystemNetworkInfoPrivate();

class  Q_SYSINFO_EXPORT QSystemDisplayInfoPrivate : public QObject
{
    Q_OBJECT
public:
    explicit QSystemDisplayInfoPrivate(QObject *parent = 0);

    int displayBrightness(int screen = 0) const { Q_UNUSED(screen); return data.displayBrightness; }
    int colorDepth(int screen = 0) const { Q_UNUSED(screen); return data.colorDepth; }

    QSystemDisplayInfo::DisplayOrientation orientation(int screen) const { Q_UNUSED(screen); return data.orientation; }
    float contrast(int screen) const { Q_UNUSED(screen); return data.contrast;}
    int getDPIHeight(int screen) const;
    int getDPIWidth(int screen) const;
    int physicalHeight(int screen) const;
    int physicalWidth(int screen) const;

    QSystemDisplayInfo::BacklightState backlightStatus(int screen) { Q_UNUSED(screen); return data.backlightStatus; }

    void setDisplayBrightness(int brightness);
    void setColorDepth(int depth);

    void setOrientation(QSystemDisplayInfo::DisplayOrientation v);
    void setContrast(float v);
    void setBacklightStatus(QSystemDisplayInfo::BacklightState v);

    void setInitialData();

private:
    QSystemDisplayInfoData data;
};
QSystemDisplayInfoPrivate *getSystemDisplayInfoPrivate();

class  Q_SYSINFO_EXPORT QSystemDeviceInfoPrivate : public QObject
{
    Q_OBJECT
public:
    explicit QSystemDeviceInfoPrivate(QObject *parent = 0);

    QSystemDeviceInfo::Profile currentProfile() const { return data.currentProfile; }
    QSystemDeviceInfo::PowerState currentPowerState() const { return data.currentPowerState; }
    QSystemDeviceInfo::ThermalState currentThermalState() const { return data.currentThermalState; }
    QSystemDeviceInfo::SimStatus simStatus() const { return data.simStatus; }
    QSystemDeviceInfo::InputMethodFlags inputMethodType() const { return data.inputMethodType; }

    QString imei() const { return data.imei; }
    QString imsi() const { return data.imsi; }
    QString manufacturer() const { return data.manufacturer; }
    QString model() const { return data.model; }
    QString productName() const { return data.productName; }

    int batteryLevel() const { return data.batteryLevel; }
    bool isDeviceLocked() const { return data.deviceLocked; }

    bool currentBluetoothPowerState() const { return data.currentBluetoothPower;}

    QSystemDeviceInfo::KeyboardTypeFlags keyboardTypes()const { return data.keyboardTypes; }
    QSystemDeviceInfo::KeypadType keypadType()const { return data.keypadType; }
    bool isWirelessKeyboardConnected()const { return data.wirelessConnected; }
    bool isKeyboardFlippedOpen()const { return data.keyboardFlipped; }

    bool keypadLightOn(QSystemDeviceInfo::KeypadType type)const { Q_UNUSED(type);return data.keypadLight; }
    bool backLightOn()const { return data.backLight; }
    QByteArray uniqueDeviceID(){ return data.uniqueDeviceId; }
    QSystemDeviceInfo::LockTypeFlags lockStatus()const { return data.lockType; }

    QSystemDeviceInfo::BatteryStatus batteryStatus() const;


    int messageRingtoneVolume() const { return data.messageRingtoneVolume; }
    int voiceRingtoneVolume() const { return data.voiceRingtoneVolume; }
    bool vibrationActive() const { return data.vibrationActive; }

    void setCurrentProfile(QSystemDeviceInfo::Profile v);
    void setCurrentPowerState(QSystemDeviceInfo::PowerState v);
    void setCurrentThermalState(QSystemDeviceInfo::ThermalState v);
    void setSimStatus(QSystemDeviceInfo::SimStatus v);
    void setInputMethodType(QSystemDeviceInfo::InputMethodFlags v);

    void setImei(const QString &v);
    void setImsi(const QString &v);
    void setManufacturer(const QString &v);
    void setModel(const QString &v);
    void setProductName(const QString &v);

    void setBatteryLevel(int v);
    void setDeviceLocked(bool v);

    void setBluetoothPower(bool v);

    void setKeyboardTypes(QSystemDeviceInfo::KeyboardTypeFlags v);
    void setKeypadType(QSystemDeviceInfo::KeypadType v);

    void setWirelessKeyboardConnected(bool v);
    void setKeyboardFlippedOpen(bool v);

    void setKeypadLightOn(bool v);
    void setBackLightOn(bool v);
    void setUniqueDeviceId(const QByteArray &v);
    void setTypeOfLock(QSystemDeviceInfo::LockTypeFlags v);

    void setMessageRingtoneVolume(int v);
    void setVoiceRingtoneVolume(int v);
    void setVibrationActive(bool b);

    void setInitialData();

Q_SIGNALS:

    void batteryLevelChanged(int) const;
    void batteryStatusChanged(QSystemDeviceInfo::BatteryStatus) const;
    void powerStateChanged(QSystemDeviceInfo::PowerState) const;
    void thermalStateChanged(QSystemDeviceInfo::ThermalState) const;
    void currentProfileChanged(QSystemDeviceInfo::Profile) const;
    void bluetoothStateChanged(bool) const;

    void wirelessKeyboardConnected(bool connected);
    void keyboardFlipped(bool open);
    void deviceLocked(bool isLocked);
    void lockStatusChanged(QSystemDeviceInfo::LockTypeFlags);

private:
    QSystemDeviceInfoData data;
    QSystemDeviceInfo::BatteryStatus oldstatus;
};
QSystemDeviceInfoPrivate *getSystemDeviceInfoPrivate();

class  Q_SYSINFO_EXPORT QSystemStorageInfoPrivate : public QObject
{
    Q_OBJECT
public:
    explicit QSystemStorageInfoPrivate(QObject *parent = 0);

    QStringList logicalDrives() const;
    QSystemStorageInfo::DriveType typeForDrive(const QString &name) const;
    qint64 totalDiskSpace(const QString &name) const;
    qint64 availableDiskSpace(const QString &name) const;

    QString uriForDrive(const QString &driveVolume) const;
    QSystemStorageInfo::StorageState getStorageState(const QString &driveVolume) const;

    bool addDrive(const QString &name);
    bool addDrive(const QString &name, QSystemStorageInfo::DriveType type,
                  qint64 totalSpace, qint64 availableSpace,
                  const QString &uri);
    bool removeDrive(const QString &name);
    bool setName(const QString &oldname, const QString &newname);
    bool setType(const QString &name, QSystemStorageInfo::DriveType type);
    bool setTotalSpace(const QString &name, qint64 space);
    bool setAvailableSpace(const QString &name, qint64 space);

    bool setUriForDrive(const QString &name, const QString &v);
    bool setStorageState(const QString &name, QSystemStorageInfo::StorageState v);

    void setInitialData();

Q_SIGNALS:
    void logicalDriveChanged(bool added,const QString &vol) const;
    void storageStateChanged(const QString &vol,QSystemStorageInfo::StorageState state) const;

private:
    QSystemStorageInfoData data;
};
QSystemStorageInfoPrivate *getSystemStorageInfoPrivate();

class  Q_SYSINFO_EXPORT QSystemScreenSaverPrivate : public QObject
{
    Q_OBJECT

public:
    explicit QSystemScreenSaverPrivate(QObject *parent = 0);
    ~QSystemScreenSaverPrivate();

    bool screenSaverInhibited();
    bool setScreenSaverInhibit();
    void setScreenSaverInhibited(bool on);
    bool isScreenLockOn();

private:
    bool didInhibit;
    QSystemScreenSaverData data;
};


class  Q_SYSINFO_EXPORT QSystemBatteryInfoPrivate : public QObject
{
    Q_OBJECT

public:
    explicit QSystemBatteryInfoPrivate(QObject *parent = 0);
    ~QSystemBatteryInfoPrivate();


    QSystemBatteryInfo::BatteryStatus batteryStatus() const { return data.batteryStatus; }
    QSystemBatteryInfo::ChargerType chargerType() const{ return data.chargerType; }
    QSystemBatteryInfo::ChargingState chargingState() const{ return data.chargingState; }


    int nominalCapacity() const { return data.nominalCapacity; }
    int remainingCapacityPercent() const { return data.remainingCapacityPercent; }
    int remainingCapacity() const { return data.remainingCapacity; }

    int voltage() const { return data.voltage; }
    int remainingChargingTime() const { return data.remainingChargingTime; }
    int currentFlow() const { return data.currentFlow; }
    int cumulativeCurrentFlow() const { return data.cumulativeCurrentFlow; }
    int remainingCapacityBars() const{ return data.remainingCapacityBars; }
    int maxBars() const { return data.maxBars; }
    QSystemBatteryInfo::EnergyUnit energyMeasurementUnit(){ return data.energyMeasurementUnit; }


    void setBatteryStatus(QSystemBatteryInfo::BatteryStatus v);
    void setChargerType(QSystemBatteryInfo::ChargerType v);
    void setChargingState(QSystemBatteryInfo::ChargingState v);


    void  setNominalCapacity(int v);
    void  setRemainingCapacityPercent(int v);
    void  setRemainingCapacity(int v);

    void  setVoltage(int v);
    void  setRemainingChargingTime(int v);
    void  setCurrentFlow(int v);
    void  setRemainingCapacityBars(int v);
    void  setMaxBars(int v);

    void setInitialData();
Q_SIGNALS:
//    void batteryLevelChanged(int level);
    void batteryStatusChanged(QSystemBatteryInfo::BatteryStatus batteryStatus);

    void chargingStateChanged(QSystemBatteryInfo::ChargingState chargingState);
    void chargerTypeChanged(QSystemBatteryInfo::ChargerType chargerType);

    void nominalCapacityChanged(int);
    void remainingCapacityPercentChanged(int);
    void remainingCapacityChanged(int);

    void currentFlowChanged(int);
    void remainingCapacityBarsChanged(int);
    void remainingChargingTimeChanged(int);

private:
    QSystemBatteryInfoData data;
};
QSystemBatteryInfoPrivate *getSystemBatteryInfoPrivate();

#ifdef TESTR
class Q_SYSINFO_EXPORT SystemInfoConnection : public QObject
{
    Q_OBJECT
public:
    SystemInfoConnection(QObject *parent = 0);
    QSystemInfoPrivate *systeminfoPrivate();
    QSystemNetworkInfoPrivate *networkInfoPrivate();
    QSystemDeviceInfoPrivate *deviceInfoPrivate();
    QSystemStorageInfoPrivate *storageInfoPrivate();
    QSystemBatteryInfoPrivate *batteryInfoPrivate();
    QSystemDeviceInfoPrivate *alignedTImerPrivate();
};
#endif


QTM_END_NAMESPACE
QT_END_HEADER

#endif /*QSYSTEMINFO_SIMULATOR_P_H*/