Skip to content

Commit

Permalink
Merge branch 'conf_proto' into 'master'
Browse files Browse the repository at this point in the history
[voicecall] Conference call support. Contributes to JB#4743



See merge request !12
  • Loading branch information
Juho Hamalainen committed Aug 17, 2016
2 parents 4e6bff5 + b299b98 commit 826ccc2
Show file tree
Hide file tree
Showing 22 changed files with 756 additions and 111 deletions.
8 changes: 8 additions & 0 deletions lib/src/abstractvoicecallhandler.h
Expand Up @@ -44,6 +44,8 @@ class AbstractVoiceCallHandler : public QObject
Q_PROPERTY(bool isMultiparty READ isMultiparty NOTIFY multipartyChanged)
Q_PROPERTY(bool isForwarded READ isForwarded NOTIFY forwardedChanged)
Q_PROPERTY(bool isRemoteHeld READ isRemoteHeld NOTIFY remoteHeldChanged)
Q_PROPERTY(QString parentHandlerId READ parentHandlerId NOTIFY parentHandlerIdChanged)
Q_PROPERTY(QList<AbstractVoiceCallHandler*> childCalls READ childCalls NOTIFY childCallsChanged)

public:
enum VoiceCallStatus {
Expand Down Expand Up @@ -71,6 +73,8 @@ class AbstractVoiceCallHandler : public QObject
virtual bool isEmergency() const = 0;
virtual bool isForwarded() const = 0;
virtual bool isRemoteHeld() const = 0;
virtual QString parentHandlerId() const = 0;
virtual QList<AbstractVoiceCallHandler*> childCalls() const = 0;

virtual VoiceCallStatus status() const = 0;

Expand All @@ -86,13 +90,17 @@ class AbstractVoiceCallHandler : public QObject
void multipartyChanged(bool);
void forwardedChanged(bool);
void remoteHeldChanged(bool);
void parentHandlerIdChanged(QString);
void childCallsChanged();

public Q_SLOTS:
virtual void answer() = 0;
virtual void hangup() = 0;
virtual void hold(bool on) = 0;
virtual void deflect(const QString &target) = 0;
virtual void sendDtmf(const QString &tones) = 0;
virtual void merge(const QString &callHandle) = 0;
virtual void split() = 0;
};

#endif // ABSTRACTVOICECALLHANDLER_H
2 changes: 1 addition & 1 deletion lib/src/common.h
Expand Up @@ -29,7 +29,7 @@
# define TRACE
# define DEBUG_T(message) if (false) { };
#else
# define TRACE qDebug() << QString("VoiceCall T: %1:%2%").arg(Q_FUNC_INFO).arg(__LINE__);
# define TRACE qDebug() << QString("VoiceCall T: %1:%2").arg(Q_FUNC_INFO).arg(__LINE__) << this;
# define DEBUG_T(message) qDebug("%s", QString("VoiceCall D: %1: %2").arg(Q_FUNC_INFO).arg(message).toUtf8().constData());
#endif

Expand Down
65 changes: 54 additions & 11 deletions lib/src/dbus/voicecallhandlerdbusadapter.cpp
Expand Up @@ -59,6 +59,8 @@ VoiceCallHandlerDBusAdapter::VoiceCallHandlerDBusAdapter(AbstractVoiceCallHandle
QObject::connect(d->handler, SIGNAL(multipartyChanged(bool)), SIGNAL(multipartyChanged(bool)));
QObject::connect(d->handler, SIGNAL(forwardedChanged(bool)), SIGNAL(forwardedChanged(bool)));
QObject::connect(d->handler, SIGNAL(remoteHeldChanged(bool)), SIGNAL(remoteHeldChanged(bool)));
QObject::connect(d->handler, SIGNAL(parentHandlerIdChanged(QString)), SIGNAL(parentHandlerIdChanged(QString)));
QObject::connect(d->handler, &AbstractVoiceCallHandler::childCallsChanged, this, [this]() { emit childCallsChanged(childCalls()); });
}

VoiceCallHandlerDBusAdapter::~VoiceCallHandlerDBusAdapter()
Expand All @@ -74,7 +76,6 @@ VoiceCallHandlerDBusAdapter::~VoiceCallHandlerDBusAdapter()
*/
QString VoiceCallHandlerDBusAdapter::providerId() const
{
TRACE
Q_D(const VoiceCallHandlerDBusAdapter);
return d->handler->provider()->providerId();
}
Expand All @@ -84,7 +85,6 @@ QString VoiceCallHandlerDBusAdapter::providerId() const
*/
QString VoiceCallHandlerDBusAdapter::handlerId() const
{
TRACE
Q_D(const VoiceCallHandlerDBusAdapter);
return d->handler->handlerId();
}
Expand All @@ -94,7 +94,6 @@ QString VoiceCallHandlerDBusAdapter::handlerId() const
*/
QString VoiceCallHandlerDBusAdapter::lineId() const
{
TRACE
Q_D(const VoiceCallHandlerDBusAdapter);
return d->handler->lineId();
}
Expand All @@ -104,7 +103,6 @@ QString VoiceCallHandlerDBusAdapter::lineId() const
*/
QDateTime VoiceCallHandlerDBusAdapter::startedAt() const
{
TRACE
Q_D(const VoiceCallHandlerDBusAdapter);
return d->handler->startedAt();
}
Expand All @@ -114,7 +112,6 @@ QDateTime VoiceCallHandlerDBusAdapter::startedAt() const
*/
int VoiceCallHandlerDBusAdapter::duration() const
{
TRACE
Q_D(const VoiceCallHandlerDBusAdapter);
return d->handler->duration();
}
Expand All @@ -124,7 +121,6 @@ int VoiceCallHandlerDBusAdapter::duration() const
*/
bool VoiceCallHandlerDBusAdapter::isIncoming() const
{
TRACE
Q_D(const VoiceCallHandlerDBusAdapter);
return d->handler->isIncoming();
}
Expand All @@ -134,7 +130,6 @@ bool VoiceCallHandlerDBusAdapter::isIncoming() const
*/
bool VoiceCallHandlerDBusAdapter::isMultiparty() const
{
TRACE
Q_D(const VoiceCallHandlerDBusAdapter);
return d->handler->isMultiparty();
}
Expand All @@ -144,7 +139,6 @@ bool VoiceCallHandlerDBusAdapter::isMultiparty() const
*/
bool VoiceCallHandlerDBusAdapter::isForwarded() const
{
TRACE
Q_D(const VoiceCallHandlerDBusAdapter);
return d->handler->isForwarded();
}
Expand All @@ -154,11 +148,19 @@ bool VoiceCallHandlerDBusAdapter::isForwarded() const
*/
bool VoiceCallHandlerDBusAdapter::isRemoteHeld() const
{
TRACE
Q_D(const VoiceCallHandlerDBusAdapter);
return d->handler->isRemoteHeld();
}

/*!
Returns this voice calls' multiparty call handlerId property.
*/
QString VoiceCallHandlerDBusAdapter::parentHandlerId() const
{
Q_D(const VoiceCallHandlerDBusAdapter);
return d->handler->parentHandlerId();
}

/*!
Returns this voice calls' emergency flag property.
*/
Expand All @@ -174,7 +176,6 @@ bool VoiceCallHandlerDBusAdapter::isEmergency() const
*/
int VoiceCallHandlerDBusAdapter::status() const
{
TRACE
Q_D(const VoiceCallHandlerDBusAdapter);
return (int)d->handler->status();
}
Expand All @@ -184,7 +185,6 @@ int VoiceCallHandlerDBusAdapter::status() const
*/
QString VoiceCallHandlerDBusAdapter::statusText() const
{
TRACE
Q_D(const VoiceCallHandlerDBusAdapter);
return d->handler->statusText();
}
Expand Down Expand Up @@ -215,6 +215,23 @@ bool VoiceCallHandlerDBusAdapter::hangup()
return true;
}

/*!
Returns a list of current voice call handler ids contained by this conference call.
*/
QStringList VoiceCallHandlerDBusAdapter::childCalls() const
{
TRACE
Q_D(const VoiceCallHandlerDBusAdapter);
QStringList results;

foreach(AbstractVoiceCallHandler *handler, d->handler->childCalls())
{
results.append(handler->handlerId());
}

return results;
}

/*!
Initiates holding this voice call, if its' currently not disconnected.
Expand Down Expand Up @@ -248,6 +265,30 @@ void VoiceCallHandlerDBusAdapter::sendDtmf(const QString &tones)
d->handler->sendDtmf(tones);
}

/*!
If this call is not already a conference call then the two calls
are merged into a conference, otherwise the call is added to the
conference. For GSM one call must be active and the other held.
*/
bool VoiceCallHandlerDBusAdapter::merge(const QString &callHandle)
{
TRACE
Q_D(VoiceCallHandlerDBusAdapter);
d->handler->merge(callHandle);
return true;
}

/*!
Initiates splitting this call from a conference call.
*/
bool VoiceCallHandlerDBusAdapter::split()
{
TRACE
Q_D(VoiceCallHandlerDBusAdapter);
d->handler->split();
return true;
}

QVariantMap VoiceCallHandlerDBusAdapter::getProperties()
{
TRACE
Expand All @@ -265,6 +306,8 @@ QVariantMap VoiceCallHandlerDBusAdapter::getProperties()
props.insert("isMultiparty", QVariant(isMultiparty()));
props.insert("isForwarded", QVariant(isForwarded()));
props.insert("isRemoteHeld", QVariant(isRemoteHeld()));
props.insert("parentHandlerId", QVariant(parentHandlerId()));
props.insert("childCalls", QVariant(childCalls()));

return props;
}
Expand Down
8 changes: 8 additions & 0 deletions lib/src/dbus/voicecallhandlerdbusadapter.h
Expand Up @@ -43,6 +43,8 @@ class VoiceCallHandlerDBusAdapter : public QDBusAbstractAdaptor
Q_PROPERTY(bool isMultiparty READ isMultiparty NOTIFY multipartyChanged)
Q_PROPERTY(bool isForwarded READ isForwarded NOTIFY forwardedChanged)
Q_PROPERTY(bool isRemoteHeld READ isRemoteHeld NOTIFY remoteHeldChanged)
Q_PROPERTY(QString parentHandlerId READ parentHandlerId NOTIFY parentHandlerIdChanged)
Q_PROPERTY(QStringList childCalls READ childCalls NOTIFY childCallsChanged)

public:
explicit VoiceCallHandlerDBusAdapter(AbstractVoiceCallHandler *parent = 0);
Expand All @@ -60,6 +62,8 @@ class VoiceCallHandlerDBusAdapter : public QDBusAbstractAdaptor
bool isEmergency() const;
bool isForwarded() const;
bool isRemoteHeld() const;
QString parentHandlerId() const;
QStringList childCalls() const;

Q_SIGNALS:
void error(const QString &message);
Expand All @@ -71,13 +75,17 @@ class VoiceCallHandlerDBusAdapter : public QDBusAbstractAdaptor
void multipartyChanged(bool);
void forwardedChanged(bool);
void remoteHeldChanged(bool);
void parentHandlerIdChanged(QString);
void childCallsChanged(QStringList);

public Q_SLOTS:
bool answer();
bool hangup();
bool hold(bool on);
bool deflect(const QString &target);
void sendDtmf(const QString &tones);
bool merge(const QString &callHandle);
bool split();
QVariantMap getProperties();

private Q_SLOTS:
Expand Down
2 changes: 2 additions & 0 deletions lib/src/src.pro
Expand Up @@ -3,6 +3,8 @@ TARGET = voicecall

QT = core dbus

CONFIG += c++11

#DEFINES += WANT_TRACE

HEADERS += \
Expand Down

0 comments on commit 826ccc2

Please sign in to comment.