~mterry/telephony-service/start-on

« back to all changes in this revision

Viewing changes to handler/tests/mock/speakeriface.h

  • Committer: CI bot
  • Author(s): Gustavo Pichorim Boiko
  • Date: 2014-04-02 12:41:29 UTC
  • mfrom: (765.2.24 telephony-service-conf_call)
  • Revision ID: ps-jenkins@lists.canonical.com-20140402124129-oywt8u6u9f4253bg
Add support for handling conference calls. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 */
 
18
 
 
19
#ifndef OFONOSPEAKERIFACE_H
 
20
#define OFONOSPEAKERIFACE_H
 
21
 
 
22
// telepathy-qt
 
23
#include <TelepathyQt/Constants>
 
24
#include <TelepathyQt/BaseChannel>
 
25
#include <TelepathyQt/AbstractAdaptor>
 
26
#include <TelepathyQt/DBusError>
 
27
#include <TelepathyQt/Callbacks>
 
28
 
 
29
#define TP_QT_IFACE_CHANNEL_SPEAKER "com.canonical.Telephony.Speaker"
 
30
 
 
31
class BaseChannelSpeakerInterface;
 
32
 
 
33
typedef Tp::SharedPtr<BaseChannelSpeakerInterface> BaseChannelSpeakerInterfacePtr;
 
34
 
 
35
class TP_QT_EXPORT BaseChannelSpeakerInterface : public Tp::AbstractChannelInterface
 
36
{
 
37
    Q_OBJECT
 
38
    Q_DISABLE_COPY(BaseChannelSpeakerInterface)
 
39
 
 
40
public:
 
41
    static BaseChannelSpeakerInterfacePtr create() {
 
42
        return BaseChannelSpeakerInterfacePtr(new BaseChannelSpeakerInterface());
 
43
    }
 
44
    template<typename BaseChannelSpeakerInterfaceSubclass>
 
45
    static Tp::SharedPtr<BaseChannelSpeakerInterfaceSubclass> create() {
 
46
        return Tp::SharedPtr<BaseChannelSpeakerInterfaceSubclass>(
 
47
                   new BaseChannelSpeakerInterfaceSubclass());
 
48
    }
 
49
    QVariantMap immutableProperties() const;
 
50
    virtual ~BaseChannelSpeakerInterface();
 
51
    bool speakerMode() const;
 
52
 
 
53
    typedef Tp::Callback2<void, bool, Tp::DBusError*> turnOnSpeakerCallback;
 
54
    void setTurnOnSpeakerCallback(const turnOnSpeakerCallback &cb);
 
55
 
 
56
public Q_SLOTS:
 
57
    void setSpeakerMode(bool active);
 
58
 
 
59
protected:
 
60
    BaseChannelSpeakerInterface();
 
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 ChannelInterfaceSpeakerAdaptor : public Tp::AbstractAdaptor
 
74
{
 
75
    Q_OBJECT
 
76
    Q_CLASSINFO("D-Bus Interface", TP_QT_IFACE_CHANNEL_SPEAKER)
 
77
    Q_CLASSINFO("D-Bus Introspection", ""
 
78
"  <interface name=\"com.canonical.Telephony.Speaker\">\n"
 
79
"    <property access=\"read\" type=\"b\" name=\"SpeakerMode\"/>\n"
 
80
"    <method name=\"turnOnSpeaker\">\n"
 
81
"      <arg direction=\"in\" type=\"b\" name=\"active\"/>\n"
 
82
"    </method>\n"
 
83
"    <signal name=\"SpeakerChanged\">\n"
 
84
"      <arg type=\"b\" name=\"active\"/>\n"
 
85
"    </signal>\n"
 
86
"  </interface>\n"
 
87
"")
 
88
    Q_PROPERTY(bool SpeakerMode READ SpeakerMode)
 
89
public:
 
90
    ChannelInterfaceSpeakerAdaptor(const QDBusConnection& dbusConnection, QObject* adaptee, QObject* parent);
 
91
    virtual ~ChannelInterfaceSpeakerAdaptor();
 
92
 
 
93
    typedef Tp::MethodInvocationContextPtr< bool > turnOnSpeakerContextPtr;
 
94
 
 
95
public: // PROPERTIES
 
96
    bool SpeakerMode() const;
 
97
 
 
98
public Q_SLOTS: // METHODS
 
99
    void turnOnSpeaker(bool active, const QDBusMessage& dbusMessage);
 
100
 
 
101
Q_SIGNALS: // SIGNALS
 
102
    void SpeakerChanged(bool active);
 
103
};
 
104
 
 
105
 
 
106
class TP_QT_NO_EXPORT BaseChannelSpeakerInterface::Adaptee : public QObject
 
107
{
 
108
    Q_OBJECT
 
109
    Q_PROPERTY(bool speakerMode READ speakerMode)
 
110
public:
 
111
    Adaptee(BaseChannelSpeakerInterface *interface);
 
112
    ~Adaptee();
 
113
    bool speakerMode() const
 
114
    {
 
115
        return mInterface->speakerMode();
 
116
    }
 
117
 
 
118
private Q_SLOTS:
 
119
    void turnOnSpeaker(bool active, const ChannelInterfaceSpeakerAdaptor::turnOnSpeakerContextPtr &context);
 
120
 
 
121
Q_SIGNALS:
 
122
    void speakerChanged(bool active);
 
123
 
 
124
public:
 
125
    BaseChannelSpeakerInterface *mInterface;
 
126
};
 
127
 
 
128
#endif