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>
26 #include <QtCore/QDebug>
28 #include "ofonomodeminterface.h"
29 #include "ofonomodem.h"
30 #include "ofonointerface.h"
32 OfonoModemInterface::OfonoModemInterface(OfonoModem::SelectionSetting modemSetting, const QString& modemPath, const QString& ifname, OfonoGetPropertySetting propertySetting, QObject *parent)
36 m_m = new OfonoModem(modemSetting, modemPath, this);
37 connect(m_m, SIGNAL(validityChanged(bool)), this, SLOT(modemValidityChanged(bool)));
38 connect(m_m, SIGNAL(interfacesChanged(QStringList)), this, SLOT(interfacesChanged(QStringList)));
40 m_if = new OfonoInterface(m_m->path(), ifname, propertySetting, this);
41 connect(m_m, SIGNAL(pathChanged(QString)), m_if, SLOT(setPath(const QString&)));
42 m_isValid = checkValidity();
45 OfonoModemInterface::~OfonoModemInterface()
49 bool OfonoModemInterface::isValid() const
54 OfonoModem* OfonoModemInterface::modem() const
59 bool OfonoModemInterface::checkValidity()
61 return (m_m->isValid() && m_m->interfaces().contains(m_if->ifname()));
64 void OfonoModemInterface::updateValidity()
66 if (isValid() != checkValidity()) {
67 m_isValid = checkValidity();
68 emit validityChanged(isValid());
72 void OfonoModemInterface::modemValidityChanged(bool /*validity*/)
77 void OfonoModemInterface::interfacesChanged(const QStringList& /*interfaces*/)
82 QString OfonoModemInterface::path() const
87 QString OfonoModemInterface::errorName() const
89 return m_if->errorName();
92 QString OfonoModemInterface::errorMessage() const
94 return m_if->errorMessage();