Add documentation, code cleanups
[profile/ivi/ofono-qt.git] / lib / ofonomodemmanager.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 #ifndef OFONOMODEMMANAGER_H
25 #define OFONOMODEMMANAGER_H
26
27 #include <QtDBus/QtDBus>
28 #include <QtCore/QObject>
29 #include "libofono-qt_global.h"
30
31 struct OfonoModemStruct {
32     QDBusObjectPath path;
33     QVariantMap properties;
34 };
35 typedef QList<OfonoModemStruct> OfonoModemList;
36 Q_DECLARE_METATYPE(OfonoModemStruct)
37 Q_DECLARE_METATYPE(OfonoModemList)
38 // Marshall the ModemStruct data into a D-Bus argument
39 QDBusArgument &operator<<(QDBusArgument &argument, const OfonoModemStruct &modem);
40     
41 // Retrieve the ModemStruct data from the D-Bus argument
42 const QDBusArgument &operator>>(const QDBusArgument &argument, OfonoModemStruct &modem);
43
44 //! Provides access to the list of available modems and changes in that list.
45 class OFONO_QT_EXPORT OfonoModemManager : public QObject {
46
47 Q_OBJECT
48
49 public:
50
51     OfonoModemManager(QObject *parent=0);
52
53     ~OfonoModemManager();
54
55     //! Returns a list of d-bus object paths that represent available modems
56     QStringList modems() const;
57
58 signals:
59     //! Issued when a modem has been added
60     void modemAdded(const QString &modemPath);
61     
62     //! Issued when a modem has been removed
63     void modemRemoved(const QString &modemPath);
64
65 private slots:
66     void onModemAdded(const QDBusObjectPath &path, const QVariantMap &map);
67     void onModemRemoved(const QDBusObjectPath &path);
68
69 private:
70     QStringList m_modems;
71 };
72
73 #endif