73ef0716d05c2cac943961f88610dfcab9071942
[profile/ivi/ofono-qt.git] / lib / ofonoconnmancontext.h
1 /*
2  * This file is part of ofono-qt
3  *
4  * Copyright (C) 2011 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 #ifndef OFONOCONNMANCONTEXT_H
24 #define OFONOCONNMANCONTEXT_H
25
26 #include <QtCore/QObject>
27 #include <QVariant>
28 #include <QStringList>
29 #include <QDBusError>
30
31 #include "libofono-qt_global.h"
32
33 class OfonoInterface;
34
35 //! This class is used to access oFono connman context API
36 /*!
37  * The API is documented in
38  * http://git.kernel.org/?p=network/ofono/ofono.git;a=blob;f=doc/connman-api.txt
39  */
40 class OFONO_QT_EXPORT OfonoConnmanContext : public QObject
41 {
42     Q_OBJECT
43
44     Q_PROPERTY(QString path READ path)
45     Q_PROPERTY(QString errorName READ errorName)
46     Q_PROPERTY(QString errorMessage READ errorMessage)
47     
48     Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
49     Q_PROPERTY(QString accessPointName READ accessPointName WRITE setAccessPointName NOTIFY accessPointNameChanged)
50     Q_PROPERTY(QString type READ type WRITE setType NOTIFY nameChanged)
51     Q_PROPERTY(QString username READ username WRITE setUsername NOTIFY usernameChanged)
52     Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged)
53     Q_PROPERTY(QString protocol READ protocol WRITE setProtocol NOTIFY protocolChanged)
54     Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
55     Q_PROPERTY(QString messageProxy READ messageProxy WRITE setMessageProxy NOTIFY messageProxyChanged)
56     Q_PROPERTY(QString messageCenter READ messageCenter WRITE setMessageCenter NOTIFY messageCenterChanged)
57     Q_PROPERTY(QVariantMap settings READ settings NOTIFY settingsChanged)
58     Q_PROPERTY(QVariantMap IPv6Settings READ IPv6Settings NOTIFY IPv6SettingsChanged)
59         
60 public:
61     OfonoConnmanContext(const QString &contextPath, QObject *parent=0);
62     OfonoConnmanContext(const OfonoConnmanContext &op);
63     ~OfonoConnmanContext();
64
65     OfonoConnmanContext operator=(const OfonoConnmanContext &op);
66     bool operator==(const OfonoConnmanContext &op);
67
68     //! Returns the D-Bus object path of the voice call object
69     QString path() const;
70
71     //! Get the D-Bus error name of the last operation.
72     /*!
73      * Returns the D-Bus error name of the last operation (setting a property
74      * or calling a method) if it has failed
75      */
76     QString errorName() const;
77
78     //! Get the D-Bus error message of the last operation.
79     /*!
80      * Returns the D-Bus error message of the last operation (setting a property
81      * or calling a method) if it has failed
82      */
83     QString errorMessage() const;
84     /* Properties for context*/
85
86     bool active() const;
87     QString accessPointName() const;
88     QString type() const;
89     QString username() const;
90     QString password() const;
91     QString protocol() const;
92     QString name() const;
93     QString messageProxy() const;
94     QString messageCenter() const;
95     QVariantMap settings() const;
96     QVariantMap IPv6Settings() const;
97
98     void setActive(const bool);
99     void setAccessPointName(const QString&);
100     void setType(const QString&);
101     void setUsername(const QString&);
102     void setPassword(const QString&);
103     void setProtocol(const QString&);
104     void setName(const QString&);
105     void setMessageProxy(const QString&);
106     void setMessageCenter(const QString&);
107
108 signals:
109     void activeChanged(const bool);
110     void accessPointNameChanged(const QString &apn);
111     void nameChanged(const QString &name);
112     void typeChanged(const QString &type);
113     void userNameChanged(const QString &uname);
114     void passwordChanged(const QString &pw);
115     void protocolChanged(const QString &proto);
116     void messageProxyChanged(const QString &proxy);
117     void messageCenterChanged(const QString &msc);
118
119     void setActiveFailed();
120     void setAccessPointNameFailed();
121     void setTypeFailed();
122     void setUsernameFailed();
123     void setPasswordFailed();
124     void setProtocolFailed();
125     void setNameFailed();
126     void setMessageProxyFailed();
127     void setMessageCenterFailed();
128
129     /* Settings change notification*/
130     void settingsChanged(const QVariantMap&);
131     void IPv6SettingsChanged(const QVariantMap&);
132
133 private slots:
134     void propertyChanged(const QString &property, const QVariant &value);
135     void setPropertyFailed(const QString& property);
136
137 private:
138     OfonoInterface *m_if;
139
140 };
141
142 #endif //OFONOCONNMANCONTEXT_H