|
1 /* |
|
2 * Copyright (c) 2009-2010 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: Create the call and emergency call to ETelMM |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <etelmm.h> |
|
20 #include <mmtsy_names.h> |
|
21 |
|
22 #include "csetupcallrequesthandler.h" |
|
23 #include "CSetUpCallHandler.h" |
|
24 #include "csetupcalldtmfsender.h" |
|
25 #include "msatasynctosync.h" |
|
26 #include "SatLog.h" |
|
27 |
|
28 // ================= MEMBER FUNCTIONS ======================= |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CSetupCallRequestHandler::CSetupCallRequestHandler |
|
32 // The class constructor. |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 CSetupCallRequestHandler::CSetupCallRequestHandler( |
|
36 MSatMultiModeApi& aPhone, CSetUpCallHandler* aDispatcher ) |
|
37 : CActive( EPriorityStandard ), iPhone( aPhone ), |
|
38 iDispatcher( aDispatcher ) |
|
39 { |
|
40 LOG( SIMPLE, |
|
41 "SETUPCALL: CSetupCallRequestHandler::CSetupCallRequestHandler \ |
|
42 calling" ) |
|
43 |
|
44 CActiveScheduler::Add( this ); |
|
45 |
|
46 LOG( SIMPLE, |
|
47 "SETUPCALL: CSetupCallRequestHandler::CSetupCallRequestHandler \ |
|
48 exiting" ) |
|
49 } |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // CSetupCallRequestHandler::NewL |
|
53 // Two-phased constructor. |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 CSetupCallRequestHandler* CSetupCallRequestHandler::NewL( |
|
57 MSatMultiModeApi& aPhone, CSetUpCallHandler* aDispatcher ) |
|
58 { |
|
59 LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::NewL calling" ) |
|
60 |
|
61 CSetupCallRequestHandler* self = |
|
62 new ( ELeave ) CSetupCallRequestHandler( aPhone, aDispatcher ); |
|
63 |
|
64 self->ConstructL(); |
|
65 |
|
66 LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::NewL exiting" ) |
|
67 return self; |
|
68 } |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CSetupCallRequestHandler::~CSetupCallRequestHandler |
|
72 // Destructor |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 CSetupCallRequestHandler::~CSetupCallRequestHandler() |
|
76 { |
|
77 LOG( SIMPLE, "SETUPCALL: \ |
|
78 CSetupCallRequestHandler::~CSetupCallRequestHandler calling" ) |
|
79 Cancel(); |
|
80 iDispatcher = NULL; |
|
81 |
|
82 delete iDtmfSender; |
|
83 iDtmfSender = NULL; |
|
84 |
|
85 LOG( SIMPLE, "SETUPCALL: \ |
|
86 CSetupCallRequestHandler::~CSetupCallRequestHandler exiting" ) |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CSetupCallRequestHandler::ConstructL |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 void CSetupCallRequestHandler::ConstructL() |
|
94 { |
|
95 LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::ConstructL calling" ) |
|
96 iDtmfSender = CSetupCallDtmfSender::NewL( iPhone ); |
|
97 LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::ConstructL exiting" ) |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CSetupCallRequestHandler::DialNumber |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 void CSetupCallRequestHandler::DialNumber( const TDesC8& aCallParams, |
|
105 TDes& aTelNumber, TBool aTerminateOtherCall, |
|
106 MSatAsyncToSync* aAsyncToSync ) |
|
107 { |
|
108 LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::DialNumber calling" ) |
|
109 |
|
110 TInt terminateRes ( KErrNone ); |
|
111 |
|
112 if( aTerminateOtherCall ) |
|
113 { |
|
114 if( aAsyncToSync ) |
|
115 { |
|
116 iPhone.TerminateActiveCalls( aAsyncToSync->RequestStatus() ); |
|
117 terminateRes = aAsyncToSync->SetActiveAndWait(); |
|
118 } |
|
119 else |
|
120 { |
|
121 LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::DialNumber \ |
|
122 bad MSatAsyncToSync pointer" ) |
|
123 terminateRes = KErrGeneral; |
|
124 } |
|
125 } |
|
126 |
|
127 if( !IsActive() ) |
|
128 { |
|
129 if( KErrNone == terminateRes ) |
|
130 { |
|
131 // Separate dtmf string from whole number and store in iDtmfString |
|
132 // the dtmf string will be removed from aTelNumber |
|
133 iDtmfSender->SeparateDtmfFromTelNumber(aTelNumber); |
|
134 // Dial the pure tel number |
|
135 iPhone.DialNoFdnCheck( iStatus, aCallParams, aTelNumber ); |
|
136 SetActive(); |
|
137 } |
|
138 else |
|
139 { |
|
140 iDispatcher->SetupCallRequestComplete( terminateRes ); |
|
141 } |
|
142 } |
|
143 else |
|
144 { |
|
145 iDispatcher->SetupCallRequestComplete( KErrInUse ); |
|
146 } |
|
147 |
|
148 LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::DialNumber exiting" ) |
|
149 } |
|
150 |
|
151 // ----------------------------------------------------------------------------- |
|
152 // CSetupCallRequestHandler::DialEmergencyCall |
|
153 // ----------------------------------------------------------------------------- |
|
154 // |
|
155 void CSetupCallRequestHandler::DialEmergencyCall( const TDesC& aTelNumber ) |
|
156 { |
|
157 LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::DialNumber calling" ) |
|
158 |
|
159 if( !IsActive() ) |
|
160 { |
|
161 iPhone.DialEmergencyCall( iStatus, aTelNumber ); |
|
162 SetActive(); |
|
163 } |
|
164 else |
|
165 { |
|
166 iDispatcher->SetupCallRequestComplete( KErrInUse ); |
|
167 } |
|
168 |
|
169 LOG( SIMPLE, |
|
170 "SETUPCALL: CSetupCallRequestHandler::DialEmergencyCall exiting" ) |
|
171 } |
|
172 |
|
173 // ----------------------------------------------------------------------------- |
|
174 // CSetupCallRequestHandler::RunL |
|
175 // Handles the command. |
|
176 // ----------------------------------------------------------------------------- |
|
177 // |
|
178 void CSetupCallRequestHandler::RunL() |
|
179 { |
|
180 LOG2( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::RunL calling\ |
|
181 iStatus=%i", iStatus.Int() ) |
|
182 |
|
183 iDispatcher->SetupCallRequestComplete( iStatus.Int() ); |
|
184 |
|
185 if ( KErrNone == iStatus.Int() ) |
|
186 { |
|
187 iDtmfSender->SendDtmfString(); |
|
188 } |
|
189 |
|
190 LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::RunL exiting" ) |
|
191 } |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // CSetupCallRequestHandler::CancelOperation |
|
195 // ----------------------------------------------------------------------------- |
|
196 // |
|
197 void CSetupCallRequestHandler::CancelOperation() |
|
198 { |
|
199 LOG( SIMPLE, "SETUPCALL: \ |
|
200 CSetupCallRequestHandler::CancelOperation calling" ) |
|
201 iPhone.DialCancel(); |
|
202 iDtmfSender->Cancel(); |
|
203 LOG( SIMPLE, |
|
204 "SETUPCALL: CSetupCallRequestHandler::CancelOperation exiting" ) |
|
205 } |
|
206 |
|
207 // ----------------------------------------------------------------------------- |
|
208 // From class CActive. |
|
209 // Cancels the sat request. |
|
210 // ----------------------------------------------------------------------------- |
|
211 // |
|
212 void CSetupCallRequestHandler::DoCancel() |
|
213 { |
|
214 LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::DoCancel calling" ) |
|
215 CancelOperation(); |
|
216 LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::DoCancel exiting" ) |
|
217 } |
|
218 |
|
219 // End of File |