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 #include <QtDBus/QtDBus>
25 #include <QtCore/QObject>
27 #include "ofonomodeminterface.h"
28 #include "ofonomodem.h"
29 #include "ofonointerface.h"
31 OfonoModemInterface::OfonoModemInterface(OfonoModem::SelectionSetting modemSetting, const QString& modemPath, const QString& ifname, OfonoGetPropertySetting propertySetting, QObject *parent)
35 m_m = new OfonoModem(modemSetting, modemPath, this);
36 connect(m_m, SIGNAL(validityChanged(bool)), this, SLOT(modemValidityChanged(bool)));
37 connect(m_m, SIGNAL(interfacesChanged(QStringList)), this, SLOT(interfacesChanged(QStringList)));
39 m_if = new OfonoInterface(m_m->path(), ifname, propertySetting, this);
40 connect(m_m, SIGNAL(pathChanged(QString)), m_if, SLOT(setPath(const QString&)));
41 m_isValid = checkValidity();
44 OfonoModemInterface::~OfonoModemInterface()
48 bool OfonoModemInterface::isValid() const
53 OfonoModem* OfonoModemInterface::modem() const
58 bool OfonoModemInterface::checkValidity()
60 return (m_m->isValid() && m_m->interfaces().contains(m_if->ifname()));
63 void OfonoModemInterface::updateValidity()
65 if (isValid() != checkValidity()) {
66 m_isValid = checkValidity();
67 emit validityChanged(isValid());
71 void OfonoModemInterface::modemValidityChanged(bool /*validity*/)
76 void OfonoModemInterface::interfacesChanged(const QStringList& /*interfaces*/)
81 QString OfonoModemInterface::path() const
86 QString OfonoModemInterface::errorName() const
88 return m_if->errorName();
91 QString OfonoModemInterface::errorMessage() const
93 return m_if->errorMessage();