src/systeminfo/qsysteminfo.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_H
       
    42 #define QSYSTEMINFO_H
       
    43 #include "qmobilityglobal.h"
       
    44 
       
    45 #include <QObject>
       
    46 #include <QSize>
       
    47 #include <QPair>
       
    48 #include <QString>
       
    49 #include <QStringList>
       
    50 #include <QNetworkInterface>
       
    51 
       
    52 
       
    53 QT_BEGIN_HEADER
       
    54 QTM_BEGIN_NAMESPACE
       
    55 
       
    56 class QSystemInfoPrivate;
       
    57 class QSystemNetworkInfoPrivate;
       
    58 class QSystemStorageInfoPrivate;
       
    59 class QSystemDeviceInfoPrivate;
       
    60 class QSystemDisplayInfoPrivate;
       
    61 
       
    62 
       
    63 class Q_SYSINFO_EXPORT QSystemInfo : public QObject
       
    64 {
       
    65     Q_OBJECT
       
    66     Q_PROPERTY(QString currentLanguage READ currentLanguage NOTIFY currentLanguageChanged)
       
    67     Q_PROPERTY(QStringList availableLanguages READ availableLanguages)
       
    68     Q_PROPERTY(QString currentCountryCode READ currentCountryCode)
       
    69     Q_ENUMS(Version)
       
    70     Q_ENUMS(Feature)
       
    71 
       
    72 public:
       
    73 
       
    74     QSystemInfo(QObject *parent = 0);
       
    75      virtual ~QSystemInfo();
       
    76 
       
    77     QString currentLanguage(); // 2 letter ISO 639-1 //signal
       
    78     QStringList availableLanguages(); // 2 letter ISO 639-1
       
    79     QString currentCountryCode(); //2 letter ISO 3166-1
       
    80     enum Version {
       
    81         Os = 1,
       
    82         QtCore,
       
    83         Firmware
       
    84     };
       
    85 
       
    86     QString version(QSystemInfo::Version type, const QString &parameter = QString());
       
    87 
       
    88     enum Feature {
       
    89         BluetoothFeature=0,
       
    90         CameraFeature,
       
    91         FmradioFeature,
       
    92         IrFeature,
       
    93         LedFeature,
       
    94         MemcardFeature,
       
    95         UsbFeature,
       
    96         VibFeature,
       
    97         WlanFeature,
       
    98         SimFeature,
       
    99         LocationFeature,
       
   100         VideoOutFeature,
       
   101         HapticsFeature
       
   102 	};
       
   103 
       
   104     bool hasFeatureSupported(QSystemInfo::Feature feature);
       
   105 
       
   106 Q_SIGNALS:
       
   107     void currentLanguageChanged(const QString &);
       
   108 private:
       
   109     QSystemInfoPrivate *d;
       
   110 protected:
       
   111     void connectNotify(const char *signal);
       
   112     void disconnectNotify(const char *signal);
       
   113 };
       
   114 
       
   115 class  Q_SYSINFO_EXPORT QSystemNetworkInfo : public QObject
       
   116 {
       
   117     Q_OBJECT
       
   118     Q_ENUMS(NetworkStatus)
       
   119     Q_ENUMS(NetworkMode)
       
   120     Q_PROPERTY(int cellId READ cellId)
       
   121     Q_PROPERTY(int locationAreaCode READ locationAreaCode)
       
   122     Q_PROPERTY(QString currentMobileCountryCode READ currentMobileCountryCode NOTIFY currentMobileCountryCodeChanged)
       
   123     Q_PROPERTY(QString currentMobileNetworkCode READ currentMobileNetworkCode NOTIFY currentMobileNetworkCodeChanged)
       
   124     Q_PROPERTY(QString homeMobileCountryCode READ homeMobileCountryCode CONSTANT)
       
   125     Q_PROPERTY(QString homeMobileNetworkCode READ homeMobileNetworkCode CONSTANT)
       
   126     Q_PROPERTY(QSystemNetworkInfo::NetworkMode currentMode READ currentMode)
       
   127 
       
   128 
       
   129 public:
       
   130 
       
   131     QSystemNetworkInfo(QObject *parent = 0);
       
   132     ~QSystemNetworkInfo();
       
   133 
       
   134     enum NetworkStatus {
       
   135         UndefinedStatus = 0,
       
   136         NoNetworkAvailable,
       
   137         EmergencyOnly,
       
   138         Searching,
       
   139         Busy,
       
   140         Connected,
       
   141         HomeNetwork,
       
   142         Denied,
       
   143         Roaming
       
   144     };
       
   145 
       
   146     enum NetworkMode {
       
   147         UnknownMode=0,
       
   148         GsmMode,
       
   149         CdmaMode,
       
   150         WcdmaMode,
       
   151         WlanMode,
       
   152         EthernetMode,
       
   153         BluetoothMode,
       
   154         WimaxMode
       
   155     };
       
   156     Q_DECLARE_FLAGS(NetworkModes, NetworkMode)
       
   157 
       
   158     Q_INVOKABLE QSystemNetworkInfo::NetworkStatus networkStatus(QSystemNetworkInfo::NetworkMode mode);
       
   159     Q_INVOKABLE static int networkSignalStrength(QSystemNetworkInfo::NetworkMode mode);
       
   160     QString macAddress(QSystemNetworkInfo::NetworkMode mode);
       
   161     QSystemNetworkInfo::NetworkMode currentMode();
       
   162 
       
   163     int cellId();
       
   164     int locationAreaCode();
       
   165 
       
   166     QString currentMobileCountryCode();
       
   167     QString currentMobileNetworkCode();
       
   168     QString homeMobileCountryCode();
       
   169     QString homeMobileNetworkCode();
       
   170     Q_INVOKABLE static QString networkName(QSystemNetworkInfo::NetworkMode mode);
       
   171     QNetworkInterface interfaceForMode(QSystemNetworkInfo::NetworkMode mode);
       
   172 
       
   173 
       
   174 Q_SIGNALS:
       
   175    void networkStatusChanged(QSystemNetworkInfo::NetworkMode, QSystemNetworkInfo::NetworkStatus);
       
   176    void networkSignalStrengthChanged(QSystemNetworkInfo::NetworkMode, int);
       
   177    void currentMobileCountryCodeChanged(const QString &);
       
   178    void currentMobileNetworkCodeChanged(const QString &);
       
   179    void networkNameChanged(QSystemNetworkInfo::NetworkMode,const QString &);
       
   180    void networkModeChanged(QSystemNetworkInfo::NetworkMode);
       
   181 
       
   182 protected:
       
   183     virtual void connectNotify(const char *signal);
       
   184     virtual void disconnectNotify(const char *signal);
       
   185 
       
   186 private:
       
   187        QSystemNetworkInfoPrivate *d;
       
   188 };
       
   189 
       
   190 
       
   191 class  Q_SYSINFO_EXPORT QSystemDisplayInfo : public QObject
       
   192 {
       
   193 Q_OBJECT
       
   194 
       
   195 public:
       
   196 
       
   197     QSystemDisplayInfo(QObject *parent = 0);
       
   198     ~QSystemDisplayInfo();
       
   199 
       
   200 
       
   201     static int displayBrightness(int screen);
       
   202     static int colorDepth(int screen);
       
   203 };
       
   204 
       
   205 
       
   206 class  Q_SYSINFO_EXPORT QSystemStorageInfo : public QObject
       
   207 {
       
   208     Q_OBJECT
       
   209     Q_PROPERTY(QStringList logicalDrives READ logicalDrives)
       
   210     Q_ENUMS(DriveType)
       
   211 
       
   212 public:
       
   213 
       
   214     QSystemStorageInfo(QObject *parent = 0);
       
   215     ~QSystemStorageInfo();
       
   216 
       
   217     enum DriveType {
       
   218         NoDrive = 0,
       
   219         InternalDrive,
       
   220         RemovableDrive,
       
   221         RemoteDrive,
       
   222         CdromDrive
       
   223 	};
       
   224 
       
   225     Q_INVOKABLE qlonglong totalDiskSpace(const QString &driveVolume);
       
   226     Q_INVOKABLE qlonglong availableDiskSpace(const QString &driveVolume);
       
   227     static QStringList logicalDrives();
       
   228 
       
   229     Q_INVOKABLE QSystemStorageInfo::DriveType typeForDrive(const QString &driveVolume);
       
   230 
       
   231 };
       
   232 
       
   233 class  Q_SYSINFO_EXPORT QSystemDeviceInfo : public QObject
       
   234 {
       
   235     Q_OBJECT
       
   236     Q_PROPERTY(Profile currentProfile READ currentProfile NOTIFY currentProfileChanged)
       
   237     Q_PROPERTY(PowerState currentPowerState READ currentPowerState NOTIFY powerStateChanged)
       
   238     Q_PROPERTY(SimStatus simStatus READ simStatus CONSTANT)
       
   239     Q_PROPERTY(BatteryStatus batteryStatus READ batteryStatus NOTIFY batteryStatusChanged)
       
   240     Q_PROPERTY(InputMethodFlags inputMethodType READ inputMethodType)
       
   241 
       
   242     Q_PROPERTY(QString imei READ imei CONSTANT)
       
   243     Q_PROPERTY(QString imsi READ imsi CONSTANT)
       
   244     Q_PROPERTY(QString manufacturer READ manufacturer CONSTANT)
       
   245     Q_PROPERTY(QString model READ model CONSTANT)
       
   246     Q_PROPERTY(QString productName READ productName CONSTANT)
       
   247     Q_PROPERTY(int batteryLevel READ batteryLevel NOTIFY batteryLevelChanged)
       
   248     Q_PROPERTY(bool isDeviceLocked READ isDeviceLocked)
       
   249 
       
   250 
       
   251     Q_ENUMS(BatteryStatus)
       
   252     Q_ENUMS(PowerState)
       
   253     Q_FLAGS(InputMethod InputMethodFlags)
       
   254     Q_ENUMS(SimStatus)
       
   255     Q_ENUMS(Profile)
       
   256 
       
   257 public:
       
   258 
       
   259     QSystemDeviceInfo(QObject *parent = 0);
       
   260     virtual ~QSystemDeviceInfo();
       
   261 
       
   262     enum BatteryStatus {
       
   263         NoBatteryLevel = 0,
       
   264         BatteryCritical,
       
   265         BatteryVeryLow,
       
   266         BatteryLow,
       
   267         BatteryNormal
       
   268     };
       
   269 
       
   270 
       
   271     enum PowerState {
       
   272         UnknownPower = 0,
       
   273         BatteryPower,
       
   274         WallPower,
       
   275         WallPowerChargingBattery
       
   276     };
       
   277 
       
   278 
       
   279     enum InputMethod {
       
   280         Keys = 0x0000001,
       
   281         Keypad = 0x0000002,
       
   282         Keyboard = 0x0000004,
       
   283         SingleTouch = 0x0000008,
       
   284         MultiTouch = 0x0000010,
       
   285         Mouse = 0x0000020
       
   286     };
       
   287 
       
   288     Q_DECLARE_FLAGS(InputMethodFlags, InputMethod)
       
   289 
       
   290     QSystemDeviceInfo::InputMethodFlags inputMethodType();
       
   291 
       
   292     QString imei();
       
   293     QString imsi();
       
   294     QString manufacturer();
       
   295     QString model();
       
   296     QString productName();
       
   297     int batteryLevel() const;
       
   298    QSystemDeviceInfo::BatteryStatus batteryStatus();
       
   299 
       
   300     enum Profile {
       
   301         UnknownProfile = 0,
       
   302         SilentProfile,
       
   303         NormalProfile,
       
   304         LoudProfile,
       
   305         VibProfile,
       
   306         OfflineProfile,
       
   307         PowersaveProfile,
       
   308         CustomProfile
       
   309     };
       
   310 
       
   311     enum SimStatus {
       
   312         SimNotAvailable = 0,
       
   313         SingleSimAvailable,
       
   314         DualSimAvailable,
       
   315         SimLocked
       
   316 	};
       
   317 
       
   318     bool isDeviceLocked();
       
   319     QSystemDeviceInfo::SimStatus simStatus();
       
   320     QSystemDeviceInfo::Profile currentProfile();
       
   321     QSystemDeviceInfo::PowerState currentPowerState();
       
   322 
       
   323 Q_SIGNALS:
       
   324     void batteryLevelChanged(int);
       
   325     void batteryStatusChanged(QSystemDeviceInfo::BatteryStatus );
       
   326     void powerStateChanged(QSystemDeviceInfo::PowerState);
       
   327     void currentProfileChanged(QSystemDeviceInfo::Profile);
       
   328     void bluetoothStateChanged(bool);
       
   329 
       
   330 private:
       
   331     QSystemDeviceInfoPrivate *d;
       
   332 protected:
       
   333     void connectNotify(const char *signal);
       
   334     void disconnectNotify(const char *signal);
       
   335 };
       
   336 
       
   337 Q_DECLARE_OPERATORS_FOR_FLAGS(QSystemDeviceInfo::InputMethodFlags )
       
   338 
       
   339 class QSystemScreenSaverPrivate;
       
   340 class  Q_SYSINFO_EXPORT QSystemScreenSaver : public QObject
       
   341 {
       
   342     Q_OBJECT
       
   343     Q_ENUMS(ScreenSaverState)
       
   344     Q_PROPERTY(bool screenSaverInhibited READ screenSaverInhibited)
       
   345 
       
   346 public:
       
   347 
       
   348     QSystemScreenSaver(QObject *parent = 0);
       
   349     ~QSystemScreenSaver();
       
   350 
       
   351     bool screenSaverInhibited();
       
   352     Q_INVOKABLE bool setScreenSaverInhibit();
       
   353 
       
   354 private:
       
   355     bool screenSaverIsInhibited;
       
   356     QSystemScreenSaverPrivate *d;
       
   357 };
       
   358 
       
   359 QTM_END_NAMESPACE
       
   360 
       
   361 QT_END_HEADER
       
   362 
       
   363 #endif /*QSYSTEMSINFO_H*/
       
   364 
       
   365 // End of file
       
   366