Fix copyright notices
[profile/ivi/ofono-qt.git] / lib / ofonointerface.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 OFONOINTERFACE_H
25 #define OFONOINTERFACE_H
26
27 #include <QtCore/QObject>
28 #include <QVariant>
29 #include <QDBusVariant>
30 #include <QDBusError>
31 #include "libofono-qt_global.h"
32
33 class OFONO_QT_EXPORT OfonoInterface : public QObject
34 {
35     Q_OBJECT
36 public:
37     enum GetPropertySetting {
38         GetAllOnStartup,
39         GetAllOnFirstRequest
40     };
41
42     OfonoInterface(const QString& path, const QString& ifname, GetPropertySetting setting, QObject *parent=0);
43     ~OfonoInterface();
44
45     QVariantMap properties() const;
46     void requestProperty(const QString& name);
47     void setProperty(const QString& name, const QVariant& property);
48     void resetProperties();
49     
50     QString path() const {return m_path;}
51     
52     QString ifname() const {return m_ifname;}
53     QString errorName() const {return m_errorName;}
54     QString errorMessage() const {return m_errorMessage;}
55
56 signals:
57     void propertyChanged(const QString& name, const QVariant& property);
58     void requestPropertyComplete(bool success, const QString& name, const QVariant& property);
59     void setPropertyFailed(const QString& name);
60
61 private slots:
62     void onPropertyChanged(QString property, QDBusVariant value);
63     void getPropertiesAsyncResp(QVariantMap properties);
64     void getPropertiesAsyncErr(const QDBusError&);
65     void setPropertyResp();
66     void setPropertyErr(const QDBusError& error);
67 protected slots:
68     void setPath(const QString& path);
69 private:
70     QVariantMap getAllPropertiesSync();
71     
72 protected:
73    QString m_errorName;
74    QString m_errorMessage;
75     
76 private:
77    QString m_path;
78    QString m_ifname;
79    QVariantMap m_properties;
80    QString m_pendingProperty;
81    GetPropertySetting m_getpropsetting;
82 };
83
84 #endif