1 /* |
|
2 * Copyright (c) 2007-2008 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 CSPEtelConferenceStatusMonitor which |
|
15 * monitors call status changes from ETel and notifies observer |
|
16 * according to call status change. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #include "cspetelconferencestatusmonitor.h" |
|
22 |
|
23 #include <mccpconferencecallobserver.h> |
|
24 |
|
25 #include "csplogger.h" |
|
26 #include "cspconferencecall.h" |
|
27 |
|
28 |
|
29 // --------------------------------------------------------------------------- |
|
30 // CSPEtelConferenceStatusMonitor::NewL. |
|
31 // --------------------------------------------------------------------------- |
|
32 // |
|
33 CSPEtelConferenceStatusMonitor* CSPEtelConferenceStatusMonitor::NewL( |
|
34 MCSPConferenceStatusObserver& aOwner, |
|
35 RMobileConferenceCall& aCall ) |
|
36 { |
|
37 CSPLOGSTRING(CSPOBJECT, "CSPEtelConferenceStatusMonitor::NewL()" ); |
|
38 CSPEtelConferenceStatusMonitor* self = |
|
39 new ( ELeave ) CSPEtelConferenceStatusMonitor( |
|
40 aOwner, aCall ); |
|
41 CleanupStack::PushL( self ); |
|
42 self->ConstructL( ); |
|
43 CleanupStack::Pop( self ); |
|
44 return self; |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // Destructs the object by canceling first ongoing monitoring. |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 CSPEtelConferenceStatusMonitor::~CSPEtelConferenceStatusMonitor( ) |
|
52 { |
|
53 CSPLOGSTRING(CSPOBJECT, |
|
54 "CSPEtelConferenceStatusMonitor::~CSPEtelConferenceStatusMonitor()" ); |
|
55 Cancel(); |
|
56 |
|
57 if ( iDestrPtr ) |
|
58 { |
|
59 *iDestrPtr = ETrue; |
|
60 iDestrPtr = NULL; |
|
61 } |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // Starts the monitoring. |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 void CSPEtelConferenceStatusMonitor::StartMonitoring() |
|
69 { |
|
70 CSPLOGSTRING(CSPOBJECT, |
|
71 "CSPEtelConferenceStatusMonitor::StartMonitoring()" ); |
|
72 if ( !IsActive() ) |
|
73 { |
|
74 CSPLOGSTRING( CSPREQOUT, |
|
75 "CSP: CSPEtelConferenceStatusMonitor::StartMonitoring: Request \ |
|
76 RMobilePhone::NotifyMobileStatusChange" ); |
|
77 iCall.NotifyConferenceStatusChange( iStatus, iConferenceStatus ); |
|
78 SetActive(); |
|
79 } |
|
80 else |
|
81 { |
|
82 CSPLOGSTRING( CSPERROR, |
|
83 "CSP: CSPEtelConferenceStatusMonitor::StartMonitoring: Already active" ); |
|
84 } |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------------------------- |
|
88 // From CActive |
|
89 // Handles call status notifying. |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 void CSPEtelConferenceStatusMonitor::RunL() |
|
93 { |
|
94 CSPLOGSTRING2( CSPREQEND, |
|
95 "CSPEtelConferenceStatusMonitor::RunL: status: %d", iStatus.Int() ); |
|
96 |
|
97 // Survive from monitor destruction during observing sequence |
|
98 TBool destroyed = EFalse; |
|
99 iDestrPtr = &destroyed; |
|
100 |
|
101 if ( iStatus == KErrNone ) |
|
102 { |
|
103 switch ( iConferenceStatus ) |
|
104 { |
|
105 |
|
106 case RMobileConferenceCall::EConferenceIdle: |
|
107 { |
|
108 CSPLOGSTRING( CSPINT, "CSPETelConferenceStatusMonitor IDLE"); |
|
109 iOwner.NotifyStateChange( |
|
110 MCSPConferenceStatusObserver::ECSPConferenceIdle ); |
|
111 break; |
|
112 } |
|
113 |
|
114 case RMobileConferenceCall::EConferenceActive: |
|
115 { |
|
116 CSPLOGSTRING( CSPINT, "CSPETelConferenceStatusMonitor ACTIVE"); |
|
117 iOwner.NotifyStateChange( |
|
118 MCSPConferenceStatusObserver::ECSPConferenceActive ); |
|
119 break; |
|
120 } |
|
121 case RMobileConferenceCall::EConferenceHold: |
|
122 { |
|
123 CSPLOGSTRING( CSPINT, "CSPETelConferenceStatusMonitor HOLD"); |
|
124 |
|
125 iOwner.NotifyStateChange( |
|
126 MCSPConferenceStatusObserver::ECSPConferenceHold ); |
|
127 |
|
128 break; |
|
129 } |
|
130 |
|
131 default: |
|
132 { |
|
133 CSPLOGSTRING2( CSPINT, |
|
134 "CSP CSPEtelConferenceStatusMonitor::RunL: Unspecified/protocol \ |
|
135 specific call status: %d", iConferenceStatus ); |
|
136 break; |
|
137 } |
|
138 } |
|
139 |
|
140 } |
|
141 else |
|
142 { |
|
143 CSPLOGSTRING2( CSPERROR, |
|
144 "CSP CSPEtelConferenceStatusMonitor::RunL err %d", iStatus.Int() ); |
|
145 } |
|
146 |
|
147 if ( !destroyed ) |
|
148 { |
|
149 // In case instance has not been deleted, it is important to clear |
|
150 // iPtr pointer. |
|
151 iDestrPtr = NULL; |
|
152 |
|
153 // ok to modify member variables. |
|
154 if ( iStatus == KErrNone ) |
|
155 { |
|
156 StartMonitoring(); |
|
157 } |
|
158 } |
|
159 else |
|
160 { |
|
161 // Already destroyed, do not touch members. |
|
162 } |
|
163 } |
|
164 |
|
165 // --------------------------------------------------------------------------- |
|
166 // From CActive |
|
167 // Canceling functionality. |
|
168 // --------------------------------------------------------------------------- |
|
169 // |
|
170 void CSPEtelConferenceStatusMonitor::DoCancel() |
|
171 { |
|
172 iCall.CancelAsyncRequest( |
|
173 EMobileConferenceCallNotifyConferenceStatusChange ); |
|
174 } |
|
175 |
|
176 // --------------------------------------------------------------------------- |
|
177 // Constructs the monitor.. |
|
178 // --------------------------------------------------------------------------- |
|
179 // |
|
180 CSPEtelConferenceStatusMonitor::CSPEtelConferenceStatusMonitor( |
|
181 MCSPConferenceStatusObserver& aOwner, |
|
182 RMobileConferenceCall& aCall ) : |
|
183 CActive( EPriorityStandard ), |
|
184 iOwner( aOwner ), |
|
185 iCall ( aCall ) |
|
186 { |
|
187 CSPLOGSTRING(CSPOBJECT, |
|
188 "CSPEtelConferenceStatusMonitor::CSPEtelConferenceStatusMonitor()" ); |
|
189 CActiveScheduler::Add( this ); |
|
190 } |
|
191 |
|
192 // --------------------------------------------------------------------------- |
|
193 // Second phase construction. |
|
194 // --------------------------------------------------------------------------- |
|
195 // |
|
196 void CSPEtelConferenceStatusMonitor::ConstructL() |
|
197 { |
|
198 // Implementation not required. |
|
199 } |
|
200 |
|
201 |
|
202 // End of file |
|