src/systeminfo/qsysteminfo_win_p.h
changeset 0 876b1a06bc25
equal deleted inserted replaced
-1:000000000000 0:876b1a06bc25
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Mobility Components.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 #ifndef QSYSTEMINFO_WIN_P_H
       
    42 #define QSYSTEMINFO_WIN_P_H
       
    43 
       
    44 
       
    45 //
       
    46 //  W A R N I N G
       
    47 //  -------------
       
    48 //
       
    49 // This file is not part of the Qt API.  It exists purely as an
       
    50 // implementation detail.  This header file may change from version to
       
    51 // version without notice, or even be removed.
       
    52 //
       
    53 // We mean it.
       
    54 //
       
    55 
       
    56 
       
    57 #include <QObject>
       
    58 #include <QSize>
       
    59 #include <QHash>
       
    60 #include <QThread>
       
    61 #include <QMutex>
       
    62 
       
    63 #include "qsysteminfo.h"
       
    64 #include "qmobilityglobal.h"
       
    65 
       
    66 #include <winsock2.h>
       
    67 #include <mswsock.h>
       
    68 
       
    69 #include <QBasicTimer>
       
    70 
       
    71 QT_BEGIN_NAMESPACE
       
    72 class QStringList;
       
    73 class QTimer;
       
    74 QT_END_NAMESPACE
       
    75 
       
    76 QT_BEGIN_HEADER
       
    77 
       
    78 QTM_BEGIN_NAMESPACE
       
    79 
       
    80 class QSystemNetworkInfo;
       
    81 class QSystemInfoPrivate : public QObject
       
    82 {
       
    83     Q_OBJECT
       
    84 
       
    85 public:
       
    86 
       
    87     QSystemInfoPrivate(QObject *parent = 0);
       
    88     virtual ~QSystemInfoPrivate();
       
    89     QString currentLanguage() const;
       
    90     QStringList availableLanguages() const;
       
    91 
       
    92     QString version(QTM_PREPEND_NAMESPACE(QSystemInfo::Version),  const QString &parameter = QString());
       
    93 
       
    94     QString currentCountryCode() const;
       
    95     bool hasFeatureSupported(QTM_PREPEND_NAMESPACE(QSystemInfo::Feature) feature);
       
    96 Q_SIGNALS:
       
    97     void currentLanguageChanged(const QString &);
       
    98 
       
    99 private:
       
   100 
       
   101     bool hasSysFeature(const QString &featureStr);
       
   102     QString currentLanguageStr;
       
   103 private Q_SLOTS:
       
   104      void currentLanguageTimeout();
       
   105 
       
   106 };
       
   107 
       
   108 class QSystemNetworkInfoPrivate : public QObject
       
   109 {
       
   110     Q_OBJECT
       
   111 
       
   112 public:
       
   113 
       
   114     QSystemNetworkInfoPrivate(QObject *parent = 0);
       
   115     virtual ~QSystemNetworkInfoPrivate();
       
   116 
       
   117     QTM_PREPEND_NAMESPACE(QSystemNetworkInfo::NetworkStatus) networkStatus(QTM_PREPEND_NAMESPACE(QSystemNetworkInfo::NetworkMode) mode);
       
   118     qint32 networkSignalStrength(QTM_PREPEND_NAMESPACE(QSystemNetworkInfo::NetworkMode) mode);
       
   119     int cellId();
       
   120     int locationAreaCode();
       
   121 
       
   122     QString currentMobileCountryCode();
       
   123     QString currentMobileNetworkCode();
       
   124 
       
   125     QString homeMobileCountryCode();
       
   126     QString homeMobileNetworkCode();
       
   127 
       
   128     QString networkName(QTM_PREPEND_NAMESPACE(QSystemNetworkInfo::NetworkMode) mode);
       
   129     QString macAddress(QTM_PREPEND_NAMESPACE(QSystemNetworkInfo::NetworkMode) mode);
       
   130 
       
   131     QNetworkInterface interfaceForMode(QTM_PREPEND_NAMESPACE(QSystemNetworkInfo::NetworkMode) mode);
       
   132 
       
   133 
       
   134    void emitNetworkStatusChanged(QSystemNetworkInfo::NetworkMode, QSystemNetworkInfo::NetworkStatus);
       
   135    void emitNetworkSignalStrengthChanged(QSystemNetworkInfo::NetworkMode,int);
       
   136    QSystemNetworkInfo::NetworkMode currentMode();
       
   137 
       
   138 
       
   139    static QSystemNetworkInfoPrivate *instance();
       
   140 protected:
       
   141    void timerEvent(QTimerEvent *event);
       
   142 
       
   143 Q_SIGNALS:
       
   144    void networkStatusChanged(QSystemNetworkInfo::NetworkMode, QSystemNetworkInfo::NetworkStatus);
       
   145    void networkSignalStrengthChanged(QSystemNetworkInfo::NetworkMode,int);
       
   146    void currentMobileCountryCodeChanged(const QString &);
       
   147    void currentMobileNetworkCodeChanged(const QString &);
       
   148    void networkNameChanged(QSystemNetworkInfo::NetworkMode, const QString &);
       
   149    void networkModeChanged(QSystemNetworkInfo::NetworkMode);
       
   150 private Q_SLOTS:
       
   151    void networkStrengthTimeout();
       
   152    void networkStatusTimeout();
       
   153 private:
       
   154     quint32 wifiStrength;
       
   155     quint32 ethStrength;
       
   156     HANDLE hWlan;
       
   157     int timerMs;
       
   158    QBasicTimer netStrengthTimer;
       
   159    bool isDefaultMode(QTM_PREPEND_NAMESPACE(QSystemNetworkInfo::NetworkMode) mode);
       
   160    void startWifiCallback();
       
   161    bool wlanCallbackInitialized;
       
   162 
       
   163 };
       
   164 
       
   165 class QSystemDisplayInfoPrivate : public QObject
       
   166 {
       
   167     Q_OBJECT
       
   168 
       
   169 public:
       
   170 
       
   171     QSystemDisplayInfoPrivate(QObject *parent = 0);
       
   172     virtual ~QSystemDisplayInfoPrivate();
       
   173 
       
   174 
       
   175     int displayBrightness(int screen);
       
   176     int colorDepth(int screen);
       
   177 };
       
   178 
       
   179 class QSystemStorageInfoPrivate : public QObject
       
   180 {
       
   181     Q_OBJECT
       
   182 
       
   183 public:
       
   184 
       
   185     QSystemStorageInfoPrivate(QObject *parent = 0);
       
   186     virtual ~QSystemStorageInfoPrivate();
       
   187 
       
   188     qint64 availableDiskSpace(const QString &driveVolume);
       
   189     qint64 totalDiskSpace(const QString &driveVolume);
       
   190     QStringList logicalDrives();
       
   191     QTM_PREPEND_NAMESPACE(QSystemStorageInfo::DriveType) typeForDrive(const QString &driveVolume);
       
   192 
       
   193 private:
       
   194     QHash<QString, QString> mountEntriesHash;
       
   195     void mountEntries();
       
   196 
       
   197 };
       
   198 
       
   199 #if defined(Q_OS_WINCE)
       
   200 
       
   201 #include "Pm.h"
       
   202 
       
   203 class QSystemDeviceInfoPrivate;
       
   204 
       
   205 class QPowerNotificationThread : public QThread
       
   206 {
       
   207     Q_OBJECT
       
   208 
       
   209 public:
       
   210     QPowerNotificationThread(QSystemDeviceInfoPrivate *parent = 0);
       
   211     ~QPowerNotificationThread();
       
   212 
       
   213 protected:
       
   214     void run();
       
   215 
       
   216 private:
       
   217     QSystemDeviceInfoPrivate *parent;
       
   218     bool done;
       
   219     QMutex mutex;
       
   220     HANDLE wakeUpEvent;
       
   221 };
       
   222 #endif
       
   223 
       
   224 class QSystemDeviceInfoPrivate : public QObject
       
   225 {
       
   226     Q_OBJECT
       
   227 
       
   228 public:
       
   229 
       
   230     QSystemDeviceInfoPrivate(QObject *parent = 0);
       
   231     virtual ~QSystemDeviceInfoPrivate();
       
   232 
       
   233     QString imei();
       
   234     QString imsi();
       
   235     QString manufacturer();
       
   236     QString model();
       
   237     QString productName();
       
   238 
       
   239     QTM_PREPEND_NAMESPACE(QSystemDeviceInfo::InputMethodFlags) inputMethodType();
       
   240 
       
   241     int  batteryLevel();
       
   242 
       
   243     QTM_PREPEND_NAMESPACE(QSystemDeviceInfo::SimStatus) simStatus();
       
   244     bool isDeviceLocked();
       
   245     QTM_PREPEND_NAMESPACE(QSystemDeviceInfo::Profile) currentProfile();
       
   246 
       
   247     QTM_PREPEND_NAMESPACE(QSystemDeviceInfo::PowerState) currentPowerState();
       
   248     void setConnection();
       
   249     static QSystemDeviceInfoPrivate *instance() {return self;}
       
   250 
       
   251 Q_SIGNALS:
       
   252     void batteryLevelChanged(int);
       
   253     void batteryStatusChanged(QSystemDeviceInfo::BatteryStatus );
       
   254 
       
   255     void powerStateChanged(QSystemDeviceInfo::PowerState);
       
   256     void currentProfileChanged(QSystemDeviceInfo::Profile);
       
   257     void bluetoothStateChanged(bool);
       
   258 
       
   259 private:
       
   260     int batteryLevelCache;
       
   261     QTM_PREPEND_NAMESPACE(QSystemDeviceInfo::PowerState) currentPowerStateCache;
       
   262     QTM_PREPEND_NAMESPACE(QSystemDeviceInfo::BatteryStatus) batteryStatusCache;
       
   263 #if defined(Q_OS_WINCE)
       
   264     QPowerNotificationThread *powerNotificationThread;
       
   265 #endif
       
   266     static QSystemDeviceInfoPrivate *self;
       
   267 };
       
   268 
       
   269 
       
   270 class QSystemScreenSaverPrivate : public QObject
       
   271 {
       
   272     Q_OBJECT
       
   273 
       
   274 public:
       
   275     QSystemScreenSaverPrivate(QObject *parent = 0);
       
   276 
       
   277     bool screenSaverInhibited();
       
   278     bool setScreenSaverInhibit();
       
   279     bool screenSaverSecureEnabled();
       
   280 private:
       
   281     QString screenPath;
       
   282     QString settingsPath;
       
   283     bool screenSaverSecure;
       
   284 
       
   285 };
       
   286 
       
   287 QTM_END_NAMESPACE
       
   288 
       
   289 QT_END_HEADER
       
   290 
       
   291 #endif /*QSYSTEMSINFO_WIN_P_H*/
       
   292 
       
   293 // End of file
       
   294