From 02d9b5893ef441656d70cbe702e0d2339ae5c6de Mon Sep 17 00:00:00 2001 From: Javier Date: Mon, 23 Mar 2015 03:57:44 +0100 Subject: use profiled via proxy --- saltoqd/voicecallmanager.cpp | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'saltoqd/voicecallmanager.cpp') diff --git a/saltoqd/voicecallmanager.cpp b/saltoqd/voicecallmanager.cpp index 3ef9223..8820dd6 100644 --- a/saltoqd/voicecallmanager.cpp +++ b/saltoqd/voicecallmanager.cpp @@ -1,18 +1,29 @@ #include #include "voicecallmanager.h" #include "voicecallmanager_interface.h" +#include "profiled_interface.h" +static ComNokiaProfiledInterface *profiled = NULL; static OrgNemomobileVoicecallVoiceCallManagerInterface *vcm = NULL; VoiceCallManager::VoiceCallManager(ToqManager *toq) : QObject(toq), _toq(toq) { + if (!profiled) { + profiled = new ComNokiaProfiledInterface("com.nokia.profiled", + "/com/nokia/profiled", + QDBusConnection::sessionBus()); + } if (!vcm) { vcm = new OrgNemomobileVoicecallVoiceCallManagerInterface("org.nemomobile.voicecall", "/", QDBusConnection::sessionBus()); } + // TODO Fix .xml to catch this signal + connect(profiled, SIGNAL(profile_changed(bool,bool,QString)), + this, SLOT(handleProfileChanged(bool,bool,QString))); + _toq->setEndpointListener(ToqConnection::VoiceCallEndpoint, this); } @@ -47,11 +58,8 @@ void VoiceCallManager::handleGetPhoneStatusMessage(const ToqConnection::Message QString VoiceCallManager::getCurrentProfile() { - QDBusConnection bus = QDBusConnection::sessionBus(); - QDBusReply resp = bus.call(QDBusMessage::createMethodCall("com.nokia.profiled", - "/com/nokia/profiled", - "com.nokia.profiled", - "get_profile")); + QDBusReply resp = profiled->get_profile(); + if (resp.isValid()) { return resp.value(); } else { @@ -62,12 +70,18 @@ QString VoiceCallManager::getCurrentProfile() void VoiceCallManager::setProfile(const QString &name) { - QDBusConnection bus = QDBusConnection::sessionBus(); - QDBusReply resp = bus.call(QDBusMessage::createMethodCall("com.nokia.profiled", - "/com/nokia/profiled", - "com.nokia.profiled", - "set_profile") << name); + QDBusReply resp = profiled->set_profile(name); + if (!resp.isValid()) { qWarning() << resp.error().message(); } } + +void VoiceCallManager::handleProfileChanged(bool changed, bool active, const QString &profile) +{ + Q_UNUSED(changed); + Q_UNUSED(active); + qDebug() << "Profile changed to" << profile; + // TODO +} + -- cgit v1.2.3