2
* Copyright (C) 2013 Canonical, Ltd.
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.
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.
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/>.
16
* Authors: Tiago Salem Herrmann <tiago.herrmann@canonical.com>
19
#ifndef OFONOSPEAKERIFACE_H
20
#define OFONOSPEAKERIFACE_H
23
#include <TelepathyQt/Constants>
24
#include <TelepathyQt/BaseChannel>
25
#include <TelepathyQt/AbstractAdaptor>
26
#include <TelepathyQt/DBusError>
27
#include <TelepathyQt/Callbacks>
29
#define TP_QT_IFACE_CHANNEL_SPEAKER "com.canonical.Telephony.Speaker"
31
class BaseChannelSpeakerInterface;
33
typedef Tp::SharedPtr<BaseChannelSpeakerInterface> BaseChannelSpeakerInterfacePtr;
35
class TP_QT_EXPORT BaseChannelSpeakerInterface : public Tp::AbstractChannelInterface
38
Q_DISABLE_COPY(BaseChannelSpeakerInterface)
41
static BaseChannelSpeakerInterfacePtr create() {
42
return BaseChannelSpeakerInterfacePtr(new BaseChannelSpeakerInterface());
44
template<typename BaseChannelSpeakerInterfaceSubclass>
45
static Tp::SharedPtr<BaseChannelSpeakerInterfaceSubclass> create() {
46
return Tp::SharedPtr<BaseChannelSpeakerInterfaceSubclass>(
47
new BaseChannelSpeakerInterfaceSubclass());
49
QVariantMap immutableProperties() const;
50
virtual ~BaseChannelSpeakerInterface();
51
bool speakerMode() const;
53
typedef Tp::Callback2<void, bool, Tp::DBusError*> turnOnSpeakerCallback;
54
void setTurnOnSpeakerCallback(const turnOnSpeakerCallback &cb);
57
void setSpeakerMode(bool active);
60
BaseChannelSpeakerInterface();
68
friend struct Private;
73
class TP_QT_EXPORT ChannelInterfaceSpeakerAdaptor : public Tp::AbstractAdaptor
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"
83
" <signal name=\"SpeakerChanged\">\n"
84
" <arg type=\"b\" name=\"active\"/>\n"
88
Q_PROPERTY(bool SpeakerMode READ SpeakerMode)
90
ChannelInterfaceSpeakerAdaptor(const QDBusConnection& dbusConnection, QObject* adaptee, QObject* parent);
91
virtual ~ChannelInterfaceSpeakerAdaptor();
93
typedef Tp::MethodInvocationContextPtr< bool > turnOnSpeakerContextPtr;
96
bool SpeakerMode() const;
98
public Q_SLOTS: // METHODS
99
void turnOnSpeaker(bool active, const QDBusMessage& dbusMessage);
101
Q_SIGNALS: // SIGNALS
102
void SpeakerChanged(bool active);
106
class TP_QT_NO_EXPORT BaseChannelSpeakerInterface::Adaptee : public QObject
109
Q_PROPERTY(bool speakerMode READ speakerMode)
111
Adaptee(BaseChannelSpeakerInterface *interface);
113
bool speakerMode() const
115
return mInterface->speakerMode();
119
void turnOnSpeaker(bool active, const ChannelInterfaceSpeakerAdaptor::turnOnSpeakerContextPtr &context);
122
void speakerChanged(bool active);
125
BaseChannelSpeakerInterface *mInterface;