Qt bindings for oFono cellular services  1.30
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 <alex.kanavin@gmail.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 "ofonopropertysetting.h"
32 #include "libofono-qt_global.h"
33 
35 
40 class OFONO_QT_EXPORT OfonoInterface : public QObject
41 {
42  Q_OBJECT
43 public:
44 
50  OfonoInterface(const QString &path, const QString &ifname, OfonoGetPropertySetting setting, QObject *parent=0);
51  ~OfonoInterface();
52 
54 
59  QVariantMap properties() const;
60 
62 
65  void requestProperty(const QString &name);
66 
68 
72  void setProperty(const QString &name, const QVariant &property, const QString& password=0);
73 
75  void resetProperties();
76 
78  QString path() const {return m_path;}
79 
81  QString ifname() const {return m_ifname;}
82 
84 
88  QString errorName() const {return m_errorName;}
89 
91 
95  QString errorMessage() const {return m_errorMessage;}
96 
97 public Q_SLOTS:
99 
104  void setPath(const QString &path);
105 
107  void setError(const QString &errorName, const QString &errorMessage);
108 
109 Q_SIGNALS:
111 
115  void propertyChanged(const QString &name, const QVariant &property);
116 
118 
123  void requestPropertyComplete(bool success, const QString &name, const QVariant &property);
124 
126 
129  void setPropertyFailed(const QString &name);
130 
131 private Q_SLOTS:
132  void onPropertyChanged(QString property, QDBusVariant value);
133  void getPropertiesAsyncResp(QVariantMap properties);
134  void getPropertiesAsyncErr(const QDBusError&);
135  void setPropertyResp();
136  void setPropertyErr(const QDBusError& error);
137 protected Q_SLOTS:
138 private:
139  QVariantMap getAllPropertiesSync();
140 
141 protected:
142  QString m_errorName;
143  QString m_errorMessage;
144 
145 private:
146  QString m_path;
147  QString m_ifname;
148  QVariantMap m_properties;
149  QString m_pendingProperty;
150  OfonoGetPropertySetting m_getpropsetting;
151 };
152 
153 #endif