|
33
|
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 "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 ReceiveData command
|
|
|
15 |
*
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
#include "MSatApi.h"
|
|
|
20 |
#include "MSatUtils.h"
|
|
|
21 |
#include "MSatSystemState.h"
|
|
|
22 |
#include "MSatUiSession.h"
|
|
|
23 |
#include "SatSOpcodes.h"
|
|
|
24 |
#include "MSatSUiClientHandler.h"
|
|
|
25 |
#include "CReceiveDataHandler.h"
|
|
|
26 |
#include "SatLog.h"
|
|
|
27 |
#include "MSatBIPDataChannel.h"
|
|
|
28 |
|
|
|
29 |
// ======== MEMBER FUNCTIONS ========
|
|
|
30 |
|
|
|
31 |
// -----------------------------------------------------------------------------
|
|
|
32 |
// Two-phased constructor.
|
|
|
33 |
// -----------------------------------------------------------------------------
|
|
|
34 |
//
|
|
|
35 |
CReceiveDataHandler* CReceiveDataHandler::NewL( MSatUtils* aUtils )
|
|
|
36 |
{
|
|
|
37 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::NewL calling" )
|
|
|
38 |
CReceiveDataHandler* self = new( ELeave ) CReceiveDataHandler;
|
|
|
39 |
|
|
|
40 |
CleanupStack::PushL( self );
|
|
|
41 |
self->BaseConstructL( aUtils );
|
|
|
42 |
self->ConstructL();
|
|
|
43 |
CleanupStack::Pop( self );
|
|
|
44 |
|
|
|
45 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::NewL exiting" )
|
|
|
46 |
return self;
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
// -----------------------------------------------------------------------------
|
|
|
50 |
// Destructor.
|
|
|
51 |
// -----------------------------------------------------------------------------
|
|
|
52 |
//
|
|
|
53 |
CReceiveDataHandler::~CReceiveDataHandler()
|
|
|
54 |
{
|
|
|
55 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
|
|
|
56 |
CReceiveDataHandler calling" )
|
|
|
57 |
Cancel();
|
|
|
58 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
|
|
|
59 |
~CReceiveDataHandler exiting" )
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
// -----------------------------------------------------------------------------
|
|
|
63 |
// From class MSatCommand.
|
|
|
64 |
// Response from the client.
|
|
|
65 |
// -----------------------------------------------------------------------------
|
|
|
66 |
//
|
|
|
67 |
void CReceiveDataHandler::ClientResponse()
|
|
|
68 |
{
|
|
|
69 |
LOG( NORMAL, "CReceiveDataHandler::ClientResponse calling-exiting" )
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
// -----------------------------------------------------------------------------
|
|
|
73 |
// From class CSatCommandHandler.
|
|
|
74 |
// Waits for indication of user wanting to close the BIP session.
|
|
|
75 |
// -----------------------------------------------------------------------------
|
|
|
76 |
//
|
|
|
77 |
void CReceiveDataHandler::Event( TInt aEvent )
|
|
|
78 |
{
|
|
|
79 |
LOG2( NORMAL, "ReceiveData: CReceiveDataHandler::Event calling, \
|
|
|
80 |
aEvent:%d", aEvent )
|
|
|
81 |
|
|
|
82 |
switch ( aEvent )
|
|
|
83 |
{
|
|
|
84 |
case MSatUtils::ECommandCancelled:
|
|
|
85 |
case MSatUtils::ECancelledUsingEndKey:
|
|
|
86 |
{
|
|
|
87 |
// Check Channel activation status
|
|
|
88 |
if ( iUtils->BipUtils().IsContextActive() )
|
|
|
89 |
{
|
|
|
90 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::Event \
|
|
|
91 |
IsContextActive" )
|
|
|
92 |
// Next command is rejected
|
|
|
93 |
iUserCancelled = ETrue;
|
|
|
94 |
SendTerminalResponse(); // If command is executing, send.
|
|
|
95 |
}
|
|
|
96 |
break;
|
|
|
97 |
}
|
|
|
98 |
case MSatUtils::EOpenChannelExecuting:
|
|
|
99 |
{
|
|
|
100 |
// New channel, reset user cancel flag.
|
|
|
101 |
iUserCancelled = EFalse;
|
|
|
102 |
break;
|
|
|
103 |
}
|
|
|
104 |
default:
|
|
|
105 |
{
|
|
|
106 |
// Move event to base class
|
|
|
107 |
CSatCommandHandler::Event( aEvent );
|
|
|
108 |
}
|
|
|
109 |
}
|
|
|
110 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::Event exiting" )
|
|
|
111 |
}
|
|
|
112 |
|
|
|
113 |
|
|
|
114 |
// -----------------------------------------------------------------------------
|
|
|
115 |
// From class CActive.
|
|
|
116 |
// Cancels the sat request.
|
|
|
117 |
// -----------------------------------------------------------------------------
|
|
|
118 |
//
|
|
|
119 |
void CReceiveDataHandler::DoCancel()
|
|
|
120 |
{
|
|
|
121 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
|
|
|
122 |
DoCancel calling" )
|
|
|
123 |
iUtils->USatAPI().NotifyReceiveDataCancel();
|
|
|
124 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
|
|
|
125 |
DoCancel exiting" )
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
// -----------------------------------------------------------------------------
|
|
|
129 |
// From class CSatCommandHandler.
|
|
|
130 |
// Requests the command notification.
|
|
|
131 |
// -----------------------------------------------------------------------------
|
|
|
132 |
//
|
|
|
133 |
void CReceiveDataHandler::IssueUSATRequest( TRequestStatus& aStatus )
|
|
|
134 |
{
|
|
|
135 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
|
|
|
136 |
IssueUSATRequest calling" )
|
|
|
137 |
// Empty data
|
|
|
138 |
new (&iReceiveDataData) RSat::TReceiveDataV2();
|
|
|
139 |
|
|
|
140 |
iUtils->USatAPI().NotifyReceiveData( aStatus, iReceiveDataPckg );
|
|
|
141 |
iUtils->NotifyEvent( MSatUtils::EBipCommandDoneExecuting );
|
|
|
142 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
|
|
|
143 |
IssueUSATRequest exiting" )
|
|
|
144 |
}
|
|
|
145 |
|
|
|
146 |
// -----------------------------------------------------------------------------
|
|
|
147 |
// From class CSatCommandHandler.
|
|
|
148 |
// Precheck before executing the command.
|
|
|
149 |
// -----------------------------------------------------------------------------
|
|
|
150 |
//
|
|
|
151 |
TBool CReceiveDataHandler::CommandAllowed()
|
|
|
152 |
{
|
|
|
153 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::CommandAllowed \
|
|
|
154 |
calling" )
|
|
|
155 |
TBool commandAllowed( ETrue );
|
|
|
156 |
|
|
|
157 |
// Check user cancel
|
|
|
158 |
if ( iUserCancelled )
|
|
|
159 |
{
|
|
|
160 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::CommandAllowed \
|
|
|
161 |
iUserCancelled true" )
|
|
|
162 |
SendTerminalResponse();
|
|
|
163 |
commandAllowed = EFalse;
|
|
|
164 |
}
|
|
|
165 |
else
|
|
|
166 |
{
|
|
|
167 |
|
|
|
168 |
// Proceed with the command
|
|
|
169 |
const TInt channelId( iReceiveDataData.iDestination );
|
|
|
170 |
|
|
|
171 |
if ( ( RSat::KChannel1 > channelId ) ||
|
|
|
172 |
( RSat::KChannel7 < channelId ) ||
|
|
|
173 |
// If icon data without alpha id
|
|
|
174 |
( ( RSat::EAlphaIdProvided !=
|
|
|
175 |
iReceiveDataData.iAlphaId.iStatus ) &&
|
|
|
176 |
( ( RSat::ESelfExplanatory ==
|
|
|
177 |
iReceiveDataData.iIconId.iQualifier ) ||
|
|
|
178 |
( RSat::ENotSelfExplanatory ==
|
|
|
179 |
iReceiveDataData.iIconId.iQualifier ) ) ) )
|
|
|
180 |
{
|
|
|
181 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::CommandAllowed \
|
|
|
182 |
Unknown channel identifier or icon without alpha id - \
|
|
|
183 |
Not allowed" )
|
|
|
184 |
// Create the response IPC package
|
|
|
185 |
iReceiveDataRspData.SetPCmdNumber(
|
|
|
186 |
iReceiveDataData.PCmdNumber() );
|
|
|
187 |
iReceiveDataRspData.iGeneralResult = RSat::KCmdDataNotUnderstood;
|
|
|
188 |
iReceiveDataRspData.iInfoType = RSat::KNoAdditionalInfo;
|
|
|
189 |
iReceiveDataRspData.iAdditionalInfo.Zero();
|
|
|
190 |
TerminalRsp( RSat::EReceiveData, iReceiveDataRspPckg );
|
|
|
191 |
commandAllowed = EFalse;
|
|
|
192 |
}
|
|
|
193 |
// Set icon command flag whether icon data was received and set qualifier
|
|
|
194 |
// to no icon id
|
|
|
195 |
// To be removed when icons are allowed in this command
|
|
|
196 |
else if ( ( RSat::ESelfExplanatory ==
|
|
|
197 |
iReceiveDataData.iIconId.iQualifier ) ||
|
|
|
198 |
( RSat::ENotSelfExplanatory ==
|
|
|
199 |
iReceiveDataData.iIconId.iQualifier ) )
|
|
|
200 |
{
|
|
|
201 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::CommandAllowed \
|
|
|
202 |
ENoIconId" )
|
|
|
203 |
iIconCommand = ETrue;
|
|
|
204 |
iReceiveDataData.iIconId.iQualifier = RSat::ENoIconId;
|
|
|
205 |
}
|
|
|
206 |
else
|
|
|
207 |
{
|
|
|
208 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::CommandAllowed \
|
|
|
209 |
others" )
|
|
|
210 |
iIconCommand = EFalse;
|
|
|
211 |
}
|
|
|
212 |
|
|
|
213 |
// ReceiveData doesn't need to check Service, ongoing calls etc.
|
|
|
214 |
// because data is waiting in SAT Engine, so ReceiveData doesn't
|
|
|
215 |
// do any network operations.
|
|
|
216 |
}
|
|
|
217 |
LOG2( NORMAL, "ReceiveData: CReceiveDataHandler::CommandAllowed exiting,\
|
|
|
218 |
commandAllowed: %d", commandAllowed )
|
|
|
219 |
return commandAllowed;
|
|
|
220 |
}
|
|
|
221 |
|
|
|
222 |
// -----------------------------------------------------------------------------
|
|
|
223 |
// From class CSatCommandHandler.
|
|
|
224 |
// Need for ui session.
|
|
|
225 |
// -----------------------------------------------------------------------------
|
|
|
226 |
//
|
|
|
227 |
TBool CReceiveDataHandler::NeedUiSession()
|
|
|
228 |
{
|
|
|
229 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::NeedUiSession calling" )
|
|
|
230 |
// UI is NOT needed in case where AlphaID is provided and it is a NULL
|
|
|
231 |
iNeedUiSession = ( !( RSat::EAlphaIdNull ==
|
|
|
232 |
iReceiveDataData.iAlphaId.iStatus ) &&
|
|
|
233 |
!( RSat::EAlphaIdNotPresent ==
|
|
|
234 |
iReceiveDataData.iAlphaId.iStatus ) );
|
|
|
235 |
// Send notification to Mediator client if Cover UI is supported
|
|
|
236 |
if ( iNeedUiSession && iUtils->CoverUiSupported() )
|
|
|
237 |
{
|
|
|
238 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::NeedUiSession \
|
|
|
239 |
CoverUiSupported" )
|
|
|
240 |
TSatCommandData medEventData;
|
|
|
241 |
medEventData.iPCmdNumber = RSat::EReceiveData;
|
|
|
242 |
medEventData.iAlphaId = iReceiveDataData.iAlphaId;
|
|
|
243 |
medEventData.iDuration.iNumOfUnits = KSatDefaultDuration;
|
|
|
244 |
medEventData.iIconID = iReceiveDataData.iIconId;
|
|
|
245 |
TSatCommandPckg tPckg( medEventData );
|
|
|
246 |
iUtils->RaiseSatEvent( tPckg );
|
|
|
247 |
}
|
|
|
248 |
LOG2( NORMAL, "ReceiveData: CReceiveDataHandler::NeedUiSession exiting,\
|
|
|
249 |
iNeedUiSession: %d", iNeedUiSession )
|
|
|
250 |
return iNeedUiSession;
|
|
|
251 |
}
|
|
|
252 |
|
|
|
253 |
// -----------------------------------------------------------------------------
|
|
|
254 |
// From class CSatCommandHandler.
|
|
|
255 |
// Called when USAT API notifies that command.
|
|
|
256 |
// -----------------------------------------------------------------------------
|
|
|
257 |
//
|
|
|
258 |
void CReceiveDataHandler::HandleCommand()
|
|
|
259 |
{
|
|
|
260 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand calling" )
|
|
|
261 |
|
|
|
262 |
// Notify other's about this command executiuon
|
|
|
263 |
iUtils->NotifyEvent( MSatUtils::EReceiveDataExecuting );
|
|
|
264 |
iUtils->NotifyEvent( MSatUtils::EBipCommandExecuting );
|
|
|
265 |
TInt uiError( KErrNone );
|
|
|
266 |
|
|
|
267 |
if ( iNeedUiSession )
|
|
|
268 |
{
|
|
|
269 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand \
|
|
|
270 |
Sending UI Notification" )
|
|
|
271 |
uiError = SendUiNotification();
|
|
|
272 |
}
|
|
|
273 |
LOG2( NORMAL,
|
|
|
274 |
"ReceiveData: CReceiveDataHandler::HandleCommand uiError: %i", uiError )
|
|
|
275 |
if ( KErrNone == uiError )
|
|
|
276 |
{
|
|
|
277 |
iChDataLength = 0;
|
|
|
278 |
|
|
|
279 |
// Proceed with the command
|
|
|
280 |
TInt err( MSatBIPUtils::ESatBIPSuccess );
|
|
|
281 |
TInt error( KErrNone );
|
|
|
282 |
|
|
|
283 |
TInt requestedLength( iReceiveDataData.iChannelDataLength );
|
|
|
284 |
|
|
|
285 |
// Make sure that reguested data length is not
|
|
|
286 |
// more than KSatBIPMaxResponseSize
|
|
|
287 |
if ( requestedLength > KSatBIPMaxResponseSize )
|
|
|
288 |
{
|
|
|
289 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand \
|
|
|
290 |
requestedLength > KSatBIPMaxResponseSize" )
|
|
|
291 |
requestedLength = KSatBIPMaxResponseSize;
|
|
|
292 |
}
|
|
|
293 |
|
|
|
294 |
LOG2( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand \
|
|
|
295 |
Requested data length: %i", requestedLength )
|
|
|
296 |
|
|
|
297 |
// Get Data Channel
|
|
|
298 |
MSatBIPDataChannel* datachannel =
|
|
|
299 |
iUtils->BipUtils().DataChannel(
|
|
|
300 |
iReceiveDataData.iDestination, err );
|
|
|
301 |
|
|
|
302 |
LOG2( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand \
|
|
|
303 |
err: %i", err )
|
|
|
304 |
//Check if ch was found
|
|
|
305 |
if ( MSatBIPUtils::ESatBIPSuccess == err
|
|
|
306 |
|| MSatBIPUtils::ESatBIPChannelClosed == err )
|
|
|
307 |
{
|
|
|
308 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand \
|
|
|
309 |
MSatBIPUtils::ESatBIPSuccess == err" )
|
|
|
310 |
iChData.Zero();
|
|
|
311 |
TRAP( error, err = datachannel->ReceiveDataL(
|
|
|
312 |
iChData,
|
|
|
313 |
requestedLength,
|
|
|
314 |
iChDataLength ) );
|
|
|
315 |
}
|
|
|
316 |
LOG2( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand \
|
|
|
317 |
error: %i", error )
|
|
|
318 |
// No point to continue
|
|
|
319 |
if ( error != KErrNone )
|
|
|
320 |
{
|
|
|
321 |
iReceiveDataRspData.iGeneralResult =
|
|
|
322 |
RSat::KBearerIndepProtocolError;
|
|
|
323 |
}
|
|
|
324 |
// Not all requested data yet available
|
|
|
325 |
else if ( MSatBIPUtils::ESatBIPReqBufSizeNotAvail == err ||
|
|
|
326 |
MSatBIPUtils::ESatBIPChannelClosed == err )
|
|
|
327 |
{
|
|
|
328 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand \
|
|
|
329 |
Not all requested data available" )
|
|
|
330 |
iReceiveDataRspData.iGeneralResult = RSat::KMissingInformation;
|
|
|
331 |
}
|
|
|
332 |
// Some other error
|
|
|
333 |
else if ( MSatBIPUtils::ESatBIPSuccess != err )
|
|
|
334 |
{
|
|
|
335 |
LOG2( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand \
|
|
|
336 |
Error %i", err )
|
|
|
337 |
iReceiveDataRspData.iGeneralResult =
|
|
|
338 |
RSat::KBearerIndepProtocolError;
|
|
|
339 |
}
|
|
|
340 |
// Everything fine
|
|
|
341 |
else
|
|
|
342 |
{
|
|
|
343 |
LOG( NORMAL,
|
|
|
344 |
"ReceiveData: CReceiveDataHandler::HandleCommand success")
|
|
|
345 |
iReceiveDataRspData.iGeneralResult = RSat::KSuccess;
|
|
|
346 |
}
|
|
|
347 |
|
|
|
348 |
// Send terminal response
|
|
|
349 |
SendTerminalResponse( err );
|
|
|
350 |
}
|
|
|
351 |
|
|
|
352 |
LOG2( NORMAL,
|
|
|
353 |
"ReceiveData: CReceiveDataHandler::HandleCommand %i bytes Remain in RX \
|
|
|
354 |
buffer.", iChDataLength )
|
|
|
355 |
LOG2( NORMAL,
|
|
|
356 |
"ReceiveData: CReceiveDataHandler::HandleCommand Returning %i bytes",
|
|
|
357 |
iChData.Length() )
|
|
|
358 |
|
|
|
359 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand exiting" )
|
|
|
360 |
}
|
|
|
361 |
|
|
|
362 |
// -----------------------------------------------------------------------------
|
|
|
363 |
// From class CSatCommandHandler.
|
|
|
364 |
// Indicates the failure of launching ui client.
|
|
|
365 |
// -----------------------------------------------------------------------------
|
|
|
366 |
//
|
|
|
367 |
void CReceiveDataHandler::UiLaunchFailed()
|
|
|
368 |
{
|
|
|
369 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::UiLaunchFailed calling" )
|
|
|
370 |
iReceiveDataRspData.iGeneralResult = RSat::KMeUnableToProcessCmd;
|
|
|
371 |
iReceiveDataRspData.iInfoType = RSat::KMeProblem;
|
|
|
372 |
iReceiveDataRspData.iAdditionalInfo.SetLength( 1 );
|
|
|
373 |
iReceiveDataRspData.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
|
|
|
374 |
iReceiveDataRspData.SetPCmdNumber( iReceiveDataData.PCmdNumber() );
|
|
|
375 |
TerminalRsp( RSat::EReceiveData, iReceiveDataRspPckg );
|
|
|
376 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::UiLaunchFailed exiting" )
|
|
|
377 |
}
|
|
|
378 |
|
|
|
379 |
// -----------------------------------------------------------------------------
|
|
|
380 |
// C++ default constructor can NOT contain any code, that
|
|
|
381 |
// might leave.
|
|
|
382 |
// -----------------------------------------------------------------------------
|
|
|
383 |
//
|
|
|
384 |
//lint -e{1403, 1769} Can not be initialized.
|
|
|
385 |
CReceiveDataHandler::CReceiveDataHandler() :
|
|
|
386 |
CSatCommandHandler(),
|
|
|
387 |
iReceiveDataData(),
|
|
|
388 |
iReceiveDataPckg( iReceiveDataData ),
|
|
|
389 |
iReceiveDataRspData(),
|
|
|
390 |
iReceiveDataRspPckg( iReceiveDataRspData ),
|
|
|
391 |
iReceiveDataUiData(),
|
|
|
392 |
iReceiveDataUiPckg( iReceiveDataUiData ),
|
|
|
393 |
iReceiveDataUiRsp(),
|
|
|
394 |
iReceiveDataUiRspPckg( iReceiveDataUiRsp ),
|
|
|
395 |
// To be removed when icons are allowed in this command
|
|
|
396 |
iIconCommand( EFalse )
|
|
|
397 |
{
|
|
|
398 |
LOG( NORMAL,
|
|
|
399 |
"ReceiveData: CReceiveDataHandler::\
|
|
|
400 |
CReceiveDataHandler calling - exiting" )
|
|
|
401 |
}
|
|
|
402 |
|
|
|
403 |
// -----------------------------------------------------------------------------
|
|
|
404 |
// Symbian 2nd phase constructor can leave.
|
|
|
405 |
// -----------------------------------------------------------------------------
|
|
|
406 |
//
|
|
|
407 |
void CReceiveDataHandler::ConstructL()
|
|
|
408 |
{
|
|
|
409 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::ConstructL \
|
|
|
410 |
calling" )
|
|
|
411 |
|
|
|
412 |
iUtils->RegisterServiceRequestL( ESatSProactiveNotification,
|
|
|
413 |
ESatSProactiveNotificationResponse, this );
|
|
|
414 |
|
|
|
415 |
// Register to ui service request
|
|
|
416 |
iUtils->RegisterL( this, MSatUtils::ECommandCancelled );
|
|
|
417 |
iUtils->RegisterL( this, MSatUtils::ECancelledUsingEndKey );
|
|
|
418 |
iUtils->RegisterL( this, MSatUtils::EOpenChannelExecuting );
|
|
|
419 |
|
|
|
420 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::ConstructL \
|
|
|
421 |
exiting" )
|
|
|
422 |
}
|
|
|
423 |
|
|
|
424 |
// -----------------------------------------------------------------------------
|
|
|
425 |
// Sends notification to UI.
|
|
|
426 |
// -----------------------------------------------------------------------------
|
|
|
427 |
//
|
|
|
428 |
TInt CReceiveDataHandler::SendUiNotification()
|
|
|
429 |
{
|
|
|
430 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::SendUiNotification \
|
|
|
431 |
calling" )
|
|
|
432 |
// Register to ui service request
|
|
|
433 |
TRAPD( uiError, iUtils->RegisterServiceRequestL(
|
|
|
434 |
ESatSProactiveNotification,
|
|
|
435 |
ESatSProactiveNotificationResponse, this ) );
|
|
|
436 |
LOG2( NORMAL, "ReceiveData: CReceiveDataHandler::SendUiNotification \
|
|
|
437 |
uiError: %d", uiError )
|
|
|
438 |
// Check UI error
|
|
|
439 |
if ( KErrNone == uiError )
|
|
|
440 |
{
|
|
|
441 |
// Create IPC data to UI
|
|
|
442 |
iReceiveDataUiData.iCommand = ESatSReceiveDataNotify;
|
|
|
443 |
|
|
|
444 |
iReceiveDataUiData.iText = iReceiveDataData.iAlphaId.iAlphaId;
|
|
|
445 |
iReceiveDataUiData.iIconId.iIdentifier
|
|
|
446 |
= iReceiveDataData.iIconId.iIdentifier;
|
|
|
447 |
|
|
|
448 |
// Define icon qualifier
|
|
|
449 |
if ( RSat::ENotSelfExplanatory ==
|
|
|
450 |
iReceiveDataData.iIconId.iQualifier )
|
|
|
451 |
{
|
|
|
452 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
|
|
|
453 |
SendUiNotification ENotSelfExplanatory" )
|
|
|
454 |
iReceiveDataUiData.iIconId.iIconQualifier =
|
|
|
455 |
ESatNotSelfExplanatory;
|
|
|
456 |
}
|
|
|
457 |
else if ( RSat::ESelfExplanatory ==
|
|
|
458 |
iReceiveDataData.iIconId.iQualifier )
|
|
|
459 |
{
|
|
|
460 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
|
|
|
461 |
SendUiNotification ESelfExplanatory" )
|
|
|
462 |
iReceiveDataUiData.iIconId.iIconQualifier = ESatSelfExplanatory;
|
|
|
463 |
}
|
|
|
464 |
else // Icon qualifier not present
|
|
|
465 |
{
|
|
|
466 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
|
|
|
467 |
SendUiNotification ESatENoIconId" )
|
|
|
468 |
iReceiveDataUiData.iIconId.iIconQualifier = ESatENoIconId;
|
|
|
469 |
}
|
|
|
470 |
LOG2( NORMAL, "ReceiveData: CReceiveDataHandler::SendUiNotification \
|
|
|
471 |
iReceiveDataData.iAlphaId.iStatus: %d",
|
|
|
472 |
iReceiveDataData.iAlphaId.iStatus )
|
|
|
473 |
// Define AlphaID status
|
|
|
474 |
switch ( iReceiveDataData.iAlphaId.iStatus )
|
|
|
475 |
{
|
|
|
476 |
case RSat::EAlphaIdNotPresent:
|
|
|
477 |
{
|
|
|
478 |
iReceiveDataUiData.iAlphaIdStatus = ESatAlphaIdNotProvided;
|
|
|
479 |
break;
|
|
|
480 |
}
|
|
|
481 |
|
|
|
482 |
case RSat::EAlphaIdProvided:
|
|
|
483 |
{
|
|
|
484 |
iReceiveDataUiData.iAlphaIdStatus = ESatAlphaIdNotNull;
|
|
|
485 |
break;
|
|
|
486 |
}
|
|
|
487 |
|
|
|
488 |
default:
|
|
|
489 |
{
|
|
|
490 |
iReceiveDataUiData.iAlphaIdStatus = ESatAlphaIdNull;
|
|
|
491 |
break;
|
|
|
492 |
}
|
|
|
493 |
}
|
|
|
494 |
|
|
|
495 |
// Send notification to UI
|
|
|
496 |
MSatUiSession* session = iUtils->SatUiHandler().UiSession();
|
|
|
497 |
session->SendCommand( &iReceiveDataUiPckg,
|
|
|
498 |
&iReceiveDataUiRspPckg,
|
|
|
499 |
ESatSProactiveNotification );
|
|
|
500 |
}
|
|
|
501 |
else
|
|
|
502 |
{
|
|
|
503 |
// Send error terminal response
|
|
|
504 |
iReceiveDataRspData.iGeneralResult = RSat::KMeUnableToProcessCmd;
|
|
|
505 |
SendTerminalResponse( RSat::KNoSpecificMeProblem );
|
|
|
506 |
}
|
|
|
507 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::SendUiNotification \
|
|
|
508 |
exiting" )
|
|
|
509 |
return uiError;
|
|
|
510 |
}
|
|
|
511 |
|
|
|
512 |
// -----------------------------------------------------------------------------
|
|
|
513 |
// Completes Terminal response and sends it.
|
|
|
514 |
// -----------------------------------------------------------------------------
|
|
|
515 |
//
|
|
|
516 |
void CReceiveDataHandler::SendTerminalResponse( const TInt aError )
|
|
|
517 |
{
|
|
|
518 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::SendTerminalResponse \
|
|
|
519 |
calling" )
|
|
|
520 |
|
|
|
521 |
if ( iUserCancelled )
|
|
|
522 |
{
|
|
|
523 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::SendTerminalResponse \
|
|
|
524 |
User cancelled the action" )
|
|
|
525 |
iReceiveDataRspData.iGeneralResult = RSat::KPSessionTerminatedByUser;
|
|
|
526 |
iReceiveDataRspData.iInfoType = RSat::KNoAdditionalInfo;
|
|
|
527 |
iReceiveDataRspData.iAdditionalInfo.Zero();
|
|
|
528 |
}
|
|
|
529 |
else if ( RSat::KMissingInformation == iReceiveDataRspData.iGeneralResult ||
|
|
|
530 |
RSat::KSuccess == iReceiveDataRspData.iGeneralResult )
|
|
|
531 |
{
|
|
|
532 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::SendTerminalResponse\
|
|
|
533 |
KMissingInformation or KSuccess" )
|
|
|
534 |
iReceiveDataRspData.iInfoType = RSat::KChannelData;
|
|
|
535 |
iReceiveDataRspData.iAdditionalInfo.Copy( iChData );
|
|
|
536 |
// More than maximum bytes remaining
|
|
|
537 |
if ( iChDataLength > KSatBIPMoreThanMaxSize )
|
|
|
538 |
{
|
|
|
539 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
|
|
|
540 |
SendTerminalResponse iChDataLength > KSatBIPMoreThanMaxSize" )
|
|
|
541 |
iReceiveDataRspData.iChannelDataLength = KSatBIPMoreThanMaxSize;
|
|
|
542 |
}
|
|
|
543 |
else
|
|
|
544 |
{
|
|
|
545 |
iReceiveDataRspData.iChannelDataLength =
|
|
|
546 |
static_cast<TUint8>( iChDataLength );
|
|
|
547 |
}
|
|
|
548 |
|
|
|
549 |
// If command had icon data and was done succesfully,
|
|
|
550 |
// report that icon was not shown.
|
|
|
551 |
// To be removed and correct handling (i.e. ClientResponse to
|
|
|
552 |
// notification is received) for general result
|
|
|
553 |
// KSuccessRequestedIconNotDisplayed must be added when icons
|
|
|
554 |
// are allowed in this command
|
|
|
555 |
if ( ( RSat::KSuccess == iReceiveDataRspData.iGeneralResult ) &&
|
|
|
556 |
iIconCommand )
|
|
|
557 |
{
|
|
|
558 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
|
|
|
559 |
SendTerminalResponse KSuccessRequestedIconNotDisplayed" )
|
|
|
560 |
iReceiveDataRspData.iGeneralResult =
|
|
|
561 |
RSat::KSuccessRequestedIconNotDisplayed;
|
|
|
562 |
}
|
|
|
563 |
}
|
|
|
564 |
else
|
|
|
565 |
{
|
|
|
566 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::SendTerminalResponse\
|
|
|
567 |
others" )
|
|
|
568 |
iReceiveDataRspData.iInfoType = RSat::KMeProblem;
|
|
|
569 |
iReceiveDataRspData.iAdditionalInfo.SetLength( 1 );
|
|
|
570 |
// Error code from MSatBIPUtils is the same as defined in etelsat.h,
|
|
|
571 |
// so we can put that error code straigth to additional info
|
|
|
572 |
iReceiveDataRspData.iAdditionalInfo[0] = static_cast<TUint8> ( aError );
|
|
|
573 |
iReceiveDataRspData.iChannelDataLength = 0;
|
|
|
574 |
}
|
|
|
575 |
|
|
|
576 |
if ( IsCommandExecuting() )
|
|
|
577 |
{
|
|
|
578 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::SendTerminalResponse\
|
|
|
579 |
IsCommandExecuting" )
|
|
|
580 |
// Create the response IPC package
|
|
|
581 |
iReceiveDataRspData.SetPCmdNumber( iReceiveDataData.PCmdNumber() );
|
|
|
582 |
|
|
|
583 |
// Fixed order to send terminal response.
|
|
|
584 |
iUtils->NotifyEvent( MSatUtils::EDelaySimSessionEnd );
|
|
|
585 |
iUtils->USatAPI().TerminalRsp( RSat::EReceiveData, iReceiveDataRspPckg );
|
|
|
586 |
Start();
|
|
|
587 |
}
|
|
|
588 |
LOG( NORMAL, "ReceiveData: CReceiveDataHandler::SendTerminalResponse \
|
|
|
589 |
exiting" )
|
|
|
590 |
}
|
|
|
591 |
|