Skip to content

Commit

Permalink
Merge pull request #67 from jusa/use-ngfd-for-dtmf
Browse files Browse the repository at this point in the history
Use NGFD for DTMF tones.
  • Loading branch information
jusa committed May 8, 2015
2 parents 5531f5d + 43c5359 commit cc8ac16
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
2 changes: 2 additions & 0 deletions plugins/declarative/src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ uri = org.nemomobile.voicecall

#DEFINES += WANT_TRACE

PKGCONFIG += ngf-qt5

HEADERS += \
voicecallhandler.h \
voicecallmanager.h \
Expand Down
32 changes: 23 additions & 9 deletions plugins/declarative/src/voicecallmanager.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "common.h"
#include "voicecallmanager.h"

#include <NgfClient>

#include <QTimer>
#include <QDBusInterface>
#include <QDBusPendingReply>
Expand All @@ -16,6 +18,8 @@ class VoiceCallManagerPrivate
voicecalls(NULL),
providers(NULL),
activeVoiceCall(NULL),
ngf(0),
eventId(0),
connected(false)
{ /*...*/ }

Expand All @@ -28,6 +32,9 @@ class VoiceCallManagerPrivate

VoiceCallHandler* activeVoiceCall;

Ngf::Client *ngf;
quint32 eventId;

bool connected;
};

Expand Down Expand Up @@ -61,6 +68,9 @@ void VoiceCallManager::initialize(bool notifyError)
Q_D(VoiceCallManager);
bool success = false;

d->ngf = new Ngf::Client(this);
d->ngf->connect();

if(d->interface->isValid())
{
success = true;
Expand Down Expand Up @@ -230,13 +240,14 @@ bool VoiceCallManager::startDtmfTone(const QString &tone)
d->activeVoiceCall->sendDtmf(tone);
}

QDBusMessage toneStart = QDBusMessage::createMethodCall("com.Nokia.Telephony.Tones", "/com/Nokia/Telephony/Tones", "com.Nokia.Telephony.Tones", "StartEventTone");
QList<QVariant> arguments;
arguments << toneId;
arguments << 0;
arguments << (unsigned int)0;
toneStart.setArguments(arguments);
QDBusConnection::systemBus().asyncCall(toneStart);
QMap<QString, QVariant> properties;
properties.insert("tonegen.value", toneId);
if (d->eventId > 0)
{
d->ngf->stop(d->eventId);
}
d->eventId = d->ngf->play("dtmf", properties);

return true;
}

Expand All @@ -245,8 +256,11 @@ bool VoiceCallManager::stopDtmfTone()
TRACE
Q_D(VoiceCallManager);

QDBusMessage toneStop = QDBusMessage::createMethodCall("com.Nokia.Telephony.Tones", "/com/Nokia/Telephony/Tones", "com.Nokia.Telephony.Tones", "StopTone");
QDBusConnection::systemBus().asyncCall(toneStop);
if (d->eventId > 0)
{
d->ngf->stop(d->eventId);
d->eventId = 0;
}

return true;
}
Expand Down

0 comments on commit cc8ac16

Please sign in to comment.