Remove unnecessary includes
[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 "ofonointerface.h"
30 #include "libofono-qt_global.h"
31
32 class OfonoModemManager;
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 OfonoInterface 
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 modemPath() const;
71
72     bool powered() const;
73     void setPowered(bool powered);
74     bool online() const;
75     void setOnline(bool online);
76     bool emergency() const;
77     
78     QString name() const;
79     QString manufacturer() const;
80     QString model() const;
81     QString revision() const;
82     QString serial() const;
83     
84     QStringList features() const;
85     QStringList interfaces() const;
86
87 signals:
88     //! Issued when a modem becomes unavailable or available again
89     void validityChanged(bool validity);
90     //! Issued when the object has switched to another modem
91     void modemPathChanged(QString modemPath);
92     
93     void poweredChanged(bool powered);
94     void setPoweredFailed();
95     void onlineChanged(bool online);
96     void setOnlineFailed();
97     void emergencyChanged(bool emergency);
98
99     void nameChanged(const QString &name);
100     void manufacturerChanged(const QString &manufacturer);
101     void modelChanged(const QString &model);
102     void revisionChanged(const QString &revision);
103     void serialChanged(const QString &serial);
104
105     void featuresChanged(const QStringList &features);
106     void interfacesChanged(const QStringList &interfaces);
107
108
109 private slots:
110     void propertyChanged(const QString &property, const QVariant &value);
111     void setPropertyFailed(const QString& property);
112     void modemAdded(const QString &modem);
113     void modemRemoved(const QString &modem);
114
115 private:
116     void modemsChanged();
117
118 private:
119     OfonoModemManager *m_mm;
120     SelectionSetting m_selectionSetting;
121     bool m_isValid;
122 };
123 #endif