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
24 #ifndef OFONOMODEMINTERFACE_H
25 #define OFONOMODEMINTERFACE_H
27 #include <QtCore/QObject>
28 #include <QStringList>
29 #include "ofonomodem.h"
30 #include "ofonopropertysetting.h"
31 #include "libofono-qt_global.h"
35 //! This class implements a generic modem interface object
37 * It provides validity checking and modem binding.
38 * It should not be instantiated directly; instead you should instantiate
39 * interface-specific subclasses.
41 class OFONO_QT_EXPORT OfonoModemInterface : public QObject
45 Q_PROPERTY(bool isValid READ isValid NOTIFY validityChanged)
46 Q_PROPERTY(QString path READ path)
47 Q_PROPERTY(QString errorName READ errorName)
48 Q_PROPERTY(QString errorMessage READ errorMessage)
52 //! Construct a modem interface object
54 * \param modemSetting modem selection setting
55 * \param modemPath path to the modem (may not be significant, depending on modemSetting)
56 * \param ifname d-bus interface name
57 * \param propertySetting oFono d-bus properties setting
59 OfonoModemInterface(OfonoModem::SelectionSetting modemSetting, const QString& modemPath, const QString& ifname, OfonoGetPropertySetting propertySetting, QObject *parent=0);
60 ~OfonoModemInterface();
62 //! Check that the modem interface object is valid
64 * This means that a modem d-bus object
65 * exists and has the d-bus interface specified in the contstructor.
69 //! Get the modem object that this interface belongs to.
71 * The ownership of the modem object stays with the OfonoModemInterface object.
73 OfonoModem *modem() const;
75 //! Returns the D-Bus object path of the interface
78 //! Get the D-Bus error name of the last operation.
80 * Returns the D-Bus error name of the last operation (setting a property
81 * or calling a method) if it has failed
83 QString errorName() const;
85 //! Get the D-Bus error message of the last operation.
87 * Returns the D-Bus error message of the last operation (setting a property
88 * or calling a method) if it has failed
90 QString errorMessage() const;
93 //! Interface validity has changed
95 * This may mean that modem has become unavailable
96 * (or available again) or that the modem interface has become unavailable
97 * (or available again)
99 void validityChanged(bool validity);
102 bool checkValidity();
103 void updateValidity();
106 void modemValidityChanged(bool validity);
107 void interfacesChanged(const QStringList &interfaces);
110 OfonoInterface *m_if;