author | Shabe Razvi <shaber@symbian.org> |
Wed, 15 Sep 2010 17:56:16 +0100 | |
changeset 75 | 949d9e5675bf |
parent 37 | ba76fc04e6c2 |
permissions | -rw-r--r-- |
37 | 1 |
/* |
2 |
* Copyright (c) 2002-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: This module contains the implementation of CPEClientServices class |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDE FILES |
|
20 |
#include "cpeclientcallrequestmonitor.h" |
|
21 |
#include "cpeclientcommandhandlermonitor.h" |
|
22 |
#include "cpeclientemergencycallmonitor.h" |
|
23 |
#include "cpeclientservices.h" |
|
24 |
#include "cpedevicemodehandler.h" |
|
25 |
#include "cpemessagehandler.h" |
|
26 |
#include "mpecallhandling.h" |
|
27 |
#include "mpephonemodelinternal.h" |
|
28 |
#include <apgtask.h> |
|
29 |
#include <cphcltcallnotify.h> |
|
30 |
#include <cphcltemergencycall.h> |
|
31 |
#include <cphcltussd.h> |
|
32 |
#include <mpedatastore.h> |
|
33 |
#include <talogger.h> |
|
34 |
||
35 |
||
36 |
// ================= MEMBER FUNCTIONS ======================= |
|
37 |
||
38 |
// ----------------------------------------------------------------------------- |
|
39 |
// CPEClientServices::CPEClientServices |
|
40 |
// C++ default constructor can NOT contain any code, that |
|
41 |
// might leave. |
|
42 |
// ----------------------------------------------------------------------------- |
|
43 |
// |
|
44 |
CPEClientServices::CPEClientServices( |
|
45 |
MPEPhoneModelInternal& aModel, |
|
46 |
CPEMessageHandler& aMessageHandler, |
|
47 |
MPECallHandling& aCallHandling, |
|
48 |
CPEManualCallControlHandler& aManualCallControlHandler |
|
49 |
) : iModel( aModel ), |
|
50 |
iMessageHandler( aMessageHandler ), |
|
51 |
iCallHandling( aCallHandling ), |
|
52 |
iManualCallControlHandler( aManualCallControlHandler ) |
|
53 |
{ |
|
54 |
} |
|
55 |
||
56 |
// ----------------------------------------------------------------------------- |
|
57 |
// CPEClientServices::ConstructL |
|
58 |
// Symbian OS default constructor may leave. |
|
59 |
// ----------------------------------------------------------------------------- |
|
60 |
// |
|
61 |
void CPEClientServices::ConstructL() |
|
62 |
{ |
|
63 |
TEFLOGSTRING( KTAOBJECT, "PE CPEClientServices::ConstructL()" ); |
|
64 |
||
65 |
User::LeaveIfError( iPhoneServer.Connect( ) ); |
|
66 |
||
67 |
// Need to call CreateAll so that Phone Server creates all managers |
|
68 |
// (f.ex. USSD manager). Otherwise USSD requests/notifications don't |
|
69 |
// get through unless USSD request is sent from Mobile Terminal first. |
|
70 |
TRequestStatus phoneServerStatus; |
|
71 |
iPhoneServer.CreateAll( phoneServerStatus ); |
|
72 |
User::WaitForRequest( phoneServerStatus ); |
|
73 |
User::LeaveIfError( phoneServerStatus.Int() ); |
|
74 |
||
75 |
iEmergency = CPhCltEmergencyCall::NewL( NULL ); |
|
76 |
||
77 |
iCallNotifier = CPhCltCallNotify::NewL(); |
|
78 |
User::LeaveIfError( iCallNotifier->Open( iPhoneServer ) ); |
|
79 |
||
80 |
iClientCallRequestMonitor = CPEClientCallRequestMonitor::NewL( |
|
81 |
iModel, |
|
82 |
*iCallNotifier ); |
|
83 |
||
84 |
iClientEmergencyMonitor = CPEClientEmergencyCallMonitor::NewL( |
|
85 |
iModel, |
|
86 |
*iCallNotifier ); |
|
87 |
||
88 |
iClientCommandHandlerMonitor = CPEClientCommandHandlerMonitor::NewL( |
|
89 |
iCallHandling, |
|
90 |
iMessageHandler, |
|
91 |
iModel, |
|
92 |
iPhoneServer, |
|
93 |
iManualCallControlHandler ); |
|
94 |
||
95 |
iDeviceModeHandler = CPEDeviceModeHandler::NewL( |
|
96 |
iCallHandling, |
|
97 |
iMessageHandler ); |
|
98 |
} |
|
99 |
||
100 |
// ----------------------------------------------------------------------------- |
|
101 |
// CPEClientServices::NewL |
|
102 |
// Two-phased constructor. |
|
103 |
// ----------------------------------------------------------------------------- |
|
104 |
// |
|
105 |
CPEClientServices* CPEClientServices::NewL( |
|
106 |
MPEPhoneModelInternal& aModel, |
|
107 |
CPEMessageHandler& aMessageHandler, |
|
108 |
MPECallHandling& aCallHandling, |
|
109 |
CPEManualCallControlHandler& aManualCallControlHandler ) |
|
110 |
{ |
|
111 |
TEFLOGSTRING( KTAOBJECT, "PE CPEClientServices::NewL()" ); |
|
112 |
||
113 |
CPEClientServices* self = new ( ELeave ) CPEClientServices( |
|
114 |
aModel, |
|
115 |
aMessageHandler, |
|
116 |
aCallHandling, |
|
117 |
aManualCallControlHandler ); |
|
118 |
||
119 |
CleanupStack::PushL( self ); |
|
120 |
self->ConstructL(); |
|
121 |
CleanupStack::Pop( self ); |
|
122 |
return (self); |
|
123 |
} |
|
124 |
||
125 |
||
126 |
// Destructor |
|
127 |
CPEClientServices::~CPEClientServices () |
|
128 |
{ |
|
129 |
delete iClientCommandHandlerMonitor; |
|
130 |
delete iClientCallRequestMonitor; |
|
131 |
delete iDeviceModeHandler; |
|
132 |
||
133 |
// Cancel any outstanding USSD requests |
|
134 |
if ( iUssdClient ) |
|
135 |
{ |
|
136 |
iUssdClient->SendUssdCancel(); |
|
75
949d9e5675bf
Make CPEClientServices destructor more resilient (Bug 3706)
Shabe Razvi <shaber@symbian.org>
parents:
37
diff
changeset
|
137 |
delete iUssdClient; |
37 | 138 |
} |
139 |
delete iClientEmergencyMonitor; |
|
75
949d9e5675bf
Make CPEClientServices destructor more resilient (Bug 3706)
Shabe Razvi <shaber@symbian.org>
parents:
37
diff
changeset
|
140 |
if ( iCallNotifier ) |
949d9e5675bf
Make CPEClientServices destructor more resilient (Bug 3706)
Shabe Razvi <shaber@symbian.org>
parents:
37
diff
changeset
|
141 |
{ |
949d9e5675bf
Make CPEClientServices destructor more resilient (Bug 3706)
Shabe Razvi <shaber@symbian.org>
parents:
37
diff
changeset
|
142 |
iCallNotifier->Close(); |
949d9e5675bf
Make CPEClientServices destructor more resilient (Bug 3706)
Shabe Razvi <shaber@symbian.org>
parents:
37
diff
changeset
|
143 |
delete iCallNotifier; |
949d9e5675bf
Make CPEClientServices destructor more resilient (Bug 3706)
Shabe Razvi <shaber@symbian.org>
parents:
37
diff
changeset
|
144 |
} |
37 | 145 |
delete iEmergency; |
146 |
iPhoneServer.Close(); |
|
147 |
} |
|
148 |
||
149 |
// ----------------------------------------------------------------------------- |
|
150 |
// CPEClientServices::IsEmergencyPhoneNumber |
|
151 |
// Check if the given telephone number is an emergency number. |
|
152 |
// ----------------------------------------------------------------------------- |
|
153 |
// |
|
154 |
TInt CPEClientServices::IsEmergencyPhoneNumber( |
|
155 |
TPhCltTelephoneNumber& aNumber, |
|
156 |
TBool& aIsEmergencyNumber ) |
|
157 |
{ |
|
158 |
TInt errorCode = iEmergency->IsEmergencyPhoneNumber( aNumber, |
|
159 |
aIsEmergencyNumber ); |
|
160 |
return errorCode; |
|
161 |
} |
|
162 |
||
163 |
// ----------------------------------------------------------------------------- |
|
164 |
// CPEClientServices::SendUssd |
|
165 |
// Process USSD request |
|
166 |
// ----------------------------------------------------------------------------- |
|
167 |
// |
|
168 |
TInt CPEClientServices::SendUssd( |
|
169 |
const TDesC& aString ) // USSD string to be sent. |
|
170 |
{ |
|
171 |
TInt errorCode( KErrNone ); |
|
172 |
||
173 |
TRAP( errorCode, ( iUssdClient = CPhCltUssd::NewL() ) ); |
|
174 |
if( errorCode == KErrNone ) |
|
175 |
{ |
|
176 |
iString.Set( aString ); |
|
177 |
iModel.SendMessage( MEngineMonitor::EPEMessageIssuingUSSDRequest ); |
|
178 |
errorCode = iUssdClient->SendUssd( iString ); |
|
179 |
iModel.SendMessage( MEngineMonitor::EPEMessageIssuedUSSDRequest ); |
|
180 |
TEFLOGSTRING2( KTAINT, |
|
181 |
"PE CPEClientServices::SendUssd, error code: %d", errorCode ); |
|
182 |
||
183 |
delete iUssdClient; |
|
184 |
iUssdClient = NULL; |
|
185 |
} |
|
186 |
else |
|
187 |
{ |
|
188 |
TEFLOGSTRING( KTAERROR, |
|
189 |
"PE CPECLIENTSERVICES::SENDUSSD > CPHCLTUSSD::NEWL FAILED" ); |
|
190 |
} |
|
191 |
||
192 |
return errorCode; |
|
193 |
} |
|
194 |
||
195 |
// ----------------------------------------------------------------------------- |
|
196 |
// CPEClientServices::StartMonitoring |
|
197 |
// Start monitoring |
|
198 |
// ----------------------------------------------------------------------------- |
|
199 |
// |
|
200 |
void CPEClientServices::StartMonitoring() |
|
201 |
{ |
|
202 |
iClientCallRequestMonitor->StartMonitoring(); |
|
203 |
iClientEmergencyMonitor->StartMonitoring(); |
|
204 |
iClientCommandHandlerMonitor->Start(); |
|
205 |
} |
|
206 |
||
207 |
// ----------------------------------------------------------------------------- |
|
208 |
// CPEClientServices::CallRequestMonitor |
|
209 |
// Returns MPEClientCallRequestMonitor object |
|
210 |
// ----------------------------------------------------------------------------- |
|
211 |
// |
|
212 |
MPEClientCallRequestMonitor* CPEClientServices::CallRequestMonitor() |
|
213 |
{ |
|
214 |
// Both monitors are accessed when in RunL, only in Sat call case call |
|
215 |
// request monitor's SendRespond method is called later when monitoring |
|
216 |
// already started. |
|
217 |
if ( !iClientEmergencyMonitor->IsActive() ) |
|
218 |
{ |
|
219 |
return iClientEmergencyMonitor; |
|
220 |
} |
|
221 |
return iClientCallRequestMonitor; |
|
222 |
} |
|
223 |
||
224 |
// ----------------------------------------------------------------------------- |
|
225 |
// CPEClientServices::CommandHandlerMonitor |
|
226 |
// Returns CPEClientCommandHandlerMonitor object |
|
227 |
// ----------------------------------------------------------------------------- |
|
228 |
// |
|
229 |
CPEClientCommandHandlerMonitor* CPEClientServices::CommandHandlerMonitor() |
|
230 |
{ |
|
231 |
return iClientCommandHandlerMonitor; |
|
232 |
} |
|
233 |
||
234 |
// End of File |