2 * This file is part of ofono-qt
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
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.
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.
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
28 #include <QtCore/QObject>
29 #include <QtCore/QStringList>
30 #include "libofono-qt_global.h"
32 class OfonoModemManager;
35 //! This class is used to access an oFono modem object and its properties
37 * oFono modem properties are documented in
38 * http://git.kernel.org/?p=network/ofono/ofono.git;a=blob_plain;f=doc/modem-api.txt
40 class OFONO_QT_EXPORT OfonoModem : public QObject
45 Q_PROPERTY(bool powered READ powered WRITE setPowered NOTIFY poweredChanged)
46 Q_PROPERTY(bool online READ online WRITE setOnline NOTIFY onlineChanged)
47 Q_PROPERTY(bool emergency READ emergency NOTIFY emergencyChanged)
49 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
50 Q_PROPERTY(QString manufacturer READ manufacturer NOTIFY manufacturerChanged)
51 Q_PROPERTY(QString model READ model NOTIFY modelChanged)
52 Q_PROPERTY(QString revision READ revision NOTIFY revisionChanged)
53 Q_PROPERTY(QString serial READ serial NOTIFY serialChanged)
55 Q_PROPERTY(QStringList features READ features NOTIFY featuresChanged)
56 Q_PROPERTY(QStringList interfaces READ interfaces NOTIFY interfacesChanged)
60 //! How the modem object should select a modem
61 enum SelectionSetting {
62 AutomaticSelect, /*!< Select the first available modem automatically;
63 * if that modem becomes unavailable, select the first available
65 ManualSelect /*!< Do not select a modem automatically,
66 * use the modem path provided in the constructor, and do not
67 * attempt to select another modem if the first one becomes
72 * \param setting sets the modem selection policy for the object
73 * \param modemPath if modem selection policy is ManualSelect, then this contains
74 * the D-Bus path to the modem object. Otherwise, it is ignored.
76 OfonoModem(SelectionSetting setting, const QString& modemPath, QObject *parent=0);
80 //! Returns true if D-Bus modem object exists.
83 //! Returns the D-Bus object path of the modem
86 //! Get the D-Bus error name of the last operation.
88 * Returns the D-Bus error name of the last operation (setting a property
89 * or calling a method) if it has failed
91 QString errorName() const;
93 //! Get the D-Bus error message of the last operation.
95 * Returns the D-Bus error message of the last operation (setting a property
96 * or calling a method) if it has failed
98 QString errorMessage() const;
100 bool powered() const;
101 void setPowered(bool powered);
103 void setOnline(bool online);
104 bool emergency() const;
106 QString name() const;
107 QString manufacturer() const;
108 QString model() const;
109 QString revision() const;
110 QString serial() const;
112 QStringList features() const;
113 QStringList interfaces() const;
116 //! Issued when a modem becomes unavailable or available again
117 void validityChanged(bool validity);
118 //! Issued when the object has switched to another modem
119 void pathChanged(QString modemPath);
121 void poweredChanged(bool powered);
122 void setPoweredFailed();
123 void onlineChanged(bool online);
124 void setOnlineFailed();
125 void emergencyChanged(bool emergency);
127 void nameChanged(const QString &name);
128 void manufacturerChanged(const QString &manufacturer);
129 void modelChanged(const QString &model);
130 void revisionChanged(const QString &revision);
131 void serialChanged(const QString &serial);
133 void featuresChanged(const QStringList &features);
134 void interfacesChanged(const QStringList &interfaces);
138 void propertyChanged(const QString &property, const QVariant &value);
139 void setPropertyFailed(const QString& property);
140 void modemAdded(const QString &modem);
141 void modemRemoved(const QString &modem);
144 void modemsChanged();
147 OfonoModemManager *m_mm;
148 OfonoInterface *m_if;
149 SelectionSetting m_selectionSetting;