Adding CallVolume interface support in ofono-qt Bindings Signed-off-by: Arun Ravindra...
[profile/ivi/ofono-qt.git] / lib / ofonomodem.h
1 /*
2  * This file is part of ofono-qt
3  *
4  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5  *
6  * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * version 2.1 as published by the Free Software Foundation.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  *
22  */
23  
24
25 #ifndef OFONOMODEM_H
26 #define OFONOMODEM_H
27
28 #include <QtCore/QObject>
29 #include "libofono-qt_global.h"
30
31 class OfonoModemManager;
32 class OfonoInterface;
33
34 //! This class is used to access an oFono modem object and its properties
35 /*!
36  * oFono modem properties are documented in
37  * http://git.kernel.org/?p=network/ofono/ofono.git;a=blob_plain;f=doc/modem-api.txt
38  */
39 class OFONO_QT_EXPORT OfonoModem : public QObject 
40 {
41
42 Q_OBJECT
43
44 public:
45
46     //! How the modem object should select a modem
47     enum SelectionSetting {
48         AutomaticSelect,        /*!< Select the first available modem automatically;
49                                  * if that modem becomes unavailable, select the first available
50                                  * modem again. */
51         ManualSelect    /*!< Do not select a modem automatically,
52                          * use the modem path provided in the constructor, and do not
53                          * attempt to select another modem if the first one becomes 
54                          * unavailable. */
55     };
56
57     /*!
58      * \param setting sets the modem selection policy for the object
59      * \param modemPath if modem selection policy is ManualSelect, then this contains
60      * the D-Bus path to the modem object. Otherwise, it is ignored.
61      */
62     OfonoModem(SelectionSetting setting, const QString& modemPath, QObject *parent=0);
63
64     ~OfonoModem();
65
66     //! Returns true if D-Bus modem object exists.
67     bool isValid() const;
68     
69     //! Returns the D-Bus object path of the modem
70     QString path() const;
71     
72     //! Get the D-Bus error name of the last operation.
73     /*!
74      * Returns the D-Bus error name of the last operation (setting a property
75      * or calling a method) if it has failed
76      */
77     QString errorName() const;
78
79     //! Get the D-Bus error message of the last operation.
80     /*!
81      * Returns the D-Bus error message of the last operation (setting a property
82      * or calling a method) if it has failed
83      */
84     QString errorMessage() const;
85
86     bool powered() const;
87     void setPowered(bool powered);
88     bool online() const;
89     void setOnline(bool online);
90     bool emergency() const;
91     
92     QString name() const;
93     QString manufacturer() const;
94     QString model() const;
95     QString revision() const;
96     QString serial() const;
97     
98     QStringList features() const;
99     QStringList interfaces() const;
100
101 signals:
102     //! Issued when a modem becomes unavailable or available again
103     void validityChanged(bool validity);
104     //! Issued when the object has switched to another modem
105     void pathChanged(QString modemPath);
106     
107     void poweredChanged(bool powered);
108     void setPoweredFailed();
109     void onlineChanged(bool online);
110     void setOnlineFailed();
111     void emergencyChanged(bool emergency);
112
113     void nameChanged(const QString &name);
114     void manufacturerChanged(const QString &manufacturer);
115     void modelChanged(const QString &model);
116     void revisionChanged(const QString &revision);
117     void serialChanged(const QString &serial);
118
119     void featuresChanged(const QStringList &features);
120     void interfacesChanged(const QStringList &interfaces);
121
122
123 private slots:
124     void propertyChanged(const QString &property, const QVariant &value);
125     void setPropertyFailed(const QString& property);
126     void modemAdded(const QString &modem);
127     void modemRemoved(const QString &modem);
128
129 private:
130     void modemsChanged();
131
132 private:
133     OfonoModemManager *m_mm;
134     OfonoInterface *m_if;
135     SelectionSetting m_selectionSetting;
136     bool m_isValid;
137 };
138 #endif