33
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-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: Handles OpenChannel command
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include <etelpckt.h>
|
|
20 |
#include <etelmmerr.h>
|
|
21 |
|
|
22 |
#include "COpenChannelHandler.h"
|
|
23 |
#include "MSatApi.h"
|
|
24 |
#include "MSatUtils.h"
|
|
25 |
#include "MSatUiSession.h"
|
|
26 |
#include "MSatSystemState.h"
|
|
27 |
#include "MSatApnHandler.h"
|
|
28 |
#include "SatSOpcodes.h"
|
|
29 |
#include "MSatSUiClientHandler.h"
|
|
30 |
#include "SatLog.h"
|
|
31 |
#include "extendedconnpref.h"
|
|
32 |
|
|
33 |
const TUint8 KChannelStatusLength( 2 );
|
|
34 |
|
|
35 |
// ======== MEMBER FUNCTIONS ========
|
|
36 |
|
|
37 |
// -----------------------------------------------------------------------------
|
|
38 |
// Two-phased constructor.
|
|
39 |
// -----------------------------------------------------------------------------
|
|
40 |
//
|
|
41 |
COpenChannelHandler* COpenChannelHandler::NewL( MSatUtils* aUtils )
|
|
42 |
{
|
|
43 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::NewL calling" )
|
|
44 |
|
|
45 |
COpenChannelHandler* self = new( ELeave ) COpenChannelHandler;
|
|
46 |
|
|
47 |
CleanupStack::PushL( self );
|
|
48 |
self->BaseConstructL( aUtils );
|
|
49 |
self->ConstructL();
|
|
50 |
CleanupStack::Pop( self );
|
|
51 |
|
|
52 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::NewL exiting" )
|
|
53 |
return self;
|
|
54 |
}
|
|
55 |
|
|
56 |
// -----------------------------------------------------------------------------
|
|
57 |
// Destructor
|
|
58 |
// -----------------------------------------------------------------------------
|
|
59 |
//
|
|
60 |
COpenChannelHandler::~COpenChannelHandler()
|
|
61 |
{
|
|
62 |
LOG( SIMPLE,
|
|
63 |
"OPENCHANNEL: COpenChannelHandler::~COpenChannelHandler calling" )
|
|
64 |
|
|
65 |
Cancel();
|
|
66 |
iDataChannel = NULL;
|
|
67 |
|
|
68 |
delete iConnectionInfo.iOverrideSet;
|
|
69 |
|
|
70 |
LOG( SIMPLE,
|
|
71 |
"OPENCHANNEL: COpenChannelHandler::~CCloseChannelHandler exiting" )
|
|
72 |
}
|
|
73 |
|
|
74 |
// ---------------------------------------------------------------------------
|
|
75 |
// From class MSatCommand.
|
|
76 |
// Response from the client.
|
|
77 |
// ---------------------------------------------------------------------------
|
|
78 |
//
|
|
79 |
void COpenChannelHandler::ClientResponse()
|
|
80 |
{
|
|
81 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::ClientResponse calling" )
|
|
82 |
|
|
83 |
// Query response from client.
|
|
84 |
if ( !iQueryRsp.iAccepted ) // Not accepted by user
|
|
85 |
{
|
|
86 |
// Close data channel
|
|
87 |
CloseChannel();
|
|
88 |
|
|
89 |
if ( iQueryRsp.iSessionTerminatedByUser ) // Terminated by user
|
|
90 |
{
|
|
91 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::ClientResponse \
|
|
92 |
Session terminated by user" )
|
|
93 |
// Notify sim session end command that next sim session end
|
|
94 |
// should close the ui session.
|
|
95 |
iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
|
|
96 |
|
|
97 |
// Terminal response, SimSessionTerminatedByUser
|
|
98 |
iOpenChannelRsp.iGeneralResult = RSat::KPSessionTerminatedByUser;
|
|
99 |
}
|
|
100 |
else
|
|
101 |
{
|
|
102 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::ClientResponse \
|
|
103 |
User not accept command" )
|
|
104 |
|
|
105 |
// Send terminal response -> User not accepted
|
|
106 |
iOpenChannelRsp.iGeneralResult = RSat::KPCmdNotAcceptedByUser;
|
|
107 |
}
|
|
108 |
|
|
109 |
iOpenChannelRsp.iInfoType = RSat::KNoAdditionalInfo;
|
|
110 |
iOpenChannelRsp.iAdditionalInfo.Zero();
|
|
111 |
iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
|
|
112 |
TerminalRsp( iPCmd, iOpenChannelRspPckg );
|
|
113 |
}
|
|
114 |
else // Accepted by user
|
|
115 |
{
|
|
116 |
LOG( NORMAL,
|
|
117 |
"OPENCHANNEL: COpenChannelHandler::ClientResponse User accepted" )
|
|
118 |
// User accepted
|
|
119 |
const TInt linkEst( iOpenChannelData.iLinkEst );
|
|
120 |
|
|
121 |
// SetUp channel if activation is on demand
|
|
122 |
if ( ( RSat::EOnDemand == linkEst ) && ( KErrNone != SetUpChannel() ) )
|
|
123 |
{
|
|
124 |
// Close channel and send error if setup failed
|
|
125 |
CloseChannel();
|
|
126 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::ClientResponse \
|
|
127 |
SetUp failed" )
|
|
128 |
iOpenChannelRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
|
|
129 |
iOpenChannelRsp.iInfoType = RSat::KNoAdditionalInfo;
|
|
130 |
iOpenChannelRsp.iAdditionalInfo.Zero();
|
|
131 |
iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
|
|
132 |
TerminalRsp( iPCmd, iOpenChannelRspPckg );
|
|
133 |
}
|
|
134 |
else
|
|
135 |
{
|
|
136 |
// Send terminal response
|
|
137 |
SendSuccessTerminalRsp();
|
|
138 |
}
|
|
139 |
|
|
140 |
}
|
|
141 |
|
|
142 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::ClientResponse exiting" )
|
|
143 |
}
|
|
144 |
|
|
145 |
// -----------------------------------------------------------------------------
|
|
146 |
// From class MSatConnectionObserver.
|
|
147 |
// Notification from the connection.
|
|
148 |
// -----------------------------------------------------------------------------
|
|
149 |
//
|
|
150 |
void COpenChannelHandler::ConnectionNotification( TInt aError )
|
|
151 |
{
|
|
152 |
LOG2( SIMPLE, "OPENCHANNEL: COpenChannelHandler::ConnectionNotification\
|
|
153 |
calling with code %i", aError )
|
|
154 |
|
|
155 |
// Check connection status
|
|
156 |
if ( KErrNone == aError )
|
|
157 |
{
|
|
158 |
// If information indication to the user is needed, show it now.
|
|
159 |
if ( iNeedUiSession )
|
|
160 |
{
|
|
161 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::HandleCommand \
|
|
162 |
Sending UI Notification" )
|
|
163 |
|
|
164 |
// Send confirmation to UI and wait for client response
|
|
165 |
SendConfirmToUi();
|
|
166 |
}
|
|
167 |
else
|
|
168 |
{
|
|
169 |
// Send successfull terminal response
|
|
170 |
SendSuccessTerminalRsp();
|
|
171 |
}
|
|
172 |
}
|
|
173 |
else
|
|
174 |
{
|
|
175 |
// Activation failed, Close channel and send error
|
|
176 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::ConnectionNotification \
|
|
177 |
Channel activation failed" )
|
|
178 |
|
|
179 |
// Close channel
|
|
180 |
CloseChannel();
|
|
181 |
|
|
182 |
// PDP Activation failed
|
|
183 |
iOpenChannelRsp.iGeneralResult = RSat::KBearerIndepProtocolError;
|
|
184 |
iOpenChannelRsp.iInfoType = RSat::KMeProblem;
|
|
185 |
iOpenChannelRsp.iAdditionalInfo.SetLength( 1 );
|
|
186 |
iOpenChannelRsp.iAdditionalInfo[0] = RSat::KNoSpecificBIPError;
|
|
187 |
iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
|
|
188 |
TerminalRsp( iPCmd, iOpenChannelRspPckg );
|
|
189 |
}
|
|
190 |
|
|
191 |
LOG( SIMPLE,
|
|
192 |
"OPENCHANNEL: COpenChannelHandler::ConnectionNotification exiting" )
|
|
193 |
}
|
|
194 |
|
|
195 |
// -----------------------------------------------------------------------------
|
|
196 |
// From class CSatCommandHandler.
|
|
197 |
// Event notification.
|
|
198 |
// -----------------------------------------------------------------------------
|
|
199 |
//
|
|
200 |
void COpenChannelHandler::Event( TInt aEvent )
|
|
201 |
{
|
|
202 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::Event calling" )
|
|
203 |
|
|
204 |
// Check event
|
|
205 |
if ( MSatUtils::ESatUiLaunched == aEvent )
|
|
206 |
{
|
|
207 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::Event ESatUiLaunched" )
|
|
208 |
iUtils->UnregisterEvent( this, MSatUtils::ESatUiLaunched );
|
|
209 |
|
|
210 |
// Send confirm to UI
|
|
211 |
SendConfirmToUi();
|
|
212 |
}
|
|
213 |
|
|
214 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::Event exiting" )
|
|
215 |
}
|
|
216 |
|
|
217 |
// -----------------------------------------------------------------------------
|
|
218 |
// From class CActive.
|
|
219 |
// Cancels the sat request.
|
|
220 |
// -----------------------------------------------------------------------------
|
|
221 |
//
|
|
222 |
void COpenChannelHandler::DoCancel()
|
|
223 |
{
|
|
224 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::DoCancel calling" )
|
|
225 |
|
|
226 |
iUtils->USatAPI().NotifyOpenChannelCancel();
|
|
227 |
|
|
228 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::DoCancel exiting" )
|
|
229 |
}
|
|
230 |
|
|
231 |
// -----------------------------------------------------------------------------
|
|
232 |
// From class CSatCommandHandler.
|
|
233 |
// Requests the command notification.
|
|
234 |
// -----------------------------------------------------------------------------
|
|
235 |
//
|
|
236 |
void COpenChannelHandler::IssueUSATRequest( TRequestStatus& aStatus )
|
|
237 |
{
|
|
238 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::IssueUSATRequest calling" )
|
|
239 |
|
|
240 |
// Reset values
|
|
241 |
iDataChannel = NULL;
|
|
242 |
iSetUpWithModifications = EFalse;
|
|
243 |
iNeedUiSession = EFalse;
|
|
244 |
|
|
245 |
// Reset open channel data.
|
|
246 |
new (&iOpenChannelData) RSat::TOpenGprsChannelV4();
|
|
247 |
new (&iQueryData) TSatQueryV1();
|
|
248 |
|
|
249 |
iUtils->USatAPI().NotifyOpenChannel( aStatus, iOpenChannelPckg );
|
|
250 |
iUtils->NotifyEvent( MSatUtils::EBipCommandDoneExecuting );
|
|
251 |
|
|
252 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::IssueUSATRequest exiting" )
|
|
253 |
}
|
|
254 |
|
|
255 |
// -----------------------------------------------------------------------------
|
|
256 |
// From class CSatCommandHandler.
|
|
257 |
// OpenChannel command is not allowed in following situations:
|
|
258 |
// - Phone is not registered to homenetwork and roaming.
|
|
259 |
// - phone is ringing, alerting or call is on and OpenChannel command
|
|
260 |
// is "make call only if not busy", "make call only if not busy wiht
|
|
261 |
// redial" or "Call type not set".
|
|
262 |
// -----------------------------------------------------------------------------
|
|
263 |
//
|
|
264 |
TBool COpenChannelHandler::CommandAllowed()
|
|
265 |
{
|
|
266 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::CommandAllowed calling" )
|
|
267 |
|
|
268 |
// Define the PCmd here since this is the first place after notification
|
|
269 |
iPCmd = RSat::EOpenChannelGprs; // Other possible values
|
|
270 |
// RSat::EOpenChannelCs
|
|
271 |
// RSat::EOpenChannelLocal
|
|
272 |
|
|
273 |
// Check parameters here, because every terminal response must contain info
|
|
274 |
// about Bearer Set and BufferSize.
|
|
275 |
TBool result( CheckParameters() );
|
|
276 |
|
|
277 |
// Indicates channel activation type
|
|
278 |
const TBool activateImmediately(
|
|
279 |
RSat::EImmediate == iOpenChannelData.iLinkEst );
|
|
280 |
|
|
281 |
//lint -e{961} Else block not needed.
|
|
282 |
if ( ( RSat::EAlphaIdProvided != iOpenChannelData.iAlphaId.iStatus ) &&
|
|
283 |
( RSat::ESelfExplanatory == iOpenChannelData.iIconId.iQualifier ||
|
|
284 |
RSat::ENotSelfExplanatory == iOpenChannelData.iIconId.iQualifier ) )
|
|
285 |
{
|
|
286 |
iOpenChannelRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
|
|
287 |
iOpenChannelRsp.iInfoType = RSat::KNoAdditionalInfo;
|
|
288 |
iOpenChannelRsp.iAdditionalInfo.Zero();
|
|
289 |
result = EFalse;
|
|
290 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CommandAllowed \
|
|
291 |
icon received without alpha id" )
|
|
292 |
}
|
|
293 |
// If parameters are OK, check rest.
|
|
294 |
else if ( result && activateImmediately )
|
|
295 |
{
|
|
296 |
// Set result to False. If checks goes OK, this is set to ETrue.
|
|
297 |
result = EFalse;
|
|
298 |
|
|
299 |
RMobilePhone::TMobilePhoneRegistrationStatus registrationStatus(
|
|
300 |
iUtils->SystemState().GetNetworkRegistrationStatus() );
|
|
301 |
|
|
302 |
// Indicates is there service on network
|
|
303 |
const TBool noService(
|
|
304 |
( RMobilePhone::ERegisteredOnHomeNetwork != registrationStatus ) &&
|
|
305 |
( RMobilePhone::ERegisteredRoaming != registrationStatus ) );
|
|
306 |
|
|
307 |
if ( RMobilePhone::ERegistrationUnknown == registrationStatus )
|
|
308 |
{
|
|
309 |
LOG( NORMAL,
|
|
310 |
"OPENCHANNEL: COpenChannelHandler::CommandAllowed \
|
|
311 |
NetworkRegStatus not available" )
|
|
312 |
iOpenChannelRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
|
|
313 |
iOpenChannelRsp.iInfoType = RSat::KMeProblem;
|
|
314 |
iOpenChannelRsp.iAdditionalInfo.SetLength( 1 );
|
|
315 |
iOpenChannelRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
|
|
316 |
}
|
|
317 |
// Check registration status
|
|
318 |
else if ( noService )
|
|
319 |
{
|
|
320 |
// No service
|
|
321 |
LOG( NORMAL,
|
|
322 |
"OPENCHANNEL: COpenChannelHandler::CommandAllowed No service" )
|
|
323 |
|
|
324 |
iOpenChannelRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
|
|
325 |
iOpenChannelRsp.iInfoType = RSat::KMeProblem;
|
|
326 |
iOpenChannelRsp.iAdditionalInfo.SetLength( 1 );
|
|
327 |
iOpenChannelRsp.iAdditionalInfo[0] = RSat::KNoService;
|
|
328 |
}
|
|
329 |
else
|
|
330 |
{
|
|
331 |
// Command allowed
|
|
332 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CommandAllowed \
|
|
333 |
Command is allowed Immediate activation" )
|
|
334 |
result = ETrue;
|
|
335 |
}
|
|
336 |
}
|
|
337 |
|
|
338 |
if ( !result ) // Send Terminal response, if result is not OK
|
|
339 |
{
|
|
340 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CommandAllowed \
|
|
341 |
result not OK" )
|
|
342 |
iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
|
|
343 |
TerminalRsp( iPCmd, iOpenChannelRspPckg );
|
|
344 |
}
|
|
345 |
else
|
|
346 |
{
|
|
347 |
// Register to handle UI commands.
|
|
348 |
TRAPD( err, iUtils->RegisterServiceRequestL( ESatSProactiveQuery,
|
|
349 |
ESatSProactiveQueryResponse, this ) );
|
|
350 |
|
|
351 |
LOG2( NORMAL, "OPENCHANNEL: COpenChannelHandler::CommandAllowed \
|
|
352 |
err: %d", err )
|
|
353 |
// Above function leaves only when there is not enough memory to
|
|
354 |
// allocate new object. So this case is very rare.
|
|
355 |
if ( KErrNone != err )
|
|
356 |
{
|
|
357 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CommandAllowed \
|
|
358 |
Error while registering service request" )
|
|
359 |
|
|
360 |
// Send general terminal response (no BIP specific)
|
|
361 |
iOpenChannelRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
|
|
362 |
iOpenChannelRsp.iInfoType = RSat::KMeProblem;
|
|
363 |
iOpenChannelRsp.iAdditionalInfo.SetLength( 1 );
|
|
364 |
iOpenChannelRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
|
|
365 |
iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
|
|
366 |
TerminalRsp( iPCmd, iOpenChannelRspPckg );
|
|
367 |
|
|
368 |
// Cannot complete, there are some major memory problems
|
|
369 |
result = EFalse;
|
|
370 |
}
|
|
371 |
// Set icon command flag whether icon data was received and
|
|
372 |
// set qualifier to no icon id
|
|
373 |
// To be removed when icons are allowed in this command
|
|
374 |
else if ( ( RSat::ESelfExplanatory ==
|
|
375 |
iOpenChannelData.iIconId.iQualifier ) ||
|
|
376 |
( RSat::ENotSelfExplanatory ==
|
|
377 |
iOpenChannelData.iIconId.iQualifier ) )
|
|
378 |
{
|
|
379 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CommandAllowed \
|
|
380 |
ENoIconId" )
|
|
381 |
iIconCommand = ETrue;
|
|
382 |
iOpenChannelData.iIconId.iQualifier = RSat::ENoIconId;
|
|
383 |
}
|
|
384 |
else
|
|
385 |
{
|
|
386 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CommandAllowed \
|
|
387 |
others" )
|
|
388 |
iIconCommand = EFalse;
|
|
389 |
}
|
|
390 |
}
|
|
391 |
|
|
392 |
LOG2( SIMPLE, "OPENCHANNEL: COpenChannelHandler::CommandAllowed exiting,\
|
|
393 |
result: %d", result )
|
|
394 |
return result;
|
|
395 |
}
|
|
396 |
|
|
397 |
// -----------------------------------------------------------------------------
|
|
398 |
// From class CSatCommandHandler.
|
|
399 |
// Need for ui session.
|
|
400 |
// -----------------------------------------------------------------------------
|
|
401 |
//
|
|
402 |
TBool COpenChannelHandler::NeedUiSession()
|
|
403 |
{
|
|
404 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::NeedUiSession calling" )
|
|
405 |
|
|
406 |
// UI is NOT needed in case where AlphaID is provided and it is a NULL
|
|
407 |
iNeedUiSession =
|
|
408 |
!( RSat::EAlphaIdNull == iOpenChannelData.iAlphaId.iStatus );
|
|
409 |
|
|
410 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::NeedUiSession exiting" )
|
|
411 |
// We do not need UI session at this point, but we will launch it by
|
|
412 |
// ourselves when we do.
|
|
413 |
return EFalse;
|
|
414 |
}
|
|
415 |
|
|
416 |
// -----------------------------------------------------------------------------
|
|
417 |
// From class CSatCommandHandler.
|
|
418 |
// Called when USAT API notifies that command.
|
|
419 |
// -----------------------------------------------------------------------------
|
|
420 |
//
|
|
421 |
void COpenChannelHandler::HandleCommand()
|
|
422 |
{
|
|
423 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::HandleCommand calling" )
|
|
424 |
|
|
425 |
// Notify others
|
|
426 |
iUtils->NotifyEvent( MSatUtils::EOpenChannelExecuting );
|
|
427 |
iUtils->NotifyEvent( MSatUtils::EBipCommandExecuting );
|
|
428 |
|
|
429 |
TInt error( MSatBIPUtils::ESatBIPNoChannelAvail ); // By default, negative
|
|
430 |
|
|
431 |
// Create data channel
|
|
432 |
TRAPD( leaveErr,
|
|
433 |
iDataChannel = iUtils->BipUtils().CreateChannelL(
|
|
434 |
iBearerType, error ) );
|
|
435 |
|
|
436 |
// Check the channel creation
|
|
437 |
if ( ( MSatBIPUtils::ESatBIPSuccess != error ) ||
|
|
438 |
( KErrNone != leaveErr ) )
|
|
439 |
{
|
|
440 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::HandleCommand\
|
|
441 |
Channel creation failed" )
|
|
442 |
|
|
443 |
// Channel creation failed -> Send terminal response
|
|
444 |
iOpenChannelRsp.iGeneralResult = RSat::KBearerIndepProtocolError;
|
|
445 |
iOpenChannelRsp.iInfoType = RSat::KMeProblem;
|
|
446 |
iOpenChannelRsp.iAdditionalInfo.SetLength( 1 );
|
|
447 |
iOpenChannelRsp.iAdditionalInfo[0] = RSat::KNoChannelAvailable;
|
|
448 |
iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
|
|
449 |
TerminalRsp( iPCmd, iOpenChannelRspPckg );
|
|
450 |
|
|
451 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannel::HandleCommand exiting" )
|
|
452 |
return;
|
|
453 |
}
|
|
454 |
|
|
455 |
LOG( NORMAL,
|
|
456 |
"OPENCHANNEL: COpenChannelHandler::HandleCommand Channel creation OK" )
|
|
457 |
|
|
458 |
// Open channel or request confirmation from user
|
|
459 |
const TInt linkEst( iOpenChannelData.iLinkEst );
|
|
460 |
|
|
461 |
// If not confirmation to user or immediate activation, open channel
|
|
462 |
if ( ( !iNeedUiSession || RSat::EImmediate == linkEst )
|
|
463 |
&& KErrNone != SetUpChannel() )
|
|
464 |
{
|
|
465 |
// Setup failed, close channel and send error
|
|
466 |
LOG( NORMAL,
|
|
467 |
"OPENCHANNEL: COpenChannelHandler::HandleCommand SetUp failed" )
|
|
468 |
|
|
469 |
// Close channel, there was an error
|
|
470 |
CloseChannel();
|
|
471 |
|
|
472 |
// Channel setup failed
|
|
473 |
iOpenChannelRsp.iGeneralResult = RSat::KBearerIndepProtocolError;
|
|
474 |
iOpenChannelRsp.iInfoType = RSat::KMeProblem;
|
|
475 |
iOpenChannelRsp.iAdditionalInfo.SetLength( 1 );
|
|
476 |
iOpenChannelRsp.iAdditionalInfo[0] = RSat::KNoSpecificBIPError;
|
|
477 |
iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
|
|
478 |
TerminalRsp( iPCmd, iOpenChannelRspPckg );
|
|
479 |
|
|
480 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::HandleCommand \
|
|
481 |
exiting" )
|
|
482 |
return;
|
|
483 |
}
|
|
484 |
|
|
485 |
// If immediate activation, activate.
|
|
486 |
if ( RSat::EImmediate == linkEst )
|
|
487 |
{
|
|
488 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::HandleCommand \
|
|
489 |
immediate activation" )
|
|
490 |
// Check activation
|
|
491 |
TInt activateError = ActivateChannel();
|
|
492 |
if ( KErrNone != activateError )
|
|
493 |
{
|
|
494 |
// Activation failed, Close channel and send error
|
|
495 |
LOG2( NORMAL, "OPENCHANNEL: COpenChannelHandler::HandleCommand \
|
|
496 |
Channel activation failed error = %i", activateError )
|
|
497 |
// Close channel
|
|
498 |
CloseChannel();
|
|
499 |
|
|
500 |
// Check is there a call ongoing
|
|
501 |
const TBool callIsOngoing( iUtils->SystemState().IsCallActive() ||
|
|
502 |
iUtils->SystemState().IsCallIncoming() );
|
|
503 |
|
|
504 |
iOpenChannelRsp.iGeneralResult = RSat::KBearerIndepProtocolError;
|
|
505 |
|
|
506 |
// Map the error to correct response
|
|
507 |
if ( KErrGprsUserAuthenticationFailure == activateError )
|
|
508 |
{
|
|
509 |
LOG( DETAILED,
|
|
510 |
"OPENCHANNEL: COpenChannelHandler::HandleCommand Security \
|
|
511 |
error" )
|
|
512 |
activateError = RSat::KSecurityError;
|
|
513 |
}
|
|
514 |
else if ( KErrGprsServicesNotAllowed == activateError || callIsOngoing )
|
|
515 |
{
|
|
516 |
LOG( DETAILED,
|
|
517 |
"OPENCHANNEL: COpenChannelHandler::HandleCommand Busy on \
|
|
518 |
call or CC on GPRS" )
|
|
519 |
activateError = RSat::KMeBusyOnCall;
|
|
520 |
iOpenChannelRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
|
|
521 |
}
|
|
522 |
else if ( ( KErrMMEtelActivationBlockedByCallControlNoText ==
|
|
523 |
activateError ) ||
|
|
524 |
( KErrMMEtelActivationBlockedByCallControlWithText ==
|
|
525 |
activateError ) )
|
|
526 |
{
|
|
527 |
iOpenChannelRsp.iGeneralResult = RSat::KInteractionWithCCPermanentError;
|
|
528 |
activateError = RSat::KActionNotAllowed;
|
|
529 |
|
|
530 |
LOG( DETAILED,
|
|
531 |
"OPENCHANNEL: COpenChannelHandler::HandleCommand CC on GPRS \
|
|
532 |
not allowed" )
|
|
533 |
}
|
|
534 |
else
|
|
535 |
{
|
|
536 |
LOG( DETAILED,
|
|
537 |
"OPENCHANNEL: COpenChannelHandler::HandleCommand No specific \
|
|
538 |
BIP error" )
|
|
539 |
activateError = RSat::KNoSpecificBIPError;
|
|
540 |
}
|
|
541 |
|
|
542 |
// PDP Activation failed
|
|
543 |
iOpenChannelRsp.iInfoType = RSat::KMeProblem;
|
|
544 |
iOpenChannelRsp.iAdditionalInfo.SetLength( 1 );
|
|
545 |
iOpenChannelRsp.iAdditionalInfo[0] =
|
|
546 |
static_cast<TUint16>( activateError );
|
|
547 |
iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
|
|
548 |
TerminalRsp( iPCmd, iOpenChannelRspPckg );
|
|
549 |
}
|
|
550 |
}
|
|
551 |
else // OnDemand. Send terminal response or confirm to UI
|
|
552 |
{
|
|
553 |
// If information indication to the user is needed, show it now.
|
|
554 |
if ( iNeedUiSession )
|
|
555 |
{
|
|
556 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::HandleCommand \
|
|
557 |
Sending UI Notification" )
|
|
558 |
// Send confirmation to UI and wait for client response
|
|
559 |
SendConfirmToUi();
|
|
560 |
}
|
|
561 |
else
|
|
562 |
{
|
|
563 |
// Send successfull terminal response
|
|
564 |
SendSuccessTerminalRsp();
|
|
565 |
}
|
|
566 |
}
|
|
567 |
|
|
568 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::HandleCommand exiting" )
|
|
569 |
}
|
|
570 |
|
|
571 |
// -----------------------------------------------------------------------------
|
|
572 |
// From class CSatCommandHandler.
|
|
573 |
// Indicates the failure of launching ui client.
|
|
574 |
// -----------------------------------------------------------------------------
|
|
575 |
//
|
|
576 |
void COpenChannelHandler::UiLaunchFailed()
|
|
577 |
{
|
|
578 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::UiLaunchFailed calling" )
|
|
579 |
|
|
580 |
iOpenChannelRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
|
|
581 |
iOpenChannelRsp.iInfoType = RSat::KMeProblem;
|
|
582 |
iOpenChannelRsp.iAdditionalInfo.SetLength( 1 );
|
|
583 |
iOpenChannelRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
|
|
584 |
iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
|
|
585 |
TerminalRsp( iPCmd, iOpenChannelRspPckg );
|
|
586 |
|
|
587 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::UiLaunchFailed exiting" )
|
|
588 |
}
|
|
589 |
|
|
590 |
// -----------------------------------------------------------------------------
|
|
591 |
// C++ default constructor can NOT contain any code, that
|
|
592 |
// might leave.
|
|
593 |
// -----------------------------------------------------------------------------
|
|
594 |
//
|
|
595 |
//lint -e{1403, 1769} Can not be initialized.
|
|
596 |
COpenChannelHandler::COpenChannelHandler() :
|
|
597 |
CSatCommandHandler(),
|
|
598 |
iOpenChannelData(),
|
|
599 |
iOpenChannelPckg( iOpenChannelData ),
|
|
600 |
iOpenChannelRsp(),
|
|
601 |
iOpenChannelRspPckg( iOpenChannelRsp ),
|
|
602 |
iQueryData(),
|
|
603 |
iQueryPckg( iQueryData ),
|
|
604 |
iQueryRsp(),
|
|
605 |
iQueryRspPckg( iQueryRsp ),
|
|
606 |
// To be removed when icons are allowed in this command
|
|
607 |
iIconCommand( EFalse )
|
|
608 |
{
|
|
609 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::COpenChannelHandler \
|
|
610 |
calling - exiting" )
|
|
611 |
}
|
|
612 |
|
|
613 |
// -----------------------------------------------------------------------------
|
|
614 |
// Symbian 2nd phase constructor can leave.
|
|
615 |
// -----------------------------------------------------------------------------
|
|
616 |
//
|
|
617 |
void COpenChannelHandler::ConstructL()
|
|
618 |
{
|
|
619 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::ConstructL calling" )
|
|
620 |
|
|
621 |
iUtils->RegisterServiceRequestL( ESatSProactiveQuery,
|
|
622 |
ESatSProactiveQueryResponse, this );
|
|
623 |
|
|
624 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::ConstructL exiting" )
|
|
625 |
}
|
|
626 |
|
|
627 |
// -----------------------------------------------------------------------------
|
|
628 |
// Sets new connection settings for channel to open.
|
|
629 |
// -----------------------------------------------------------------------------
|
|
630 |
//
|
|
631 |
void COpenChannelHandler::SetConnectionSettingsL(
|
|
632 |
MSatBIPUtils::TSatBearerType aBearerType )
|
|
633 |
{
|
|
634 |
LOG2( SIMPLE,
|
|
635 |
"OPENCHANNEL: COpenChannelHandler::SetConnectionSettingsL calling,\
|
|
636 |
aBearerType: %d", aBearerType )
|
|
637 |
|
|
638 |
RPacketContext::TProtocolType pdpType = RPacketContext::EPdpTypeIPv4;
|
|
639 |
TUint32 defaultId( 0 );
|
|
640 |
switch ( aBearerType )
|
|
641 |
{
|
|
642 |
case MSatBIPUtils::ESatGPRS:
|
|
643 |
{
|
|
644 |
// Resolve override settings
|
|
645 |
if ( iOpenChannelData.iAccessName.Length() > 0 )
|
|
646 |
{
|
|
647 |
LOG( NORMAL,
|
|
648 |
"OPENCHANNEL: COpenChannelHandler::SetConnectionSettingsL \
|
|
649 |
Getting APN" )
|
|
650 |
|
|
651 |
TUint32 iapId( 0 );
|
|
652 |
TUint32 nwId( 0 );
|
|
653 |
TBool apnCreated( EFalse );
|
|
654 |
|
|
655 |
pdpType = RPacketContext::EPdpTypeIPv6;
|
|
656 |
|
|
657 |
if ( RSat::EIPv4Address ==
|
|
658 |
iOpenChannelData.iDestinationAddress.iType )
|
|
659 |
{
|
|
660 |
LOG( NORMAL,
|
|
661 |
"OPENCHANNEL: COpenChannelHandler::SetConnectionSettingsL \
|
|
662 |
IPV4 Address" )
|
|
663 |
pdpType = RPacketContext::EPdpTypeIPv4;
|
|
664 |
}
|
|
665 |
iUtils->BipUtils().ApnHandler().GetApnInfoL
|
|
666 |
(
|
|
667 |
iOpenChannelData.iAccessName,
|
|
668 |
iOpenChannelData.iUserLogin,
|
|
669 |
iOpenChannelData.iUserPassword,
|
|
670 |
iapId,
|
|
671 |
nwId,
|
|
672 |
apnCreated,
|
|
673 |
pdpType, // IPv6 or IPv4
|
|
674 |
iOpenChannelData.iLocalAddress.iAddress
|
|
675 |
);
|
|
676 |
|
|
677 |
if ( apnCreated )
|
|
678 |
{
|
|
679 |
LOG( NORMAL,
|
|
680 |
"OPENCHANNEL: COpenChannelHandler::SetConnectionSettingsL \
|
|
681 |
APN created by SAT" )
|
|
682 |
// Store APN Id for later use
|
|
683 |
iConnectionInfo.iCreatedApnId = nwId;
|
|
684 |
}
|
|
685 |
|
|
686 |
SetOverrideSettingsL( iapId );
|
|
687 |
}
|
|
688 |
else
|
|
689 |
{
|
|
690 |
LOG( NORMAL, "OPENCHANNEL: SetConnectionSettingsL \
|
|
691 |
No APN, using defaults" )
|
|
692 |
// No APN, use default settings
|
|
693 |
TRAPD( err, defaultId =
|
|
694 |
iUtils->BipUtils().ApnHandler().FindDefaultApL( pdpType ) );
|
|
695 |
LOG2( NORMAL, "OPENCHANNEL: SetConnectionSettingsL \
|
|
696 |
No APN, using defaults err = %i", err )
|
|
697 |
SetOverrideSettingsL( defaultId );
|
|
698 |
}
|
|
699 |
break;
|
|
700 |
}
|
|
701 |
|
|
702 |
default:
|
|
703 |
{
|
|
704 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::\
|
|
705 |
SetConnectionSettingsL exiting default" )
|
|
706 |
// Leave if not supported
|
|
707 |
User::Leave( KErrNotSupported );
|
|
708 |
}
|
|
709 |
}
|
|
710 |
|
|
711 |
#ifdef SAT_USE_DUMMY_TSY
|
|
712 |
// No APN, use default settings
|
|
713 |
TRAPD( err,
|
|
714 |
defaultId = iUtils->BipUtils().ApnHandler().FindDefaultApL( pdpType ) );
|
|
715 |
LOG2( NORMAL, "OPENCHANNEL: COpenChannelHandler::SetConnectionSettingsL \
|
|
716 |
No APN, using defaults err = %i", err )
|
|
717 |
SetOverrideSettingsL( defaultId );
|
|
718 |
#endif // SAT_USE_DUMMY_TSY
|
|
719 |
|
|
720 |
LOG( SIMPLE,
|
|
721 |
"OPENCHANNEL: COpenChannelHandler::SetConnectionSettingsL exiting" )
|
|
722 |
}
|
|
723 |
|
|
724 |
// -----------------------------------------------------------------------------
|
|
725 |
// Sets override settings into connection information.
|
|
726 |
// -----------------------------------------------------------------------------
|
|
727 |
//
|
|
728 |
void COpenChannelHandler::SetOverrideSettingsL( const TUint32 aIapId )
|
|
729 |
{
|
|
730 |
|
|
731 |
LOG2( SIMPLE,
|
|
732 |
"OPENCHANNEL: COpenChannelHandler::SetOverrideSettingsL aIapId: %i",
|
|
733 |
aIapId )
|
|
734 |
|
|
735 |
delete iConnectionInfo.iOverrideSet;
|
|
736 |
iConnectionInfo.iOverrideSet = NULL;
|
|
737 |
|
|
738 |
// Override connection preferences
|
|
739 |
TExtendedConnPref* overrideSettings = new( ELeave ) TExtendedConnPref;
|
|
740 |
overrideSettings->SetIapId( aIapId );
|
|
741 |
overrideSettings->SetNoteBehaviour(
|
|
742 |
TExtendedConnPref::ENoteBehaviourConnSilent );
|
|
743 |
iConnectionInfo.iOverrideSet = overrideSettings;
|
|
744 |
|
|
745 |
LOG( SIMPLE,
|
|
746 |
"OPENCHANNEL: COpenChannelHandler::SetOverrideSettingsL exiting" )
|
|
747 |
}
|
|
748 |
|
|
749 |
// -----------------------------------------------------------------------------
|
|
750 |
// Sets up data channel. Does not activate context.
|
|
751 |
// -----------------------------------------------------------------------------
|
|
752 |
//
|
|
753 |
TInt COpenChannelHandler::SetUpChannel()
|
|
754 |
{
|
|
755 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::SetUpChannel calling" )
|
|
756 |
|
|
757 |
// get connection settings from CommDB and
|
|
758 |
// set connection settings to data channel
|
|
759 |
TRAPD( status,
|
|
760 |
SetConnectionSettingsL( iBearerType );
|
|
761 |
iDataChannel->SetupConnectionL( iConnectionInfo ); );
|
|
762 |
|
|
763 |
LOG2( SIMPLE,
|
|
764 |
"OPENCHANNEL: COpenChannelHandler::SetUpChannel exiting with status %i",
|
|
765 |
status )
|
|
766 |
return status;
|
|
767 |
}
|
|
768 |
|
|
769 |
// -----------------------------------------------------------------------------
|
|
770 |
// Activates context.
|
|
771 |
// -----------------------------------------------------------------------------
|
|
772 |
//
|
|
773 |
TInt COpenChannelHandler::ActivateChannel()
|
|
774 |
{
|
|
775 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::ActivateChannel calling" )
|
|
776 |
|
|
777 |
// Activate the connection
|
|
778 |
TRAPD( err, iDataChannel->ActivateConnectionL( this ) );
|
|
779 |
|
|
780 |
LOG2( SIMPLE, "OPENCHANNEL: COpenChannelHandler::ActivateChannel exiting\
|
|
781 |
with error %i:", err )
|
|
782 |
return err;
|
|
783 |
}
|
|
784 |
|
|
785 |
// -----------------------------------------------------------------------------
|
|
786 |
// Creates and sends the terminal response on successful cases.
|
|
787 |
// -----------------------------------------------------------------------------
|
|
788 |
//
|
|
789 |
void COpenChannelHandler::SendSuccessTerminalRsp()
|
|
790 |
{
|
|
791 |
LOG( SIMPLE,
|
|
792 |
"OPENCHANNEL: COpenChannelHandler::SendSuccessTerminalRsp calling" )
|
|
793 |
|
|
794 |
iDataChannel->GetNegotiatedQoSParams( iOpenChannelRsp.iBearer.iParams );
|
|
795 |
|
|
796 |
// Get the channel status
|
|
797 |
RSat::TChannelStatus channelStatus;
|
|
798 |
TRAPD( err, channelStatus = iUtils->BipUtils().GenerateChannelStatusL(
|
|
799 |
iDataChannel->ChannelId(), 0 ) );
|
|
800 |
LOG2( SIMPLE, "OPENCHANNEL: COpenChannelHandler::SendSuccessTerminalRsp \
|
|
801 |
error: %i", err )
|
|
802 |
|
|
803 |
if ( KErrNone == err )
|
|
804 |
{
|
|
805 |
iOpenChannelRsp.iInfoType = RSat::KChannelStatusInfo;
|
|
806 |
iOpenChannelRsp.iAdditionalInfo.SetLength( KChannelStatusLength );
|
|
807 |
|
|
808 |
// Channel ID + PDP context status
|
|
809 |
iOpenChannelRsp.iAdditionalInfo[0] = channelStatus[0];
|
|
810 |
|
|
811 |
// Channel status
|
|
812 |
iOpenChannelRsp.iAdditionalInfo[1] = channelStatus[1];
|
|
813 |
iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
|
|
814 |
|
|
815 |
// Define the result of this command handling
|
|
816 |
if ( iSetUpWithModifications )
|
|
817 |
{
|
|
818 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::HandleCommand\
|
|
819 |
Channel setup modified" )
|
|
820 |
iOpenChannelRsp.iGeneralResult = RSat::KPerformedWithModifications;
|
|
821 |
}
|
|
822 |
else if ( !iQueryRsp.iRequestedIconDisplayed &&
|
|
823 |
( ( RSat::ESelfExplanatory ==
|
|
824 |
iOpenChannelData.iIconId.iQualifier ) ||
|
|
825 |
( RSat::ENotSelfExplanatory ==
|
|
826 |
iOpenChannelData.iIconId.iQualifier ) ) )
|
|
827 |
{
|
|
828 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::HandleCommand\
|
|
829 |
Open channel successful, no icon displayed" )
|
|
830 |
iOpenChannelRsp.iGeneralResult =
|
|
831 |
RSat::KSuccessRequestedIconNotDisplayed;
|
|
832 |
}
|
|
833 |
else
|
|
834 |
{
|
|
835 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::HandleCommand\
|
|
836 |
Open channel successful" )
|
|
837 |
iOpenChannelRsp.iGeneralResult = RSat::KSuccess;
|
|
838 |
}
|
|
839 |
}
|
|
840 |
else
|
|
841 |
{
|
|
842 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::HandleCommand\
|
|
843 |
Channel not found!" )
|
|
844 |
iOpenChannelRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
|
|
845 |
iOpenChannelRsp.iInfoType = RSat::KMeProblem;
|
|
846 |
iOpenChannelRsp.iAdditionalInfo.SetLength( 1 );
|
|
847 |
iOpenChannelRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
|
|
848 |
}
|
|
849 |
|
|
850 |
// If command had icon data and was done succesfully, report that icon
|
|
851 |
// was not shown
|
|
852 |
// To be removed when icons are allowed in this command
|
|
853 |
if ( ( RSat::KSuccess == iOpenChannelRsp.iGeneralResult ) &&
|
|
854 |
iIconCommand )
|
|
855 |
{
|
|
856 |
LOG( SIMPLE, "COpenChannelHandler::SendSuccessTerminalRsp requested\
|
|
857 |
icon not displayed" )
|
|
858 |
iOpenChannelRsp.iGeneralResult =
|
|
859 |
RSat::KSuccessRequestedIconNotDisplayed;
|
|
860 |
}
|
|
861 |
|
|
862 |
// Sending terminal response
|
|
863 |
TerminalRsp( iPCmd, iOpenChannelRspPckg );
|
|
864 |
|
|
865 |
LOG( SIMPLE,
|
|
866 |
"OPENCHANNEL: COpenChannelHandler::SendSuccessTerminalRsp exiting" )
|
|
867 |
}
|
|
868 |
|
|
869 |
// -----------------------------------------------------------------------------
|
|
870 |
// Sends confirmation query to UI.
|
|
871 |
// -----------------------------------------------------------------------------
|
|
872 |
//
|
|
873 |
void COpenChannelHandler::SendConfirmToUi()
|
|
874 |
{
|
|
875 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::SendConfirmToUi calling" )
|
|
876 |
|
|
877 |
// Command Duration for Mediator Client
|
|
878 |
TUint8 commandDuration( KSatDurationNotSet );
|
|
879 |
|
|
880 |
// Launch UI of not launched. This function is called again when UI is
|
|
881 |
// launched.
|
|
882 |
if ( !LaunchUiSession() )
|
|
883 |
{
|
|
884 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::SendConfirmToUi \
|
|
885 |
not launch UI" )
|
|
886 |
// Create IPC data to UI
|
|
887 |
iQueryData.iCommand = ESatOpenChannelQuery;
|
|
888 |
iQueryData.iQueryText = iOpenChannelData.iAlphaId.iAlphaId;
|
|
889 |
iQueryData.iIconId.iIdentifier = iOpenChannelData.iIconId.iIdentifier;
|
|
890 |
LOG2( SIMPLE, "COpenChannelHandler::SendConfirmToUi \
|
|
891 |
iOpenChannelData.iIconId.iQualifier:%d",
|
|
892 |
iOpenChannelData.iIconId.iQualifier )
|
|
893 |
// Check Icon
|
|
894 |
switch ( iOpenChannelData.iIconId.iQualifier )
|
|
895 |
{
|
|
896 |
case RSat::ESelfExplanatory:
|
|
897 |
{
|
|
898 |
// Icon qualifier is self explanatory (to display instead
|
|
899 |
// of the alpha id or text string).
|
|
900 |
iQueryData.iIconId.iIconQualifier = ESatSelfExplanatory;
|
|
901 |
break;
|
|
902 |
}
|
|
903 |
|
|
904 |
case RSat::ENotSelfExplanatory:
|
|
905 |
{
|
|
906 |
// Icon qualifier is not self explanatory.
|
|
907 |
iQueryData.iIconId.iIconQualifier = ESatNotSelfExplanatory;
|
|
908 |
break;
|
|
909 |
}
|
|
910 |
|
|
911 |
default:
|
|
912 |
{
|
|
913 |
// Icon qualifier not present
|
|
914 |
iQueryData.iIconId.iIconQualifier = ESatENoIconId;
|
|
915 |
break;
|
|
916 |
}
|
|
917 |
}
|
|
918 |
LOG2( SIMPLE, "COpenChannelHandler::SendConfirmToUi \
|
|
919 |
iOpenChannelData.iAlphaId.iStatus:%d",
|
|
920 |
iOpenChannelData.iAlphaId.iStatus )
|
|
921 |
// Define AlphaID status
|
|
922 |
switch ( iOpenChannelData.iAlphaId.iStatus )
|
|
923 |
{
|
|
924 |
case RSat::EAlphaIdNotPresent:
|
|
925 |
{
|
|
926 |
iQueryData.iAlphaIdStatus = ESatAlphaIdNotProvided;
|
|
927 |
commandDuration = KSatLongDuration;
|
|
928 |
break;
|
|
929 |
}
|
|
930 |
|
|
931 |
case RSat::EAlphaIdProvided:
|
|
932 |
{
|
|
933 |
iQueryData.iAlphaIdStatus = ESatAlphaIdNotNull;
|
|
934 |
commandDuration = KSatLongDuration;
|
|
935 |
break;
|
|
936 |
}
|
|
937 |
|
|
938 |
default:
|
|
939 |
{
|
|
940 |
iQueryData.iAlphaIdStatus = ESatAlphaIdNull;
|
|
941 |
commandDuration = KSatDurationNotSet;
|
|
942 |
break;
|
|
943 |
}
|
|
944 |
}
|
|
945 |
|
|
946 |
// Send notification to Mediator client if Cover UI is supported
|
|
947 |
if ( iUtils->CoverUiSupported() )
|
|
948 |
{
|
|
949 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::SendConfirmToUi \
|
|
950 |
CoverUiSupported" )
|
|
951 |
TSatCommandData medEventData;
|
|
952 |
medEventData.iPCmdNumber = iPCmd;
|
|
953 |
medEventData.iAlphaId = iOpenChannelData.iAlphaId;
|
|
954 |
medEventData.iDuration.iTimeUnit = RSat::ESeconds;
|
|
955 |
medEventData.iDuration.iNumOfUnits = commandDuration;
|
|
956 |
medEventData.iIconID = iOpenChannelData.iIconId;
|
|
957 |
TSatCommandPckg tPckg( medEventData );
|
|
958 |
iUtils->RaiseSatEvent( tPckg );
|
|
959 |
}
|
|
960 |
// Send notification to UI
|
|
961 |
MSatUiSession* session = iUtils->SatUiHandler().UiSession();
|
|
962 |
session->SendCommand(
|
|
963 |
&iQueryPckg, &iQueryRspPckg, ESatSProactiveQuery );
|
|
964 |
}
|
|
965 |
|
|
966 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::SendConfirmToUi exiting" )
|
|
967 |
}
|
|
968 |
|
|
969 |
// -----------------------------------------------------------------------------
|
|
970 |
// Closes the channel in error cases.
|
|
971 |
// -----------------------------------------------------------------------------
|
|
972 |
//
|
|
973 |
void COpenChannelHandler::CloseChannel()
|
|
974 |
{
|
|
975 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::CloseChannel calling" )
|
|
976 |
|
|
977 |
// If data channel is not null, close it
|
|
978 |
if ( iDataChannel )
|
|
979 |
{
|
|
980 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::CloseChannel have\
|
|
981 |
channel" )
|
|
982 |
iUtils->BipUtils().CloseChannel( iDataChannel->ChannelId() );
|
|
983 |
}
|
|
984 |
|
|
985 |
if ( iConnectionInfo.iCreatedApnId > 0 )
|
|
986 |
{
|
|
987 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::CloseChannel delete\
|
|
988 |
APN" )
|
|
989 |
// APN created -> Remove it
|
|
990 |
TRAP_IGNORE( iUtils->BipUtils().ApnHandler().DeleteApnL(
|
|
991 |
iConnectionInfo.iCreatedApnId ) )
|
|
992 |
}
|
|
993 |
|
|
994 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::CloseChannel exiting" )
|
|
995 |
}
|
|
996 |
|
|
997 |
// -----------------------------------------------------------------------------
|
|
998 |
// Checks parameters from SIM and makes modifications, if needed.
|
|
999 |
// -----------------------------------------------------------------------------
|
|
1000 |
//
|
|
1001 |
TBool COpenChannelHandler::CheckParameters()
|
|
1002 |
{
|
|
1003 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::CheckParameters calling" )
|
|
1004 |
// Return variable. Indicates is the context activation possible with
|
|
1005 |
// given / modified parameters.
|
|
1006 |
TBool paramsOk( EFalse );
|
|
1007 |
|
|
1008 |
// Check buffer size
|
|
1009 |
if ( KSatBIPMaxBufferSize < iOpenChannelData.iBufferSize ||
|
|
1010 |
0 == iOpenChannelData.iBufferSize )
|
|
1011 |
{
|
|
1012 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CheckParameters \
|
|
1013 |
Changing buffersize" )
|
|
1014 |
// Too big requested buffer size -> set to max
|
|
1015 |
iConnectionInfo.iBufferSize = KSatBIPMaxBufferSize;
|
|
1016 |
// put modified buffer size to terminal response
|
|
1017 |
iOpenChannelRsp.iBufferSize = KSatBIPMaxBufferSize;
|
|
1018 |
// Modified parameters
|
|
1019 |
iSetUpWithModifications = ETrue;
|
|
1020 |
}
|
|
1021 |
else
|
|
1022 |
{
|
|
1023 |
iConnectionInfo.iBufferSize = iOpenChannelData.iBufferSize;
|
|
1024 |
iOpenChannelRsp.iBufferSize = iOpenChannelData.iBufferSize;
|
|
1025 |
}
|
|
1026 |
|
|
1027 |
// Set bearer for the terminal response. This information is mandatory to
|
|
1028 |
// each terminal response.
|
|
1029 |
iOpenChannelRsp.iBearer = iOpenChannelData.iBearer;
|
|
1030 |
|
|
1031 |
// Indicates is there destination address defined
|
|
1032 |
const TBool destinationAddressNotDefined
|
|
1033 |
(
|
|
1034 |
RSat::EIPv4Address != iOpenChannelData.iDestinationAddress.iType &&
|
|
1035 |
RSat::EIPv6Address != iOpenChannelData.iDestinationAddress.iType
|
|
1036 |
);
|
|
1037 |
|
|
1038 |
// Indicates is there a transport protocol defined
|
|
1039 |
const TBool transportProtoNotDefined
|
|
1040 |
(
|
|
1041 |
RSat::ETcp != iOpenChannelData.iSimMeInterface.iTransportProto &&
|
|
1042 |
RSat::EUdp != iOpenChannelData.iSimMeInterface.iTransportProto
|
|
1043 |
);
|
|
1044 |
|
|
1045 |
// Indicates is there a transport port number defined
|
|
1046 |
const TBool transportPortNumberNotDefined
|
|
1047 |
(
|
|
1048 |
0 == iOpenChannelData.iSimMeInterface.iPrtNumber
|
|
1049 |
);
|
|
1050 |
|
|
1051 |
// Indicates is selected bearer supported
|
|
1052 |
const TBool bearerNotSupported
|
|
1053 |
(
|
|
1054 |
RSat::EPCmdTypeNotSet != iOpenChannelData.iPCmdType &&
|
|
1055 |
RSat::EGprsBearer != iOpenChannelData.iPCmdType &&
|
|
1056 |
RSat::EAnyBearer != iOpenChannelData.iPCmdType
|
|
1057 |
);
|
|
1058 |
|
|
1059 |
// Check parameters
|
|
1060 |
paramsOk = !( destinationAddressNotDefined ||
|
|
1061 |
transportProtoNotDefined ||
|
|
1062 |
bearerNotSupported ||
|
|
1063 |
transportPortNumberNotDefined );
|
|
1064 |
|
|
1065 |
// Check is connection possible
|
|
1066 |
if ( paramsOk )
|
|
1067 |
{
|
|
1068 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CheckParameters \
|
|
1069 |
Bearer type is GPRS" )
|
|
1070 |
// Bearer type is GPRS
|
|
1071 |
iBearerType = MSatBIPUtils::ESatGPRS;
|
|
1072 |
// Set bearer type for the terminal response in case it was not defined
|
|
1073 |
iOpenChannelRsp.iBearer.iType = RSat::EGPRSBearer;
|
|
1074 |
// Destination address
|
|
1075 |
iConnectionInfo.iDestination = iOpenChannelData.iDestinationAddress;
|
|
1076 |
// Local address
|
|
1077 |
iConnectionInfo.iSource = iOpenChannelData.iLocalAddress;
|
|
1078 |
// Bearer parameters
|
|
1079 |
iConnectionInfo.iBearerParams = iOpenChannelData.iBearer.iParams;
|
|
1080 |
// Set protocol info to connection data
|
|
1081 |
iConnectionInfo.iProtocol = iOpenChannelData.iSimMeInterface;
|
|
1082 |
}
|
|
1083 |
else if ( transportProtoNotDefined ||
|
|
1084 |
bearerNotSupported ||
|
|
1085 |
transportPortNumberNotDefined )
|
|
1086 |
{
|
|
1087 |
// Fail
|
|
1088 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CheckParameters \
|
|
1089 |
Unable to connect" )
|
|
1090 |
// If parameters are not OK, send terminal response
|
|
1091 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CommandAllowed \
|
|
1092 |
Not valid parameters" )
|
|
1093 |
iOpenChannelRsp.iGeneralResult = RSat::KCmdBeyondMeCapabilities;
|
|
1094 |
iOpenChannelRsp.iInfoType = RSat::KNoAdditionalInfo;
|
|
1095 |
iOpenChannelRsp.iAdditionalInfo.Zero();
|
|
1096 |
}
|
|
1097 |
else if ( destinationAddressNotDefined )
|
|
1098 |
{
|
|
1099 |
// Fail
|
|
1100 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CheckParameters \
|
|
1101 |
Destination not set" )
|
|
1102 |
iOpenChannelRsp.iGeneralResult = RSat::KErrorRequiredValuesMissing;
|
|
1103 |
iOpenChannelRsp.iInfoType = RSat::KNoAdditionalInfo;
|
|
1104 |
iOpenChannelRsp.iAdditionalInfo.Zero();
|
|
1105 |
}
|
|
1106 |
else
|
|
1107 |
{
|
|
1108 |
// Fail
|
|
1109 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CheckParameters \
|
|
1110 |
Unable to connect" )
|
|
1111 |
// If parameters are not OK, send terminal response
|
|
1112 |
LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CheckParameters \
|
|
1113 |
Not valid parameters" )
|
|
1114 |
iOpenChannelRsp.iGeneralResult = RSat::KCmdBeyondMeCapabilities;
|
|
1115 |
iOpenChannelRsp.iInfoType = RSat::KNoAdditionalInfo;
|
|
1116 |
iOpenChannelRsp.iAdditionalInfo.Zero();
|
|
1117 |
}
|
|
1118 |
|
|
1119 |
LOG2( SIMPLE, "OPENCHANNEL: COpenChannelHandler::CheckParameters exiting,\
|
|
1120 |
paramsOk: %d", paramsOk )
|
|
1121 |
return paramsOk;
|
|
1122 |
}
|
|
1123 |
|
|
1124 |
// -----------------------------------------------------------------------------
|
|
1125 |
// Launches UI if it not active.
|
|
1126 |
// -----------------------------------------------------------------------------
|
|
1127 |
//
|
|
1128 |
TBool COpenChannelHandler::LaunchUiSession()
|
|
1129 |
{
|
|
1130 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::LaunchUiSession calling" )
|
|
1131 |
TBool retVal( EFalse );
|
|
1132 |
|
|
1133 |
// If ui session is not availabe, SATUI has to be
|
|
1134 |
// launched.
|
|
1135 |
if ( NULL == iUtils->SatUiHandler().UiSession() )
|
|
1136 |
{
|
|
1137 |
TRAPD( err,
|
|
1138 |
iUtils->RegisterL( this, MSatUtils::ESatUiLaunched );
|
|
1139 |
// Try to launch the ui client.
|
|
1140 |
iUtils->SatUiHandler().LaunchSatUiL();
|
|
1141 |
); // End of TRAPD
|
|
1142 |
|
|
1143 |
if ( KErrNone != err )
|
|
1144 |
{
|
|
1145 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::LaunchUiSession \
|
|
1146 |
Ui launch failed" )
|
|
1147 |
// Ui launch failed, unregister event
|
|
1148 |
iUtils->UnregisterEvent( this, MSatUtils::ESatUiLaunched );
|
|
1149 |
// Notify SIM that ui launch failed.
|
|
1150 |
UiLaunchFailed();
|
|
1151 |
}
|
|
1152 |
else
|
|
1153 |
{
|
|
1154 |
LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::LaunchUiSession \
|
|
1155 |
Ui launch successfully" )
|
|
1156 |
// Return true indicating that we had to launch UI
|
|
1157 |
retVal = ETrue;
|
|
1158 |
}
|
|
1159 |
}
|
|
1160 |
|
|
1161 |
LOG2( SIMPLE, "OPENCHANNEL: COpenChannelHandler::LaunchUiSession exiting,\
|
|
1162 |
retVal: %d", retVal )
|
|
1163 |
return retVal;
|
|
1164 |
}
|