From 6a8cdaf2f718fef8a826fd98241050a7d3cbfb3d Mon Sep 17 00:00:00 2001 From: Tomasz Sterna Date: Fri, 11 Jul 2014 23:31:28 +0200 Subject: Use Log4Qt in daemon --- daemon/voicecallhandler.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'daemon/voicecallhandler.cpp') diff --git a/daemon/voicecallhandler.cpp b/daemon/voicecallhandler.cpp index 1a006f1..c8ffe89 100644 --- a/daemon/voicecallhandler.cpp +++ b/daemon/voicecallhandler.cpp @@ -48,7 +48,7 @@ VoiceCallHandler::VoiceCallHandler(const QString &handlerId, QObject *parent) : QObject(parent), d_ptr(new VoiceCallHandlerPrivate(this, handlerId)) { Q_D(VoiceCallHandler); - qDebug() << QString("Creating D-Bus interface to: ") + handlerId; + logger()->debug() << QString("Creating D-Bus interface to: ") + handlerId; d->interface = new QDBusInterface("org.nemomobile.voicecall", "/calls/" + handlerId, "org.nemomobile.voicecall.VoiceCall", @@ -178,7 +178,8 @@ method return sender=:1.13 -> dest=:1.150 reply_serial=2 QDBusReply reply = props.call("GetAll", d->interface->interface()); if (reply.isValid()) { QVariantMap props = reply.value(); - qDebug() << props; + QString str; QDebug(&str) << props; + logger()->debug() << str; d->providerId = props["providerId"].toString(); d->duration = props["duration"].toInt(); d->status = props["status"].toInt(); @@ -196,7 +197,7 @@ method return sender=:1.13 -> dest=:1.150 reply_serial=2 emit emergencyChanged(); emit forwardedChanged(); } else if (notifyError) { - qWarning() << "Failed to get VoiceCall properties from VCM D-Bus service."; + logger()->error() << "Failed to get VoiceCall properties from VCM D-Bus service."; emit this->error("Failed to get VoiceCall properties from VCM D-Bus service."); } } @@ -413,10 +414,10 @@ void VoiceCallHandler::onPendingCallFinished(QDBusPendingCallWatcher *watcher) QDBusPendingReply reply = *watcher; if (reply.isError()) { - qWarning() << QString::fromLatin1("Received error reply for member: %1 (%2)").arg(reply.reply().member()).arg(reply.error().message()); + logger()->error() << QString::fromLatin1("Received error reply for member: %1 (%2)").arg(reply.reply().member()).arg(reply.error().message()); emit this->error(reply.error().message()); watcher->deleteLater(); } else { - qDebug() << QString::fromLatin1("Received successful reply for member: %1").arg(reply.reply().member()); + logger()->debug() << QString::fromLatin1("Received successful reply for member: %1").arg(reply.reply().member()); } } -- cgit v1.2.3 From 9d03d21ad9affb57d3bad486e92eecd6b2a1df08 Mon Sep 17 00:00:00 2001 From: Tomasz Sterna Date: Sat, 12 Jul 2014 02:10:03 +0200 Subject: (Possibly) Fix 'Unknown' call notifications --- daemon/voicecallhandler.cpp | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'daemon/voicecallhandler.cpp') diff --git a/daemon/voicecallhandler.cpp b/daemon/voicecallhandler.cpp index c8ffe89..428785f 100644 --- a/daemon/voicecallhandler.cpp +++ b/daemon/voicecallhandler.cpp @@ -66,7 +66,6 @@ VoiceCallHandler::~VoiceCallHandler() void VoiceCallHandler::initialize(bool notifyError) { Q_D(VoiceCallHandler); - bool success = false; /* method return sender=:1.13 -> dest=:1.150 reply_serial=2 @@ -154,24 +153,12 @@ method return sender=:1.13 -> dest=:1.150 reply_serial=2 " */ - if(d->interface->isValid()) - { - success = true; - success &= (bool)QObject::connect(d->interface, SIGNAL(error(QString)), SIGNAL(error(QString))); - success &= (bool)QObject::connect(d->interface, SIGNAL(statusChanged()), SLOT(onStatusChanged())); - success &= (bool)QObject::connect(d->interface, SIGNAL(lineIdChanged()), SLOT(onLineIdChanged())); - success &= (bool)QObject::connect(d->interface, SIGNAL(durationChanged()), SLOT(onDurationChanged())); - success &= (bool)QObject::connect(d->interface, SIGNAL(startedAtChanged()), SLOT(onStartedAtChanged())); - success &= (bool)QObject::connect(d->interface, SIGNAL(emergencyChanged()), SLOT(onEmergencyChanged())); - success &= (bool)QObject::connect(d->interface, SIGNAL(multipartyChanged()), SLOT(onMultipartyChanged())); - success &= (bool)QObject::connect(d->interface, SIGNAL(forwardedChanged()), SLOT(onForwardedChanged())); - } - - if(!(d->connected = success)) + if (not d->connected) { QTimer::singleShot(2000, this, SLOT(initialize())); if(notifyError) emit this->error("Failed to connect to VCM D-Bus service."); - } else { + } + else if (d->interface->isValid()) { QDBusInterface props(d->interface->service(), d->interface->path(), "org.freedesktop.DBus.Properties", d->interface->connection()); @@ -196,10 +183,20 @@ method return sender=:1.13 -> dest=:1.150 reply_serial=2 emit multipartyChanged(); emit emergencyChanged(); emit forwardedChanged(); - } else if (notifyError) { + } + else { logger()->error() << "Failed to get VoiceCall properties from VCM D-Bus service."; - emit this->error("Failed to get VoiceCall properties from VCM D-Bus service."); + if (notifyError) emit this->error("Failed to get VoiceCall properties from VCM D-Bus service."); } + + connect(d->interface, SIGNAL(error(QString)), SIGNAL(error(QString))); + connect(d->interface, SIGNAL(statusChanged()), SLOT(onStatusChanged())); + connect(d->interface, SIGNAL(lineIdChanged()), SLOT(onLineIdChanged())); + connect(d->interface, SIGNAL(durationChanged()), SLOT(onDurationChanged())); + connect(d->interface, SIGNAL(startedAtChanged()), SLOT(onStartedAtChanged())); + connect(d->interface, SIGNAL(emergencyChanged()), SLOT(onEmergencyChanged())); + connect(d->interface, SIGNAL(multipartyChanged()), SLOT(onMultipartyChanged())); + connect(d->interface, SIGNAL(forwardedChanged()), SLOT(onForwardedChanged())); } } -- cgit v1.2.3