diff options
| author | Tiago Salem Herrmann <tiago.herrmann@canonical.com> | 2015-01-30 17:40:20 -0200 | 
|---|---|---|
| committer | David Edmundson <kde@davidedmundson.co.uk> | 2015-02-10 15:29:14 +0100 | 
| commit | 56667bfa6db7f108611b7d407f66108ba08d7a97 (patch) | |
| tree | 01b6c6c46bf5aa2fa8231f49800c1745bbd5152e | |
| parent | 099dd1c08450d35f699a553e2407356a8969122a (diff) | |
Add BaseChannelCallType
Add BaseChannelHoldInterface
Add BaseChannelConferenceInterface
Add BaseChannelMergeableConferenceInterface
Add BaseChannelSplittableInterface
| -rw-r--r-- | TelepathyQt/BaseCall | 13 | ||||
| -rw-r--r-- | TelepathyQt/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | TelepathyQt/base-call-internal.h | 136 | ||||
| -rw-r--r-- | TelepathyQt/base-call.cpp | 502 | ||||
| -rw-r--r-- | TelepathyQt/base-call.h | 190 | ||||
| -rw-r--r-- | TelepathyQt/base-channel-internal.h | 180 | ||||
| -rw-r--r-- | TelepathyQt/base-channel.cpp | 754 | ||||
| -rw-r--r-- | TelepathyQt/base-channel.h | 257 | ||||
| -rw-r--r-- | TelepathyQt/call-interfaces.xml | 9 | ||||
| -rw-r--r-- | TelepathyQt/service-types.h | 18 | ||||
| -rw-r--r-- | TelepathyQt/stable-interfaces.xml | 2 | ||||
| -rw-r--r-- | TelepathyQt/svc-call.xml | 12 | ||||
| -rw-r--r-- | TelepathyQt/svc-channel.xml | 2 | 
13 files changed, 2083 insertions, 0 deletions
| diff --git a/TelepathyQt/BaseCall b/TelepathyQt/BaseCall new file mode 100644 index 00000000..b7656e45 --- /dev/null +++ b/TelepathyQt/BaseCall @@ -0,0 +1,13 @@ +#ifndef _TelepathyQt_BaseCall_HEADER_GUARD_ +#define _TelepathyQt_BaseCall_HEADER_GUARD_ + +#ifndef IN_TP_QT_HEADER +#define IN_TP_QT_HEADER +#endif + +#include <TelepathyQt/base-call.h> + +#undef IN_TP_QT_HEADER + +#endif +// vim:set ft=cpp: diff --git a/TelepathyQt/CMakeLists.txt b/TelepathyQt/CMakeLists.txt index 04899759..58668cd9 100644 --- a/TelepathyQt/CMakeLists.txt +++ b/TelepathyQt/CMakeLists.txt @@ -857,6 +857,7 @@ if(ENABLE_SERVICE_SUPPORT)      # lets build tp-qt service side support as a separate library until we can guarantee API/ABI      # stability      set(telepathy_qt_service_SRCS +        base-call.cpp          base-connection-manager.cpp          base-connection.cpp          base-channel.cpp @@ -871,6 +872,8 @@ if(ENABLE_SERVICE_SUPPORT)          abstract-adaptor.h          AbstractDBusServiceInterface          AbstractProtocolInterface +        BaseCall +        base-call.h          BaseConnectionManager          base-connection-manager.h          BaseConnection @@ -894,12 +897,15 @@ if(ENABLE_SERVICE_SUPPORT)      # Generated headers which will be installed and exported      set(telepathy_qt_service_gen_HEADERS          ${CMAKE_CURRENT_BINARY_DIR}/_gen/svc-channel.h +        ${CMAKE_CURRENT_BINARY_DIR}/_gen/svc-call.h          ${CMAKE_CURRENT_BINARY_DIR}/_gen/svc-connection.h          ${CMAKE_CURRENT_BINARY_DIR}/_gen/svc-connection-manager.h)      # Headers file moc will be run on      set(telepathy_qt_service_MOC_SRCS          abstract-adaptor.h +        base-call.h +        base-call-internal.h          base-connection-manager.h          base-connection-manager-internal.h          base-channel.h @@ -915,6 +921,7 @@ if(ENABLE_SERVICE_SUPPORT)      set(SPECS          svc-channel +        svc-call          svc-connection          svc-connection-manager)      foreach(spec ${SPECS}) @@ -930,6 +937,7 @@ if(ENABLE_SERVICE_SUPPORT)      endforeach(spec ${SPECS})      tpqt_service_generator(svc-channel servicechannel Channel Tp::Service DEPENDS svc-channel-spec-xincludator) +    tpqt_service_generator(svc-call servicecall Channel Tp::Service DEPENDS svc-call-spec-xincludator)      tpqt_service_generator(svc-connection serviceconn Connection Tp::Service DEPENDS svc-connection-spec-xincludator)      tpqt_service_generator(svc-connection-manager servicecm ConnectionManager Tp::Service DEPENDS svc-connection-manager-spec-xincludator) diff --git a/TelepathyQt/base-call-internal.h b/TelepathyQt/base-call-internal.h new file mode 100644 index 00000000..95ba637f --- /dev/null +++ b/TelepathyQt/base-call-internal.h @@ -0,0 +1,136 @@ +/** + * This file is part of TelepathyQt + * + * @copyright Copyright (C) 2013 Matthias Gehre <gehre.matthias@gmail.com> + * @copyright Copyright 2013 Canonical Ltd. + * @license LGPL 2.1 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA + */ + +#include "TelepathyQt/_gen/svc-call.h" + +#include <TelepathyQt/Global> +#include <TelepathyQt/MethodInvocationContext> +#include <TelepathyQt/Constants> +#include <TelepathyQt/Types> +#include "TelepathyQt/debug-internal.h" + + +namespace Tp +{ + +class TP_QT_NO_EXPORT BaseCallContent::Adaptee : public QObject +{ +    Q_OBJECT +    Q_PROPERTY(QString name READ name) +    Q_PROPERTY(uint type READ type) +    Q_PROPERTY(uint disposition READ disposition) +    Q_PROPERTY(Tp::ObjectPathList streams READ streams) +    Q_PROPERTY(QStringList interfaces READ interfaces) + +public: +    Adaptee(const QDBusConnection &dbusConnection, BaseCallContent *content); +    ~Adaptee(); +    QStringList interfaces() const; + +    QString name() const { +        return mContent->name(); +    } + +    uint type() const { +        return mContent->type(); +    } + +    uint disposition() const { +        return mContent->disposition(); +    } + +    Tp::ObjectPathList streams() const { +        return mContent->streams(); +    } + +public Q_SLOTS: +    void remove(const Tp::Service::CallContentAdaptor::RemoveContextPtr &context); + + +Q_SIGNALS: +    void streamsAdded(const Tp::ObjectPathList &streams); +    void streamsRemoved(const Tp::ObjectPathList &streams, const Tp::CallStateReason &reason); + +private: +    BaseCallContent *mContent; +    Service::CallContentAdaptor *mAdaptor; +}; + + +class TP_QT_NO_EXPORT BaseCallMuteInterface::Adaptee : public QObject +{ +    Q_OBJECT +    Q_PROPERTY(uint localMuteState READ localMuteState) + +public: +    Adaptee(BaseCallMuteInterface *content); +    ~Adaptee(); +    QStringList interfaces() const; + +    uint localMuteState() const { +        return mInterface->localMuteState(); +    } + +public Q_SLOTS: +    void requestMuted(bool muted, const Tp::Service::CallInterfaceMuteAdaptor::RequestMutedContextPtr &context); + +Q_SIGNALS: +    void muteStateChanged(uint muteState); + +public: +    BaseCallMuteInterface *mInterface; +    Service::CallInterfaceMuteAdaptor *mAdaptor; +}; + +class TP_QT_NO_EXPORT BaseCallContentDTMFInterface::Adaptee : public QObject +{ +    Q_OBJECT +    Q_PROPERTY(bool currentlySendingTones READ currentlySendingTones) +    Q_PROPERTY(QString deferredTones READ deferredTones) + +public: +    Adaptee(BaseCallContentDTMFInterface *interface); +    ~Adaptee(); +    QStringList interfaces() const; + +    bool currentlySendingTones() const { +        return mInterface->currentlySendingTones(); +    } +    QString deferredTones() const { +        return mInterface->deferredTones(); +    } + +public Q_SLOTS: +    void multipleTones(const QString& tones, const Tp::Service::CallContentInterfaceDTMFAdaptor::MultipleTonesContextPtr &context); +    void startTone(uchar event, const Tp::Service::CallContentInterfaceDTMFAdaptor::StartToneContextPtr &context); +    void stopTone(const Tp::Service::CallContentInterfaceDTMFAdaptor::StopToneContextPtr &context); +Q_SIGNALS: +    void tonesDeferred(const QString& tones); +    void sendingTones(const QString& tones); +    void stoppedTones(bool cancelled); + +public: +    BaseCallContentDTMFInterface *mInterface; +    Service::CallContentInterfaceDTMFAdaptor *mAdaptor; +}; + +} diff --git a/TelepathyQt/base-call.cpp b/TelepathyQt/base-call.cpp new file mode 100644 index 00000000..e20d278c --- /dev/null +++ b/TelepathyQt/base-call.cpp @@ -0,0 +1,502 @@ +/** + * This file is part of TelepathyQt + * + * @copyright Copyright (C) 2013 Matthias Gehre <gehre.matthias@gmail.com> + * @copyright Copyright 2013 Canonical Ltd. + * @license LGPL 2.1 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA + */ + +#include <TelepathyQt/BaseCall> +#include <TelepathyQt/BaseChannel> +#include "TelepathyQt/base-call-internal.h" + +#include "TelepathyQt/_gen/base-call.moc.hpp" +#include "TelepathyQt/_gen/base-call-internal.moc.hpp" + +#include "TelepathyQt/debug-internal.h" + +#include <TelepathyQt/BaseConnection> +#include <TelepathyQt/Constants> +#include <TelepathyQt/DBusObject> +#include <TelepathyQt/Utils> +#include <TelepathyQt/AbstractProtocolInterface> +#include <QString> +#include <QVariantMap> + +namespace Tp +{ + +/** + * \class AbstractCallContentInterface + * \ingroup servicecm + * \headerfile TelepathyQt/base-call.h <TelepathyQt/BaseCall> + * + * \brief Base class for all the CallContent object interface implementations. + */ + +AbstractCallContentInterface::AbstractCallContentInterface(const QString &interfaceName) +    : AbstractDBusServiceInterface(interfaceName) +{ +} + +AbstractCallContentInterface::~AbstractCallContentInterface() +{ +} + +BaseCallContent::Adaptee::Adaptee(const QDBusConnection &dbusConnection, +                              BaseCallContent *content) +    : QObject(content), +      mContent(content) +{ +    debug() << "Creating service::CallContentAdaptor for " << content->dbusObject(); +    mAdaptor = new Service::CallContentAdaptor(dbusConnection, this, content->dbusObject()); +} + +QStringList BaseCallContent::Adaptee::interfaces() const +{ +    QStringList ret; +    foreach(const AbstractCallContentInterfacePtr & iface, mContent->interfaces()) { +        ret << iface->interfaceName(); +    } +    ret << TP_QT_IFACE_PROPERTIES; +    return ret; +} + +BaseCallContent::Adaptee::~Adaptee() +{ +} + +void BaseCallContent::Adaptee::remove(const Tp::Service::CallContentAdaptor::RemoveContextPtr &context) +{ +    context->setFinished(); +} + +struct TP_QT_NO_EXPORT BaseCallContent::Private { +    Private(BaseCallContent *parent, +            const QDBusConnection &dbusConnection, +            BaseChannel* channel, +            const QString &name, +            const Tp::MediaStreamType &type, +            const Tp::MediaStreamDirection &direction) +        : parent(parent), +          channel(channel), +          name(name), +          type(type), +          disposition(Tp::CallContentDispositionNone), +          direction(direction), +          adaptee(new BaseCallContent::Adaptee(dbusConnection, parent)) { +    } + +    BaseCallContent *parent; +    BaseChannel *channel; + +    QString name; +    Tp::MediaStreamType type; +    Tp::CallContentDisposition disposition; +    Tp::ObjectPathList streams; + +    Tp::MediaStreamDirection direction; + +    QHash<QString, AbstractCallContentInterfacePtr> interfaces; +    BaseCallContent::Adaptee *adaptee; +}; + +BaseCallContent::BaseCallContent(const QDBusConnection &dbusConnection, +                         BaseChannel* channel, +                         const QString &name, +                         const Tp::MediaStreamType &type, +                         const Tp::MediaStreamDirection &direction) +    : DBusService(dbusConnection), +      mPriv(new Private(this, dbusConnection, channel, +                        name, type, direction)) +{ +} + +BaseCallContent::~BaseCallContent() +{ +    delete mPriv; +} + +QVariantMap BaseCallContent::immutableProperties() const +{ +    QVariantMap map; +    map.insert(TP_QT_IFACE_CALL_CONTENT + QLatin1String(".Interfaces"), +               QVariant::fromValue(mPriv->adaptee->interfaces())); +    map.insert(TP_QT_IFACE_CALL_CONTENT + QLatin1String(".Name"), +               QVariant::fromValue(mPriv->adaptee->name())); +    map.insert(TP_QT_IFACE_CALL_CONTENT + QLatin1String(".Type"), +               QVariant::fromValue((uint)mPriv->adaptee->type())); +    map.insert(TP_QT_IFACE_CALL_CONTENT + QLatin1String(".Disposition"), +               QVariant::fromValue((uint)mPriv->adaptee->disposition())); +    return map; +} + +QString BaseCallContent::name() const { +    return mPriv->name; +} + +Tp::MediaStreamType BaseCallContent::type() const { +    return mPriv->type; +} + +Tp::CallContentDisposition BaseCallContent::disposition() const { +    return mPriv->disposition; +} + +Tp::ObjectPathList BaseCallContent::streams() const { +    return mPriv->streams; +} + +QString BaseCallContent::uniqueName() const +{ +    return QString(QLatin1String("_%1")).arg((quintptr) this, 0, 16); +} + +bool BaseCallContent::registerObject(DBusError *error) +{ +    if (isRegistered()) { +        return true; +    } + +    QString name = mPriv->name; +    QString busName = mPriv->channel->busName(); +    QString objectPath = QString(QLatin1String("%1/%2")) +                         .arg(mPriv->channel->objectPath(), name); +    debug() << "Registering Content: busName: " << busName << " objectName: " << objectPath; +    DBusError _error; + +    debug() << "CallContent: registering interfaces  at " << dbusObject(); +    foreach(const AbstractCallContentInterfacePtr & iface, mPriv->interfaces) { +        if (!iface->registerInterface(dbusObject())) { +            // lets not fail if an optional interface fails registering, lets warn only +            warning() << "Unable to register interface" << iface->interfaceName(); +        } +    } + +    bool ret = registerObject(busName, objectPath, &_error); +    if (!ret && error) { +        error->set(_error.name(), _error.message()); +    } +    return ret; +} + +/** + * Reimplemented from DBusService. + */ +bool BaseCallContent::registerObject(const QString &busName, +                                 const QString &objectPath, DBusError *error) +{ +    return DBusService::registerObject(busName, objectPath, error); +} + +QList<AbstractCallContentInterfacePtr> BaseCallContent::interfaces() const +{ +    return mPriv->interfaces.values(); +} + +bool BaseCallContent::plugInterface(const AbstractCallContentInterfacePtr &interface) +{ +    if (isRegistered()) { +        warning() << "Unable to plug protocol interface " << interface->interfaceName() << +                  "- protocol already registered"; +        return false; +    } + +    if (interface->isRegistered()) { +        warning() << "Unable to plug protocol interface" << interface->interfaceName() << +                  "- interface already registered"; +        return false; +    } + +    if (mPriv->interfaces.contains(interface->interfaceName())) { +        warning() << "Unable to plug protocol interface" << interface->interfaceName() << +                  "- another interface with same name already plugged"; +        return false; +    } + +    debug() << "Interface" << interface->interfaceName() << "plugged"; +    mPriv->interfaces.insert(interface->interfaceName(), interface); +    return true; +} + +// Call.I.Mute +BaseCallMuteInterface::Adaptee::Adaptee(BaseCallMuteInterface *interface) +    : QObject(interface), +      mInterface(interface) +{ +} + +BaseCallMuteInterface::Adaptee::~Adaptee() +{ +} + +struct TP_QT_NO_EXPORT BaseCallMuteInterface::Private { +    Private(BaseCallMuteInterface *parent, Tp::LocalMuteState state) +        : state(state), +          adaptee(new BaseCallMuteInterface::Adaptee(parent)) { +    } + +    SetMuteStateCallback setMuteStateCB; +    Tp::LocalMuteState state; +    BaseCallMuteInterface::Adaptee *adaptee; +}; + +void BaseCallMuteInterface::Adaptee::requestMuted(bool mute, const Tp::Service::CallInterfaceMuteAdaptor::RequestMutedContextPtr &context) +{ +    if (!mInterface->mPriv->setMuteStateCB.isValid()) { +        context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")); +        return; +    } + +    Tp::LocalMuteState state = Tp::LocalMuteStateUnmuted; +    if (mute) { +        state = Tp::LocalMuteStateMuted; +    } + +    DBusError error; +    mInterface->mPriv->setMuteStateCB(state, &error); +    if (error.isValid()) { +        context->setFinishedWithError(error.name(), error.message()); +        return; +    } +    context->setFinished(); +} + + +/** + * \class BaseCallMuteInterface + * \ingroup servicecm + * \headerfile TelepathyQt/base-call.h <TelepathyQt/BaseCall> + * + * \brief Base class for implementations of Call.Interface.Mute + * + */ + +/** + * Class constructor. + */ +BaseCallMuteInterface::BaseCallMuteInterface() +    : AbstractChannelInterface(TP_QT_IFACE_CALL_INTERFACE_MUTE), +      mPriv(new Private(this, Tp::LocalMuteStateUnmuted)) +{ +} + +Tp::LocalMuteState BaseCallMuteInterface::localMuteState() const +{ +    return mPriv->state; +} + +void BaseCallMuteInterface::setMuteState(const Tp::LocalMuteState &state) +{ +    if (mPriv->state != state) { +        mPriv->state = state; +        emit mPriv->adaptee->muteStateChanged(state); +    } +} + +void BaseCallMuteInterface::setSetMuteStateCallback(const SetMuteStateCallback &cb) +{ +    mPriv->setMuteStateCB = cb; +} + +/** + * Class destructor. + */ +BaseCallMuteInterface::~BaseCallMuteInterface() +{ +    delete mPriv; +} + +/** + * Return the immutable properties of this interface. + * + * Immutable properties cannot change after the interface has been registered + * on a service on the bus with registerInterface(). + * + * \return The immutable properties of this interface. + */ +QVariantMap BaseCallMuteInterface::immutableProperties() const +{ +    QVariantMap map; +    return map; +} + +void BaseCallMuteInterface::createAdaptor() +{ +    (void) new Service::CallInterfaceMuteAdaptor(dbusObject()->dbusConnection(), +            mPriv->adaptee, dbusObject()); +} + +// Call.Content.Interface.DTMF +BaseCallContentDTMFInterface::Adaptee::Adaptee(BaseCallContentDTMFInterface *interface) +    : QObject(interface), +      mInterface(interface) +{ +} + +BaseCallContentDTMFInterface::Adaptee::~Adaptee() +{ +} + +struct TP_QT_NO_EXPORT BaseCallContentDTMFInterface::Private { +    Private(BaseCallContentDTMFInterface *parent) +        : currentlySendingTones(false), +          adaptee(new BaseCallContentDTMFInterface::Adaptee(parent)) { +    } + +    StartToneCallback startToneCB; +    StopToneCallback stopToneCB; +    MultipleTonesCallback multipleTonesCB; +    bool currentlySendingTones; +    QString deferredTones; +    BaseCallContentDTMFInterface::Adaptee *adaptee; +}; + +void BaseCallContentDTMFInterface::Adaptee::startTone(uchar event, const Tp::Service::CallContentInterfaceDTMFAdaptor::StartToneContextPtr &context) +{ +    if (!mInterface->mPriv->startToneCB.isValid()) { +        context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")); +        return; +    } + +    DBusError error; +    mInterface->mPriv->startToneCB(event, &error); +    if (error.isValid()) { +        context->setFinishedWithError(error.name(), error.message()); +        return; +    } +    context->setFinished(); +} + +void BaseCallContentDTMFInterface::Adaptee::stopTone(const Tp::Service::CallContentInterfaceDTMFAdaptor::StopToneContextPtr &context) +{ +    if (!mInterface->mPriv->stopToneCB.isValid()) { +        context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")); +        return; +    } + +    DBusError error; +    mInterface->mPriv->stopToneCB(&error); +    if (error.isValid()) { +        context->setFinishedWithError(error.name(), error.message()); +        return; +    } +    context->setFinished(); +} + + +void BaseCallContentDTMFInterface::Adaptee::multipleTones(const QString& tones, const Tp::Service::CallContentInterfaceDTMFAdaptor::MultipleTonesContextPtr &context) +{ +    if (!mInterface->mPriv->multipleTonesCB.isValid()) { +        context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")); +        return; +    } + +    DBusError error; +    mInterface->mPriv->multipleTonesCB(tones, &error); +    if (error.isValid()) { +        context->setFinishedWithError(error.name(), error.message()); +        return; +    } +    context->setFinished(); +} + +/** + * \class BaseCallContentDTMFInterface + * \ingroup servicecm + * \headerfile TelepathyQt/base-call.h <TelepathyQt/BaseCall> + * + * \brief Base class for implementations of Call.Content.Interface.DTMF + * + */ + +/** + * Class constructor. + */ +BaseCallContentDTMFInterface::BaseCallContentDTMFInterface() +    : AbstractCallContentInterface(TP_QT_IFACE_CALL_CONTENT_INTERFACE_DTMF), +      mPriv(new Private(this)) +{ +} + +bool BaseCallContentDTMFInterface::currentlySendingTones() const +{ +    return mPriv->currentlySendingTones; +} + +void BaseCallContentDTMFInterface::setCurrentlySendingTones(bool sending) +{ +    mPriv->currentlySendingTones = sending; +} + +QString BaseCallContentDTMFInterface::deferredTones() const +{ +    return mPriv->deferredTones; +} + +void BaseCallContentDTMFInterface::setDeferredTones(const QString &tones) +{ +    mPriv->deferredTones = tones; +} + + +void BaseCallContentDTMFInterface::setStartToneCallback(const StartToneCallback &cb) +{ +    mPriv->startToneCB = cb; +} + +void BaseCallContentDTMFInterface::setStopToneCallback(const StopToneCallback &cb) +{ +    mPriv->stopToneCB = cb; +} + + +void BaseCallContentDTMFInterface::setMultipleTonesCallback(const MultipleTonesCallback &cb) +{ +    mPriv->multipleTonesCB = cb; +} + +/** + * Class destructor. + */ +BaseCallContentDTMFInterface::~BaseCallContentDTMFInterface() +{ +    delete mPriv; +} + +/** + * Return the immutable properties of this interface. + * + * Immutable properties cannot change after the interface has been registered + * on a service on the bus with registerInterface(). + * + * \return The immutable properties of this interface. + */ +QVariantMap BaseCallContentDTMFInterface::immutableProperties() const +{ +    QVariantMap map; +    return map; +} + +void BaseCallContentDTMFInterface::createAdaptor() +{ +    (void) new Service::CallContentInterfaceDTMFAdaptor(dbusObject()->dbusConnection(), +            mPriv->adaptee, dbusObject()); +} + +} + diff --git a/TelepathyQt/base-call.h b/TelepathyQt/base-call.h new file mode 100644 index 00000000..c42d4fbd --- /dev/null +++ b/TelepathyQt/base-call.h @@ -0,0 +1,190 @@ +/** + * This file is part of TelepathyQt + * + * @copyright Copyright (C) 2013 Matthias Gehre <gehre.matthias@gmail.com> + * @copyright Copyright 2013 Canonical Ltd. + * @license LGPL 2.1 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA + */ + +#ifndef _TelepathyQt_base_call_h_HEADER_GUARD_ +#define _TelepathyQt_base_call_h_HEADER_GUARD_ + +#ifndef IN_TP_QT_HEADER +#error IN_TP_QT_HEADER +#endif + + +#include <TelepathyQt/DBusService> +#include <TelepathyQt/Global> +#include <TelepathyQt/Types> +#include <TelepathyQt/Callbacks> +#include <TelepathyQt/Constants> +#include <TelepathyQt/BaseChannel> + +#include <QDBusConnection> + +class QString; + +namespace Tp +{ + +class TP_QT_EXPORT AbstractCallContentInterface : public AbstractDBusServiceInterface +{ +    Q_OBJECT +    Q_DISABLE_COPY(AbstractCallContentInterface) + +public: +    AbstractCallContentInterface(const QString &interfaceName); +    virtual ~AbstractCallContentInterface(); + +private: +    friend class BaseCallContent; + +    class Private; +    friend class Private; +    Private *mPriv; +}; + +class TP_QT_EXPORT BaseCallContent : public DBusService +{ +    Q_OBJECT +    Q_DISABLE_COPY(BaseCallContent) + +public: +    static BaseCallContentPtr create(const QDBusConnection &dbusConnection, +                                     BaseChannel* channel, +                                     const QString &name, +                                     const Tp::MediaStreamType &type, +                                     const Tp::MediaStreamDirection &direction) { +        return BaseCallContentPtr(new BaseCallContent(dbusConnection, channel, name, type, direction)); +    } + +    virtual ~BaseCallContent(); +    QVariantMap immutableProperties() const; +    bool registerObject(DBusError *error = NULL); +    virtual QString uniqueName() const; + +    QList<AbstractCallContentInterfacePtr> interfaces() const; +    AbstractCallContentInterfacePtr interface(const QString &interfaceName) const; +    bool plugInterface(const AbstractCallContentInterfacePtr &interface); + +    QString name() const; +    Tp::MediaStreamType type() const; +    Tp::CallContentDisposition disposition() const; +    Tp::ObjectPathList streams() const; +protected: +    BaseCallContent(const QDBusConnection &dbusConnection, +                    BaseChannel* channel, +                    const QString &name, +                    const Tp::MediaStreamType &type, +                    const Tp::MediaStreamDirection &direction); + +    virtual bool registerObject(const QString &busName, const QString &objectPath, +                                DBusError *error); +    void remove(); + +private: +    class Adaptee; +    friend class Adaptee; +    struct Private; +    friend struct Private; +    Private *mPriv; +}; + +class TP_QT_EXPORT BaseCallMuteInterface : public AbstractChannelInterface +{ +    Q_OBJECT +    Q_DISABLE_COPY(BaseCallMuteInterface) + +public: +    static BaseCallMuteInterfacePtr create() { +        return BaseCallMuteInterfacePtr(new BaseCallMuteInterface()); +    } +    template<typename BaseCallMuteInterfaceSubclass> +    static SharedPtr<BaseCallMuteInterfaceSubclass> create() { +        return SharedPtr<BaseCallMuteInterfaceSubclass>( +                   new BaseCallMuteInterfaceSubclass()); +    } +    virtual ~BaseCallMuteInterface(); + +    QVariantMap immutableProperties() const; + +    Tp::LocalMuteState localMuteState() const; +    void setMuteState(const Tp::LocalMuteState &state); + +    typedef Callback2<void, const Tp::LocalMuteState&, DBusError*> SetMuteStateCallback; +    void setSetMuteStateCallback(const SetMuteStateCallback &cb); +Q_SIGNALS: +    void muteStateChanged(const Tp::LocalMuteState &state); +private: +    BaseCallMuteInterface(); +    void createAdaptor(); + +    class Adaptee; +    friend class Adaptee; +    struct Private; +    friend struct Private; +    Private *mPriv; +}; + +class TP_QT_EXPORT BaseCallContentDTMFInterface : public AbstractCallContentInterface +{ +    Q_OBJECT +    Q_DISABLE_COPY(BaseCallContentDTMFInterface) + +public: +    static BaseCallContentDTMFInterfacePtr create() { +        return BaseCallContentDTMFInterfacePtr(new BaseCallContentDTMFInterface()); +    } +    template<typename BaseCallContentDTMFInterfaceSubclass> +    static SharedPtr<BaseCallContentDTMFInterfaceSubclass> create() { +        return SharedPtr<BaseCallContentDTMFInterfaceSubclass>( +                   new BaseCallContentDTMFInterfaceSubclass()); +    } +    virtual ~BaseCallContentDTMFInterface(); + +    QVariantMap immutableProperties() const; + +    bool currentlySendingTones() const; +    void setCurrentlySendingTones(bool sendingTones); + +    QString deferredTones() const; +    void setDeferredTones(const QString &deferredTones); + + +    typedef Callback2<void, uchar, DBusError*> StartToneCallback; +    void setStartToneCallback(const StartToneCallback &cb); +    typedef Callback1<void, DBusError*> StopToneCallback; +    void setStopToneCallback(const StopToneCallback &cb); +    typedef Callback2<void, const QString&, DBusError*> MultipleTonesCallback; +    void setMultipleTonesCallback(const MultipleTonesCallback &cb); +Q_SIGNALS: + +private: +    BaseCallContentDTMFInterface(); +    void createAdaptor(); + +    class Adaptee; +    friend class Adaptee; +    struct Private; +    friend struct Private; +    Private *mPriv; +}; + + +} +#endif diff --git a/TelepathyQt/base-channel-internal.h b/TelepathyQt/base-channel-internal.h index 8ac91d89..156780d8 100644 --- a/TelepathyQt/base-channel-internal.h +++ b/TelepathyQt/base-channel-internal.h @@ -2,6 +2,7 @@   * This file is part of TelepathyQt   *   * @copyright Copyright (C) 2013 Matthias Gehre <gehre.matthias@gmail.com> + * @copyright Copyright 2013 Canonical Ltd.   * @license LGPL 2.1   *   * This library is free software; you can redistribute it and/or @@ -322,4 +323,183 @@ public:      BaseChannelGroupInterface *mInterface;  }; +class TP_QT_NO_EXPORT BaseChannelCallType::Adaptee : public QObject +{ +    Q_OBJECT +    Q_PROPERTY(Tp::ObjectPathList contents READ contents) +    Q_PROPERTY(QVariantMap callStateDetails READ callStateDetails) +    Q_PROPERTY(uint callState READ callState) +    Q_PROPERTY(uint callFlags READ callFlags) +    Q_PROPERTY(Tp::CallStateReason callStateReason READ callStateReason) +    Q_PROPERTY(bool hardwareStreaming READ hardwareStreaming) +    Q_PROPERTY(Tp::CallMemberMap callMembers READ callMembers) +    Q_PROPERTY(Tp::HandleIdentifierMap memberIdentifiers READ memberIdentifiers) +    Q_PROPERTY(uint initialTransport READ initialTransport) +    Q_PROPERTY(bool initialAudio READ initialAudio) +    Q_PROPERTY(bool initialVideo READ initialVideo) +    Q_PROPERTY(QString initialVideoName READ initialVideoName) +    Q_PROPERTY(QString initialAudioName READ initialAudioName) +    Q_PROPERTY(bool mutableContents READ mutableContents) + +public: +    Adaptee(BaseChannelCallType *interface); +    ~Adaptee(); + +    Tp::ObjectPathList contents() const { +        return mInterface->contents(); +    } + +    QVariantMap callStateDetails() const { +        return mInterface->callStateDetails(); +    } + +    uint callState() const { +        return mInterface->callState(); +    } + +    uint callFlags() const { +        return mInterface->callFlags(); +    } + +    Tp::CallStateReason callStateReason() const { +        return mInterface->callStateReason(); +    } + +    bool hardwareStreaming() const { +        return mInterface->hardwareStreaming(); +    } + +    Tp::CallMemberMap callMembers() const { +        return mInterface->callMembers(); +    } + +    Tp::HandleIdentifierMap memberIdentifiers() const { +        return mInterface->memberIdentifiers(); +    } + +    uint initialTransport() const { +        return mInterface->initialTransport(); +    } + +    bool initialAudio() const { +        return mInterface->initialAudio(); +    } + +    bool initialVideo() const { +        return mInterface->initialVideo(); +    } + +    QString initialVideoName() const { +        return mInterface->initialVideoName(); +    } + +    QString initialAudioName() const { +        return mInterface->initialAudioName(); +    } + +    bool mutableContents() const { +        return mInterface->mutableContents(); +    } + +public slots: +    void setRinging(const Tp::Service::ChannelTypeCallAdaptor::SetRingingContextPtr &context); +    void setQueued(const Tp::Service::ChannelTypeCallAdaptor::SetQueuedContextPtr &context); +    void accept(const Tp::Service::ChannelTypeCallAdaptor::AcceptContextPtr &context); +    void hangup(uint reason, const QString &detailedHangupReason, const QString &message, const Tp::Service::ChannelTypeCallAdaptor::HangupContextPtr &context); +    void addContent(const QString &contentName, const Tp::MediaStreamType &contentType, const Tp::MediaStreamDirection &initialDirection, const Tp::Service::ChannelTypeCallAdaptor::AddContentContextPtr &context); + +signals: +    void contentAdded(const QDBusObjectPath &content); +    void contentRemoved(const QDBusObjectPath &content, const Tp::CallStateReason &reason); +    void callStateChanged(uint callState, uint callFlags, const Tp::CallStateReason &stateReason, const QVariantMap &callStateDetails); +    void callMembersChanged(const Tp::CallMemberMap &flagsChanged, const Tp::HandleIdentifierMap &identifiers, const Tp::UIntList &removed, const Tp::CallStateReason &reason); + +public: +    BaseChannelCallType *mInterface; +}; + +class TP_QT_NO_EXPORT BaseChannelHoldInterface::Adaptee : public QObject +{ +    Q_OBJECT +public: +    Adaptee(BaseChannelHoldInterface *interface); +    ~Adaptee(); + +public slots: +    void getHoldState(const Tp::Service::ChannelInterfaceHoldAdaptor::GetHoldStateContextPtr &context); +    void requestHold(bool hold, const Tp::Service::ChannelInterfaceHoldAdaptor::RequestHoldContextPtr &context); +signals: +    void holdStateChanged(uint holdState, uint reason); + +public: +    BaseChannelHoldInterface *mInterface; +}; + +class TP_QT_NO_EXPORT BaseChannelConferenceInterface::Adaptee : public QObject +{ +    Q_OBJECT +    Q_PROPERTY(Tp::ObjectPathList channels READ channels) +    Q_PROPERTY(Tp::ObjectPathList initialChannels READ initialChannels) +    Q_PROPERTY(Tp::UIntList initialInviteeHandles READ initialInviteeHandles) +    Q_PROPERTY(QStringList initialInviteeIDs READ initialInviteeIDs) +    Q_PROPERTY(QString invitationMessage READ invitationMessage) +    Q_PROPERTY(ChannelOriginatorMap originalChannels READ originalChannels) +public: +    Adaptee(BaseChannelConferenceInterface *interface); +    ~Adaptee(); +    Tp::ObjectPathList channels() const { +        return mInterface->channels(); +    } +    Tp::ObjectPathList initialChannels() const { +        return mInterface->initialChannels(); +    } +    Tp::UIntList initialInviteeHandles() const { +        return mInterface->initialInviteeHandles(); +    } +    QStringList initialInviteeIDs() const { +        return mInterface->initialInviteeIDs(); +    } +    QString invitationMessage() const { +        return mInterface->invitationMessage(); +    } +    ChannelOriginatorMap originalChannels() const { +        return mInterface->originalChannels(); +    } + +signals: +    void channelMerged(const QDBusObjectPath &channel, uint channelHandle, const QVariantMap &properties); +    void channelRemoved(const QDBusObjectPath &channel, const QVariantMap& details); + +public: +    BaseChannelConferenceInterface *mInterface; +}; + +class TP_QT_NO_EXPORT BaseChannelMergeableConferenceInterface::Adaptee : public QObject +{ +    Q_OBJECT +public: +    Adaptee(BaseChannelMergeableConferenceInterface *interface); +    ~Adaptee(); + +public slots: +    void merge(const QDBusObjectPath &channel, const Tp::Service::ChannelInterfaceMergeableConferenceAdaptor::MergeContextPtr &context); + +public: +    BaseChannelMergeableConferenceInterface *mInterface; +}; + +class TP_QT_NO_EXPORT BaseChannelSplittableInterface::Adaptee : public QObject +{ +    Q_OBJECT +public: +    Adaptee(BaseChannelSplittableInterface *interface); +    ~Adaptee(); + +public slots: +    void split(const Tp::Service::ChannelInterfaceSplittableAdaptor::SplitContextPtr &context); + +public: +    BaseChannelSplittableInterface *mInterface; +}; +  } diff --git a/TelepathyQt/base-channel.cpp b/TelepathyQt/base-channel.cpp index a0c265b9..8bcf6bf0 100644 --- a/TelepathyQt/base-channel.cpp +++ b/TelepathyQt/base-channel.cpp @@ -2,6 +2,7 @@   * This file is part of TelepathyQt   *   * @copyright Copyright (C) 2013 Matthias Gehre <gehre.matthias@gmail.com> + * @copyright Copyright 2013 Canonical Ltd.   * @license LGPL 2.1   *   * This library is free software; you can redistribute it and/or @@ -20,10 +21,12 @@   */  #include <TelepathyQt/BaseChannel> +#include <TelepathyQt/BaseCall>  #include "TelepathyQt/base-channel-internal.h"  #include "TelepathyQt/_gen/base-channel.moc.hpp"  #include "TelepathyQt/_gen/base-channel-internal.moc.hpp" +#include "TelepathyQt/future-internal.h"  #include "TelepathyQt/debug-internal.h" @@ -1841,4 +1844,755 @@ void BaseChannelGroupInterface::removeMembers(const Tp::UIntList& handles)          QMetaObject::invokeMethod(mPriv->adaptee,"membersChanged",Q_ARG(QString, QString()), Q_ARG(Tp::UIntList, Tp::UIntList()), Q_ARG(Tp::UIntList, removed), Q_ARG(Tp::UIntList, Tp::UIntList()), Q_ARG(Tp::UIntList, Tp::UIntList()), Q_ARG(uint, 0), Q_ARG(uint,ChannelGroupChangeReasonNone)); //Can simply use emit in Qt5 //Can simply use emit in Qt5  } +// Chan.T.Call +BaseChannelCallType::Adaptee::Adaptee(BaseChannelCallType *interface) +    : QObject(interface), +      mInterface(interface) +{ +} + +BaseChannelCallType::Adaptee::~Adaptee() +{ +} + + +struct TP_QT_NO_EXPORT BaseChannelCallType::Private { +    Private(BaseChannelCallType *parent, BaseChannel* channel, bool hardwareStreaming, +            uint initialTransport, +            bool initialAudio, +            bool initialVideo, +            QString initialAudioName, +            QString initialVideoName, +            bool mutableContents) +        : hardwareStreaming(hardwareStreaming), +          initialTransport(initialTransport), +          initialAudio(initialAudio), +          initialVideo(initialVideo), +          initialAudioName(initialAudioName), +          initialVideoName(initialVideoName), +          mutableContents(mutableContents), +          channel(channel), +          adaptee(new BaseChannelCallType::Adaptee(parent)) { +    } + +    Tp::ObjectPathList contents; +    QVariantMap callStateDetails; +    uint callState; +    uint callFlags; +    Tp::CallStateReason callStateReason; +    bool hardwareStreaming; +    Tp::CallMemberMap callMembers; +    Tp::HandleIdentifierMap memberIdentifiers; +    uint initialTransport; +    bool initialAudio; +    bool initialVideo; +    QString initialAudioName; +    QString initialVideoName; +    bool mutableContents; + +    QList<Tp::BaseCallContentPtr> mCallContents; +    AcceptCallback acceptCB; +    HangupCallback hangupCB; +    SetQueuedCallback setQueuedCB; +    SetRingingCallback setRingingCB; +    AddContentCallback addContentCB; + +    BaseChannel *channel; +    BaseChannelCallType::Adaptee *adaptee; +}; + +void BaseChannelCallType::Adaptee::setRinging(const Tp::Service::ChannelTypeCallAdaptor::SetRingingContextPtr &context) +{ +    if (!mInterface->mPriv->setRingingCB.isValid()) { +        context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")); +        return; +    } +    DBusError error; +    mInterface->mPriv->setRingingCB(&error); +    if (error.isValid()) { +        context->setFinishedWithError(error.name(), error.message()); +        return; +    } +    context->setFinished(); +} + +void BaseChannelCallType::Adaptee::setQueued(const Tp::Service::ChannelTypeCallAdaptor::SetQueuedContextPtr &context) +{ +    if (!mInterface->mPriv->setQueuedCB.isValid()) { +        context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")); +        return; +    } +    DBusError error; +    mInterface->mPriv->setQueuedCB(&error); +    if (error.isValid()) { +        context->setFinishedWithError(error.name(), error.message()); +        return; +    } +    context->setFinished(); +} + +void BaseChannelCallType::Adaptee::accept(const Tp::Service::ChannelTypeCallAdaptor::AcceptContextPtr &context) +{ +    if (!mInterface->mPriv->acceptCB.isValid()) { +        context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")); +        return; +    } +    DBusError error; +    mInterface->mPriv->acceptCB(&error); +    if (error.isValid()) { +        context->setFinishedWithError(error.name(), error.message()); +        return; +    } +    context->setFinished(); +} + +void BaseChannelCallType::Adaptee::hangup(uint reason, const QString &detailedHangupReason, const QString &message, const Tp::Service::ChannelTypeCallAdaptor::HangupContextPtr &context) +{ +    if (!mInterface->mPriv->hangupCB.isValid()) { +        context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")); +        return; +    } +    DBusError error; +    mInterface->mPriv->hangupCB(reason, detailedHangupReason, message, &error); +    if (error.isValid()) { +        context->setFinishedWithError(error.name(), error.message()); +        return; +    } +    context->setFinished(); +} + +void BaseChannelCallType::Adaptee::addContent(const QString &contentName, const Tp::MediaStreamType &contentType, const Tp::MediaStreamDirection &initialDirection, const Tp::Service::ChannelTypeCallAdaptor::AddContentContextPtr &context) +{ +    if (!mInterface->mPriv->addContentCB.isValid()) { +        Tp::BaseCallContentPtr ptr = mInterface->addContent(contentName, contentType, initialDirection); +        QDBusObjectPath objPath; +        objPath.setPath(ptr->objectPath()); +        context->setFinished(objPath); +        return; +    } + +    DBusError error; +    QDBusObjectPath objPath = mInterface->mPriv->addContentCB(contentName, contentType, initialDirection, &error); +    if (error.isValid()) { +        context->setFinishedWithError(error.name(), error.message()); +        return; +    } +    context->setFinished(objPath); +} + +/** + * \class BaseChannelCallType + * \ingroup servicecm + * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel> + * + * \brief Base class for implementations of Channel.Type.Call + * + */ + +/** + * Class constructor. + */ +BaseChannelCallType::BaseChannelCallType(BaseChannel* channel, bool hardwareStreaming, +                                         uint initialTransport, +                                         bool initialAudio, +                                         bool initialVideo, +                                         QString initialAudioName, +                                         QString initialVideoName, +                                         bool mutableContents) +    : AbstractChannelInterface(TP_QT_IFACE_CHANNEL_TYPE_CALL), +      mPriv(new Private(this, channel, +                        hardwareStreaming, +                        initialTransport, +                        initialAudio, +                        initialVideo, +                        initialAudioName, +                        initialVideoName, +                        mutableContents)) +{ +} + +Tp::ObjectPathList BaseChannelCallType::contents() { +    return mPriv->contents; +} + +QVariantMap BaseChannelCallType::callStateDetails() { +    return mPriv->callStateDetails; +} + +uint BaseChannelCallType::callState() { +    return mPriv->callState; +} + +uint BaseChannelCallType::callFlags() { +    return mPriv->callFlags; +} + +Tp::CallStateReason BaseChannelCallType::callStateReason() { +    return mPriv->callStateReason; +} + +bool BaseChannelCallType::hardwareStreaming() { +    return mPriv->hardwareStreaming; +} + +Tp::CallMemberMap BaseChannelCallType::callMembers() { +    return mPriv->callMembers; +} + +Tp::HandleIdentifierMap BaseChannelCallType::memberIdentifiers() { +    return mPriv->memberIdentifiers; +} + +uint BaseChannelCallType::initialTransport() { +    return mPriv->initialTransport; +} + +bool BaseChannelCallType::initialAudio() { +    return mPriv->initialAudio; +} + +bool BaseChannelCallType::initialVideo() { +    return mPriv->initialVideo; +} + +QString BaseChannelCallType::initialVideoName() { +    return mPriv->initialVideoName; +} + +QString BaseChannelCallType::initialAudioName() { +    return mPriv->initialAudioName; +} + +bool BaseChannelCallType::mutableContents() { +    return mPriv->mutableContents; +} + +/** + * Class destructor. + */ +BaseChannelCallType::~BaseChannelCallType() +{ +    delete mPriv; +} + +QVariantMap BaseChannelCallType::immutableProperties() const +{ +    QVariantMap map; + +    map.insert(TP_QT_IFACE_CHANNEL_TYPE_CALL + QLatin1String(".HardwareStreaming"), +               QVariant::fromValue(mPriv->adaptee->hardwareStreaming())); +    map.insert(TP_QT_IFACE_CHANNEL_TYPE_CALL + QLatin1String(".InitialTransport"), +               QVariant::fromValue(mPriv->adaptee->initialTransport())); +    map.insert(TP_QT_IFACE_CHANNEL_TYPE_CALL + QLatin1String(".InitialAudio"), +               QVariant::fromValue(mPriv->adaptee->initialAudio())); +    map.insert(TP_QT_IFACE_CHANNEL_TYPE_CALL + QLatin1String(".InitialVideo"), +               QVariant::fromValue(mPriv->adaptee->initialVideo())); +    map.insert(TP_QT_IFACE_CHANNEL_TYPE_CALL + QLatin1String(".InitialAudioName"), +               QVariant::fromValue(mPriv->adaptee->initialAudioName())); +    map.insert(TP_QT_IFACE_CHANNEL_TYPE_CALL + QLatin1String(".InitialVideoName"), +               QVariant::fromValue(mPriv->adaptee->initialVideoName())); +    map.insert(TP_QT_IFACE_CHANNEL_TYPE_CALL + QLatin1String(".MutableContents"), +               QVariant::fromValue(mPriv->adaptee->mutableContents())); +    return map; +} + +void BaseChannelCallType::createAdaptor() +{ +    (void) new Service::ChannelTypeCallAdaptor(dbusObject()->dbusConnection(), +            mPriv->adaptee, dbusObject()); +} + +void BaseChannelCallType::setCallState(const Tp::CallState &state, uint flags, const Tp::CallStateReason &stateReason, const QVariantMap &callStateDetails) +{ +    mPriv->callState = state; +    mPriv->callFlags = flags; +    mPriv->callStateReason = stateReason; +    mPriv->callStateDetails = callStateDetails; +    emit mPriv->adaptee->callStateChanged(state, flags, stateReason, callStateDetails); +} + +void BaseChannelCallType::setAcceptCallback(const AcceptCallback &cb) +{ +    mPriv->acceptCB = cb; +} + +void BaseChannelCallType::setHangupCallback(const HangupCallback &cb) +{ +    mPriv->hangupCB = cb; +} + +void BaseChannelCallType::setSetRingingCallback(const SetRingingCallback &cb) +{ +    mPriv->setRingingCB = cb; +} + +void BaseChannelCallType::setSetQueuedCallback(const SetQueuedCallback &cb) +{ +    mPriv->setQueuedCB = cb; +} + +void BaseChannelCallType::setAddContentCallback(const AddContentCallback &cb) +{ +    mPriv->addContentCB = cb; +} + +void BaseChannelCallType::setMembersFlags(const Tp::CallMemberMap &flagsChanged, const Tp::HandleIdentifierMap &identifiers, const Tp::UIntList &removed, const Tp::CallStateReason &reason) +{ +    mPriv->callMembers = flagsChanged; +    mPriv->memberIdentifiers = identifiers; +    emit mPriv->adaptee->callMembersChanged(flagsChanged, identifiers, removed, reason); +} + +BaseCallContentPtr BaseChannelCallType::addContent(const QString &name, const Tp::MediaStreamType &type, const Tp::MediaStreamDirection &direction) +{ +    BaseCallContentPtr ptr = BaseCallContent::create(mPriv->channel->dbusConnection(), mPriv->channel, name, type, direction); +    DBusError error; +    ptr->registerObject(&error); +    QDBusObjectPath objpath; +    objpath.setPath(ptr->objectPath()); +    mPriv->contents.append(objpath); +    emit mPriv->adaptee->contentAdded(objpath); + +    return ptr; +} + +void BaseChannelCallType::addContent(BaseCallContentPtr content) +{ +    DBusError error; +    content->registerObject(&error); +    QDBusObjectPath objpath; +    objpath.setPath(content->objectPath()); +    mPriv->contents.append(objpath); +    emit mPriv->adaptee->contentAdded(objpath); +} + +// Chan.I.Hold +BaseChannelHoldInterface::Adaptee::Adaptee(BaseChannelHoldInterface *interface) +    : QObject(interface), +      mInterface(interface) +{ +} + +BaseChannelHoldInterface::Adaptee::~Adaptee() +{ +} + +struct TP_QT_NO_EXPORT BaseChannelHoldInterface::Private { +    Private(BaseChannelHoldInterface *parent, Tp::LocalHoldState state) +        : state(state), +          reason(Tp::LocalHoldStateReasonNone), +          adaptee(new BaseChannelHoldInterface::Adaptee(parent)) { +    } + +    SetHoldStateCallback setHoldStateCB; +    Tp::LocalHoldState state; +    Tp::LocalHoldStateReason reason; +    BaseChannelHoldInterface::Adaptee *adaptee; +}; + +void BaseChannelHoldInterface::Adaptee::getHoldState(const Tp::Service::ChannelInterfaceHoldAdaptor::GetHoldStateContextPtr &context) +{ +    context->setFinished(mInterface->getHoldState(), mInterface->getHoldReason()); +} + +void BaseChannelHoldInterface::Adaptee::requestHold(bool hold, const Tp::Service::ChannelInterfaceHoldAdaptor::RequestHoldContextPtr &context) +{ +    if (!mInterface->mPriv->setHoldStateCB.isValid()) { +        context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")); +        return; +    } + +    Tp::LocalHoldState state = hold ? Tp::LocalHoldStateHeld : Tp::LocalHoldStateUnheld; + +    DBusError error; +    mInterface->mPriv->setHoldStateCB(state, Tp::LocalHoldStateReasonRequested, &error); +    if (error.isValid()) { +        context->setFinishedWithError(error.name(), error.message()); +        return; +    } +    context->setFinished(); +} + +/** + * \class BaseChannelHoldInterface + * \ingroup servicecm + * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel> + * + * \brief Base class for implementations of Channel.Interface.Hold + * + */ + +/** + * Class constructor. + */ +BaseChannelHoldInterface::BaseChannelHoldInterface() +    : AbstractChannelInterface(TP_QT_IFACE_CHANNEL_INTERFACE_HOLD), +      mPriv(new Private(this, Tp::LocalHoldStateUnheld)) +{ +} + +Tp::LocalHoldState BaseChannelHoldInterface::getHoldState() const +{ +    return mPriv->state; +} + +Tp::LocalHoldStateReason BaseChannelHoldInterface::getHoldReason() const +{ +    return mPriv->reason; +} + +void BaseChannelHoldInterface::setSetHoldStateCallback(const SetHoldStateCallback &cb) +{ +    mPriv->setHoldStateCB = cb; +} + +void BaseChannelHoldInterface::setHoldState(const Tp::LocalHoldState &state, const Tp::LocalHoldStateReason &reason) +{ +    if (mPriv->state != state) { +        mPriv->state = state; +        mPriv->reason = reason; +        emit mPriv->adaptee->holdStateChanged(state, reason); +    } +} + +/** + * Class destructor. + */ +BaseChannelHoldInterface::~BaseChannelHoldInterface() +{ +    delete mPriv; +} + +/** + * Return the immutable properties of this interface. + * + * Immutable properties cannot change after the interface has been registered + * on a service on the bus with registerInterface(). + * + * \return The immutable properties of this interface. + */ +QVariantMap BaseChannelHoldInterface::immutableProperties() const +{ +    QVariantMap map; +    return map; +} + +void BaseChannelHoldInterface::createAdaptor() +{ +    (void) new Service::ChannelInterfaceHoldAdaptor(dbusObject()->dbusConnection(), +            mPriv->adaptee, dbusObject()); +} + + +// Chan.I.MergeableConference +BaseChannelMergeableConferenceInterface::Adaptee::Adaptee(BaseChannelMergeableConferenceInterface *interface) +    : QObject(interface), +      mInterface(interface) +{ +} + +BaseChannelMergeableConferenceInterface::Adaptee::~Adaptee() +{ +} + +struct TP_QT_NO_EXPORT BaseChannelMergeableConferenceInterface::Private { +    Private(BaseChannelMergeableConferenceInterface *parent) +        :adaptee(new BaseChannelMergeableConferenceInterface::Adaptee(parent)) { +    } + +    MergeCallback mergeCB; +    BaseChannelMergeableConferenceInterface::Adaptee *adaptee; +}; + +void BaseChannelMergeableConferenceInterface::Adaptee::merge(const QDBusObjectPath &channelPath, const Tp::Service::ChannelInterfaceMergeableConferenceAdaptor::MergeContextPtr &context) +{ +    if (!mInterface->mPriv->mergeCB.isValid()) { +        context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")); +        return; +    } + +    DBusError error; +    mInterface->mPriv->mergeCB(channelPath, &error); +    if (error.isValid()) { +        context->setFinishedWithError(error.name(), error.message()); +        return; +    } +    context->setFinished(); +} + +/** + * \class BaseChannelMergeableConferenceInterface + * \ingroup servicecm + * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel> + * + * \brief Base class for implementations of Channel.Interface.MergeableConference + * + */ + +/** + * Class constructor. + */ +BaseChannelMergeableConferenceInterface::BaseChannelMergeableConferenceInterface() +    : AbstractChannelInterface(TP_QT_FUTURE_IFACE_CHANNEL_INTERFACE_MERGEABLE_CONFERENCE), +      mPriv(new Private(this)) +{ +} + +void BaseChannelMergeableConferenceInterface::setMergeCallback(const MergeCallback &cb) +{ +    mPriv->mergeCB = cb; +} + +/** + * Class destructor. + */ +BaseChannelMergeableConferenceInterface::~BaseChannelMergeableConferenceInterface() +{ +    delete mPriv; +} + +/** + * Return the immutable properties of this interface. + * + * Immutable properties cannot change after the interface has been registered + * on a service on the bus with registerInterface(). + * + * \return The immutable properties of this interface. + */ +QVariantMap BaseChannelMergeableConferenceInterface::immutableProperties() const +{ +    QVariantMap map; +    return map; +} + +void BaseChannelMergeableConferenceInterface::createAdaptor() +{ +    (void) new Service::ChannelInterfaceMergeableConferenceAdaptor(dbusObject()->dbusConnection(), +            mPriv->adaptee, dbusObject()); +} + + +// Chan.I.Splittable +BaseChannelSplittableInterface::Adaptee::Adaptee(BaseChannelSplittableInterface *interface) +    : QObject(interface), +      mInterface(interface) +{ +} + +BaseChannelSplittableInterface::Adaptee::~Adaptee() +{ +} + +struct TP_QT_NO_EXPORT BaseChannelSplittableInterface::Private { +    Private(BaseChannelSplittableInterface *parent) +        :adaptee(new BaseChannelSplittableInterface::Adaptee(parent)) { +    } + +    SplitCallback splitCB; +    BaseChannelSplittableInterface::Adaptee *adaptee; +}; + +void BaseChannelSplittableInterface::Adaptee::split(const Tp::Service::ChannelInterfaceSplittableAdaptor::SplitContextPtr &context) +{ +    if (!mInterface->mPriv->splitCB.isValid()) { +        context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")); +        return; +    } + +    DBusError error; +    mInterface->mPriv->splitCB(&error); +    if (error.isValid()) { +        context->setFinishedWithError(error.name(), error.message()); +        return; +    } +    context->setFinished(); +} + +/** + * \class BaseChannelSplittableInterface + * \ingroup servicecm + * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel> + * + * \brief Base class for implementations of Channel.Interface.Splittable + * + */ + +/** + * Class constructor. + */ +BaseChannelSplittableInterface::BaseChannelSplittableInterface() +    : AbstractChannelInterface(TP_QT_FUTURE_IFACE_CHANNEL_INTERFACE_SPLITTABLE), +      mPriv(new Private(this)) +{ +} + +void BaseChannelSplittableInterface::setSplitCallback(const SplitCallback &cb) +{ +    mPriv->splitCB = cb; +} + +/** + * Class destructor. + */ +BaseChannelSplittableInterface::~BaseChannelSplittableInterface() +{ +    delete mPriv; +} + +/** + * Return the immutable properties of this interface. + * + * Immutable properties cannot change after the interface has been registered + * on a service on the bus with registerInterface(). + * + * \return The immutable properties of this interface. + */ +QVariantMap BaseChannelSplittableInterface::immutableProperties() const +{ +    QVariantMap map; +    return map; +} + +void BaseChannelSplittableInterface::createAdaptor() +{ +    (void) new Service::ChannelInterfaceSplittableAdaptor(dbusObject()->dbusConnection(), +            mPriv->adaptee, dbusObject()); +} + + +// Chan.I.Conference +BaseChannelConferenceInterface::Adaptee::Adaptee(BaseChannelConferenceInterface *interface) +    : QObject(interface), +      mInterface(interface) +{ +} + +BaseChannelConferenceInterface::Adaptee::~Adaptee() +{ +} + +struct TP_QT_NO_EXPORT BaseChannelConferenceInterface::Private { +    Private(BaseChannelConferenceInterface *parent, +            Tp::ObjectPathList initialChannels, +            Tp::UIntList initialInviteeHandles, +            QStringList initialInviteeIDs, +            QString invitationMessage, +            ChannelOriginatorMap originalChannels) : +        channels(initialChannels), +        initialChannels(initialChannels), +        initialInviteeHandles(initialInviteeHandles), +        initialInviteeIDs(initialInviteeIDs), +        invitationMessage(invitationMessage), +        originalChannels(originalChannels), +        adaptee(new BaseChannelConferenceInterface::Adaptee(parent)) { +    } +    Tp::ObjectPathList channels; +    Tp::ObjectPathList initialChannels; +    Tp::UIntList initialInviteeHandles; +    QStringList initialInviteeIDs; +    QString invitationMessage; +    ChannelOriginatorMap originalChannels; + +    BaseChannelConferenceInterface::Adaptee *adaptee; +}; + +/** + * \class BaseChannelConferenceInterface + * \ingroup servicecm + * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel> + * + * \brief Base class for implementations of Channel.Interface.Conference + * + */ + +/** + * Class constructor. + */ +BaseChannelConferenceInterface::BaseChannelConferenceInterface(Tp::ObjectPathList initialChannels, +    Tp::UIntList initialInviteeHandles, +    QStringList initialInviteeIDs, +    QString invitationMessage, +    ChannelOriginatorMap originalChannels) +    : AbstractChannelInterface(TP_QT_IFACE_CHANNEL_INTERFACE_CONFERENCE), +      mPriv(new Private(this, initialChannels, initialInviteeHandles, initialInviteeIDs, invitationMessage, originalChannels)) +{ +} + +Tp::ObjectPathList BaseChannelConferenceInterface::channels() const +{ +    return mPriv->channels; +} + +Tp::ObjectPathList BaseChannelConferenceInterface::initialChannels() const +{ +    return mPriv->initialChannels; +} + +Tp::UIntList BaseChannelConferenceInterface::initialInviteeHandles() const +{ +    return mPriv->initialInviteeHandles; +} + +QStringList BaseChannelConferenceInterface::initialInviteeIDs() const +{ +    return mPriv->initialInviteeIDs; +} + +QString BaseChannelConferenceInterface::invitationMessage() const +{ +    return mPriv->invitationMessage; +} + +void BaseChannelConferenceInterface::mergeChannel(const QDBusObjectPath &channel, uint channelHandle, const QVariantMap &properties) +{ +    mPriv->channels.append(channel); +    if (channelHandle != 0) { +        mPriv->originalChannels[channelHandle] = channel; +    } +    emit mPriv->adaptee->channelMerged(channel, channelHandle, properties); +} + + +void BaseChannelConferenceInterface::removeChannel(const QDBusObjectPath &channel, const QVariantMap& details) +{ +    mPriv->channels.removeAll(channel); +    if (mPriv->originalChannels.values().contains(channel)) { +        mPriv->originalChannels.remove(mPriv->originalChannels.key(channel)); +    } +    emit mPriv->adaptee->channelRemoved(channel, details); +} + +ChannelOriginatorMap BaseChannelConferenceInterface::originalChannels() const +{ +    return mPriv->originalChannels; +} + +/** + * Class destructor. + */ +BaseChannelConferenceInterface::~BaseChannelConferenceInterface() +{ +    delete mPriv; +} + +/** + * Return the immutable properties of this interface. + * + * Immutable properties cannot change after the interface has been registered + * on a service on the bus with registerInterface(). + * + * \return The immutable properties of this interface. + */ +QVariantMap BaseChannelConferenceInterface::immutableProperties() const +{ +    QVariantMap map; +    return map; +} + +void BaseChannelConferenceInterface::createAdaptor() +{ +    (void) new Service::ChannelInterfaceConferenceAdaptor(dbusObject()->dbusConnection(), +            mPriv->adaptee, dbusObject()); +} +  } diff --git a/TelepathyQt/base-channel.h b/TelepathyQt/base-channel.h index f9fde8ee..9a8bfc30 100644 --- a/TelepathyQt/base-channel.h +++ b/TelepathyQt/base-channel.h @@ -515,5 +515,262 @@ private:      Private *mPriv;  }; +class TP_QT_EXPORT BaseChannelCallType : public AbstractChannelInterface +{ +    Q_OBJECT +    Q_DISABLE_COPY(BaseChannelCallType) + +public: +    static BaseChannelCallTypePtr create(BaseChannel* channel, bool hardwareStreaming, +                                         uint initialTransport, +                                         bool initialAudio, +                                         bool initialVideo, +                                         QString initialAudioName, +                                         QString initialVideoName, +                                         bool mutableContents = false) { +        return BaseChannelCallTypePtr(new BaseChannelCallType(channel, +                                                              hardwareStreaming, +                                                              initialTransport, +                                                              initialAudio, +                                                              initialVideo, +                                                              initialAudioName, +                                                              initialVideoName, +                                                              mutableContents)); +    } +    template<typename BaseChannelCallTypeSubclass> +    static SharedPtr<BaseChannelCallTypeSubclass> create(BaseChannel* channel, bool hardwareStreaming, +                                                         uint initialTransport, +                                                         bool initialAudio, +                                                         bool initialVideo, +                                                         QString initialAudioName, +                                                         QString initialVideoName, +                                                         bool mutableContents = false) { +        return SharedPtr<BaseChannelCallTypeSubclass>( +                   new BaseChannelCallTypeSubclass(channel, +                                                   hardwareStreaming, +                                                   initialTransport, +                                                   initialAudio, +                                                   initialVideo, +                                                   initialAudioName, +                                                   initialVideoName, +                                                   mutableContents)); +    } + +    typedef Callback2<QDBusObjectPath, const QVariantMap&, DBusError*> CreateChannelCallback; +    CreateChannelCallback createChannel; + +    typedef Callback2<bool, const QVariantMap&, DBusError*> EnsureChannelCallback; +    EnsureChannelCallback ensureChannel; + +    virtual ~BaseChannelCallType(); + +    QVariantMap immutableProperties() const; + +    Tp::ObjectPathList contents(); +    QVariantMap callStateDetails(); +    uint callState(); +    uint callFlags(); +    Tp::CallStateReason callStateReason(); +    bool hardwareStreaming(); +    Tp::CallMemberMap callMembers(); +    Tp::HandleIdentifierMap memberIdentifiers(); +    uint initialTransport(); +    bool initialAudio(); +    bool initialVideo(); +    QString initialAudioName(); +    QString initialVideoName(); +    bool mutableContents(); + +    typedef Callback1<void, DBusError*> AcceptCallback; +    void setAcceptCallback(const AcceptCallback &cb); + +    typedef Callback4<void, uint, const QString &, const QString &, DBusError*> HangupCallback; +    void setHangupCallback(const HangupCallback &cb); + +    typedef Callback1<void, DBusError*> SetRingingCallback; +    void setSetRingingCallback(const SetRingingCallback &cb); + +    typedef Callback1<void, DBusError*> SetQueuedCallback; +    void setSetQueuedCallback(const SetQueuedCallback &cb); + +    typedef Callback4<QDBusObjectPath, const QString&, const Tp::MediaStreamType&, const Tp::MediaStreamDirection&, DBusError*> AddContentCallback; +    void setAddContentCallback(const AddContentCallback &cb); + +    void setCallState(const Tp::CallState &state, uint flags, const Tp::CallStateReason &stateReason, const QVariantMap &callStateDetails); +    void setMembersFlags(const Tp::CallMemberMap &flagsChanged, const Tp::HandleIdentifierMap &identifiers, const Tp::UIntList &removed, const Tp::CallStateReason &reason); +    BaseCallContentPtr addContent(const QString &name, const Tp::MediaStreamType &type, const Tp::MediaStreamDirection &direction); +    void addContent(BaseCallContentPtr content); + +    Tp::RequestableChannelClassList requestableChannelClasses; + +protected: +    BaseChannelCallType(BaseChannel* channel, +                        bool hardwareStreaming, +                        uint initialTransport, +                        bool initialAudio, +                        bool initialVideo, +                        QString initialAudioName, +                        QString initialVideoName, +                        bool mutableContents = false); + +private: +    void createAdaptor(); + +    class Adaptee; +    friend class Adaptee; +    struct Private; +    friend struct Private; +    Private *mPriv; +}; + +class TP_QT_EXPORT BaseChannelHoldInterface : public AbstractChannelInterface +{ +    Q_OBJECT +    Q_DISABLE_COPY(BaseChannelHoldInterface) + +public: +    static BaseChannelHoldInterfacePtr create() { +        return BaseChannelHoldInterfacePtr(new BaseChannelHoldInterface()); +    } +    template<typename BaseChannelHoldInterfaceSubclass> +    static SharedPtr<BaseChannelHoldInterfaceSubclass> create() { +        return SharedPtr<BaseChannelHoldInterfaceSubclass>( +                   new BaseChannelHoldInterfaceSubclass()); +    } +    virtual ~BaseChannelHoldInterface(); + +    QVariantMap immutableProperties() const; + +    Tp::LocalHoldState getHoldState() const; +    Tp::LocalHoldStateReason getHoldReason() const; +    void setHoldState(const Tp::LocalHoldState &state, const Tp::LocalHoldStateReason &reason); + +    typedef Callback3<void, const Tp::LocalHoldState&, const Tp::LocalHoldStateReason &, DBusError*> SetHoldStateCallback; +    void setSetHoldStateCallback(const SetHoldStateCallback &cb); +Q_SIGNALS: +    void holdStateChanged(const Tp::LocalHoldState &state, const Tp::LocalHoldStateReason &reason); +private: +    BaseChannelHoldInterface(); +    void createAdaptor(); + +    class Adaptee; +    friend class Adaptee; +    struct Private; +    friend struct Private; +    Private *mPriv; +}; + +class TP_QT_EXPORT BaseChannelMergeableConferenceInterface : public AbstractChannelInterface +{ +    Q_OBJECT +    Q_DISABLE_COPY(BaseChannelMergeableConferenceInterface) + +public: +    static BaseChannelMergeableConferenceInterfacePtr create() { +        return BaseChannelMergeableConferenceInterfacePtr(new BaseChannelMergeableConferenceInterface()); +    } +    template<typename BaseChannelMergeableConferenceInterfaceSubclass> +    static SharedPtr<BaseChannelMergeableConferenceInterfaceSubclass> create() { +        return SharedPtr<BaseChannelMergeableConferenceInterfaceSubclass>( +                   new BaseChannelMergeableConferenceInterfaceSubclass()); +    } +    virtual ~BaseChannelMergeableConferenceInterface(); + +    QVariantMap immutableProperties() const; + +    void merge(const QDBusObjectPath &channel); + +    typedef Callback2<void, const QDBusObjectPath&, DBusError*> MergeCallback; +    void setMergeCallback(const MergeCallback &cb); +private: +    BaseChannelMergeableConferenceInterface(); +    void createAdaptor(); + +    class Adaptee; +    friend class Adaptee; +    struct Private; +    friend struct Private; +    Private *mPriv; +}; + +class TP_QT_EXPORT BaseChannelSplittableInterface : public AbstractChannelInterface +{ +    Q_OBJECT +    Q_DISABLE_COPY(BaseChannelSplittableInterface) + +public: +    static BaseChannelSplittableInterfacePtr create() { +        return BaseChannelSplittableInterfacePtr(new BaseChannelSplittableInterface()); +    } +    template<typename BaseChannelSplittableInterfaceSubclass> +    static SharedPtr<BaseChannelSplittableInterfaceSubclass> create() { +        return SharedPtr<BaseChannelSplittableInterfaceSubclass>( +                   new BaseChannelSplittableInterfaceSubclass()); +    } +    virtual ~BaseChannelSplittableInterface(); + +    QVariantMap immutableProperties() const; + +    void split(); + +    typedef Callback1<void, DBusError*> SplitCallback; +    void setSplitCallback(const SplitCallback &cb); +private: +    BaseChannelSplittableInterface(); +    void createAdaptor(); + +    class Adaptee; +    friend class Adaptee; +    struct Private; +    friend struct Private; +    Private *mPriv; +}; + +class TP_QT_EXPORT BaseChannelConferenceInterface : public AbstractChannelInterface +{ +    Q_OBJECT +    Q_DISABLE_COPY(BaseChannelConferenceInterface) + +public: +    static BaseChannelConferenceInterfacePtr create(Tp::ObjectPathList initialChannels = Tp::ObjectPathList(), +            Tp::UIntList initialInviteeHandles = Tp::UIntList(), +            QStringList initialInviteeIDs = QStringList(), +            QString invitationMessage = QString(), +            ChannelOriginatorMap originalChannels = ChannelOriginatorMap()) { +        return BaseChannelConferenceInterfacePtr(new BaseChannelConferenceInterface(initialChannels, initialInviteeHandles, initialInviteeIDs, invitationMessage, originalChannels)); +    } +    template<typename BaseChannelConferenceInterfaceSubclass> +    static SharedPtr<BaseChannelConferenceInterfaceSubclass> create(Tp::ObjectPathList initialChannels = Tp::ObjectPathList(), +            Tp::UIntList initialInviteeHandles = Tp::UIntList(), +            QStringList initialInviteeIDs = QStringList(), +            QString invitationMessage = QString(), +            ChannelOriginatorMap originalChannels = ChannelOriginatorMap()) { +        return SharedPtr<BaseChannelConferenceInterfaceSubclass>( +                   new BaseChannelConferenceInterfaceSubclass(initialChannels, initialInviteeHandles, initialInviteeIDs, invitationMessage, originalChannels)); +    } +    virtual ~BaseChannelConferenceInterface(); + +    QVariantMap immutableProperties() const; +    Tp::ObjectPathList channels() const; +    Tp::ObjectPathList initialChannels() const; +    Tp::UIntList initialInviteeHandles() const; +    QStringList initialInviteeIDs() const; +    QString invitationMessage() const; +    ChannelOriginatorMap originalChannels() const; + +    void mergeChannel(const QDBusObjectPath &channel, uint channelHandle, const QVariantMap &properties); +    void removeChannel(const QDBusObjectPath &channel, const QVariantMap &details); + +private: +    BaseChannelConferenceInterface(Tp::ObjectPathList initialChannels, Tp::UIntList initialInviteeHandles, QStringList initialInviteeIDs, QString invitationMessage, ChannelOriginatorMap originalChannels); +    void createAdaptor(); + +    class Adaptee; +    friend class Adaptee; +    struct Private; +    friend struct Private; +    Private *mPriv; +}; +  }  #endif diff --git a/TelepathyQt/call-interfaces.xml b/TelepathyQt/call-interfaces.xml new file mode 100644 index 00000000..429cbc2b --- /dev/null +++ b/TelepathyQt/call-interfaces.xml @@ -0,0 +1,9 @@ +<tp:spec +  xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0" +  xmlns:xi="http://www.w3.org/2001/XInclude"> + +<tp:title>Call interfaces, version 1</tp:title> + +<xi:include href="../spec/Call_Interface_Mute.xml" /> + +</tp:spec> diff --git a/TelepathyQt/service-types.h b/TelepathyQt/service-types.h index e9bcf0de..c93d3631 100644 --- a/TelepathyQt/service-types.h +++ b/TelepathyQt/service-types.h @@ -33,8 +33,12 @@ namespace Tp  {  class AbstractProtocolInterface; +class AbstractCallContentInterface;  class AbstractConnectionInterface;  class AbstractChannelInterface; +class BaseCallContent; +class BaseCallMuteInterface; +class BaseCallContentDTMFInterface;  class BaseConnection;  class BaseConnectionRequestsInterface;  class BaseConnectionContactsInterface; @@ -51,6 +55,7 @@ class BaseProtocolAvatarsInterface;  class BaseProtocolPresenceInterface;  class BaseChannel;  class BaseChannelTextType; +class BaseChannelCallType;  class BaseChannelMessagesInterface;  class BaseChannelServerAuthenticationType;  class BaseChannelSASLAuthenticationInterface; @@ -58,13 +63,21 @@ class BaseChannelCaptchaAuthenticationInterface;  class BaseChannelSecurableInterface;  class BaseChannelChatStateInterface;  class BaseChannelGroupInterface; +class BaseChannelHoldInterface; +class BaseChannelMergeableConferenceInterface; +class BaseChannelSplittableInterface; +class BaseChannelConferenceInterface;  class DBusService;  #ifndef DOXYGEN_SHOULD_SKIP_THIS  typedef SharedPtr<AbstractProtocolInterface> AbstractProtocolInterfacePtr; +typedef SharedPtr<AbstractCallContentInterface> AbstractCallContentInterfacePtr;  typedef SharedPtr<AbstractConnectionInterface> AbstractConnectionInterfacePtr;  typedef SharedPtr<AbstractChannelInterface> AbstractChannelInterfacePtr; +typedef SharedPtr<BaseCallContent> BaseCallContentPtr; +typedef SharedPtr<BaseCallContentDTMFInterface> BaseCallContentDTMFInterfacePtr; +typedef SharedPtr<BaseCallMuteInterface> BaseCallMuteInterfacePtr;  typedef SharedPtr<BaseConnection> BaseConnectionPtr;  typedef SharedPtr<BaseConnectionRequestsInterface> BaseConnectionRequestsInterfacePtr;  typedef SharedPtr<BaseConnectionContactsInterface> BaseConnectionContactsInterfacePtr; @@ -80,6 +93,7 @@ typedef SharedPtr<BaseProtocolAddressingInterface> BaseProtocolAddressingInterfa  typedef SharedPtr<BaseProtocolAvatarsInterface> BaseProtocolAvatarsInterfacePtr;  typedef SharedPtr<BaseProtocolPresenceInterface> BaseProtocolPresenceInterfacePtr;  typedef SharedPtr<BaseChannel> BaseChannelPtr; +typedef SharedPtr<BaseChannelCallType> BaseChannelCallTypePtr;  typedef SharedPtr<BaseChannelTextType> BaseChannelTextTypePtr;  typedef SharedPtr<BaseChannelMessagesInterface> BaseChannelMessagesInterfacePtr;  typedef SharedPtr<BaseChannelServerAuthenticationType> BaseChannelServerAuthenticationTypePtr; @@ -88,6 +102,10 @@ typedef SharedPtr<BaseChannelCaptchaAuthenticationInterface> BaseChannelCaptchaA  typedef SharedPtr<BaseChannelSecurableInterface> BaseChannelSecurableInterfacePtr;  typedef SharedPtr<BaseChannelChatStateInterface> BaseChannelChatStateInterfacePtr;  typedef SharedPtr<BaseChannelGroupInterface> BaseChannelGroupInterfacePtr; +typedef SharedPtr<BaseChannelHoldInterface> BaseChannelHoldInterfacePtr; +typedef SharedPtr<BaseChannelMergeableConferenceInterface> BaseChannelMergeableConferenceInterfacePtr; +typedef SharedPtr<BaseChannelSplittableInterface> BaseChannelSplittableInterfacePtr; +typedef SharedPtr<BaseChannelConferenceInterface> BaseChannelConferenceInterfacePtr;  typedef SharedPtr<DBusService> DBusServicePtr;  #endif /* DOXYGEN_SHOULD_SKIP_THIS */ diff --git a/TelepathyQt/stable-interfaces.xml b/TelepathyQt/stable-interfaces.xml index d78879a7..4a4883ba 100644 --- a/TelepathyQt/stable-interfaces.xml +++ b/TelepathyQt/stable-interfaces.xml @@ -25,6 +25,8 @@  <xi:include href="call-content-media-description.xml"/>  <xi:include href="call-stream.xml"/>  <xi:include href="call-stream-endpoint.xml"/> +<xi:include href="call-interfaces.xml"/> +  <xi:include href="../spec/generic-types.xml"/>  <xi:include href="../spec/errors.xml"/> diff --git a/TelepathyQt/svc-call.xml b/TelepathyQt/svc-call.xml new file mode 100644 index 00000000..7db11a62 --- /dev/null +++ b/TelepathyQt/svc-call.xml @@ -0,0 +1,12 @@ +<tp:spec +  xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0" +  xmlns:xi="http://www.w3.org/2001/XInclude"> + +<tp:title>Call interfaces</tp:title> + +<xi:include href="../spec/Call_Content.xml"/> +<xi:include href="../spec/Call_Content_Interface_DTMF.xml"/> + +<xi:include href="../spec/Call_Interface_Mute.xml"/> + +</tp:spec> diff --git a/TelepathyQt/svc-channel.xml b/TelepathyQt/svc-channel.xml index 2df9cb06..e048321d 100644 --- a/TelepathyQt/svc-channel.xml +++ b/TelepathyQt/svc-channel.xml @@ -28,6 +28,7 @@  <xi:include href="../spec/Channel_Interface_Group.xml"/>  <xi:include href="../spec/Channel_Interface_Hold.xml"/>  <xi:include href="../spec/Channel_Interface_Media_Signalling.xml"/> +<xi:include href="../spec/Channel_Interface_Mergeable_Conference.xml"/>  <xi:include href="../spec/Channel_Interface_Messages.xml"/>  <xi:include href="../spec/Channel_Interface_Password.xml"/>  <xi:include href="../spec/Channel_Interface_Room.xml"/> @@ -36,6 +37,7 @@  <xi:include href="../spec/Channel_Interface_Securable.xml"/>  <xi:include href="../spec/Channel_Interface_Service_Point.xml"/>  <xi:include href="../spec/Channel_Interface_SMS.xml"/> +<xi:include href="../spec/Channel_Interface_Splittable.xml"/>  <xi:include href="../spec/Channel_Interface_Subject.xml"/>  </tp:spec> | 
