|
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 CSPEtelConferenceEventMonitor which |
|
15 * monitors call events from ETel and notifies observer |
|
16 * accordingly. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #include "cspetelconferenceeventmonitor.h" |
|
22 |
|
23 #include <mccpconferencecallobserver.h> |
|
24 |
|
25 #include "csplogger.h" |
|
26 #include "cspconferencecall.h" |
|
27 |
|
28 |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // CSPEtelConferenceEventMonitor::NewL. |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 CSPEtelConferenceEventMonitor* CSPEtelConferenceEventMonitor::NewL( |
|
35 CSPConferenceCall& aOwner, |
|
36 RMobileConferenceCall& aCall ) |
|
37 { |
|
38 CSPLOGSTRING(CSPOBJECT, |
|
39 "CSPEtelConferenceEventMonitor::NewL()" ); |
|
40 CSPEtelConferenceEventMonitor* self = |
|
41 new ( ELeave ) CSPEtelConferenceEventMonitor( |
|
42 aOwner, aCall ); |
|
43 CleanupStack::PushL( self ); |
|
44 self->ConstructL( ); |
|
45 CleanupStack::Pop( self ); |
|
46 return self; |
|
47 } |
|
48 |
|
49 |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // Destructs the object by canceling first ongoing monitoring. |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 CSPEtelConferenceEventMonitor::~CSPEtelConferenceEventMonitor( ) |
|
56 { |
|
57 CSPLOGSTRING(CSPOBJECT, |
|
58 "CSPEtelConferenceEventMonitor::~CSPEtelConferenceEventMonitor()" ); |
|
59 Cancel(); |
|
60 |
|
61 if ( iDestrPtr ) |
|
62 { |
|
63 *iDestrPtr = ETrue; |
|
64 iDestrPtr = NULL; |
|
65 } |
|
66 |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // Starts the monitoring. |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 void CSPEtelConferenceEventMonitor::StartMonitoring() |
|
74 { |
|
75 CSPLOGSTRING(CSPOBJECT, |
|
76 "CSPEtelConferenceEventMonitor::StartMonitoring()" ); |
|
77 |
|
78 |
|
79 if ( !IsActive() ) |
|
80 { |
|
81 CSPLOGSTRING( CSPREQOUT, |
|
82 "CSP: CSPEtelConferenceEventMonitor::StartMonitoring: \ |
|
83 Request RMobilePhone::NotifyEvent" ); |
|
84 |
|
85 iCall.NotifyConferenceEvent( iStatus, iEvent, iCallName ); |
|
86 SetActive(); |
|
87 } |
|
88 else |
|
89 { |
|
90 CSPLOGSTRING( CSPERROR, |
|
91 "CSP: CSPEtelConferenceEventMonitor::StartMonitoring: Already active" ); |
|
92 } |
|
93 } |
|
94 |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // From CActive |
|
98 // Handles event notifying. |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 void CSPEtelConferenceEventMonitor::RunL() |
|
102 { |
|
103 CSPLOGSTRING2( CSPREQEND, |
|
104 "CSPEtelConferenceEventMonitor::RunL: status: %d", iStatus.Int() ); |
|
105 |
|
106 // Survive from monitor destruction during observing sequence |
|
107 TBool destroyed = EFalse; |
|
108 iDestrPtr = &destroyed; |
|
109 |
|
110 |
|
111 if ( iStatus == KErrNone ) |
|
112 { |
|
113 CSPLOGSTRING2( CSPINT, |
|
114 "CSP CSPEtelConferenceEventMonitor::RunL Event related callname = %S", |
|
115 &iCallName ); |
|
116 |
|
117 switch ( iEvent ) |
|
118 { |
|
119 case RMobileConferenceCall::EConferenceCallAdded: |
|
120 { |
|
121 CSPLOGSTRING( CSPINT, |
|
122 "CSP CSPEtelConferenceEventMonitor::RunL: ECCPConferenceCallAdded" ); |
|
123 iOwner.NotifyEvent( |
|
124 MCCPConferenceCallObserver::ECCPConferenceCallAdded, |
|
125 iCallName ); |
|
126 |
|
127 break; |
|
128 } |
|
129 // The call has been placed on hold as a result of a local action |
|
130 case RMobileConferenceCall::EConferenceCallRemoved: |
|
131 { |
|
132 CSPLOGSTRING( CSPINT, |
|
133 "CSP CSPEtelConferenceEventMonitor::RunL: ECCPConferenceCallRemoved" ); |
|
134 iOwner.NotifyEvent( |
|
135 MCCPConferenceCallObserver::ECCPConferenceCallRemoved, |
|
136 iCallName ); |
|
137 break; |
|
138 } |
|
139 |
|
140 // The call has been resumed as a result of a local action. |
|
141 case RMobileConferenceCall::EConferenceBuilt: |
|
142 { |
|
143 CSPLOGSTRING( CSPINT, |
|
144 "CSP CSPEtelConferenceEventMonitor::RunL: ECCPConferenceBuilt" ); |
|
145 iOwner.NotifyEvent( |
|
146 MCCPConferenceCallObserver::ECCPConferenceBuilt ); |
|
147 break; |
|
148 } |
|
149 |
|
150 case RMobileConferenceCall::EConferenceTerminated: |
|
151 { |
|
152 CSPLOGSTRING( CSPINT, |
|
153 "CSP CSPEtelConferenceEventMonitor::RunL: ECCPConferenceTerminated" ); |
|
154 iOwner.NotifyEvent( |
|
155 MCCPConferenceCallObserver::ECCPConferenceTerminated ); |
|
156 break; |
|
157 } |
|
158 |
|
159 case RMobileConferenceCall::EConferenceSwapped: |
|
160 { |
|
161 CSPLOGSTRING( CSPINT, |
|
162 "CSP CSPEtelConferenceEventMonitor::RunL: ECCPConferenceSwapped" ); |
|
163 iOwner.NotifyEvent( |
|
164 MCCPConferenceCallObserver::ECCPConferenceSwapped ); |
|
165 break; |
|
166 } |
|
167 |
|
168 case RMobileConferenceCall::EConferenceSplit: |
|
169 { |
|
170 CSPLOGSTRING( CSPINT, |
|
171 "CSP CSPEtelConferenceEventMonitor::RunL: ECCPConferenceSplit" ); |
|
172 iOwner.NotifyEvent( |
|
173 MCCPConferenceCallObserver::ECCPConferenceSplit, |
|
174 iCallName ); |
|
175 break; |
|
176 } |
|
177 |
|
178 default: |
|
179 { |
|
180 CSPLOGSTRING2( CSPERROR, |
|
181 "CSP CSPEtelConferenceEventMonitor::RunL: ERROR Unspecified \ |
|
182 call event: %d", iEvent ); |
|
183 break; |
|
184 } |
|
185 |
|
186 } |
|
187 } |
|
188 else |
|
189 { |
|
190 CSPLOGSTRING2( CSPERROR, |
|
191 "CSP CSPEtelConferenceEventMonitor::RunL err %d", iStatus.Int() ); |
|
192 } |
|
193 |
|
194 if ( !destroyed ) |
|
195 { |
|
196 // In case instance has not been deleted, it is important to clear |
|
197 // iPtr pointer. |
|
198 iDestrPtr = NULL; |
|
199 |
|
200 // ok to modify member variables. |
|
201 if ( iStatus == KErrNone ) |
|
202 { |
|
203 StartMonitoring(); |
|
204 } |
|
205 } |
|
206 else |
|
207 { |
|
208 // already destroyed, do not touch members. |
|
209 } |
|
210 |
|
211 } |
|
212 |
|
213 |
|
214 // --------------------------------------------------------------------------- |
|
215 // From CActive |
|
216 // Request canceling. |
|
217 // --------------------------------------------------------------------------- |
|
218 // |
|
219 void CSPEtelConferenceEventMonitor::DoCancel() |
|
220 { |
|
221 iCall.CancelAsyncRequest( EMobileConferenceCallNotifyConferenceEvent ); |
|
222 } |
|
223 |
|
224 |
|
225 // --------------------------------------------------------------------------- |
|
226 // Constructs the monitor. |
|
227 // --------------------------------------------------------------------------- |
|
228 // |
|
229 CSPEtelConferenceEventMonitor::CSPEtelConferenceEventMonitor( CSPConferenceCall& aOwner, |
|
230 RMobileConferenceCall& aCall ) : |
|
231 CActive( EPriorityStandard ), |
|
232 iOwner( aOwner ), |
|
233 iCall ( aCall ) |
|
234 { |
|
235 CSPLOGSTRING(CSPOBJECT, |
|
236 "CSPEtelConferenceEventMonitor::CSPEtelConferenceEventMonitor()" ); |
|
237 CActiveScheduler::Add( this ); |
|
238 } |
|
239 |
|
240 // --------------------------------------------------------------------------- |
|
241 // Second phase construction. |
|
242 // --------------------------------------------------------------------------- |
|
243 // |
|
244 void CSPEtelConferenceEventMonitor::ConstructL() |
|
245 { |
|
246 // Implementation not required. |
|
247 } |
|
248 |
|
249 |
|
250 // End of file |