Merge lp:~boiko/telepathy-ofono/rtm-set_hold_reason into lp:telepathy-ofono/rtm-14.09

Proposed by Gustavo Pichorim Boiko on 2015-01-28
Status: Merged
Approved by: Gustavo Pichorim Boiko on 2015-02-04
Approved revision: 108
Merged at revision: 108
Proposed branch: lp:~boiko/telepathy-ofono/rtm-set_hold_reason
Merge into: lp:telepathy-ofono/rtm-14.09
Diff against target: 92 lines (+29/-2)
4 files modified
ofonocallchannel.cpp (+12/-0)
ofonocallchannel.h (+1/-0)
ofonoconferencecallchannel.cpp (+15/-2)
ofonoconferencecallchannel.h (+1/-0)
To merge this branch: bzr merge lp:~boiko/telepathy-ofono/rtm-set_hold_reason
Reviewer Review Type Date Requested Status
Ubuntu Phablet Team 2015-01-28 Pending
Review via email: mp+247845@code.launchpad.net

Commit message

Watch for swapCallsComplete(bool) and set HoldState and HoldStateReason accordingly.

Description of the change

Watch for swapCallsComplete(bool) and set HoldState and HoldStateReason accordingly.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ofonocallchannel.cpp'
2--- ofonocallchannel.cpp 2014-10-06 17:22:47 +0000
3+++ ofonocallchannel.cpp 2015-01-28 14:31:42 +0000
4@@ -191,12 +191,24 @@
5 void oFonoCallChannel::onHoldStateChanged(const Tp::LocalHoldState &state, const Tp::LocalHoldStateReason &reason, Tp::DBusError *error)
6 {
7 if (state == Tp::LocalHoldStateHeld && this->state() == "active") {
8+ QObject::connect(mConnection->voiceCallManager(), SIGNAL(swapCallsComplete(bool)), this, SLOT(onSwapCallsComplete(bool)));
9 mConnection->voiceCallManager()->swapCalls();
10+ mHoldIface->setHoldState(Tp::LocalHoldStatePendingHold, Tp::LocalHoldStateReasonRequested);
11 } else if (state == Tp::LocalHoldStateUnheld && this->state() == "held") {
12+ QObject::connect(mConnection->voiceCallManager(), SIGNAL(swapCallsComplete(bool)), this, SLOT(onSwapCallsComplete(bool)));
13 mConnection->voiceCallManager()->swapCalls();
14+ mHoldIface->setHoldState(Tp::LocalHoldStatePendingUnhold, Tp::LocalHoldStateReasonRequested);
15 }
16 }
17
18+void oFonoCallChannel::onSwapCallsComplete(bool success)
19+{
20+ Tp::LocalHoldState holdState = this->state() == "active" ? Tp::LocalHoldStateUnheld : Tp::LocalHoldStateHeld;
21+ Tp::LocalHoldStateReason reason = success ? Tp::LocalHoldStateReasonRequested : Tp::LocalHoldStateReasonResourceNotAvailable;
22+ QObject::disconnect(mConnection->voiceCallManager(), SIGNAL(swapCallsComplete(bool)), this, SLOT(onSwapCallsComplete(bool)));
23+ mHoldIface->setHoldState(holdState, reason);
24+}
25+
26 void oFonoCallChannel::onMuteStateChanged(const Tp::LocalMuteState &state, Tp::DBusError *error)
27 {
28 if (state == Tp::LocalMuteStateMuted) {
29
30=== modified file 'ofonocallchannel.h'
31--- ofonocallchannel.h 2014-10-06 17:22:47 +0000
32+++ ofonocallchannel.h 2015-01-28 14:31:42 +0000
33@@ -61,6 +61,7 @@
34 private Q_SLOTS:
35 void onOfonoCallStateChanged(const QString &state);
36 void onDtmfComplete(bool success);
37+ void onSwapCallsComplete(bool success);
38 void sendNextDtmf();
39 void init();
40
41
42=== modified file 'ofonoconferencecallchannel.cpp'
43--- ofonoconferencecallchannel.cpp 2014-09-17 21:25:12 +0000
44+++ ofonoconferencecallchannel.cpp 2015-01-28 14:31:42 +0000
45@@ -192,20 +192,33 @@
46 void oFonoConferenceCallChannel::setConferenceActive(bool active)
47 {
48 if (active) {
49- mHoldIface->setHoldState(Tp::LocalHoldStateUnheld, Tp::LocalHoldStateReasonNone);
50+ mHoldIface->setHoldState(Tp::LocalHoldStateUnheld, Tp::LocalHoldStateReasonRequested);
51 } else {
52- mHoldIface->setHoldState(Tp::LocalHoldStateHeld, Tp::LocalHoldStateReasonNone);
53+ mHoldIface->setHoldState(Tp::LocalHoldStateHeld, Tp::LocalHoldStateReasonRequested);
54 }
55 }
56
57 void oFonoConferenceCallChannel::onHoldStateChanged(const Tp::LocalHoldState &state, const Tp::LocalHoldStateReason &reason, Tp::DBusError *error)
58 {
59 if (state == Tp::LocalHoldStateHeld && mHoldIface->getHoldState() == Tp::LocalHoldStateUnheld) {
60+ QObject::connect(mConnection->voiceCallManager(), SIGNAL(swapCallsComplete(bool)), this, SLOT(onSwapCallsComplete(bool)));
61+ mHoldIface->setHoldState(Tp::LocalHoldStatePendingHold, Tp::LocalHoldStateReasonRequested);
62 mConnection->voiceCallManager()->swapCalls();
63 } else if (state == Tp::LocalHoldStateUnheld && mHoldIface->getHoldState() == Tp::LocalHoldStateHeld) {
64+ QObject::connect(mConnection->voiceCallManager(), SIGNAL(swapCallsComplete(bool)), this, SLOT(onSwapCallsComplete(bool)));
65+ mHoldIface->setHoldState(Tp::LocalHoldStatePendingUnhold, Tp::LocalHoldStateReasonRequested);
66 mConnection->voiceCallManager()->swapCalls();
67 }
68+}
69
70+void oFonoConferenceCallChannel::onSwapCallsComplete(bool success)
71+{
72+ QObject::disconnect(mConnection->voiceCallManager(), SIGNAL(swapCallsComplete(bool)), this, SLOT(onSwapCallsComplete(bool)));
73+ if (!success) {
74+ // only change hold state in case of failure. Successful action will happen through setConferenceActive()
75+ Tp::LocalHoldState holdState = mHoldIface->getHoldState() == Tp::LocalHoldStatePendingHold ? Tp::LocalHoldStateUnheld : Tp::LocalHoldStateHeld;
76+ mHoldIface->setHoldState(holdState, Tp::LocalHoldStateReasonResourceNotAvailable);
77+ }
78 }
79
80 void oFonoConferenceCallChannel::onMuteStateChanged(const Tp::LocalMuteState &state, Tp::DBusError *error)
81
82=== modified file 'ofonoconferencecallchannel.h'
83--- ofonoconferencecallchannel.h 2014-09-17 21:25:12 +0000
84+++ ofonoconferencecallchannel.h 2015-01-28 14:31:42 +0000
85@@ -58,6 +58,7 @@
86 void onOfonoMuteChanged(bool mute);
87 void onChannelMerged(const QDBusObjectPath &path);
88 void onChannelSplitted(const QDBusObjectPath &path);
89+ void onSwapCallsComplete(bool success);
90
91 private:
92 QString mObjPath;

Subscribers

People subscribed via source and target branches