Qt bindings for oFono cellular services  1.30
ofonoconnman.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 <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 OFONOCONNMAN_H
25 #define OFONOCONNMAN_H
26 
27 #include <QtCore/QObject>
28 #include <QStringList>
29 #include <QDBusError>
30 #include <QDBusObjectPath>
31 #include "ofonomodeminterface.h"
32 #include "libofono-qt_global.h"
33 
35  QDBusObjectPath path;
36  QVariantMap properties;
37 };
38 typedef QList<OfonoConnmanStruct> OfonoConnmanList;
39 Q_DECLARE_METATYPE(OfonoConnmanStruct)
40 Q_DECLARE_METATYPE(OfonoConnmanList)
41 
42 
47 class OFONO_QT_EXPORT OfonoConnMan : public OfonoModemInterface
48 {
49  Q_OBJECT
50 
51  Q_PROPERTY(bool attached READ attached NOTIFY attachedChanged)
52  Q_PROPERTY(QString bearer READ bearer NOTIFY bearerChanged)
53  Q_PROPERTY(bool suspended READ suspended NOTIFY suspendedChanged)
54  Q_PROPERTY(bool roamingAllowed READ roamingAllowed WRITE setRoamingAllowed NOTIFY roamingAllowedChanged)
55  Q_PROPERTY(bool powered READ powered WRITE setPowered NOTIFY poweredChanged)
56 
57 public:
58  OfonoConnMan(OfonoModem::SelectionSetting modemSetting, const QString &modemPath, QObject *parent=0);
59  ~OfonoConnMan();
60 
61  Q_INVOKABLE QStringList getContexts();
62 
63  /* Properties */
64  bool attached() const;
65  QString bearer() const;
66  bool suspended() const;
67  bool roamingAllowed() const;
68  bool powered() const;
69 
70 public Q_SLOTS:
71  void setPowered(const bool);
72  void setRoamingAllowed(const bool);
73  void deactivateAll();
74  QDBusObjectPath addContext(const QString& type, bool &success);
75  void removeContext(const QString& path);
76 
77 Q_SIGNALS:
78  void attachedChanged(const bool value);
79  void bearerChanged(const QString &bearer);
80  void suspendedChanged(const bool suspnd);
81  void roamingAllowedChanged(const bool roaming);
82  void poweredChanged(const bool powrd);
83  void contextAdded(const QString& path);
84  void contextRemoved(const QString& path);
85 
86  void deactivateAllComplete(bool success);
87  void addContextComplete(bool success, const QString& path);
88  void removeContextComplete(bool success);
89 
90  void setPoweredFailed();
91  void setRoamingAllowedFailed();
92 
93 private Q_SLOTS:
94  void validityChanged(bool);
95  void pathChanged(const QString& path);
96  void propertyChanged(const QString& property, const QVariant& value);
97  void contextAddedChanged(const QDBusObjectPath &path, const QVariantMap &properties);
98  void contextRemovedChanged(const QDBusObjectPath &path);
99  void deactivateAllResp();
100  void deactivateAllErr(const QDBusError& error);
101  void addContextResp(const QDBusObjectPath &path);
102  void addContextErr(const QDBusError& error);
103  void removeContextResp();
104  void removeContextErr(const QDBusError& error);
105  void setPropertyFailed(const QString& property);
106 private:
107  QStringList getContextList();
108  void connectDbusSignals(const QString& path);
109 private:
110  QStringList m_contextlist;
111 };
112 
113 #endif /* !OFONOCONNMAN_H */
This class implements a generic modem interface object.
Definition: ofonomodeminterface.h:41
Definition: ofonoconnman.h:34
This class is used to access oFono connman API.
Definition: ofonoconnman.h:47
SelectionSetting
How the modem object should select a modem.
Definition: ofonomodem.h:68