I have made the following changes intended for : CE:Apps / voicecall Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below.
https://build.pub.meego.com//request/show/7654 Thank You, tswindell [This message was auto-generated] --- Request # 7654: Messages from BOSS: State: review at 2013-01-11T13:57:33 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: home:tswindell:CE:Apps / voicecall -> CE:Apps / voicecall changes files: -------------- --- voicecall.changes +++ voicecall.changes @@ -0,0 +1,6 @@ +* Fri Jan 11 2013 Tom Swindell <[email protected]> - 0.3.3 +- Audio routing clean-up +- Fixed handling of call status in telepathy provider +- Fixed NGF VOIP ringtone handling +- Added initial API and framework for call holding + old: ---- voicecall-0.3.2.tar.gz new: ---- voicecall-0.3.3.tar.gz spec files: ----------- --- voicecall.spec +++ voicecall.spec @@ -1,6 +1,6 @@ Name: voicecall Summary: Voice Call Suite -Version: 0.3.2 +Version: 0.3.3 Release: 1 Group: Communications/Telephony and IM License: Apache License, Version 2.0 other changes: -------------- ++++++ voicecall-0.3.2.tar.gz -> voicecall-0.3.3.tar.gz --- lib/src/abstractvoicecallhandler.h +++ lib/src/abstractvoicecallhandler.h @@ -80,6 +80,7 @@ public Q_SLOTS: virtual void answer() = 0; virtual void hangup() = 0; + virtual void hold(bool on = true) = 0; virtual void deflect(const QString &target) = 0; virtual void sendDtmf(const QString &tones) = 0; }; --- lib/src/dbus/voicecallhandlerdbusadapter.cpp +++ lib/src/dbus/voicecallhandlerdbusadapter.cpp @@ -172,7 +172,7 @@ /*! Initiates hanging up this voice call, if its' currently not disconnected. - \sa status(), answer(), deflect() + \sa status(), answer(), hold(), deflect() */ bool VoiceCallHandlerDBusAdapter::hangup() { @@ -182,6 +182,19 @@ return true; } +/*! + Initiates holding this voice call, if its' currently not disconnected. + + \sa status(), answer(), hangup(), deflect() +*/ +bool VoiceCallHandlerDBusAdapter::hold(bool on) +{ + TRACE + Q_D(VoiceCallHandlerDBusAdapter); + d->handler->hold(on); + return true; +} + /*! Initiates deflecting this call to the provided target msisdn (phone number). --- lib/src/dbus/voicecallhandlerdbusadapter.h +++ lib/src/dbus/voicecallhandlerdbusadapter.h @@ -66,6 +66,7 @@ public Q_SLOTS: bool answer(); bool hangup(); + bool hold(bool on = true); bool deflect(const QString &target); void sendDtmf(const QString &tones); --- lib/src/voicecallmanagerinterface.h +++ lib/src/voicecallmanagerinterface.h @@ -97,7 +97,7 @@ void setAudioRoutedRequested(bool on); void setMuteMicrophoneRequested(bool on); - void setMuteSpeakerRequested(bool on); + void setMuteSpeakerRequested(bool on); void startEventToneRequested(ToneType type, int volume); void stopEventToneRequested(); @@ -121,6 +121,11 @@ virtual void setMuteMicrophone(bool on = true) = 0; virtual void setMuteSpeaker(bool on = true) = 0; + virtual void onAudioModeChanged(const QString &mode) = 0; + virtual void onAudioRoutedChanged(bool on) = 0; + virtual void onMuteMicrophoneChanged(bool on) = 0; + virtual void onMuteSpeakerChanged(bool on) = 0; + virtual void startEventTone(ToneType type, int volume) = 0; virtual void stopEventTone() = 0; --- plugins/declarative/src/voicecallhandler.cpp +++ plugins/declarative/src/voicecallhandler.cpp @@ -195,6 +195,19 @@ } /*! + Initiates holding the call, unless the call is disconnected. + */ +void VoiceCallHandler::hold() +{ + TRACE + Q_D(VoiceCallHandler); + QDBusPendingCall call = d->interface->asyncCall("hold"); + + QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this); + QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(onPendingCallFinished(QDBusPendingCallWatcher*))); +} + +/*! Initiates deflecting the call to the provided target phone number. */ void VoiceCallHandler::deflect(const QString &target) --- plugins/declarative/src/voicecallhandler.h +++ plugins/declarative/src/voicecallhandler.h @@ -59,6 +59,7 @@ public Q_SLOTS: void answer(); void hangup(); + void hold(); void deflect(const QString &target); void sendDtmf(const QString &tones); --- plugins/declarative/src/voicecallmanager.cpp +++ plugins/declarative/src/voicecallmanager.cpp @@ -227,13 +227,12 @@ else return false; } - d->tonegend->call("StartEventTone", toneId, 0, (unsigned int)0); - if(d->activeVoiceCall) { d->activeVoiceCall->sendDtmf(tone); } + d->tonegend->call("StartEventTone", toneId, 0, (unsigned int)0); return true; } --- plugins/ofono/src/ofonovoicecallhandler.cpp +++ plugins/ofono/src/ofonovoicecallhandler.cpp @@ -171,6 +171,12 @@ d->ofonoVoiceCall->hangup(); } +void OfonoVoiceCallHandler::hold(bool on) +{ + TRACE + Q_D(OfonoVoiceCallHandler); +} + void OfonoVoiceCallHandler::deflect(const QString &target) { TRACE --- plugins/ofono/src/ofonovoicecallhandler.h +++ plugins/ofono/src/ofonovoicecallhandler.h @@ -52,6 +52,7 @@ public Q_SLOTS: void answer(); void hangup(); + void hold(bool on = true); void deflect(const QString &target); void sendDtmf(const QString &tones); --- plugins/resource-policy-routing/src/resourcepolicyroutingplugin.cpp +++ plugins/resource-policy-routing/src/resourcepolicyroutingplugin.cpp @@ -180,6 +180,8 @@ Q_D(ResourcePolicyRoutingPlugin); d->manager = manager; + QObject::connect(d->manager, SIGNAL(voiceCallsChanged()), SLOT(onVoiceCallsChanged())); + QObject::connect(d->manager, SIGNAL(setAudioModeRequested(QString)), SLOT(setMode(QString))); QObject::connect(d->manager, SIGNAL(setMuteMicrophoneRequested(bool)), SLOT(setMuteMicrophone(bool))); QObject::connect(d->manager, SIGNAL(setMuteSpeakerRequested(bool)), SLOT(setMuteSpeaker(bool))); @@ -213,6 +215,8 @@ void ResourcePolicyRoutingPlugin::setMode(const QString &mode) { TRACE + Q_D(ResourcePolicyRoutingPlugin); + AudioAction act; AudioActionObject obj; AudioActionProp sink_device("device", QDBusVariant("earpiece")); @@ -240,12 +244,17 @@ if(!QDBusConnection::systemBus().send(message)) { WARNING_T("Failed to send policy audio_actions signal."); + return; } + + d->manager->onAudioModeChanged(mode); } void ResourcePolicyRoutingPlugin::setMuteMicrophone(bool on) { TRACE + Q_D(ResourcePolicyRoutingPlugin); + AudioAction act; AudioActionObject a; @@ -265,32 +274,54 @@ if(!QDBusConnection::systemBus().send(message)) { WARNING_T("Failed to send policy audio_actions signal."); + return; } + + d->manager->onMuteMicrophoneChanged(on); } void ResourcePolicyRoutingPlugin::setMuteSpeaker(bool on) { TRACE - AudioAction act; - AudioActionObject a; + Q_D(ResourcePolicyRoutingPlugin); + + AudioAction act; + AudioActionObject a; + + act.action = "com.nokia.policy.audio_mute"; + + a.props << AudioActionProp("device", QDBusVariant("headset")); + a.props << AudioActionProp("mute", on ? QDBusVariant("muted") : QDBusVariant("unmuted")); + + act.objects << a; - act.action = "com.nokia.policy.audio_mute"; + QDBusMessage message = QDBusMessage::createSignal("/com/nokia/policy/decision", + "com.nokia.policy", + "audio_actions"); + message << (uint)0; + message << qVariantFromValue(act); - a.props << AudioActionProp("device", QDBusVariant("headset")); - a.props << AudioActionProp("mute", on ? QDBusVariant("muted") : QDBusVariant("unmuted")); + if(!QDBusConnection::systemBus().send(message)) + { + WARNING_T("Failed to send policy audio_actions signal."); + return; + } - act.objects << a; - - QDBusMessage message = QDBusMessage::createSignal("/com/nokia/policy/decision", - "com.nokia.policy", - "audio_actions"); - message << (uint)0; - message << qVariantFromValue(act); - - if(!QDBusConnection::systemBus().send(message)) - { - WARNING_T("Failed to send policy audio_actions signal."); - } + d->manager->onMuteSpeakerChanged(on); +} + +void ResourcePolicyRoutingPlugin::onVoiceCallsChanged() +{ + TRACE + Q_D(ResourcePolicyRoutingPlugin); + + // When all calls are done, we reset audio policy to a sensible state. + if(d->manager->voiceCalls().empty()) + { + this->setMode("earpiece"); + this->setMuteMicrophone(false); + this->setMuteSpeaker(false); + } } Q_EXPORT_PLUGIN2(resource-policy-routing-plugin, ResourcePolicyRoutingPlugin) --- plugins/resource-policy-routing/src/resourcepolicyroutingplugin.h +++ plugins/resource-policy-routing/src/resourcepolicyroutingplugin.h @@ -49,6 +49,9 @@ void setMuteMicrophone(bool on = true); void setMuteSpeaker(bool on = true); +protected Q_SLOTS: + void onVoiceCallsChanged(); + private: class ResourcePolicyRoutingPluginPrivate *d_ptr; --- plugins/telepathy/src/telepathyhandler.cpp +++ plugins/telepathy/src/telepathyhandler.cpp @@ -257,6 +257,14 @@ emit statusChanged(); } +void TelepathyHandler::hold(bool on) +{ + TRACE + Q_D(TelepathyHandler); + Tp::Client::ChannelInterfaceHoldInterface *holdIface = new Tp::Client::ChannelInterfaceHoldInterface(d->channel.data(), this); + holdIface->RequestHold(on); +} + //FIXME: Don't know what telepathy API provides this. void TelepathyHandler::deflect(const QString &target) { @@ -621,7 +629,7 @@ case Tp::MediaStreamStateConnected: DEBUG_T("Media stream state connected."); - d->status = STATUS_ACTIVE; + d->status = STATUS_ALERTING; emit this->statusChanged(); break; @@ -679,8 +687,13 @@ if(reply.value().count() == 0) { d->status = STATUS_DISCONNECTED; - emit this->statusChanged(); } + else + { + d->status = STATUS_ACTIVE; + } + + emit this->statusChanged(); } } --- plugins/telepathy/src/telepathyhandler.h +++ plugins/telepathy/src/telepathyhandler.h @@ -60,6 +60,7 @@ /*** AbstractVoiceCallHandler Implementation ***/ void answer(); void hangup(); + void hold(bool on = true); void deflect(const QString &target); void sendDtmf(const QString &tones); --- src/audiocallpolicyproxy.cpp +++ src/audiocallpolicyproxy.cpp @@ -139,6 +139,13 @@ this->deleteResourceSet(); } +void AudioCallPolicyProxy::hold(bool on) +{ + TRACE + Q_D(AudioCallPolicyProxy); + d->subject->hold(on); +} + void AudioCallPolicyProxy::deflect(const QString &target) { TRACE --- src/audiocallpolicyproxy.h +++ src/audiocallpolicyproxy.h @@ -47,6 +47,7 @@ public Q_SLOTS: void answer(); void hangup(); + void hold(bool on = true); void deflect(const QString &target); void sendDtmf(const QString &tones); --- src/voicecallmanager.cpp +++ src/voicecallmanager.cpp @@ -33,7 +33,7 @@ public: VoiceCallManagerPrivate(VoiceCallManager *q) : q_ptr(q), activeVoiceCall(NULL), - isAudioRouted(false), isMicrophoneMuted(false), isSpeakerMuted(false) + audioMode("earpiece"), isAudioRouted(false), isMicrophoneMuted(false), isSpeakerMuted(false) {/* ... */} VoiceCallManager *q_ptr; @@ -56,7 +56,6 @@ : VoiceCallManagerInterface(parent), d_ptr(new VoiceCallManagerPrivate(this)) { TRACE - this->setAudioMode(".default"); } VoiceCallManager::~VoiceCallManager() @@ -204,6 +203,7 @@ Q_D(VoiceCallManager); d->audioMode = mode; emit this->setAudioModeRequested(mode); + emit this->audioModeChanged(); } void VoiceCallManager::setAudioRouted(bool on) @@ -212,6 +212,7 @@ Q_D(VoiceCallManager); d->isAudioRouted = on; emit this->setAudioRoutedRequested(on); + emit this->audioRoutedChanged(); } void VoiceCallManager::setMuteMicrophone(bool on) @@ -232,6 +233,38 @@ emit this->speakerMutedChanged(); } +void VoiceCallManager::onAudioModeChanged(const QString &mode) +{ + TRACE + Q_D(VoiceCallManager); + d->audioMode = mode; + emit this->audioModeChanged(); +} + +void VoiceCallManager::onAudioRoutedChanged(bool on) +{ + TRACE + Q_D(VoiceCallManager); + d->isAudioRouted = on; + emit this->audioRoutedChanged(); +} + +void VoiceCallManager::onMuteMicrophoneChanged(bool on) +{ + TRACE + Q_D(VoiceCallManager); + d->isMicrophoneMuted = on; + emit this->microphoneMutedChanged(); +} + +void VoiceCallManager::onMuteSpeakerChanged(bool on) +{ + TRACE + Q_D(VoiceCallManager); + d->isSpeakerMuted = on; + emit this->speakerMutedChanged(); +} + bool VoiceCallManager::dial(const QString &providerId, const QString &msisdn) { TRACE @@ -311,12 +344,6 @@ AudioCallPolicyProxy *pHandler = qobject_cast<AudioCallPolicyProxy*>(d->voiceCalls.value(handlerId)); d->voiceCalls.remove(handlerId); - if(this->voiceCallCount() == 0 && d->isAudioRouted) - { - this->setAudioMode("ihf"); - this->setAudioRouted(false); - } - emit this->voiceCallRemoved(handlerId); emit this->voiceCallsChanged(); @@ -336,12 +363,9 @@ if(d->activeVoiceCall) { - if(!d->isAudioRouted) this->setAudioRouted(true); - switch(d->activeVoiceCall->status()) { case AbstractVoiceCallHandler::STATUS_ACTIVE: - this->setAudioMode(".default"); break; case AbstractVoiceCallHandler::STATUS_HELD: break; @@ -350,13 +374,10 @@ case AbstractVoiceCallHandler::STATUS_ALERTING: break; case AbstractVoiceCallHandler::STATUS_INCOMING: - this->setAudioMode("ihf"); break; case AbstractVoiceCallHandler::STATUS_WAITING: break; case AbstractVoiceCallHandler::STATUS_DISCONNECTED: - this->setAudioMode("ihf"); - this->setAudioRouted(false); break; default: break; --- src/voicecallmanager.h +++ src/voicecallmanager.h @@ -62,6 +62,11 @@ void setMuteMicrophone(bool on); void setMuteSpeaker(bool on); + void onAudioModeChanged(const QString &mode); + void onAudioRoutedChanged(bool on); + void onMuteMicrophoneChanged(bool on); + void onMuteSpeakerChanged(bool on); + void startEventTone(ToneType type, int volume); void stopEventTone();
