src/systeminfo/qsysteminfo_maemo_p.h
changeset 0 876b1a06bc25
child 5 603d3f8b6302
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_MAEMO_P_H
       
    42 #define QSYSTEMINFO_MAEMO_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 
       
    61 #include "qsysteminfo_linux_common_p.h"
       
    62 #include "qsysteminfo.h"
       
    63 #include <qmobilityglobal.h>
       
    64 #if !defined(QT_NO_DBUS)
       
    65 #include "qhalservice_linux_p.h"
       
    66 
       
    67 typedef enum
       
    68 {
       
    69     NM_DEVICE_STATE_UNKNOWN = 0,
       
    70     NM_DEVICE_STATE_UNMANAGED,
       
    71     NM_DEVICE_STATE_UNAVAILABLE,
       
    72     NM_DEVICE_STATE_DISCONNECTED,
       
    73     NM_DEVICE_STATE_PREPARE,
       
    74     NM_DEVICE_STATE_CONFIG,
       
    75     NM_DEVICE_STATE_NEED_AUTH,
       
    76     NM_DEVICE_STATE_IP_CONFIG,
       
    77     NM_DEVICE_STATE_ACTIVATED,
       
    78     NM_DEVICE_STATE_FAILED
       
    79 } NMDeviceState;
       
    80 
       
    81 struct ProfileDataValue {
       
    82     QString key;
       
    83     QString val;
       
    84     QString type;
       
    85     };
       
    86 
       
    87 Q_DECLARE_METATYPE(ProfileDataValue)
       
    88 Q_DECLARE_METATYPE(QList<ProfileDataValue>)
       
    89 
       
    90 #endif
       
    91 
       
    92 QT_BEGIN_HEADER
       
    93 
       
    94 QT_BEGIN_NAMESPACE
       
    95 class QStringList;
       
    96 class QTimer;
       
    97 QT_END_NAMESPACE
       
    98 
       
    99 QTM_BEGIN_NAMESPACE
       
   100 
       
   101 class QSystemNetworkInfo;
       
   102 class QSystemInfoPrivate : public QSystemInfoLinuxCommonPrivate
       
   103 {
       
   104     Q_OBJECT
       
   105 
       
   106 public:
       
   107 
       
   108     QSystemInfoPrivate(QSystemInfoLinuxCommonPrivate *parent = 0);
       
   109     virtual ~QSystemInfoPrivate();
       
   110     QStringList availableLanguages() const;
       
   111     QString version(QSystemInfo::Version,  const QString &parameter = QString());
       
   112 
       
   113     bool hasFeatureSupported(QSystemInfo::Feature feature);
       
   114 };
       
   115 
       
   116 class QNetworkManagerInterface;
       
   117 class QNetworkManagerInterfaceDeviceWired;
       
   118 class QNetworkManagerInterfaceDeviceWireless;
       
   119 class QNetworkManagerInterfaceAccessPoint;
       
   120 
       
   121 class QSystemNetworkInfoPrivate : public QSystemNetworkInfoLinuxCommonPrivate
       
   122 {
       
   123     Q_OBJECT
       
   124 
       
   125 public:
       
   126 
       
   127     QSystemNetworkInfoPrivate(QSystemNetworkInfoLinuxCommonPrivate *parent = 0);
       
   128     virtual ~QSystemNetworkInfoPrivate();
       
   129 
       
   130     QSystemNetworkInfo::NetworkStatus networkStatus(QSystemNetworkInfo::NetworkMode mode);
       
   131     qint32 networkSignalStrength(QSystemNetworkInfo::NetworkMode mode);
       
   132     int cellId();
       
   133     int locationAreaCode();
       
   134 
       
   135     QString currentMobileCountryCode();
       
   136     QString currentMobileNetworkCode();
       
   137     QString homeMobileCountryCode();
       
   138     QString homeMobileNetworkCode();
       
   139 
       
   140     QString networkName(QSystemNetworkInfo::NetworkMode mode);
       
   141     QString macAddress(QSystemNetworkInfo::NetworkMode mode);
       
   142 
       
   143     QNetworkInterface interfaceForMode(QSystemNetworkInfo::NetworkMode mode);
       
   144     QSystemNetworkInfo::NetworkMode currentMode();
       
   145     void setWlanSignalStrengthCheckEnabled(bool enabled);
       
   146 
       
   147 protected:
       
   148     void setupNetworkInfo();
       
   149 
       
   150 private Q_SLOTS:
       
   151     void bluetoothNetworkStatusCheck();
       
   152 #if defined(Q_WS_MAEMO_6)
       
   153     // Slots only available in Maemo6
       
   154     void slotSignalStrengthChanged(int percent, int dbm);
       
   155     void slotOperatorChanged(const QString &mnc, const QString &mcc);
       
   156     void slotOperatorNameChanged(const QString &name);
       
   157     void slotRegistrationChanged(const QString &status);
       
   158     void slotCellChanged(const QString &type, int id, int lac);
       
   159 #endif
       
   160 
       
   161 #if defined(Q_WS_MAEMO_5)
       
   162     // Slots only available in Maemo5
       
   163     void cellNetworkSignalStrengthChanged(uchar,uchar);
       
   164     void icdStatusChanged(QString,QString,QString,QString);
       
   165     void networkModeChanged(int);
       
   166     void operatorNameChanged(uchar,QString,QString,uint,uint);
       
   167     void registrationStatusChanged(uchar,ushort,uint,uint,uint,uchar,uchar);
       
   168 #endif
       
   169     void usbCableAction();
       
   170     void wlanSignalStrengthCheck();
       
   171 
       
   172 private:
       
   173     // The index of wanted argument in the QDBusMessage which is received as a
       
   174     // reply to the sent get_registration_status message via interface Phone.Net
       
   175 
       
   176     enum {                // In the received QDBusMessage..
       
   177         STATUS_INDEX = 0, // the original type of status argument is byte
       
   178         LAC_INDEX,        // the original type of lac argument is uint16
       
   179         CELLID_INDEX,     // the original type of cellId argument is uint32
       
   180         MNC_INDEX,        // the original type of mnc argument is uint32
       
   181         MCC_INDEX         // the original type of mcc argument is uint32
       
   182     };
       
   183 
       
   184     int cellSignalStrength;
       
   185     QSystemNetworkInfo::NetworkStatus currentBluetoothNetworkStatus;
       
   186     int currentCellId;
       
   187     int currentCellNetworkStatus;
       
   188     int currentEthernetSignalStrength;
       
   189     int currentLac;
       
   190     QString currentEthernetState;
       
   191     QString currentMCC;
       
   192     QString currentMNC;
       
   193     QString currentOperatorName;
       
   194     int currentWlanSignalStrength;
       
   195     int radioAccessTechnology;
       
   196     int iWlanStrengthCheckEnabled;
       
   197     QTimer *wlanSignalStrengthTimer;
       
   198 
       
   199     QMap<QString,int> csStatusMaemo6;
       
   200 };
       
   201 
       
   202 class QSystemDisplayInfoPrivate : public QSystemDisplayInfoLinuxCommonPrivate
       
   203 {
       
   204     Q_OBJECT
       
   205 
       
   206 public:
       
   207 
       
   208     QSystemDisplayInfoPrivate(QSystemDisplayInfoLinuxCommonPrivate *parent = 0);
       
   209     virtual ~QSystemDisplayInfoPrivate();
       
   210 
       
   211     int displayBrightness(int screen);
       
   212 };
       
   213 
       
   214 class QSystemStorageInfoPrivate : public QSystemStorageInfoLinuxCommonPrivate
       
   215 {
       
   216     Q_OBJECT
       
   217 
       
   218 public:
       
   219 
       
   220     QSystemStorageInfoPrivate(QSystemStorageInfoLinuxCommonPrivate *parent = 0);
       
   221     virtual ~QSystemStorageInfoPrivate();
       
   222 
       
   223 };
       
   224 
       
   225 class QSystemDeviceInfoPrivate : public QSystemDeviceInfoLinuxCommonPrivate
       
   226 {
       
   227     Q_OBJECT
       
   228 
       
   229 public:
       
   230 
       
   231     QSystemDeviceInfoPrivate(QSystemDeviceInfoLinuxCommonPrivate *parent = 0);
       
   232     ~QSystemDeviceInfoPrivate();
       
   233 
       
   234     QString imei();
       
   235     QString imsi();
       
   236     QSystemDeviceInfo::SimStatus simStatus();
       
   237     bool isDeviceLocked();
       
   238     QSystemDeviceInfo::Profile currentProfile();
       
   239     QSystemDeviceInfo::PowerState currentPowerState();
       
   240 
       
   241 protected:
       
   242 #if !defined(QT_NO_DBUS)
       
   243     QHalInterface *halIface;
       
   244     QHalDeviceInterface *halIfaceDevice;
       
   245     void setupBluetooth();
       
   246     void setupProfile();
       
   247 
       
   248 private Q_SLOTS:
       
   249     void halChanged(int,QVariantList);
       
   250     void bluezPropertyChanged(const QString&, QDBusVariant);
       
   251     void deviceModeChanged(QString newMode);
       
   252     void profileChanged(bool changed, bool active, QString profile, QList<ProfileDataValue> values);
       
   253 
       
   254 private:
       
   255     bool flightMode;
       
   256     QString profileName;
       
   257     bool silentProfile;
       
   258     bool vibratingAlertEnabled;
       
   259     int ringingAlertVolume;
       
   260 
       
   261     QSystemDeviceInfo::PowerState previousPowerState;
       
   262 #endif
       
   263 };
       
   264 
       
   265 
       
   266 class QSystemScreenSaverPrivate : public QSystemScreenSaverLinuxCommonPrivate
       
   267 {
       
   268     Q_OBJECT
       
   269 
       
   270 public:
       
   271     QSystemScreenSaverPrivate(QObject *parent = 0);
       
   272     ~QSystemScreenSaverPrivate();
       
   273 
       
   274     bool screenSaverInhibited();
       
   275     bool setScreenSaverInhibit();
       
   276 
       
   277 private Q_SLOTS:
       
   278     void wakeUpDisplay();
       
   279 
       
   280 private:
       
   281     QTimer *ssTimer;
       
   282 #if !defined(QT_NO_DBUS)
       
   283     QDBusInterface *mceConnectionInterface;
       
   284 #endif
       
   285 };
       
   286 
       
   287 QTM_END_NAMESPACE
       
   288 
       
   289 QT_END_HEADER
       
   290 
       
   291 #endif /*QSYSTEMINFO_MAEMO_P_H*/
       
   292 
       
   293 // End of file
       
   294