1 /* |
|
2 * Copyright (c) 2007 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: Implementation of class CSPEtelCallEventMonitor which |
|
15 * monitors call events from ETel and notifies observer |
|
16 * accordingly. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #include <mccptransferobserver.h> |
|
22 #include <mccpforwardobserver.h> |
|
23 #include <mccpconferencecallobserver.h> |
|
24 |
|
25 #include "cspetelcalleventmonitor.h" |
|
26 #include "csplogger.h" |
|
27 #include "cspcall.h" |
|
28 |
|
29 |
|
30 |
|
31 // --------------------------------------------------------------------------- |
|
32 // CSPEtelCallEventMonitor::NewL. |
|
33 // --------------------------------------------------------------------------- |
|
34 // |
|
35 CSPEtelCallEventMonitor* CSPEtelCallEventMonitor::NewL( MCSPCallObserver& aObserver, |
|
36 RMobileCall& aCall ) |
|
37 { |
|
38 CSPLOGSTRING(CSPOBJECT, |
|
39 "CSPEtelCallEventMonitor::NewL()" ); |
|
40 CSPEtelCallEventMonitor* self = new ( ELeave ) CSPEtelCallEventMonitor( |
|
41 aObserver, aCall ); |
|
42 return self; |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // Destructs the object by canceling first ongoing monitoring. |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 CSPEtelCallEventMonitor::~CSPEtelCallEventMonitor( ) |
|
50 { |
|
51 CSPLOGSTRING(CSPOBJECT, |
|
52 "CSPEtelCallEventMonitor::~CSPEtelCallEventMonitor()" ); |
|
53 Cancel(); |
|
54 |
|
55 if ( iDestrPtr ) |
|
56 { |
|
57 *iDestrPtr = ETrue; |
|
58 iDestrPtr = NULL; |
|
59 } |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // Starts the monitoring. |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 void CSPEtelCallEventMonitor::StartMonitoring() |
|
67 { |
|
68 CSPLOGSTRING( CSPINT, "CSPEtelCallEventMonitor::StartMonitoring" ); |
|
69 |
|
70 if ( !IsActive() ) |
|
71 { |
|
72 CSPLOGSTRING( CSPREQOUT, |
|
73 "CSP: CSPEtelCallEventMonitor::StartMonitoring: \ |
|
74 Request RMobilePhone::NotifyCallEvent" ); |
|
75 iCall.NotifyCallEvent( iStatus, iCallEvent ); |
|
76 SetActive(); |
|
77 } |
|
78 else |
|
79 { |
|
80 CSPLOGSTRING( CSPERROR, |
|
81 "CSP: CSPEtelCallEventMonitor::StartMonitoring: Already active" ); |
|
82 } |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // From CActive |
|
87 // Handles event notifying. |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 void CSPEtelCallEventMonitor::RunL() |
|
91 { |
|
92 CSPLOGSTRING( CSPINT, "CSPEtelCallEventMonitor::RunL") |
|
93 |
|
94 // Survive from monitor destruction during observing sequence |
|
95 TBool destroyed = EFalse; |
|
96 iDestrPtr = &destroyed; |
|
97 |
|
98 if ( iStatus == KErrNone ) |
|
99 { |
|
100 switch ( iCallEvent ) |
|
101 { |
|
102 // The call has been terminated by the remote party. |
|
103 case RMobileCall::ERemoteTerminated: |
|
104 { |
|
105 CSPLOGSTRING( CSPINT, |
|
106 "CSP CSPEtelCallEventMonitor::RunL: Remotely terminated" ); |
|
107 iObserver.NotifyCallEventOccurred( |
|
108 MCCPCallObserver::ECCPRemoteTerminated ); |
|
109 break; |
|
110 } |
|
111 // The call has been placed on hold as a result of a local action |
|
112 case RMobileCall::ELocalHold: |
|
113 { |
|
114 CSPLOGSTRING( CSPINT, |
|
115 "CSP CSPEtelCallEventMonitor::RunL: Locally held" ); |
|
116 iObserver.NotifyCallEventOccurred( |
|
117 MCCPCallObserver::ECCPLocalHold ); |
|
118 break; |
|
119 } |
|
120 |
|
121 // The call has been resumed as a result of a local action. |
|
122 case RMobileCall::ELocalResume: |
|
123 { |
|
124 CSPLOGSTRING( CSPINT, |
|
125 "CSP CSPEtelCallEventMonitor::RunL: Locally resumed" ); |
|
126 iObserver.NotifyCallEventOccurred( |
|
127 MCCPCallObserver::ECCPLocalResume ); |
|
128 break; |
|
129 } |
|
130 // The call has been deflected to another remote party as a result |
|
131 // of a local action. |
|
132 case RMobileCall::ELocalDeflectCall: |
|
133 { |
|
134 CSPLOGSTRING( CSPINT, |
|
135 "CSP CSPEtelCallEventMonitor::RunL: Locally deflected" ); |
|
136 iObserver.NotifyTransferCallEventOccurred( |
|
137 MCCPTransferObserver::ECCPLocalTransfer ); |
|
138 break; |
|
139 } |
|
140 // The call has been transferred to another remote party as a |
|
141 // result of a local action. |
|
142 case RMobileCall::ELocalTransfer: |
|
143 { |
|
144 CSPLOGSTRING( CSPINT, |
|
145 "CSP CSPEtelCallEventMonitor::RunL: Locally transfered" ); |
|
146 iObserver.NotifyTransferCallEventOccurred( |
|
147 MCCPTransferObserver::ECCPLocalTransfer ); |
|
148 break; |
|
149 } |
|
150 // The call has been placed on hold by the remote connected party |
|
151 case RMobileCall::ERemoteHold: |
|
152 { |
|
153 CSPLOGSTRING( CSPINT, |
|
154 "CSP CSPEtelCallEventMonitor::RunL: Remotely held" ); |
|
155 iObserver.NotifyCallEventOccurred( |
|
156 MCCPCallObserver::ECCPRemoteHold ); |
|
157 break; |
|
158 } |
|
159 // The call has been resumed by the remote connected party. |
|
160 case RMobileCall::ERemoteResume: |
|
161 { |
|
162 CSPLOGSTRING( CSPINT, |
|
163 "CSP CSPEtelCallEventMonitor::RunL: Remotely resumed" ); |
|
164 iObserver.NotifyCallEventOccurred( |
|
165 MCCPCallObserver::ECCPRemoteResume ); |
|
166 break; |
|
167 } |
|
168 // The call has been joined by the remote connected party to other |
|
169 // call(s) to create/add to a conference call. |
|
170 case RMobileCall::ERemoteConferenceCreate: |
|
171 { |
|
172 CSPLOGSTRING( CSPINT, |
|
173 "CSP CSPEtelCallEventMonitor::RunL: Remotely created \ |
|
174 conference" ); |
|
175 |
|
176 iObserver.NotifyCallEventOccurred( |
|
177 MCCPCallObserver::ECCPRemoteConferenceCreate ); |
|
178 |
|
179 break; |
|
180 } |
|
181 case RMobileCall::ERemoteTransferring: |
|
182 { |
|
183 CSPLOGSTRING( CSPINT, |
|
184 "CSP CSPEtelCallEventMonitor::RunL: Remotely created \ |
|
185 conference" ); |
|
186 iObserver.NotifyTransferCallEventOccurred( |
|
187 MCCPTransferObserver::ECCPRemoteTransferring ); |
|
188 break; |
|
189 } |
|
190 case RMobileCall::ERemoteTransferAlerting: |
|
191 { |
|
192 CSPLOGSTRING( CSPINT, |
|
193 "CSP CSPEtelCallEventMonitor::RunL: Remotely created \ |
|
194 conference" ); |
|
195 iObserver.NotifyTransferCallEventOccurred( |
|
196 MCCPTransferObserver::ECCPRemoteTransferAlerting ); |
|
197 break; |
|
198 } |
|
199 // The outgoing call has been barred by the remote party |
|
200 case RMobileCall::ERemoteBarred: |
|
201 { |
|
202 CSPLOGSTRING( CSPINT, |
|
203 "CSP CSPEtelCallEventMonitor::RunL: Remotely barred" ); |
|
204 iObserver.NotifyCallEventOccurred( |
|
205 MCCPCallObserver::ECCPRemoteBarred ); |
|
206 break; |
|
207 } |
|
208 |
|
209 // The call is being forwarded by the remote party. |
|
210 case RMobileCall::ERemoteForwarding: |
|
211 { |
|
212 CSPLOGSTRING( CSPINT, |
|
213 "CSP CSPEtelCallEventMonitor::RunL: Remotely forwarded" ); |
|
214 iObserver.NotifyForwardEventOccurred( |
|
215 MCCPForwardObserver::ECCPRemoteForwarding ); |
|
216 break; |
|
217 } |
|
218 |
|
219 // The call is waiting at the remote end. |
|
220 case RMobileCall::ERemoteWaiting: |
|
221 { |
|
222 CSPLOGSTRING( CSPINT, |
|
223 "CSP CSPEtelCallEventMonitor::RunL: Remotely waiting" ); |
|
224 iObserver.NotifyCallEventOccurred( |
|
225 MCCPCallObserver::ECCPRemoteWaiting ); |
|
226 break; |
|
227 } |
|
228 |
|
229 // The outgoing call has been barred by the local party. |
|
230 case RMobileCall::ELocalBarred: |
|
231 { |
|
232 CSPLOGSTRING( CSPINT, |
|
233 "CSP CSPEtelCallEventMonitor::RunL: Locally barred" ); |
|
234 iObserver.NotifyCallEventOccurred( |
|
235 MCCPCallObserver::ECCPLocalBarred ); |
|
236 break; |
|
237 } |
|
238 |
|
239 default: |
|
240 { |
|
241 CSPLOGSTRING2( CSPINT, |
|
242 "CSP CSPEtelCallEventMonitor::RunL: Unspecified/protocol \ |
|
243 specific call event: %d", iCallEvent ); |
|
244 break; |
|
245 } |
|
246 } |
|
247 } |
|
248 |
|
249 if ( !destroyed ) |
|
250 { |
|
251 // In case instance has not been deleted, pointer must be cleared. |
|
252 iDestrPtr = NULL; |
|
253 if ( iStatus == KErrNone ) |
|
254 { |
|
255 StartMonitoring(); |
|
256 } |
|
257 } |
|
258 else |
|
259 { |
|
260 // already destroyed, do not touch members. |
|
261 } |
|
262 } |
|
263 |
|
264 // --------------------------------------------------------------------------- |
|
265 // From CActive |
|
266 // Request canceling. |
|
267 // --------------------------------------------------------------------------- |
|
268 // |
|
269 void CSPEtelCallEventMonitor::DoCancel() |
|
270 { |
|
271 CSPLOGSTRING( CSPINT, "CSPEtelCallEventMonitor::DoCancel" ); |
|
272 iCall.CancelAsyncRequest( EMobileCallNotifyCallEvent ); |
|
273 } |
|
274 |
|
275 // --------------------------------------------------------------------------- |
|
276 // Constructs the monitor. |
|
277 // --------------------------------------------------------------------------- |
|
278 // |
|
279 CSPEtelCallEventMonitor::CSPEtelCallEventMonitor( MCSPCallObserver& aObserver, |
|
280 RMobileCall& aCall ) : |
|
281 CActive( EPriorityStandard ), |
|
282 iObserver( aObserver ), |
|
283 iCall ( aCall ) |
|
284 { |
|
285 CSPLOGSTRING(CSPOBJECT, |
|
286 "CSPEtelCallEventMonitor::CSPEtelCallEventMonitor()" ); |
|
287 CActiveScheduler::Add( this ); |
|
288 } |
|
289 |
|
290 // End of File |
|
291 |
|