~andreas-pokorny/telepathy-ofono/control-proximity-handling-in-powerd

8 by Tiago Salem Herrmann
- add presence interface (and connect it to ofono NetworkRegistration interface)
1
/**
19 by Tiago Salem Herrmann
fix copyright year
2
 * Copyright (C) 2013 Canonical, Ltd.
8 by Tiago Salem Herrmann
- add presence interface (and connect it to ofono NetworkRegistration interface)
3
 *
24.1.2 by Ricardo Salveti de Araujo
* Packaging cleanup
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
8 by Tiago Salem Herrmann
- add presence interface (and connect it to ofono NetworkRegistration interface)
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
24.1.2 by Ricardo Salveti de Araujo
* Packaging cleanup
15
 *
16
 * Authors: Tiago Salem Herrmann <tiago.herrmann@canonical.com>
8 by Tiago Salem Herrmann
- add presence interface (and connect it to ofono NetworkRegistration interface)
17
 */
18
19
#ifndef OFONOVOICEMAILIFACE_H
20
#define OFONOVOICEMAILIFACE_H
21
22
// telepathy-qt
23
#include <TelepathyQt/Constants>
24
#include <TelepathyQt/BaseConnection>
25
#include <TelepathyQt/AbstractAdaptor>
26
#include <TelepathyQt/DBusError>
27
#include <TelepathyQt/Callbacks>
28
29
class BaseConnectionVoicemailInterface;
30
31
typedef Tp::SharedPtr<BaseConnectionVoicemailInterface> BaseConnectionVoicemailInterfacePtr;
32
9 by Tiago Salem Herrmann
- change interface name to com.canonical.Telephony.Voicemail
33
#define TP_QT_IFACE_CONNECTION_VOICEMAIL "com.canonical.Telephony.Voicemail"
34
8 by Tiago Salem Herrmann
- add presence interface (and connect it to ofono NetworkRegistration interface)
35
class TP_QT_EXPORT BaseConnectionVoicemailInterface : public Tp::AbstractConnectionInterface
36
{
37
    Q_OBJECT
38
    Q_DISABLE_COPY(BaseConnectionVoicemailInterface)
39
40
public:
41
    static BaseConnectionVoicemailInterfacePtr create() {
42
        return BaseConnectionVoicemailInterfacePtr(new BaseConnectionVoicemailInterface());
43
    }
44
    template<typename BaseConnectionVoicemailInterfaceSubclass>
45
    static Tp::SharedPtr<BaseConnectionVoicemailInterfaceSubclass> create() {
46
        return Tp::SharedPtr<BaseConnectionVoicemailInterfaceSubclass>(
47
                   new BaseConnectionVoicemailInterfaceSubclass());
48
    }
49
    QVariantMap immutableProperties() const;
50
    virtual ~BaseConnectionVoicemailInterface();
51
52
    typedef Tp::Callback1<uint, Tp::DBusError*> VoicemailCountCallback;
53
    void setVoicemailCountCallback(const VoicemailCountCallback &cb);
54
55
    typedef Tp::Callback1<bool, Tp::DBusError*> VoicemailIndicatorCallback;
56
    void setVoicemailIndicatorCallback(const VoicemailIndicatorCallback &cb);
57
58
    typedef Tp::Callback1<QString, Tp::DBusError*> VoicemailNumberCallback;
59
    void setVoicemailNumberCallback(const VoicemailNumberCallback &cb);
60
61
public Q_SLOTS:
62
    void setVoicemailCount(int count);
63
    void setVoicemailIndicator(bool active);
88.1.1 by Tiago Salem Herrmann
add VoicemailNumberChanged() signal
64
    void setVoicemailNumber(const QString &voicemailNumber);
8 by Tiago Salem Herrmann
- add presence interface (and connect it to ofono NetworkRegistration interface)
65
66
protected:
67
    BaseConnectionVoicemailInterface();
68
69
private:
70
    void createAdaptor();
71
72
    class Adaptee;
73
    friend class Adaptee;
74
    struct Private;
75
    friend struct Private;
76
    Private *mPriv;
77
};
78
79
80
class TP_QT_EXPORT ConnectionInterfaceVoicemailAdaptor : public Tp::AbstractAdaptor
81
{
82
    Q_OBJECT
9 by Tiago Salem Herrmann
- change interface name to com.canonical.Telephony.Voicemail
83
    Q_CLASSINFO("D-Bus Interface", TP_QT_IFACE_CONNECTION_VOICEMAIL)
8 by Tiago Salem Herrmann
- add presence interface (and connect it to ofono NetworkRegistration interface)
84
    Q_CLASSINFO("D-Bus Introspection", ""
9 by Tiago Salem Herrmann
- change interface name to com.canonical.Telephony.Voicemail
85
"  <interface name=\"com.canonical.Telephony.Voicemail\">\n"
8 by Tiago Salem Herrmann
- add presence interface (and connect it to ofono NetworkRegistration interface)
86
"    <method name=\"VoicemailIndicator\">\n"
87
"      <arg direction=\"out\" type=\"b\" name=\"voicemailIndicator\"/>\n"
88
"    </method>\n"
89
"    <method name=\"VoicemailNumber\">\n"
90
"      <arg direction=\"out\" type=\"s\" name=\"voicemailNumber\"/>\n"
91
"    </method>\n"
92
"    <method name=\"VoicemailCount\">\n"
93
"      <arg direction=\"out\" type=\"u\" name=\"voicemailCount\"/>\n"
94
"    </method>\n"
95
"    <signal name=\"VoicemailCountChanged\">\n"
96
"      <arg type=\"u\" name=\"count\"/>\n"
97
"    </signal>\n"
98
"    <signal name=\"VoicemailIndicatorChanged\">\n"
99
"      <arg type=\"b\" name=\"active\"/>\n"
100
"    </signal>\n"
88.1.1 by Tiago Salem Herrmann
add VoicemailNumberChanged() signal
101
"    <signal name=\"VoicemailNumberChanged\">\n"
102
"      <arg type=\"s\" name=\"voicemailNumber\"/>\n"
103
"    </signal>\n"
8 by Tiago Salem Herrmann
- add presence interface (and connect it to ofono NetworkRegistration interface)
104
"  </interface>\n"
105
"")
106
107
public:
108
    ConnectionInterfaceVoicemailAdaptor(const QDBusConnection& dbusConnection, QObject* adaptee, QObject* parent);
109
    virtual ~ConnectionInterfaceVoicemailAdaptor();
110
111
    typedef Tp::MethodInvocationContextPtr< bool > VoicemailIndicatorContextPtr;
112
    typedef Tp::MethodInvocationContextPtr< QString > VoicemailNumberContextPtr;
113
    typedef Tp::MethodInvocationContextPtr< uint > VoicemailCountContextPtr;
114
115
public Q_SLOTS: // METHODS
116
    bool VoicemailIndicator(const QDBusMessage& dbusMessage);
117
    QString VoicemailNumber(const QDBusMessage& dbusMessage);
118
    uint VoicemailCount(const QDBusMessage& dbusMessage);
119
120
Q_SIGNALS: // SIGNALS
121
    void VoicemailCountChanged(uint count);
122
    void VoicemailIndicatorChanged(bool active);
88.1.1 by Tiago Salem Herrmann
add VoicemailNumberChanged() signal
123
    void VoicemailNumberChanged(const QString &voicemailNumber);
8 by Tiago Salem Herrmann
- add presence interface (and connect it to ofono NetworkRegistration interface)
124
};
125
126
127
class TP_QT_NO_EXPORT BaseConnectionVoicemailInterface::Adaptee : public QObject
128
{
129
    Q_OBJECT
130
131
public:
132
    Adaptee(BaseConnectionVoicemailInterface *interface);
133
    ~Adaptee();
134
135
private Q_SLOTS:
136
    void voicemailIndicator(const ConnectionInterfaceVoicemailAdaptor::VoicemailIndicatorContextPtr &context);
137
    void voicemailNumber(const ConnectionInterfaceVoicemailAdaptor::VoicemailNumberContextPtr &context);
138
    void voicemailCount(const ConnectionInterfaceVoicemailAdaptor::VoicemailCountContextPtr &context);
139
140
Q_SIGNALS:
141
    void voicemailCountChanged(uint count);
142
    void voicemailIndicatorChanged(bool active);
88.1.1 by Tiago Salem Herrmann
add VoicemailNumberChanged() signal
143
    void voicemailNumberChanged(const QString &voicemailNumber);
8 by Tiago Salem Herrmann
- add presence interface (and connect it to ofono NetworkRegistration interface)
144
145
public:
146
    BaseConnectionVoicemailInterface *mInterface;
147
};
148
149
#endif