|
33
|
1 |
/*
|
|
|
2 |
* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
3 |
* All rights reserved.
|
|
|
4 |
* This component and the accompanying materials are made available
|
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
|
6 |
* which accompanies this distribution, and is available
|
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
|
8 |
*
|
|
|
9 |
* Initial Contributors:
|
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
|
11 |
*
|
|
|
12 |
* Contributors:
|
|
|
13 |
*
|
|
|
14 |
* Description: Handles DisplayText command
|
|
|
15 |
*
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
#include <MSatShellController.h>
|
|
|
20 |
#include "MSatApi.h"
|
|
|
21 |
#include "MSatUtils.h"
|
|
|
22 |
#include "MSatSystemState.h"
|
|
|
23 |
#include "MSatUiSession.h"
|
|
|
24 |
#include "SatSOpcodes.h"
|
|
|
25 |
#include "MSatSUiClientHandler.h"
|
|
|
26 |
#include "CDisplayTextHandler.h"
|
|
|
27 |
#include "CClearScreenHandler.h"
|
|
|
28 |
#include "SatLog.h"
|
|
|
29 |
|
|
|
30 |
const TInt8 KSecondsInMinute = 60;
|
|
|
31 |
const TInt8 KSecond = 10;
|
|
|
32 |
const TUint8 KHalfSecond = 5;
|
|
|
33 |
|
|
|
34 |
// ======== MEMBER FUNCTIONS ========
|
|
|
35 |
|
|
|
36 |
// -----------------------------------------------------------------------------
|
|
|
37 |
// CDisplayTextHandler::CDisplayTextHandler
|
|
|
38 |
// C++ default constructor can NOT contain any code, that
|
|
|
39 |
// might leave.
|
|
|
40 |
// -----------------------------------------------------------------------------
|
|
|
41 |
//
|
|
|
42 |
CDisplayTextHandler::CDisplayTextHandler() :
|
|
|
43 |
CSatCommandHandler(),
|
|
|
44 |
iDisplayTextData(),
|
|
|
45 |
iDisplayTextPckg( iDisplayTextData ),
|
|
|
46 |
iDisplayTextRsp(),
|
|
|
47 |
iDisplayTextRspPckg( iDisplayTextRsp ),
|
|
|
48 |
iDisplayTextSendData(),
|
|
|
49 |
iDisplayTextSendPckg( iDisplayTextSendData )
|
|
|
50 |
{
|
|
|
51 |
LOG( SIMPLE, "DISPLAYTEXT: \
|
|
|
52 |
CDisplayTextHandler::CDisplayTextHandler calling - exiting" )
|
|
|
53 |
}
|
|
|
54 |
|
|
|
55 |
// -----------------------------------------------------------------------------
|
|
|
56 |
// CDisplayTextHandler::ConstructL
|
|
|
57 |
// Symbian 2nd phase constructor can leave.
|
|
|
58 |
// -----------------------------------------------------------------------------
|
|
|
59 |
//
|
|
|
60 |
void CDisplayTextHandler::ConstructL()
|
|
|
61 |
{
|
|
|
62 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::ConstructL calling" )
|
|
|
63 |
|
|
|
64 |
// Register service request handler for DisplayText command
|
|
|
65 |
iUtils->RegisterServiceRequestL(
|
|
|
66 |
ESatSProactiveDisplayText,
|
|
|
67 |
ESatSProactiveDisplayTextResponse,
|
|
|
68 |
this );
|
|
|
69 |
|
|
|
70 |
iClearScreenHandler = CClearScreenHandler::NewL( *iUtils );
|
|
|
71 |
|
|
|
72 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::ConstructL exiting" )
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
// -----------------------------------------------------------------------------
|
|
|
76 |
// CDisplayTextHandler::NewL
|
|
|
77 |
// Two-phased constructor.
|
|
|
78 |
// -----------------------------------------------------------------------------
|
|
|
79 |
//
|
|
|
80 |
CDisplayTextHandler* CDisplayTextHandler::NewL( MSatUtils* aUtils )
|
|
|
81 |
{
|
|
|
82 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::NewL calling" )
|
|
|
83 |
|
|
|
84 |
CDisplayTextHandler* self = new( ELeave ) CDisplayTextHandler;
|
|
|
85 |
|
|
|
86 |
CleanupStack::PushL( self );
|
|
|
87 |
self->BaseConstructL( aUtils );
|
|
|
88 |
self->ConstructL();
|
|
|
89 |
CleanupStack::Pop( self );
|
|
|
90 |
|
|
|
91 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::NewL exiting" )
|
|
|
92 |
return self;
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
// Destructor
|
|
|
96 |
CDisplayTextHandler::~CDisplayTextHandler()
|
|
|
97 |
{
|
|
|
98 |
LOG( SIMPLE,
|
|
|
99 |
"DISPLAYTEXT: CDisplayTextHandler::~CDisplayTextHandler calling" )
|
|
|
100 |
|
|
|
101 |
Cancel();
|
|
|
102 |
delete iClearScreenHandler;
|
|
|
103 |
|
|
|
104 |
LOG( SIMPLE,
|
|
|
105 |
"DISPLAYTEXT: CDisplayTextHandler::~CDisplayTextHandler exiting" )
|
|
|
106 |
}
|
|
|
107 |
|
|
|
108 |
// -----------------------------------------------------------------------------
|
|
|
109 |
// CDisplayTextHandler::ClientResponse
|
|
|
110 |
// -----------------------------------------------------------------------------
|
|
|
111 |
//
|
|
|
112 |
void CDisplayTextHandler::ClientResponse()
|
|
|
113 |
{
|
|
|
114 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::ClientResponse calling" )
|
|
|
115 |
|
|
|
116 |
// SatShellController checks if SatUi was brought to foreground from
|
|
|
117 |
// background and set SatUi background again.
|
|
|
118 |
if ( RSat::EHighPriority == iDisplayTextData.iPriority )
|
|
|
119 |
{
|
|
|
120 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::ClientResponse \
|
|
|
121 |
set SatUi background" )
|
|
|
122 |
iUtils->SatUiHandler().ShellController().SetSatUiToBackground();
|
|
|
123 |
}
|
|
|
124 |
|
|
|
125 |
TBool terminatedByUser( EFalse );
|
|
|
126 |
if ( RSat::KPSessionTerminatedByUser == iDisplayTextRsp.iGeneralResult )
|
|
|
127 |
{
|
|
|
128 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::ClientResponse \
|
|
|
129 |
session terminated by user" )
|
|
|
130 |
terminatedByUser = ETrue;
|
|
|
131 |
|
|
|
132 |
iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
|
|
|
133 |
}
|
|
|
134 |
|
|
|
135 |
// Check immediate response. If true, no need to send TerminalResponse
|
|
|
136 |
// This must be checked from our own member variable, because
|
|
|
137 |
// ClearScreenHandler may have this value set to false already if the
|
|
|
138 |
// timer has run out and screen was cleared.
|
|
|
139 |
if ( iImmediateResponse )
|
|
|
140 |
{
|
|
|
141 |
// Check has sustained text cleared in ClearScreen handler
|
|
|
142 |
if ( !iImmediatePending )
|
|
|
143 |
{
|
|
|
144 |
// No need to send terminal response since it is already sent.
|
|
|
145 |
iImmediateResponse = EFalse;
|
|
|
146 |
|
|
|
147 |
// Notify sustained text removal, if not yet notified.
|
|
|
148 |
iUtils->NotifyEvent( MSatUtils::ESustainedTextRemoved );
|
|
|
149 |
iClearScreenHandler->UpdateImmediateState( EFalse );
|
|
|
150 |
|
|
|
151 |
if ( !iUtils->SatUiHandler().UiLaunchedByUser() ||
|
|
|
152 |
terminatedByUser )
|
|
|
153 |
{
|
|
|
154 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::\
|
|
|
155 |
ClientResponse close ui session" )
|
|
|
156 |
// Next SimSession end will close the ui session.
|
|
|
157 |
iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
|
|
|
158 |
}
|
|
|
159 |
else
|
|
|
160 |
{
|
|
|
161 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::\
|
|
|
162 |
ClientResponse others" )
|
|
|
163 |
// If SATUI client application is running, show the setup menu.
|
|
|
164 |
if ( iUtils->SatUiHandler().UiSession() )
|
|
|
165 |
{
|
|
|
166 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::\
|
|
|
167 |
ClientResponse SetUpMenu" )
|
|
|
168 |
iUtils->NotifyEvent( MSatUtils::ESetUpMenuNeeded );
|
|
|
169 |
}
|
|
|
170 |
}
|
|
|
171 |
}
|
|
|
172 |
iImmediatePending = EFalse;
|
|
|
173 |
}
|
|
|
174 |
else
|
|
|
175 |
{
|
|
|
176 |
LOG( SIMPLE,
|
|
|
177 |
"DISPLAYTEXT: CDisplayTextHandler::ClientResponse Success" )
|
|
|
178 |
// Generate terminal response
|
|
|
179 |
iDisplayTextRsp.SetPCmdNumber( iDisplayTextData.PCmdNumber() );
|
|
|
180 |
TerminalRsp( RSat::EDisplayText, iDisplayTextRspPckg );
|
|
|
181 |
}
|
|
|
182 |
|
|
|
183 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::ClientResponse exiting" )
|
|
|
184 |
}
|
|
|
185 |
|
|
|
186 |
// -----------------------------------------------------------------------------
|
|
|
187 |
// CDisplayTextHandler::DoCancel
|
|
|
188 |
// Cancels the sat request.
|
|
|
189 |
// -----------------------------------------------------------------------------
|
|
|
190 |
//
|
|
|
191 |
void CDisplayTextHandler::DoCancel()
|
|
|
192 |
{
|
|
|
193 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::DoCancel calling" )
|
|
|
194 |
|
|
|
195 |
iUtils->USatAPI().NotifyDisplayTextCancel();
|
|
|
196 |
|
|
|
197 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::DoCancel exiting" )
|
|
|
198 |
}
|
|
|
199 |
|
|
|
200 |
// -----------------------------------------------------------------------------
|
|
|
201 |
// CDisplayTextHandler::IssueUSATRequest
|
|
|
202 |
// -----------------------------------------------------------------------------
|
|
|
203 |
//
|
|
|
204 |
void CDisplayTextHandler::IssueUSATRequest( TRequestStatus& aStatus )
|
|
|
205 |
{
|
|
|
206 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::IssueUSATRequest calling" )
|
|
|
207 |
|
|
|
208 |
// Clear the IPC package.
|
|
|
209 |
new (&iDisplayTextData) RSat::TDisplayTextV2();
|
|
|
210 |
iDisplayTextRsp.iGeneralResult = RSat::KPSessionTerminatedByUser; // default
|
|
|
211 |
iDisplayTextSendData.iDuration = 0;
|
|
|
212 |
iDisplayTextSendData.iClearScreen = RSat::EClearScreenTriggerNotSet;
|
|
|
213 |
|
|
|
214 |
iUtils->USatAPI().NotifyDisplayText( aStatus, iDisplayTextPckg );
|
|
|
215 |
|
|
|
216 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::IssueUSATRequest exiting" )
|
|
|
217 |
}
|
|
|
218 |
|
|
|
219 |
// -----------------------------------------------------------------------------
|
|
|
220 |
// CDisplayTextHandler::CommandAllowed
|
|
|
221 |
// -----------------------------------------------------------------------------
|
|
|
222 |
//
|
|
|
223 |
TBool CDisplayTextHandler::CommandAllowed()
|
|
|
224 |
{
|
|
|
225 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::CommandAllowed calling" )
|
|
|
226 |
|
|
|
227 |
// By default, this is true.
|
|
|
228 |
TBool commandAllowed( ETrue );
|
|
|
229 |
|
|
|
230 |
const TBool callIncoming( iUtils->SystemState().IsCallIncoming() );
|
|
|
231 |
const TBool phoneInIdle( IsPhoneInIdleState() );
|
|
|
232 |
|
|
|
233 |
|
|
|
234 |
TBool screenSaver( EFalse );
|
|
|
235 |
|
|
|
236 |
// By default, this is true.
|
|
|
237 |
TBool uiNotReady( ETrue );
|
|
|
238 |
|
|
|
239 |
// If screen saver is actived from idle.
|
|
|
240 |
screenSaver = iUtils->SystemState().IsScreenSaverActivedFromIdle();
|
|
|
241 |
|
|
|
242 |
if ( screenSaver )
|
|
|
243 |
{
|
|
|
244 |
uiNotReady = EFalse;
|
|
|
245 |
}
|
|
|
246 |
else
|
|
|
247 |
{
|
|
|
248 |
uiNotReady = ( !phoneInIdle &&
|
|
|
249 |
( !iUtils->SatUiHandler().UiSession() ) );
|
|
|
250 |
}
|
|
|
251 |
|
|
|
252 |
const RSat::TDisplayPriority priority( iDisplayTextData.iPriority );
|
|
|
253 |
|
|
|
254 |
// Icon without text
|
|
|
255 |
if ( ( 0 == iDisplayTextData.iText.Length() ) &&
|
|
|
256 |
( RSat::ENotSelfExplanatory == iDisplayTextData.iIconId.iQualifier ||
|
|
|
257 |
RSat::ESelfExplanatory == iDisplayTextData.iIconId.iQualifier ) )
|
|
|
258 |
{
|
|
|
259 |
iDisplayTextRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
|
|
|
260 |
iDisplayTextRsp.iInfoType = RSat::KNoAdditionalInfo;
|
|
|
261 |
iDisplayTextRsp.iAdditionalInfo.Zero();
|
|
|
262 |
commandAllowed = EFalse;
|
|
|
263 |
}
|
|
|
264 |
// Check is call incoming or if Normal priority check is call ongoing or is
|
|
|
265 |
// phone in idle state and is there UiSession. AND Ui is not closing
|
|
|
266 |
else if ( callIncoming ||
|
|
|
267 |
( ( priority == RSat::ENormalPriority ) &&
|
|
|
268 |
( uiNotReady ) ) )
|
|
|
269 |
{
|
|
|
270 |
// Check is UI closing
|
|
|
271 |
if ( !iUtils->SatUiHandler().IsUiClosing() )
|
|
|
272 |
{
|
|
|
273 |
// Generate proper terminal response and send it.
|
|
|
274 |
// By default, this command does not have additional information,
|
|
|
275 |
// except in this case when screen is busy.
|
|
|
276 |
iDisplayTextRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
|
|
|
277 |
iDisplayTextRsp.iInfoType = RSat::KMeProblem;
|
|
|
278 |
iDisplayTextRsp.iAdditionalInfo.SetLength( 1 );
|
|
|
279 |
iDisplayTextRsp.iAdditionalInfo[0] = RSat::KScreenBusy;
|
|
|
280 |
|
|
|
281 |
// Command is not allowed.
|
|
|
282 |
LOG( SIMPLE,
|
|
|
283 |
"DISPLAYTEXT: CDisplayTextHandler::CommandAllowed Not allowed" )
|
|
|
284 |
commandAllowed = EFalse;
|
|
|
285 |
}
|
|
|
286 |
else // UI is closing, command is allowed. UI is launched again when it
|
|
|
287 |
// has been fully closed
|
|
|
288 |
{
|
|
|
289 |
LOG( SIMPLE,
|
|
|
290 |
"DISPLAYTEXT: CDisplayTextHandler::CommandAllowed Ui is closing\
|
|
|
291 |
Command is allowed" )
|
|
|
292 |
}
|
|
|
293 |
}
|
|
|
294 |
else
|
|
|
295 |
{
|
|
|
296 |
LOG( SIMPLE,
|
|
|
297 |
"DISPLAYTEXT: CDisplayTextHandler::CommandAllowed Allowed" )
|
|
|
298 |
}
|
|
|
299 |
|
|
|
300 |
if ( !commandAllowed )
|
|
|
301 |
{
|
|
|
302 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::CommandAllowed \
|
|
|
303 |
commandAllowed false" )
|
|
|
304 |
iDisplayTextRsp.SetPCmdNumber( iDisplayTextData.PCmdNumber() );
|
|
|
305 |
TerminalRsp( RSat::EDisplayText, iDisplayTextRspPckg );
|
|
|
306 |
}
|
|
|
307 |
|
|
|
308 |
LOG2( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::CommandAllowed exiting,\
|
|
|
309 |
commandAllowed: %d", commandAllowed )
|
|
|
310 |
return commandAllowed;
|
|
|
311 |
}
|
|
|
312 |
|
|
|
313 |
// -----------------------------------------------------------------------------
|
|
|
314 |
// CDisplayTextHandler::NeedUiSession
|
|
|
315 |
// -----------------------------------------------------------------------------
|
|
|
316 |
//
|
|
|
317 |
TBool CDisplayTextHandler::NeedUiSession()
|
|
|
318 |
{
|
|
|
319 |
// Priority and phone idle state is checked in CommandAllowed function, so
|
|
|
320 |
// in this case it has passed and we need UI.
|
|
|
321 |
LOG( NORMAL,
|
|
|
322 |
"DISPLAYTEXT: CDisplayTextHandler::NeedUiSession calling - calling" )
|
|
|
323 |
|
|
|
324 |
// Notify Mediator if Cover UI is supported
|
|
|
325 |
if ( iUtils->CoverUiSupported() )
|
|
|
326 |
{
|
|
|
327 |
TSatCommandData medEventData;
|
|
|
328 |
medEventData.iPCmdNumber = RSat::EDisplayText;
|
|
|
329 |
medEventData.iAlphaId.iStatus = RSat::EAlphaIdProvided;
|
|
|
330 |
medEventData.iAlphaId.iAlphaId.Copy( iDisplayTextData.iText );
|
|
|
331 |
if ( RSat::ETimeUnitNotSet == iDisplayTextData.iDuration.iTimeUnit &&
|
|
|
332 |
RSat::EClearAfterDelay == iDisplayTextData.iClearScreenTrigger )
|
|
|
333 |
{
|
|
|
334 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::NeedUiSession \
|
|
|
335 |
KSatDefaultDuration" )
|
|
|
336 |
medEventData.iDuration.iTimeUnit = RSat::ESeconds;
|
|
|
337 |
medEventData.iDuration.iNumOfUnits = KSatDefaultDuration;
|
|
|
338 |
}
|
|
|
339 |
else if (
|
|
|
340 |
( RSat::ETimeUnitNotSet == iDisplayTextData.iDuration.iTimeUnit ) &&
|
|
|
341 |
( RSat::EUserClear == iDisplayTextData.iClearScreenTrigger ) )
|
|
|
342 |
{
|
|
|
343 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::NeedUiSession \
|
|
|
344 |
KSatLongDuration" )
|
|
|
345 |
medEventData.iDuration.iTimeUnit = RSat::ESeconds;
|
|
|
346 |
medEventData.iDuration.iNumOfUnits = KSatLongDuration;
|
|
|
347 |
}
|
|
|
348 |
else
|
|
|
349 |
{
|
|
|
350 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::NeedUiSession \
|
|
|
351 |
others" )
|
|
|
352 |
medEventData.iDuration = iDisplayTextData.iDuration;
|
|
|
353 |
}
|
|
|
354 |
|
|
|
355 |
medEventData.iIconID = iDisplayTextData.iIconId;
|
|
|
356 |
TSatCommandPckg tPckg( medEventData );
|
|
|
357 |
iUtils->RaiseSatEvent( tPckg );
|
|
|
358 |
}
|
|
|
359 |
|
|
|
360 |
LOG( NORMAL,
|
|
|
361 |
"DISPLAYTEXT: CDisplayTextHandler::NeedUiSession - exiting" )
|
|
|
362 |
return ETrue;
|
|
|
363 |
}
|
|
|
364 |
|
|
|
365 |
// -----------------------------------------------------------------------------
|
|
|
366 |
// CDisplayTextHandler::HandleCommand
|
|
|
367 |
// -----------------------------------------------------------------------------
|
|
|
368 |
//
|
|
|
369 |
void CDisplayTextHandler::HandleCommand()
|
|
|
370 |
{
|
|
|
371 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::HandleCommand calling" )
|
|
|
372 |
|
|
|
373 |
// If this is a High priority message, bring SatUi to foreground.
|
|
|
374 |
if ( RSat::EHighPriority == iDisplayTextData.iPriority )
|
|
|
375 |
{
|
|
|
376 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::HandleCommand bring \
|
|
|
377 |
SatUi to foreground" )
|
|
|
378 |
iUtils->SatUiHandler().ShellController().BringSatUiToForeground();
|
|
|
379 |
}
|
|
|
380 |
|
|
|
381 |
// Notify must be here, because it triggers ClearScreen and
|
|
|
382 |
// this notify must be before UpdateImmediateState function call.
|
|
|
383 |
iUtils->NotifyEvent( MSatUtils::EDisplayTextExecuting );
|
|
|
384 |
|
|
|
385 |
// Send terminal response immediately if SIM requires it.
|
|
|
386 |
if ( RSat::EImmediateRsp == iDisplayTextData.iImmediateRsp )
|
|
|
387 |
{
|
|
|
388 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::HandleCommand \
|
|
|
389 |
immediate response" )
|
|
|
390 |
// There is sustained text already on display
|
|
|
391 |
if ( iImmediateResponse )
|
|
|
392 |
{
|
|
|
393 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::HandleCommand \
|
|
|
394 |
iImmediateResponse true" )
|
|
|
395 |
iImmediatePending = ETrue;
|
|
|
396 |
}
|
|
|
397 |
|
|
|
398 |
// Generate terminal response
|
|
|
399 |
iDisplayTextRsp.iGeneralResult = RSat::KSuccess;
|
|
|
400 |
iDisplayTextRsp.iInfoType = RSat::KNoAdditionalInfo;
|
|
|
401 |
iDisplayTextRsp.iAdditionalInfo.Zero();
|
|
|
402 |
iDisplayTextRsp.SetPCmdNumber( iDisplayTextData.PCmdNumber() );
|
|
|
403 |
|
|
|
404 |
// We cannot use CSatCommandHandler's TerminalRsp here because it
|
|
|
405 |
// restarts the request and we are not yet ready for that
|
|
|
406 |
iUtils->NotifyEvent( MSatUtils::EDelaySimSessionEnd );
|
|
|
407 |
|
|
|
408 |
iUtils->USatAPI().TerminalRsp(
|
|
|
409 |
RSat::EDisplayText, iDisplayTextRspPckg );
|
|
|
410 |
|
|
|
411 |
iImmediateResponse = ETrue;
|
|
|
412 |
iClearScreenHandler->UpdateImmediateState( ETrue );
|
|
|
413 |
|
|
|
414 |
iUtils->NotifyEvent( MSatUtils::ESustainedTextInDisplay );
|
|
|
415 |
|
|
|
416 |
// Inform UI that this is sustained text
|
|
|
417 |
iDisplayTextSendData.iSustainedText = ETrue;
|
|
|
418 |
}
|
|
|
419 |
else
|
|
|
420 |
{
|
|
|
421 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::HandleCommand \
|
|
|
422 |
others" )
|
|
|
423 |
// Reset information for other cases.
|
|
|
424 |
// Inform UI that this is not sustained text.
|
|
|
425 |
iDisplayTextSendData.iSustainedText = EFalse;
|
|
|
426 |
}
|
|
|
427 |
|
|
|
428 |
// Check if duration data is available.
|
|
|
429 |
if ( ( RSat::ENoDurationAvailable != iDisplayTextData.iDuration.iTimeUnit )
|
|
|
430 |
&& ( RSat::ETimeUnitNotSet != iDisplayTextData.iDuration.iTimeUnit )
|
|
|
431 |
&& iDisplayTextData.iDuration.iNumOfUnits )
|
|
|
432 |
{
|
|
|
433 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::HandleCommand \
|
|
|
434 |
duration data available" )
|
|
|
435 |
// The resolution of a timer is 1 second.
|
|
|
436 |
TTimeIntervalSeconds duration( 0 );
|
|
|
437 |
duration = DurationInSeconds( iDisplayTextData.iDuration );
|
|
|
438 |
iDisplayTextSendData.iDuration = duration;
|
|
|
439 |
}
|
|
|
440 |
|
|
|
441 |
// Build the IPC Package.
|
|
|
442 |
iDisplayTextSendData.iText = iDisplayTextData.iText;
|
|
|
443 |
iDisplayTextSendData.iSimApplicationName = iUtils->SatAppName();
|
|
|
444 |
iDisplayTextSendData.iPCmdNumber = iDisplayTextData.PCmdNumber();
|
|
|
445 |
iDisplayTextSendData.iIconId = iDisplayTextData.iIconId;
|
|
|
446 |
iDisplayTextSendData.iClearScreen = iDisplayTextData.iClearScreenTrigger;
|
|
|
447 |
|
|
|
448 |
// Now we can send command to client.
|
|
|
449 |
MSatUiSession* uiSession = iUtils->SatUiHandler().UiSession();
|
|
|
450 |
uiSession->SendCommand(
|
|
|
451 |
&iDisplayTextSendPckg,
|
|
|
452 |
&iDisplayTextRspPckg,
|
|
|
453 |
ESatSProactiveDisplayText );
|
|
|
454 |
|
|
|
455 |
// Restart request, if immediate response.
|
|
|
456 |
if ( RSat::EImmediateRsp == iDisplayTextData.iImmediateRsp )
|
|
|
457 |
{
|
|
|
458 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::HandleCommand \
|
|
|
459 |
immediate response" )
|
|
|
460 |
// Renew the request
|
|
|
461 |
Start();
|
|
|
462 |
}
|
|
|
463 |
|
|
|
464 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::HandleCommand exiting" )
|
|
|
465 |
}
|
|
|
466 |
|
|
|
467 |
// -----------------------------------------------------------------------------
|
|
|
468 |
// CDisplayTextHandler::UiLaunchFailed
|
|
|
469 |
// -----------------------------------------------------------------------------
|
|
|
470 |
//
|
|
|
471 |
void CDisplayTextHandler::UiLaunchFailed()
|
|
|
472 |
{
|
|
|
473 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::UiLaunchFailed calling" )
|
|
|
474 |
|
|
|
475 |
// Send terminal response
|
|
|
476 |
iDisplayTextRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
|
|
|
477 |
iDisplayTextRsp.iInfoType = RSat::KMeProblem;
|
|
|
478 |
iDisplayTextRsp.iAdditionalInfo.SetLength( 1 );
|
|
|
479 |
iDisplayTextRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
|
|
|
480 |
iDisplayTextRsp.SetPCmdNumber( iDisplayTextData.PCmdNumber() );
|
|
|
481 |
TerminalRsp( RSat::EDisplayText, iDisplayTextRspPckg );
|
|
|
482 |
|
|
|
483 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::UiLaunchFailed exiting" )
|
|
|
484 |
}
|
|
|
485 |
|
|
|
486 |
// -----------------------------------------------------------------------------
|
|
|
487 |
// CDisplayTextHandler::DurationInSeconds
|
|
|
488 |
// Return duration in seconds.
|
|
|
489 |
// -----------------------------------------------------------------------------
|
|
|
490 |
//
|
|
|
491 |
TTimeIntervalSeconds CDisplayTextHandler::DurationInSeconds(
|
|
|
492 |
const RSat::TDuration& aDuration ) const
|
|
|
493 |
{
|
|
|
494 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::DurationInSeconds calling" )
|
|
|
495 |
|
|
|
496 |
TTimeIntervalSeconds duration( 0 );
|
|
|
497 |
LOG2( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::DurationInSeconds \
|
|
|
498 |
aDuration.iTimeUnit: %d", aDuration.iTimeUnit )
|
|
|
499 |
switch ( aDuration.iTimeUnit )
|
|
|
500 |
{
|
|
|
501 |
case RSat::EMinutes:
|
|
|
502 |
{
|
|
|
503 |
duration = aDuration.iNumOfUnits * KSecondsInMinute;
|
|
|
504 |
break;
|
|
|
505 |
}
|
|
|
506 |
|
|
|
507 |
case RSat::ESeconds:
|
|
|
508 |
{
|
|
|
509 |
duration = aDuration.iNumOfUnits;
|
|
|
510 |
break;
|
|
|
511 |
}
|
|
|
512 |
|
|
|
513 |
case RSat::ETenthsOfSeconds:
|
|
|
514 |
{
|
|
|
515 |
// If duration exists minimum values is 1 second
|
|
|
516 |
if ( aDuration.iNumOfUnits < KHalfSecond )
|
|
|
517 |
{
|
|
|
518 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::\
|
|
|
519 |
DurationInSeconds aDuration.iNumOfUnits < KHalfSecond" )
|
|
|
520 |
duration = KSecond;
|
|
|
521 |
}
|
|
|
522 |
else
|
|
|
523 |
{
|
|
|
524 |
// Make Roundup
|
|
|
525 |
duration = ( aDuration.iNumOfUnits + KHalfSecond ) / KSecond;
|
|
|
526 |
}
|
|
|
527 |
break;
|
|
|
528 |
}
|
|
|
529 |
|
|
|
530 |
default:
|
|
|
531 |
{
|
|
|
532 |
//duration is 0
|
|
|
533 |
break;
|
|
|
534 |
}
|
|
|
535 |
}
|
|
|
536 |
|
|
|
537 |
LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::DurationInSeconds exiting" )
|
|
|
538 |
return duration;
|
|
|
539 |
}
|