82.1.1
by Gustavo Pichorim Boiko
Expose the emergency numbers via DBus to clients. |
1 |
/**
|
2 |
* Copyright (C) 2013 Canonical, Ltd.
|
|
3 |
*
|
|
4 |
* This program is free software: you can redistribute it and/or modify it under
|
|
5 |
* the terms of the GNU Lesser General Public License version 3, as published by
|
|
6 |
* the Free Software Foundation.
|
|
7 |
*
|
|
8 |
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
9 |
* ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
|
|
10 |
* SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
11 |
* Lesser General Public License for more details.
|
|
12 |
*
|
|
13 |
* You should have received a copy of the GNU Lesser General Public License
|
|
14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15 |
*
|
|
16 |
* Authors: Tiago Salem Herrmann <tiago.herrmann@canonical.com>
|
|
17 |
* Gustavo Pichorim Boiko <gustavo.boiko@gmail.com>
|
|
18 |
*/
|
|
19 |
||
20 |
#ifndef OFONOEMERGENCYMODEIFACE_H
|
|
21 |
#define OFONOEMERGENCYMODEIFACE_H
|
|
22 |
||
23 |
// telepathy-qt
|
|
24 |
#include <TelepathyQt/Constants> |
|
25 |
#include <TelepathyQt/BaseConnection> |
|
26 |
#include <TelepathyQt/AbstractAdaptor> |
|
27 |
#include <TelepathyQt/DBusError> |
|
28 |
#include <TelepathyQt/Callbacks> |
|
29 |
||
30 |
class BaseConnectionEmergencyModeInterface; |
|
31 |
||
32 |
typedef Tp::SharedPtr<BaseConnectionEmergencyModeInterface> BaseConnectionEmergencyModeInterfacePtr; |
|
33 |
||
34 |
#define TP_QT_IFACE_CONNECTION_EMERGENCYMODE "com.canonical.Telephony.EmergencyMode"
|
|
35 |
||
36 |
class TP_QT_EXPORT BaseConnectionEmergencyModeInterface : public Tp::AbstractConnectionInterface |
|
37 |
{
|
|
38 |
Q_OBJECT
|
|
39 |
Q_DISABLE_COPY(BaseConnectionEmergencyModeInterface) |
|
40 |
||
41 |
public: |
|
42 |
static BaseConnectionEmergencyModeInterfacePtr create() { |
|
43 |
return BaseConnectionEmergencyModeInterfacePtr(new BaseConnectionEmergencyModeInterface()); |
|
44 |
}
|
|
45 |
template<typename BaseConnectionEmergencyModeInterfaceSubclass> |
|
46 |
static Tp::SharedPtr<BaseConnectionEmergencyModeInterfaceSubclass> create() { |
|
47 |
return Tp::SharedPtr<BaseConnectionEmergencyModeInterfaceSubclass>( |
|
48 |
new BaseConnectionEmergencyModeInterfaceSubclass()); |
|
49 |
}
|
|
50 |
QVariantMap immutableProperties() const; |
|
51 |
virtual ~BaseConnectionEmergencyModeInterface(); |
|
52 |
||
53 |
typedef Tp::Callback1<QStringList, Tp::DBusError*> EmergencyNumbersCallback; |
|
54 |
void setEmergencyNumbersCallback(const EmergencyNumbersCallback &cb); |
|
55 |
||
56 |
public Q_SLOTS: |
|
57 |
void setEmergencyNumbers(const QStringList &numbers); |
|
58 |
||
59 |
protected: |
|
60 |
BaseConnectionEmergencyModeInterface(); |
|
61 |
||
62 |
private: |
|
63 |
void createAdaptor(); |
|
64 |
||
65 |
class Adaptee; |
|
66 |
friend class Adaptee; |
|
67 |
struct Private; |
|
68 |
friend struct Private; |
|
69 |
Private *mPriv; |
|
70 |
};
|
|
71 |
||
72 |
||
73 |
class TP_QT_EXPORT ConnectionInterfaceEmergencyModeAdaptor : public Tp::AbstractAdaptor |
|
74 |
{
|
|
75 |
Q_OBJECT
|
|
76 |
Q_CLASSINFO("D-Bus Interface", TP_QT_IFACE_CONNECTION_EMERGENCYMODE) |
|
77 |
Q_CLASSINFO("D-Bus Introspection", "" |
|
78 |
" <interface name=\"com.canonical.Telephony.EmergencyMode\">\n" |
|
79 |
" <method name=\"EmergencyNumbers\">\n" |
|
80 |
" <arg direction=\"out\" type=\"as\" name=\"emergencyNumbers\"/>\n" |
|
81 |
" </method>\n" |
|
82 |
" <signal name=\"EmergencyNumbersChanged\">\n" |
|
83 |
" <arg type=\"as\" name=\"numbers\"/>\n" |
|
84 |
" </signal>\n" |
|
85 |
" </interface>\n" |
|
86 |
"") |
|
87 |
||
88 |
public: |
|
89 |
ConnectionInterfaceEmergencyModeAdaptor(const QDBusConnection& dbusConnection, QObject* adaptee, QObject* parent); |
|
90 |
virtual ~ConnectionInterfaceEmergencyModeAdaptor(); |
|
91 |
||
92 |
typedef Tp::MethodInvocationContextPtr< QStringList > EmergencyNumbersContextPtr; |
|
93 |
||
94 |
public Q_SLOTS: // METHODS |
|
95 |
QStringList EmergencyNumbers(const QDBusMessage& dbusMessage); |
|
96 |
||
97 |
Q_SIGNALS: // SIGNALS |
|
98 |
void EmergencyNumbersChanged(const QStringList &numbers); |
|
99 |
};
|
|
100 |
||
101 |
||
102 |
class TP_QT_NO_EXPORT BaseConnectionEmergencyModeInterface::Adaptee : public QObject |
|
103 |
{
|
|
104 |
Q_OBJECT
|
|
105 |
||
106 |
public: |
|
107 |
Adaptee(BaseConnectionEmergencyModeInterface *interface); |
|
108 |
~Adaptee(); |
|
109 |
||
110 |
private Q_SLOTS: |
|
111 |
void emergencyNumbers(const ConnectionInterfaceEmergencyModeAdaptor::EmergencyNumbersContextPtr &context); |
|
112 |
||
113 |
Q_SIGNALS: |
|
114 |
void emergencyNumbersChanged(const QStringList &numbers); |
|
115 |
||
116 |
public: |
|
117 |
BaseConnectionEmergencyModeInterface *mInterface; |
|
118 |
};
|
|
119 |
||
120 |
#endif
|