Adding CallVolume interface support in ofono-qt Bindings Signed-off-by: Arun Ravindra...
[profile/ivi/ofono-qt.git] / lib / ofonomodeminterface.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 #ifndef OFONOMODEMINTERFACE_H
25 #define OFONOMODEMINTERFACE_H
26
27 #include <QtCore/QObject>
28 #include <QStringList>
29 #include "ofonomodem.h"
30 #include "ofonopropertysetting.h"
31 #include "libofono-qt_global.h"
32
33 class OfonoInterface;
34
35 //! This class implements a generic modem interface object
36 /*!
37  * It provides validity checking and modem binding.
38  * It should not be instantiated directly; instead you should instantiate
39  * interface-specific subclasses.
40  */
41 class OFONO_QT_EXPORT OfonoModemInterface : public QObject
42 {
43     Q_OBJECT
44 public:
45
46     //! Construct a modem interface object
47     /*!
48      * \param modemSetting modem selection setting
49      * \param modemPath path to the modem (may not be significant, depending on modemSetting)
50      * \param ifname d-bus interface name
51      * \param propertySetting oFono d-bus properties setting
52      */
53     OfonoModemInterface(OfonoModem::SelectionSetting modemSetting, const QString& modemPath, const QString& ifname, OfonoGetPropertySetting propertySetting, QObject *parent=0);
54     ~OfonoModemInterface();
55
56     //! Check that the modem interface object is valid
57     /*!
58      * This means that a modem d-bus object
59      * exists and has the d-bus interface specified in the contstructor.
60      */
61     bool isValid() const;
62     
63     //! Get the modem object that this interface belongs to.
64     /*!
65      * The ownership of the modem object stays with the OfonoModemInterface object.
66      */
67     OfonoModem *modem() const;
68     
69     //! Returns the D-Bus object path of the interface
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 signals:
87     //! Interface validity has changed
88     /*!
89      * This may mean that modem has become unavailable
90      * (or available again) or that the modem interface has become unavailable
91      * (or available again)
92      */
93     void validityChanged(bool validity);
94
95 private:
96     bool checkValidity();
97     void updateValidity();
98
99 private slots:
100     void modemValidityChanged(bool validity);
101     void interfacesChanged(const QStringList &interfaces);
102
103 protected:
104     OfonoInterface *m_if;
105
106 private:
107     OfonoModem *m_m;
108     bool m_isValid;
109 };
110 #endif