src/plugins/bearer/connman/qofonoservice_linux_p.h
changeset 37 758a864f9613
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
       
     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 plugins of the Qt Toolkit.
       
     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 
       
    42 #ifndef QOFONOSERVICE_H
       
    43 #define QOFONOSERVICE_H
       
    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 #include <QtDBus/QtDBus>
       
    57 #include <QtDBus/QDBusConnection>
       
    58 #include <QtDBus/QDBusError>
       
    59 #include <QtDBus/QDBusInterface>
       
    60 #include <QtDBus/QDBusMessage>
       
    61 #include <QtDBus/QDBusReply>
       
    62 
       
    63 #include <QtDBus/QDBusPendingCallWatcher>
       
    64 #include <QtDBus/QDBusObjectPath>
       
    65 #include <QtDBus/QDBusContext>
       
    66 #include <QMap>
       
    67 
       
    68 #define OFONO_SERVICE	                         "org.ofono"
       
    69 #define OFONO_MANAGER_INTERFACE                  "org.ofono.Manager"
       
    70 #define OFONO_MANAGER_PATH                       "/"
       
    71 #define OFONO_MODEM_INTERFACE                    "org.ofono.Modem"
       
    72 #define OFONO_NETWORK_REGISTRATION_INTERFACE     "org.ofono.NetworkRegistration"
       
    73 #define OFONO_NETWORK_OPERATOR_INTERFACE         "org.ofono.NetworkOperator"
       
    74 #define OFONO_DATA_CONNECTION_MANAGER_INTERFACE  "org.ofono.DataConnectionManager"
       
    75 #define OFONO_SIM_MANAGER_INTERFACE              "org.ofono.SimManager"
       
    76 #define OFONO_DATA_CONTEXT_INTERFACE             "org.ofono.PrimaryDataContext"
       
    77 
       
    78 #define OFONO_SMS_MANAGER_INTERFACE              "org.ofono.SmsManager"
       
    79 #define OFONO_PHONEBOOK_INTERFACE                "org.ofono.Phonebook"
       
    80 #define OFONO_MESSAGE_WAITING_INTERFACE          "org.ofono.MessageWaiting"
       
    81 
       
    82 
       
    83 
       
    84 QT_BEGIN_NAMESPACE
       
    85 
       
    86 QT_END_NAMESPACE
       
    87 
       
    88 
       
    89 QT_BEGIN_NAMESPACE
       
    90 
       
    91 class QOfonoManagerInterface : public  QDBusAbstractInterface
       
    92 {
       
    93     Q_OBJECT
       
    94 
       
    95 public:
       
    96 
       
    97     QOfonoManagerInterface( QObject *parent = 0);
       
    98     ~QOfonoManagerInterface();
       
    99 
       
   100      QDBusObjectPath path() const;
       
   101 
       
   102     QVariantMap getProperties();
       
   103     bool setProperty(const QString &name, const QDBusVariant &value);
       
   104     QList <QDBusObjectPath> getModems();
       
   105     QDBusObjectPath currentModem();
       
   106 
       
   107 Q_SIGNALS:
       
   108     void propertyChanged(const QString &, const QDBusVariant &value);
       
   109     void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
       
   110 protected:
       
   111     void connectNotify(const char *signal);
       
   112     void disconnectNotify(const char *signal);
       
   113     QVariant getProperty(const QString &);
       
   114 
       
   115 };
       
   116 
       
   117 
       
   118 class QOfonoDBusHelper: public QObject, protected QDBusContext
       
   119  {
       
   120      Q_OBJECT
       
   121  public:
       
   122     QOfonoDBusHelper(QObject *parent = 0);
       
   123     ~QOfonoDBusHelper();
       
   124 
       
   125  public slots:
       
   126     void propertyChanged(const QString &, const QDBusVariant &);
       
   127  Q_SIGNALS:
       
   128     void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
       
   129 };
       
   130 
       
   131 class QOfonoModemInterface : public QDBusAbstractInterface
       
   132 {
       
   133     Q_OBJECT
       
   134 
       
   135 public:
       
   136 
       
   137     QOfonoModemInterface(const QString &dbusModemPathName, QObject *parent = 0);
       
   138     ~QOfonoModemInterface();
       
   139 
       
   140     QVariantMap getProperties();
       
   141     //properties
       
   142     bool isPowered();
       
   143     bool isOnline();
       
   144     QString getName();
       
   145     QString getManufacturer();
       
   146     QString getModel();
       
   147     QString getRevision();
       
   148     QString getSerial();
       
   149 
       
   150     QStringList getFeatures(); //sms, sim
       
   151     QStringList getInterfaces();
       
   152     QString defaultInterface();
       
   153 
       
   154 protected:
       
   155     void connectNotify(const char *signal);
       
   156     void disconnectNotify(const char *signal);
       
   157     QVariant getProperty(const QString &);
       
   158 Q_SIGNALS:
       
   159     void propertyChanged(const QString &, const QDBusVariant &value);
       
   160     void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
       
   161 };
       
   162 
       
   163 
       
   164 class QOfonoNetworkRegistrationInterface : public QDBusAbstractInterface
       
   165 {
       
   166     Q_OBJECT
       
   167 
       
   168 public:
       
   169 
       
   170     QOfonoNetworkRegistrationInterface(const QString &dbusModemPathName, QObject *parent = 0);
       
   171     ~QOfonoNetworkRegistrationInterface();
       
   172 
       
   173     QVariantMap getProperties();
       
   174 
       
   175     //properties
       
   176     QString getStatus();
       
   177     quint16 getLac();
       
   178     quint32 getCellId();
       
   179     QString getTechnology();
       
   180     QString getOperatorName();
       
   181     int getSignalStrength();
       
   182     QString getBaseStation();
       
   183     QList <QDBusObjectPath> getOperators();
       
   184 
       
   185 protected:
       
   186     void connectNotify(const char *signal);
       
   187     void disconnectNotify(const char *signal);
       
   188     QVariant getProperty(const QString &);
       
   189 Q_SIGNALS:
       
   190     void propertyChanged(const QString &, const QDBusVariant &value);
       
   191     void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
       
   192 
       
   193 };
       
   194 
       
   195 class QOfonoNetworkOperatorInterface : public QDBusAbstractInterface
       
   196 {
       
   197     Q_OBJECT
       
   198 
       
   199 public:
       
   200 //modem or operator paths
       
   201     QOfonoNetworkOperatorInterface(const QString &dbusPathName, QObject *parent = 0);
       
   202     ~QOfonoNetworkOperatorInterface();
       
   203 
       
   204     QVariantMap getProperties();
       
   205 
       
   206     //properties
       
   207     QString getName();
       
   208     QString getStatus();// "unknown", "available", "current" and "forbidden"
       
   209     QString getMcc();
       
   210     QString getMnc();
       
   211     QStringList getTechnologies();
       
   212 
       
   213 protected:
       
   214     void connectNotify(const char *signal);
       
   215     void disconnectNotify(const char *signal);
       
   216     QVariant getProperty(const QString &);
       
   217 };
       
   218 
       
   219 class QOfonoSimInterface : public QDBusAbstractInterface
       
   220 {
       
   221     Q_OBJECT
       
   222 
       
   223 public:
       
   224 
       
   225     QOfonoSimInterface(const QString &dbusModemPathName, QObject *parent = 0);
       
   226     ~QOfonoSimInterface();
       
   227 
       
   228     QVariantMap getProperties();
       
   229 
       
   230     //properties
       
   231     bool isPresent();
       
   232     QString getHomeMcc();
       
   233     QString getHomeMnc();
       
   234 //    QStringList subscriberNumbers();
       
   235 //    QMap<QString,QString> serviceNumbers();
       
   236     QString pinRequired();
       
   237     QString lockedPins();
       
   238     QString cardIdentifier();
       
   239 
       
   240 protected:
       
   241     void connectNotify(const char *signal);
       
   242     void disconnectNotify(const char *signal);
       
   243     QVariant getProperty(const QString &);
       
   244 };
       
   245 
       
   246 
       
   247 class QOfonoDataConnectionManagerInterface : public QDBusAbstractInterface
       
   248 {
       
   249     Q_OBJECT
       
   250 
       
   251 public:
       
   252 
       
   253     QOfonoDataConnectionManagerInterface(const QString &dbusPathName, QObject *parent = 0);
       
   254     ~QOfonoDataConnectionManagerInterface();
       
   255 
       
   256     QVariantMap getProperties();
       
   257 
       
   258     //properties
       
   259     QList<QDBusObjectPath> getPrimaryContexts();
       
   260     bool isAttached();
       
   261     bool isRoamingAllowed();
       
   262     bool isPowered();
       
   263 
       
   264     bool setPower(bool on);
       
   265 
       
   266 protected:
       
   267     void connectNotify(const char *signal);
       
   268     void disconnectNotify(const char *signal);
       
   269     QVariant getProperty(const QString &);
       
   270 };
       
   271 
       
   272 
       
   273 class QOfonoPrimaryDataContextInterface : public QDBusAbstractInterface
       
   274 {
       
   275     Q_OBJECT
       
   276 
       
   277 public:
       
   278 
       
   279     QOfonoPrimaryDataContextInterface(const QString &dbusPathName, QObject *parent = 0);
       
   280     ~QOfonoPrimaryDataContextInterface();
       
   281 
       
   282     QVariantMap getProperties();
       
   283 
       
   284     //properties
       
   285     bool isActive();
       
   286     QString getApName();
       
   287     QString getType();
       
   288     QString getName();
       
   289     QVariantMap getSettings();
       
   290     QString getInterface();
       
   291     QString getAddress();
       
   292 
       
   293     bool setActive(bool on);
       
   294     bool setApn(const QString &name);
       
   295 
       
   296 protected:
       
   297     void connectNotify(const char *signal);
       
   298     void disconnectNotify(const char *signal);
       
   299     QVariant getProperty(const QString &);
       
   300     bool setProp(const QString &, const QVariant &var);
       
   301 };
       
   302 
       
   303 class QOfonoSmsInterface : public QDBusAbstractInterface
       
   304 {
       
   305     Q_OBJECT
       
   306 
       
   307 public:
       
   308 
       
   309     QOfonoSmsInterface(const QString &dbusModemPathName, QObject *parent = 0);
       
   310     ~QOfonoSmsInterface();
       
   311 
       
   312     QVariantMap getProperties();
       
   313     void sendMessage(const QString &to, const QString &message);
       
   314 
       
   315     //properties
       
   316     QString  serviceCenterAddress();
       
   317     bool useDeliveryReports();
       
   318     QString bearer();
       
   319 
       
   320 protected:
       
   321     void connectNotify(const char *signal);
       
   322     void disconnectNotify(const char *signal);
       
   323     QVariant getProperty(const QString &);
       
   324 
       
   325 Q_SIGNALS:
       
   326     void propertyChanged(const QString &, const QDBusVariant &value);
       
   327     void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
       
   328     void immediateMessage(const QString &message, const QVariantMap &info);
       
   329     void incomingMessage(const QString &message, const QVariantMap &info);
       
   330 };
       
   331 
       
   332 #endif //QOFONOSERVICE_H