0
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2009 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 the License "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: Call Control specific test class. Inherits CSatBase.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <stifparser.h>
|
|
22 |
#include "satcallcontrol.h"
|
|
23 |
|
|
24 |
// CONSTANTS
|
|
25 |
_LIT( KControlResult, "ControlResult" );
|
|
26 |
_LIT( KAlphaIdValidity, "AlphaIdValidity" );
|
|
27 |
_LIT( KType, "Type" );
|
|
28 |
_LIT( KActionOriginator, "ActionOriginator" );
|
|
29 |
_LIT( KBCRepeatIndicator, "BCRepeatIndicator" );
|
|
30 |
_LIT( KCcp1, "Ccp1" );
|
|
31 |
_LIT( KCcp2, "Ccp2" );
|
|
32 |
_LIT( KSubAddress, "SubAddress" );
|
|
33 |
|
|
34 |
#ifndef LEGACY
|
|
35 |
_LIT( KPdpContextParams, "PdpContextParameters" );
|
|
36 |
#endif // LEGACY
|
|
37 |
|
|
38 |
// -----------------------------------------------------------------------------
|
|
39 |
// CSatCallControl::CSatCallControl
|
|
40 |
// C++ default constructor can NOT contain any code, that
|
|
41 |
// might leave.
|
|
42 |
// -----------------------------------------------------------------------------
|
|
43 |
//
|
|
44 |
CSatCallControl::CSatCallControl
|
|
45 |
(
|
|
46 |
const TSatIpc aIpc,
|
|
47 |
const RSat& aSat,
|
|
48 |
CStifItemParser& aParser,
|
|
49 |
CStifLogger& aLog
|
|
50 |
) : CSatBase ( aIpc, aSat, aParser, aLog ), iDataPckg( iData )
|
|
51 |
{
|
|
52 |
}
|
|
53 |
|
|
54 |
// -----------------------------------------------------------------------------
|
|
55 |
// CSatCallControl::~CSatCallControl
|
|
56 |
// Destructor
|
|
57 |
// -----------------------------------------------------------------------------
|
|
58 |
//
|
|
59 |
CSatCallControl::~CSatCallControl()
|
|
60 |
{
|
|
61 |
}
|
|
62 |
|
|
63 |
// -----------------------------------------------------------------------------
|
|
64 |
// CSatCallControl::NotifySat
|
|
65 |
// Send a notify request to Etel and clear internal data
|
|
66 |
// (other items were commented in a header).
|
|
67 |
// -----------------------------------------------------------------------------
|
|
68 |
//
|
|
69 |
TInt CSatCallControl::NotifySat
|
|
70 |
(
|
|
71 |
TRequestStatus& aSimAtkStatus
|
|
72 |
)
|
|
73 |
{
|
|
74 |
TInt ret ( KErrNone );
|
|
75 |
|
|
76 |
// Clear the package
|
|
77 |
Init( iData );
|
|
78 |
|
|
79 |
iSat.NotifyCallControlRequest( aSimAtkStatus, iDataPckg );
|
|
80 |
|
|
81 |
return ret;
|
|
82 |
}
|
|
83 |
|
|
84 |
// -----------------------------------------------------------------------------
|
|
85 |
// CSatCallControl::CheckData
|
|
86 |
// Verifies the validity of received call control event
|
|
87 |
// (other items were commented in a header).
|
|
88 |
// -----------------------------------------------------------------------------
|
|
89 |
//
|
|
90 |
TInt CSatCallControl::CheckData()
|
|
91 |
{
|
|
92 |
iLog.Log( _L( "CSatCallControl::CheckData" ) );
|
|
93 |
|
|
94 |
TInt ret( KErrNone );
|
|
95 |
|
|
96 |
// AlphaId & AlphaIdValidity
|
|
97 |
RSat::TAlphaIdValidity validity;
|
|
98 |
RSat::TAlphaId alphaId;
|
|
99 |
iData.GetAlphaId( validity, alphaId );
|
|
100 |
|
|
101 |
// AlphaIdValidity
|
|
102 |
if ( KErrNone != CheckValue( KAlphaIdValidity, validity, RSat::ENoAlphaId ) )
|
|
103 |
{
|
|
104 |
ret = KErrCorrupt;
|
|
105 |
}
|
|
106 |
|
|
107 |
// AlphaId
|
|
108 |
if ( KErrCorrupt == CheckAlphaId( alphaId ) )
|
|
109 |
{
|
|
110 |
ret = KErrCorrupt;
|
|
111 |
}
|
|
112 |
|
|
113 |
// CallControlType
|
|
114 |
RSat::TCallControlType cct;
|
|
115 |
iData.GetCallControlType( cct );
|
|
116 |
|
|
117 |
if ( KErrNone != CheckValue( KType, cct, RSat::ECcTypeNotSet ) )
|
|
118 |
{
|
|
119 |
ret = KErrCorrupt;
|
|
120 |
}
|
|
121 |
if ( RSat::ECcTypeNotSet == cct )
|
|
122 |
{
|
|
123 |
iLog.Log( _L( "CSatCallControl::CheckData \
|
|
124 |
- CallControlType not set!" ) );
|
|
125 |
// ret = KErrCorrupt;
|
|
126 |
}
|
|
127 |
|
|
128 |
// GeneralResult
|
|
129 |
RSat::TControlResult controlResult;
|
|
130 |
iData.GetCcGeneralResult( controlResult );
|
|
131 |
|
|
132 |
if ( KErrNone != CheckValue( KControlResult, controlResult ) )
|
|
133 |
{
|
|
134 |
ret = KErrCorrupt;
|
|
135 |
}
|
|
136 |
|
|
137 |
// ActionOriginator
|
|
138 |
RSat::TActionOriginator ao;
|
|
139 |
iData.GetActionOriginator( ao );
|
|
140 |
|
|
141 |
if ( KErrNone != CheckValue( KActionOriginator, ao, RSat::EActionOriginatorNotSet ) )
|
|
142 |
{
|
|
143 |
ret = KErrCorrupt;
|
|
144 |
}
|
|
145 |
|
|
146 |
if ( RSat::EActionOriginatorNotSet == ao
|
|
147 |
&& RSat::EAllowedWithModifications == controlResult )
|
|
148 |
{
|
|
149 |
iLog.Log( _L( "CSatCallControl::CheckData \
|
|
150 |
- ActionOriginator not set!" ) );
|
|
151 |
// ret = KErrCorrupt;
|
|
152 |
}
|
|
153 |
|
|
154 |
// Following methods apply only when CC modified the call
|
|
155 |
if ( RSat::EAllowedWithModifications == controlResult )
|
|
156 |
{
|
|
157 |
switch( cct )
|
|
158 |
{
|
|
159 |
case RSat::ECcAddress:
|
|
160 |
{
|
|
161 |
if ( KErrNone != CheckCallParams() )
|
|
162 |
{
|
|
163 |
ret = KErrCorrupt;
|
|
164 |
}
|
|
165 |
break;
|
|
166 |
}
|
|
167 |
case RSat::ECcSsString:
|
|
168 |
{
|
|
169 |
if ( KErrNone != CheckSsParams() )
|
|
170 |
{
|
|
171 |
ret = KErrCorrupt;
|
|
172 |
}
|
|
173 |
break;
|
|
174 |
}
|
|
175 |
case RSat::ECcUssdString:
|
|
176 |
{
|
|
177 |
if ( KErrNone != CheckUssdParams() )
|
|
178 |
{
|
|
179 |
ret = KErrCorrupt;
|
|
180 |
}
|
|
181 |
break;
|
|
182 |
}
|
|
183 |
#ifndef LEGACY
|
|
184 |
case RSat::ECcPDPParameters:
|
|
185 |
{
|
|
186 |
// Parameters are no longer provided to client
|
|
187 |
break;
|
|
188 |
}
|
|
189 |
#endif // LEGACY
|
|
190 |
case RSat::ECcTypeNotSet:
|
|
191 |
default:
|
|
192 |
{
|
|
193 |
iLog.Log( _L( "CSatCallControl::CheckData \
|
|
194 |
- Unknown CallControlType!" ) );
|
|
195 |
ret = KErrCorrupt;
|
|
196 |
break;
|
|
197 |
}
|
|
198 |
}
|
|
199 |
|
|
200 |
}
|
|
201 |
|
|
202 |
return ret;
|
|
203 |
}
|
|
204 |
|
|
205 |
// -----------------------------------------------------------------------------
|
|
206 |
// CSatCallControl::CheckCallParams
|
|
207 |
// Verifies the received parameters
|
|
208 |
// (other items were commented in a header).
|
|
209 |
// -----------------------------------------------------------------------------
|
|
210 |
//
|
|
211 |
TInt CSatCallControl::CheckCallParams()
|
|
212 |
{
|
|
213 |
iLog.Log( _L( "CSatCallControl::CheckCallParams" ) );
|
|
214 |
|
|
215 |
TInt ret( KErrNone );
|
|
216 |
|
|
217 |
// BCRepeatIndicator
|
|
218 |
RSat::TBCRepeatIndicator ri;
|
|
219 |
iData.GetBCRepeatIndicator( ri );
|
|
220 |
|
|
221 |
if ( KErrNone != CheckValue( KBCRepeatIndicator, ri,
|
|
222 |
RSat::EBCAlternateMode ) )
|
|
223 |
{
|
|
224 |
ret = KErrCorrupt;
|
|
225 |
}
|
|
226 |
|
|
227 |
// CallName, not supported but let's make sure it is not set.
|
|
228 |
TName name;
|
|
229 |
iData.GetCallName( name );
|
|
230 |
if ( name.Length() )
|
|
231 |
{
|
|
232 |
iLog.Log( _L( "CSatCallControl::CheckCallParams \
|
|
233 |
- CallName received!" ) );
|
|
234 |
ret = KErrCorrupt;
|
|
235 |
}
|
|
236 |
|
|
237 |
// CallSetUpParams
|
|
238 |
RSat::TCallSetUpParams params;
|
|
239 |
iData.GetCallSetUpDetails( params );
|
|
240 |
|
|
241 |
if ( KErrNone != CheckAddress( params.iAddress ) )
|
|
242 |
{
|
|
243 |
ret = KErrCorrupt;
|
|
244 |
}
|
|
245 |
|
|
246 |
if ( KErrCorrupt == CheckBuffer( KCcp1, params.iCcp1 ) )
|
|
247 |
{
|
|
248 |
ret = KErrCorrupt;
|
|
249 |
}
|
|
250 |
|
|
251 |
if ( KErrCorrupt == CheckBuffer( KCcp2, params.iCcp2 ) )
|
|
252 |
{
|
|
253 |
ret = KErrCorrupt;
|
|
254 |
}
|
|
255 |
|
|
256 |
// Text
|
|
257 |
if ( KErrNone != CheckText( KSubAddress, params.iSubAddress ) )
|
|
258 |
{
|
|
259 |
ret = KErrCorrupt;
|
|
260 |
}
|
|
261 |
|
|
262 |
return ret;
|
|
263 |
}
|
|
264 |
|
|
265 |
// -----------------------------------------------------------------------------
|
|
266 |
// CSatCallControl::CheckSsParams
|
|
267 |
// Verifies the received parameters
|
|
268 |
// (other items were commented in a header).
|
|
269 |
// -----------------------------------------------------------------------------
|
|
270 |
//
|
|
271 |
TInt CSatCallControl::CheckSsParams()
|
|
272 |
{
|
|
273 |
iLog.Log( _L( "CSatCallControl::CheckSsParams" ) );
|
|
274 |
|
|
275 |
TInt ret( KErrNone );
|
|
276 |
|
|
277 |
// Get CC modified data
|
|
278 |
RSat::TSsString ss;
|
|
279 |
iData.GetSendSsDetails( ss );
|
|
280 |
|
|
281 |
// Because TSString- and TAddress-structures are very similar, let's
|
|
282 |
// reuse helper method made for TAddress
|
|
283 |
RSat::TAddress ssAddress;
|
|
284 |
|
|
285 |
ssAddress.iNumberPlan = ss.iNumberPlan;
|
|
286 |
ssAddress.iTypeOfNumber = ss.iTypeOfNumber;
|
|
287 |
ssAddress.iTelNumber.Copy( ss.iSsString ); // Can't overflow
|
|
288 |
|
|
289 |
if ( KErrNone != CheckAddress( ssAddress ) )
|
|
290 |
{
|
|
291 |
ret = KErrCorrupt;
|
|
292 |
}
|
|
293 |
|
|
294 |
return ret;
|
|
295 |
}
|
|
296 |
|
|
297 |
// -----------------------------------------------------------------------------
|
|
298 |
// CSatCallControl::CheckUssdParams
|
|
299 |
// Verifies the received parameters
|
|
300 |
// (other items were commented in a header).
|
|
301 |
// -----------------------------------------------------------------------------
|
|
302 |
//
|
|
303 |
TInt CSatCallControl::CheckUssdParams()
|
|
304 |
{
|
|
305 |
iLog.Log( _L( "CSatCallControl::CheckUssdParams" ) );
|
|
306 |
|
|
307 |
TInt ret( KErrNone );
|
|
308 |
|
|
309 |
// Get CC modified data
|
|
310 |
RSat::TUssdString ussd;
|
|
311 |
iData.GetSendUssdDetails( ussd );
|
|
312 |
|
|
313 |
// Reference from script
|
|
314 |
RSat::TUssdString scriptedUssd;
|
|
315 |
if ( KErrNone != GetUssdString( scriptedUssd ) )
|
|
316 |
{
|
|
317 |
iLog.Log( _L( "CSatCallControl::CheckData \
|
|
318 |
- Mandatory parameter UssdString missing from script!" ) );
|
|
319 |
ret = KErrArgument;
|
|
320 |
}
|
|
321 |
else
|
|
322 |
{
|
|
323 |
// String
|
|
324 |
if ( scriptedUssd.iUssdString != ussd.iUssdString )
|
|
325 |
{
|
|
326 |
iLog.Log( _L( "CSatCallControl::CheckUssdParams: ERROR \
|
|
327 |
UssdString mismatch!" ) );
|
|
328 |
ret = KErrCorrupt;
|
|
329 |
}
|
|
330 |
|
|
331 |
// DCS
|
|
332 |
if ( scriptedUssd.iDcs != ussd.iDcs )
|
|
333 |
{
|
|
334 |
iLog.Log( _L( "CSatCallControl::CheckUssdParams: ERROR \
|
|
335 |
UssdString DCS mismatch!" ) );
|
|
336 |
ret = KErrCorrupt;
|
|
337 |
}
|
|
338 |
}
|
|
339 |
|
|
340 |
return ret;
|
|
341 |
}
|
|
342 |
|
|
343 |
// -----------------------------------------------------------------------------
|
|
344 |
// CSatCallControl::CheckPdpParams
|
|
345 |
// Verifies the received parameters
|
|
346 |
// (other items were commented in a header).
|
|
347 |
// -----------------------------------------------------------------------------
|
|
348 |
//
|
|
349 |
TInt CSatCallControl::CheckPdpParams()
|
|
350 |
{
|
|
351 |
iLog.Log( _L( "CSatCallControl::CheckPdpParams" ) );
|
|
352 |
|
|
353 |
TInt ret( KErrNone );
|
|
354 |
|
|
355 |
#ifndef LEGACY
|
|
356 |
|
|
357 |
TPdpParameters pdpParameters;
|
|
358 |
iData.GetPdpParameters( pdpParameters );
|
|
359 |
|
|
360 |
if ( KErrCorrupt == CheckBuffer( KPdpContextParams, pdpParameters ) )
|
|
361 |
{
|
|
362 |
ret = KErrCorrupt;
|
|
363 |
}
|
|
364 |
|
|
365 |
#endif // LEGACY
|
|
366 |
|
|
367 |
return ret;
|
|
368 |
}
|
|
369 |
|
|
370 |
// End of file
|