|
1 /* |
|
2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Monitor the status of CS Conference call |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "mussesseioninformationapi.h" |
|
20 #include "muslogger.h" |
|
21 #include "muscallconferencemonitor.h" |
|
22 #include "muscallconferenceeventmonitor.h" |
|
23 |
|
24 #include <etelmm.h> |
|
25 #include <e32svr.h> |
|
26 #include <mmtsy_names.h> |
|
27 #include <e32property.h> |
|
28 |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // Symbian two-phase constructor. |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 CMusCallConferenceMonitor* CMusCallConferenceMonitor::NewL( RMobilePhone& aPhone, |
|
35 RMobileLine& aLine, |
|
36 RPointerArray<CMusCallMonitor>& aCallMonitorArray ) |
|
37 { |
|
38 MUS_LOG( "mus: [MUSAO] -> CMusCallConferenceMonitor::NewL" ) |
|
39 CMusCallConferenceMonitor* self = new (ELeave) |
|
40 CMusCallConferenceMonitor(aLine,aCallMonitorArray); |
|
41 CleanupStack::PushL( self ); |
|
42 self->ConstructL( aPhone ); |
|
43 CleanupStack::Pop( self ); |
|
44 MUS_LOG( "mus: [MUSAO] <- CMusCallConferenceMonitor::NewL" ) |
|
45 return self; |
|
46 } |
|
47 |
|
48 |
|
49 // ----------------------------------------------------------------------------- |
|
50 // C++ destructor. |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 CMusCallConferenceMonitor::~CMusCallConferenceMonitor() |
|
54 { |
|
55 MUS_LOG( "mus: [MUSAO] -> \ |
|
56 CMusCallConferenceMonitor::~CMusCallConferenceMonitor" ) |
|
57 Cancel(); |
|
58 iConfCall.Close(); |
|
59 delete iConfCallEvent; |
|
60 MUS_LOG( "mus: [MUSAO] <- \ |
|
61 CMusCallConferenceMonitor::~CMusCallConferenceMonitor" ) |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // Symbian second-phase constructor. |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 void CMusCallConferenceMonitor::ConstructL( RMobilePhone& aPhone ) |
|
69 { |
|
70 MUS_LOG( "mus: [MUSAO] -> CMusCallConferenceMonitor::ConstructL" ) |
|
71 CActiveScheduler::Add( this ); |
|
72 User::LeaveIfError(iConfCall.Open(aPhone)); |
|
73 iConfCall.NotifyConferenceStatusChange(iStatus,iConfStatus); |
|
74 SetActive(); |
|
75 iConfCallEvent = CMusCallConferenceEventMonitor::NewL(aPhone, |
|
76 iLine, |
|
77 iCallMonitorArray); |
|
78 MUS_LOG( "mus: [MUSAO] <- CMusCallConferenceMonitor::ConstructL" ) |
|
79 } |
|
80 |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // C++ constructor. |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 CMusCallConferenceMonitor::CMusCallConferenceMonitor(RMobileLine& aLine, |
|
87 RPointerArray<CMusCallMonitor>& aCallMonitorArray) |
|
88 : CActive( EPriorityNormal ), |
|
89 iLine(aLine), |
|
90 iCallMonitorArray(aCallMonitorArray) |
|
91 |
|
92 |
|
93 { |
|
94 } |
|
95 |
|
96 |
|
97 // -------------------------------------------------------------------------------- |
|
98 // CMusCallConferenceMonitor::RunL() |
|
99 // Implemented for CActive.It will be called any NotifyMobileLineStatusChange |
|
100 // Event happens. |
|
101 // -------------------------------------------------------------------------------- |
|
102 // |
|
103 void CMusCallConferenceMonitor::RunL() |
|
104 { |
|
105 MUS_LOG( "mus: [MUSAO] -> CMusCallConferenceMonitor::RunL" ) |
|
106 iConfCall.NotifyConferenceStatusChange(iStatus,iConfStatus); |
|
107 SetActive(); |
|
108 MUS_LOG1( "mus: [MUSAO] Conference->iCallStatus = %d", iConfStatus ) |
|
109 switch(iConfStatus) |
|
110 { |
|
111 case RMobileConferenceCall::EConferenceIdle: |
|
112 MonitorCallL(); |
|
113 break; |
|
114 case RMobileConferenceCall::EConferenceActive: |
|
115 SetStateL( NMusSessionInformationApi::EConferenceCall ); |
|
116 break; |
|
117 case RMobileConferenceCall::EConferenceHold: |
|
118 SetStateL(NMusSessionInformationApi::ECallHold); |
|
119 break; |
|
120 default: |
|
121 break; |
|
122 } |
|
123 MUS_LOG( "mus: [MUSAO] <- CMusCallConferenceMonitor::RunL" ) |
|
124 } |
|
125 |
|
126 |
|
127 // -------------------------------------------------------------------------------- |
|
128 // CMusCallConferenceMonitor::DoCancel() |
|
129 // Implemented for CActive. |
|
130 // Will be called when Cancel() method is called. |
|
131 // -------------------------------------------------------------------------------- |
|
132 // |
|
133 void CMusCallConferenceMonitor::DoCancel() |
|
134 { |
|
135 MUS_LOG( "mus: [MUSAO] -> CMusCallConferenceMonitor::DoCancel" ) |
|
136 iConfCall.CancelAsyncRequest( EMobileConferenceCallNotifyConferenceStatusChange ); |
|
137 MUS_LOG( "mus: [MUSAO] <- CMusCallConferenceMonitor::DoCancel" ) |
|
138 } |
|
139 |
|
140 // -------------------------------------------------------------------------------- |
|
141 // CMusCallConferenceMonitor::RunError( TInt aError ) |
|
142 // Implemented for CActive. |
|
143 // Will be called automatically by framework when RunL Leaves. |
|
144 // -------------------------------------------------------------------------------- |
|
145 // |
|
146 |
|
147 TInt CMusCallConferenceMonitor::RunError( TInt aError ) |
|
148 { |
|
149 MUS_LOG1( "mus: [MUSAO] -> CMusCallConferenceMonitor::RunError, aError %d", \ |
|
150 aError ) |
|
151 aError = KErrNone; |
|
152 MUS_LOG( "mus: [MUSAO] <- CMusCallConferenceMonitor::RunError" ) |
|
153 return aError; |
|
154 } |
|
155 |
|
156 |
|
157 // -------------------------------------------------------------------------------- |
|
158 // CMusCallConferenceMonitor::SetStateL() |
|
159 // Sets the Call State to Property |
|
160 // -------------------------------------------------------------------------------- |
|
161 // |
|
162 void CMusCallConferenceMonitor::SetStateL() |
|
163 { |
|
164 MUS_LOG( "mus: [MUSAO] -> CMusCallConferenceMonitor::SetStateL") |
|
165 User::LeaveIfError(iConfCall.GetConferenceStatus(iConfStatus)); |
|
166 MUS_LOG1( "mus: [MUSAO] Conference->iCallStatus = %d", iConfStatus ) |
|
167 switch(iConfStatus) |
|
168 { |
|
169 case RMobileConferenceCall::EConferenceIdle: |
|
170 break; |
|
171 case RMobileConferenceCall::EConferenceActive: |
|
172 SetStateL( NMusSessionInformationApi::EConferenceCall ); |
|
173 break; |
|
174 case RMobileConferenceCall::EConferenceHold: |
|
175 SetStateL(NMusSessionInformationApi::ECallHold); |
|
176 break; |
|
177 default: |
|
178 break; |
|
179 } |
|
180 MUS_LOG( "mus: [MUSAO] <- CMusCallConferenceMonitor::SetStateL" ) |
|
181 } |
|
182 |
|
183 |
|
184 // -------------------------------------------------------------------------------- |
|
185 // CMusCallConferenceMonitor::SetStateL( TInt aError ) |
|
186 // Sets the Call State to Property |
|
187 // -------------------------------------------------------------------------------- |
|
188 // |
|
189 void CMusCallConferenceMonitor::SetStateL( |
|
190 NMusSessionInformationApi::TMusCallEvent aVal) |
|
191 { |
|
192 MUS_LOG1( "mus: [MUSAO] -> CMusCallConferenceMonitor::SetStateL, aVal %d",\ |
|
193 aVal ) |
|
194 TInt currentVal; |
|
195 User::LeaveIfError(RProperty::Get( NMusSessionInformationApi::KCategoryUid, |
|
196 NMusSessionInformationApi::KMusCallEvent,currentVal)); |
|
197 if(currentVal != (TInt)aVal) |
|
198 { |
|
199 User::LeaveIfError(RProperty::Set( NMusSessionInformationApi::KCategoryUid, |
|
200 NMusSessionInformationApi::KMusCallEvent, |
|
201 aVal )); |
|
202 } |
|
203 else |
|
204 { |
|
205 // No point of reporting it . |
|
206 } |
|
207 MUS_LOG( "mus: [MUSAO] <- CMusCallConferenceMonitor::SetStateL" ) |
|
208 } |
|
209 |
|
210 // -------------------------------------------------------------------------------- |
|
211 // CMusCallConferenceMonitor::MonitorCallL() |
|
212 // If the call in conference is dropped that has to be removed. |
|
213 // from call monitoring array.and start monitoring. |
|
214 // -------------------------------------------------------------------------------- |
|
215 // |
|
216 void CMusCallConferenceMonitor::MonitorCallL() |
|
217 { |
|
218 MUS_LOG( "mus: [MUSAO] -> CMusCallConferenceMonitor::MonitorCallL") |
|
219 TInt callCount; |
|
220 iLine.EnumerateCall(callCount); |
|
221 MUS_LOG1( "mus: [MUSAO] -> callCount = %d",callCount) |
|
222 RLine::TCallInfo callInfo; |
|
223 for(TInt i=0;i<callCount;i++) |
|
224 { |
|
225 MUS_LOG( "mus: [MUSAO] -----------------------------------\n" ) |
|
226 iLine.GetCallInfo(i,callInfo); |
|
227 MUS_LOG1( "mus: [MUSAO] Call index = %d",i) |
|
228 MUS_LOG_TDESC("mus: [MUSAO] Call Name",callInfo.iCallName); |
|
229 MUS_LOG1( "mus: [MUSAO] Call Status = %d",callInfo.iStatus ); |
|
230 if(callInfo.iStatus == RCall::EStatusIdle) |
|
231 { |
|
232 for ( TInt j = 0; j < iCallMonitorArray.Count(); j++ ) |
|
233 { |
|
234 if( iCallMonitorArray[j]->IsEqual( callInfo.iCallName ) ) |
|
235 { |
|
236 delete iCallMonitorArray[j]; |
|
237 iCallMonitorArray.Remove(j); |
|
238 break; |
|
239 } |
|
240 } |
|
241 } |
|
242 MUS_LOG( "mus: [MUSAO] -----------------------------------\n" ) |
|
243 } |
|
244 |
|
245 MUS_LOG( "mus: [MUSAO] -> CMusCallConferenceMonitor::CheckCallStatus") |
|
246 } |
|
247 |
|
248 // End of file |
|
249 |
|
250 |