|
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 SetUpIdleModeText command
|
|
|
15 |
*
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
#include <e32property.h>
|
|
|
20 |
#include <centralrepository.h>
|
|
|
21 |
#include <networkhandlingdomainpskeys.h>
|
|
|
22 |
#include "SATPrivateCRKeys.h"
|
|
|
23 |
#include "MSatApi.h"
|
|
|
24 |
#include "MSatUtils.h"
|
|
|
25 |
#include "MSatUiSession.h"
|
|
|
26 |
#include "SatSOpcodes.h"
|
|
|
27 |
#include "MSatSUiClientHandler.h"
|
|
|
28 |
#include "MSatSystemState.h"
|
|
|
29 |
#include "CSetUpIdleModeTextHandler.h"
|
|
|
30 |
#include "SatLog.h"
|
|
|
31 |
|
|
|
32 |
// This was agreed with Idle.
|
|
|
33 |
const TInt KNoIcon = -1;
|
|
|
34 |
|
|
|
35 |
// ======== MEMBER FUNCTIONS ========
|
|
|
36 |
|
|
|
37 |
// -----------------------------------------------------------------------------
|
|
|
38 |
// CSetUpIdleModeTextHandler::CSetUpIdleModeTextHandler
|
|
|
39 |
// C++ default constructor can NOT contain any code, that
|
|
|
40 |
// might leave.
|
|
|
41 |
// -----------------------------------------------------------------------------
|
|
|
42 |
//
|
|
|
43 |
CSetUpIdleModeTextHandler::CSetUpIdleModeTextHandler() :
|
|
|
44 |
CSatCommandHandler(),
|
|
|
45 |
iSetUpIdleModeTextData(),
|
|
|
46 |
iSetUpIdleModeTextPckg( iSetUpIdleModeTextData ),
|
|
|
47 |
iSetUpIdleModeTextRsp(),
|
|
|
48 |
iSetUpIdleModeTextRspPckg( iSetUpIdleModeTextRsp ),
|
|
|
49 |
iSimResetExecuting( EFalse ),
|
|
|
50 |
iLastValidText( KNullDesC ),
|
|
|
51 |
iLastValidIconId( KNoIcon ),
|
|
|
52 |
iLastValidIconQualifier( RSat::EIconQualifierNotSet ),
|
|
|
53 |
iHasHomezoneIndicator( 0 )
|
|
|
54 |
{
|
|
|
55 |
LOG( SIMPLE, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::\
|
|
|
56 |
CSetUpIdleModeTextHandler calling - exiting" )
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
// -----------------------------------------------------------------------------
|
|
|
60 |
// CSetUpIdleModeTextHandler::ConstructL
|
|
|
61 |
// Symbian 2nd phase constructor can leave.
|
|
|
62 |
// -----------------------------------------------------------------------------
|
|
|
63 |
//
|
|
|
64 |
void CSetUpIdleModeTextHandler::ConstructL()
|
|
|
65 |
{
|
|
|
66 |
LOG( SIMPLE, "SETUPIDLEMODETEXT: \
|
|
|
67 |
CSetUpIdleModeTextHandler::ConstructL calling" )
|
|
|
68 |
|
|
|
69 |
// Register to listen ESimReset execution.
|
|
|
70 |
iUtils->RegisterL( this, MSatUtils::ESimResetCalled );
|
|
|
71 |
iUtils->RegisterL( this, MSatUtils::ESimResetCancelled );
|
|
|
72 |
iUtils->RegisterL( this, MSatUtils::ESimInitDone );
|
|
|
73 |
// Get the homezone indicator flag from the Central Repository.
|
|
|
74 |
CRepository* repo = CRepository::NewLC( KCRUidSatServer );
|
|
|
75 |
TInt errorCode = repo->Get( KSatHomeZoneIconVisible, iHasHomezoneIndicator );
|
|
|
76 |
LOG2( NORMAL, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::ConstructL \
|
|
|
77 |
get homezone indicator flag and return: %d", errorCode )
|
|
|
78 |
CleanupStack::PopAndDestroy( repo );
|
|
|
79 |
|
|
|
80 |
LOG( SIMPLE, "SETUPIDLEMODETEXT: \
|
|
|
81 |
CSetUpIdleModeTextHandler::ConstructL exiting" )
|
|
|
82 |
}
|
|
|
83 |
|
|
|
84 |
// -----------------------------------------------------------------------------
|
|
|
85 |
// CSetUpIdleModeTextHandler::NewL
|
|
|
86 |
// Two-phased constructor.
|
|
|
87 |
// -----------------------------------------------------------------------------
|
|
|
88 |
//
|
|
|
89 |
CSetUpIdleModeTextHandler* CSetUpIdleModeTextHandler::NewL( MSatUtils* aUtils )
|
|
|
90 |
{
|
|
|
91 |
LOG( SIMPLE,
|
|
|
92 |
"SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::NewL calling" )
|
|
|
93 |
|
|
|
94 |
CSetUpIdleModeTextHandler* self = new( ELeave ) CSetUpIdleModeTextHandler;
|
|
|
95 |
|
|
|
96 |
CleanupStack::PushL( self );
|
|
|
97 |
self->BaseConstructL( aUtils );
|
|
|
98 |
self->ConstructL();
|
|
|
99 |
CleanupStack::Pop( self );
|
|
|
100 |
|
|
|
101 |
LOG( SIMPLE,
|
|
|
102 |
"SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::NewL exiting" )
|
|
|
103 |
return self;
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
// -----------------------------------------------------------------------------
|
|
|
107 |
// CSetUpIdleModeTextHandler::~CSetUpIdleModeTextHandler
|
|
|
108 |
// Destructor.
|
|
|
109 |
// -----------------------------------------------------------------------------
|
|
|
110 |
//
|
|
|
111 |
CSetUpIdleModeTextHandler::~CSetUpIdleModeTextHandler()
|
|
|
112 |
{
|
|
|
113 |
LOG( SIMPLE, "SETUPIDLEMODETEXT: \
|
|
|
114 |
CSetUpIdleModeTextHandler::~CSetUpIdleModeTextHandler calling" )
|
|
|
115 |
|
|
|
116 |
Cancel();
|
|
|
117 |
|
|
|
118 |
LOG( SIMPLE, "SETUPIDLEMODETEXT: \
|
|
|
119 |
CSetUpIdleModeTextHandler::~CSetUpIdleModeTextHandler exiting" )
|
|
|
120 |
}
|
|
|
121 |
|
|
|
122 |
// -----------------------------------------------------------------------------
|
|
|
123 |
// CSetUpIdleModeTextHandler::Event
|
|
|
124 |
// -----------------------------------------------------------------------------
|
|
|
125 |
//
|
|
|
126 |
void CSetUpIdleModeTextHandler::Event( TInt aEvent )
|
|
|
127 |
{
|
|
|
128 |
LOG( SIMPLE,
|
|
|
129 |
"SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::Event calling" )
|
|
|
130 |
// Check the response
|
|
|
131 |
switch ( aEvent )
|
|
|
132 |
{
|
|
|
133 |
case MSatUtils::ESimResetCalled:
|
|
|
134 |
{
|
|
|
135 |
LOG( NORMAL, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler \
|
|
|
136 |
ESimResetCalled")
|
|
|
137 |
iSimResetExecuting = ETrue;
|
|
|
138 |
}
|
|
|
139 |
//lint -fallthrough intended here
|
|
|
140 |
|
|
|
141 |
case MSatUtils::ESimInitDone:
|
|
|
142 |
{
|
|
|
143 |
LOG( NORMAL, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler \
|
|
|
144 |
remove idle mode text")
|
|
|
145 |
|
|
|
146 |
// Remove the idle mode text and icon.
|
|
|
147 |
// Note no response now, responseOk remains EFalse.
|
|
|
148 |
iUtils->SystemState().WriteSetIdleModeText(
|
|
|
149 |
KNullDesC, KNoIcon, RSat::ENoIconId );
|
|
|
150 |
// Remove the homezone indicator.
|
|
|
151 |
if ( iHasHomezoneIndicator && iLastValidText.Length() )
|
|
|
152 |
{
|
|
|
153 |
TInt errorCode = RProperty::Set(
|
|
|
154 |
KPSUidNetworkInfo,
|
|
|
155 |
KNWHomeZoneStatus,
|
|
|
156 |
ENWNone );
|
|
|
157 |
LOG2( NORMAL, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler \
|
|
|
158 |
remove the homezone indicator and return %d", errorCode )
|
|
|
159 |
}
|
|
|
160 |
break;
|
|
|
161 |
}
|
|
|
162 |
|
|
|
163 |
case MSatUtils::ESimResetCancelled:
|
|
|
164 |
{
|
|
|
165 |
LOG( NORMAL, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler \
|
|
|
166 |
ESimResetCancelled")
|
|
|
167 |
|
|
|
168 |
// Restore the idle mode text and icon.
|
|
|
169 |
// Note no response now, responseOk remains EFalse.
|
|
|
170 |
if ( iSimResetExecuting )
|
|
|
171 |
{
|
|
|
172 |
LOG( NORMAL, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler \
|
|
|
173 |
iSimResetExecuting true")
|
|
|
174 |
iUtils->SystemState().WriteSetIdleModeText(
|
|
|
175 |
iLastValidText, iLastValidIconId, iLastValidIconQualifier );
|
|
|
176 |
// Restore the homezone indicator as SIM reset was cancelled.
|
|
|
177 |
if ( iHasHomezoneIndicator && iLastValidText.Length() )
|
|
|
178 |
{
|
|
|
179 |
TInt errorCode = RProperty::Set(
|
|
|
180 |
KPSUidNetworkInfo,
|
|
|
181 |
KNWHomeZoneStatus,
|
|
|
182 |
ENWHomeZone );
|
|
|
183 |
LOG2( NORMAL, "SETUPIDLEMODETEXT: \
|
|
|
184 |
CSetUpIdleModeTextHandler restore the homezone indicator \
|
|
|
185 |
and return %d", errorCode )
|
|
|
186 |
}
|
|
|
187 |
iSimResetExecuting = EFalse;
|
|
|
188 |
}
|
|
|
189 |
break;
|
|
|
190 |
}
|
|
|
191 |
|
|
|
192 |
default:
|
|
|
193 |
{
|
|
|
194 |
CSatCommandHandler::Event( aEvent );
|
|
|
195 |
break;
|
|
|
196 |
}
|
|
|
197 |
}
|
|
|
198 |
LOG( SIMPLE,
|
|
|
199 |
"SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::Event exiting" )
|
|
|
200 |
}
|
|
|
201 |
|
|
|
202 |
// -----------------------------------------------------------------------------
|
|
|
203 |
// CSetUpIdleModeTextHandler::DoCancel
|
|
|
204 |
// Cancels the sat request.
|
|
|
205 |
// -----------------------------------------------------------------------------
|
|
|
206 |
//
|
|
|
207 |
void CSetUpIdleModeTextHandler::DoCancel()
|
|
|
208 |
{
|
|
|
209 |
LOG( SIMPLE,
|
|
|
210 |
"SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::DoCancel calling" )
|
|
|
211 |
|
|
|
212 |
iUtils->USatAPI().NotifySetUpIdleModeTextCancel();
|
|
|
213 |
|
|
|
214 |
LOG( SIMPLE,
|
|
|
215 |
"SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::DoCancel exiting" )
|
|
|
216 |
}
|
|
|
217 |
|
|
|
218 |
// -----------------------------------------------------------------------------
|
|
|
219 |
// CSetUpIdleModeTextHandler::IssueUSATRequest
|
|
|
220 |
// -----------------------------------------------------------------------------
|
|
|
221 |
//
|
|
|
222 |
void CSetUpIdleModeTextHandler::IssueUSATRequest( TRequestStatus& aStatus )
|
|
|
223 |
{
|
|
|
224 |
LOG( SIMPLE, "SETUPIDLEMODETEXT: \
|
|
|
225 |
CSetUpIdleModeTextHandler::IssueUSATRequest calling" )
|
|
|
226 |
|
|
|
227 |
// Clear the IPC package.
|
|
|
228 |
new (&iSetUpIdleModeTextData) RSat::TSetUpIdleModeTextV1();
|
|
|
229 |
|
|
|
230 |
iUtils->USatAPI().NotifySetUpIdleModeText(
|
|
|
231 |
aStatus, iSetUpIdleModeTextPckg );
|
|
|
232 |
|
|
|
233 |
LOG( SIMPLE, "SETUPIDLEMODETEXT: \
|
|
|
234 |
CSetUpIdleModeTextHandler::IssueUSATRequest exiting" )
|
|
|
235 |
}
|
|
|
236 |
|
|
|
237 |
// -----------------------------------------------------------------------------
|
|
|
238 |
// CSetUpIdleModeTextHandler::CommandAllowed
|
|
|
239 |
// -----------------------------------------------------------------------------
|
|
|
240 |
//
|
|
|
241 |
TBool CSetUpIdleModeTextHandler::CommandAllowed()
|
|
|
242 |
{
|
|
|
243 |
LOG( SIMPLE, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::\
|
|
|
244 |
CommandAllowed calling" )
|
|
|
245 |
TBool commandAllowed( ETrue );
|
|
|
246 |
|
|
|
247 |
if ( ( 0 == iSetUpIdleModeTextData.iText.Length() ) &&
|
|
|
248 |
( RSat::ENotSelfExplanatory ==
|
|
|
249 |
iSetUpIdleModeTextData.iIconId.iQualifier ||
|
|
|
250 |
RSat::ESelfExplanatory ==
|
|
|
251 |
iSetUpIdleModeTextData.iIconId.iQualifier ) )
|
|
|
252 |
{
|
|
|
253 |
iSetUpIdleModeTextRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
|
|
|
254 |
iSetUpIdleModeTextRsp.iInfoType = RSat::KNoAdditionalInfo;
|
|
|
255 |
iSetUpIdleModeTextRsp.iAdditionalInfo.Zero();
|
|
|
256 |
iSetUpIdleModeTextRsp.SetPCmdNumber(
|
|
|
257 |
iSetUpIdleModeTextData.PCmdNumber() );
|
|
|
258 |
TerminalRsp( RSat::ESetUpIdleModeText, iSetUpIdleModeTextRspPckg );
|
|
|
259 |
commandAllowed = EFalse;
|
|
|
260 |
LOG( NORMAL,
|
|
|
261 |
"SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler \
|
|
|
262 |
CommandAllowed icon received without alpha id" )
|
|
|
263 |
}
|
|
|
264 |
|
|
|
265 |
LOG2( SIMPLE, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::\
|
|
|
266 |
CommandAllowed exiting,commandAllowed: %d", commandAllowed )
|
|
|
267 |
return commandAllowed;
|
|
|
268 |
}
|
|
|
269 |
|
|
|
270 |
// -----------------------------------------------------------------------------
|
|
|
271 |
// CSetUpIdleModeTextHandler::NeedUiSession
|
|
|
272 |
// -----------------------------------------------------------------------------
|
|
|
273 |
//
|
|
|
274 |
TBool CSetUpIdleModeTextHandler::NeedUiSession()
|
|
|
275 |
{
|
|
|
276 |
LOG( SIMPLE, "SETUPIDLEMODETEXT: \
|
|
|
277 |
CSetUpIdleModeTextHandler::NeedUiSession calling - exiting" )
|
|
|
278 |
return EFalse; // No need for UI Session.
|
|
|
279 |
}
|
|
|
280 |
|
|
|
281 |
// -----------------------------------------------------------------------------
|
|
|
282 |
// CSetUpIdleModeTextHandler::HandleCommand
|
|
|
283 |
// -----------------------------------------------------------------------------
|
|
|
284 |
//
|
|
|
285 |
void CSetUpIdleModeTextHandler::HandleCommand()
|
|
|
286 |
{
|
|
|
287 |
LOG( SIMPLE,
|
|
|
288 |
"SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::HandleCommand calling" )
|
|
|
289 |
|
|
|
290 |
iUtils->NotifyEvent( MSatUtils::ESetUpIdleModeTextExecuting );
|
|
|
291 |
|
|
|
292 |
// The idle mode text is not written to shared data if
|
|
|
293 |
// Sim indicates the removal of idle mode text.
|
|
|
294 |
TPtrC idleModeText( iSetUpIdleModeTextData.iText );
|
|
|
295 |
TInt iconId( iSetUpIdleModeTextData.iIconId.iIdentifier );
|
|
|
296 |
|
|
|
297 |
// Get the icon description.
|
|
|
298 |
const RSat::TIconQualifier qualifier
|
|
|
299 |
( iSetUpIdleModeTextData.iIconId.iQualifier );
|
|
|
300 |
|
|
|
301 |
if ( RSat::ERemoveExistingIdleModeText == iSetUpIdleModeTextData.iType )
|
|
|
302 |
{
|
|
|
303 |
LOG( SIMPLE,
|
|
|
304 |
"SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::HandleCommand \
|
|
|
305 |
ERemoveExistingIdleModeText" )
|
|
|
306 |
idleModeText.Set( KNullDesC );
|
|
|
307 |
iconId = KErrNotFound;
|
|
|
308 |
}
|
|
|
309 |
else
|
|
|
310 |
{
|
|
|
311 |
if ( ( RSat::ENoIconId == qualifier ) ||
|
|
|
312 |
( RSat::EIconQualifierNotSet == qualifier ) )
|
|
|
313 |
{
|
|
|
314 |
LOG( SIMPLE,
|
|
|
315 |
"SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::HandleCommand \
|
|
|
316 |
KErrNotFound" )
|
|
|
317 |
// Icon information not provided in command.
|
|
|
318 |
iconId = KErrNotFound;
|
|
|
319 |
}
|
|
|
320 |
}
|
|
|
321 |
|
|
|
322 |
// Write text and icon id to P&S.
|
|
|
323 |
const TInt err(
|
|
|
324 |
iUtils->SystemState().WriteSetIdleModeText(
|
|
|
325 |
idleModeText, iconId, qualifier ) );
|
|
|
326 |
|
|
|
327 |
iSetUpIdleModeTextRsp.iInfoType = RSat::KNoAdditionalInfo;
|
|
|
328 |
iSetUpIdleModeTextRsp.iAdditionalInfo.Zero();
|
|
|
329 |
iSetUpIdleModeTextRsp.SetPCmdNumber(
|
|
|
330 |
iSetUpIdleModeTextData.PCmdNumber() );
|
|
|
331 |
|
|
|
332 |
// Send the terminal response now, if there was an error.
|
|
|
333 |
if ( KErrNone != err )
|
|
|
334 |
{
|
|
|
335 |
LOG( NORMAL,
|
|
|
336 |
"SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::HandleCommand \
|
|
|
337 |
Error, Sending Terminal Response" )
|
|
|
338 |
iSetUpIdleModeTextRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
|
|
|
339 |
|
|
|
340 |
// Send the response.
|
|
|
341 |
TerminalRsp( RSat::ESetUpIdleModeText, iSetUpIdleModeTextRspPckg );
|
|
|
342 |
}
|
|
|
343 |
else
|
|
|
344 |
{
|
|
|
345 |
// Save data for restore.
|
|
|
346 |
iSimResetExecuting = EFalse;
|
|
|
347 |
iLastValidText = idleModeText;
|
|
|
348 |
iLastValidIconId = iconId;
|
|
|
349 |
iLastValidIconQualifier = qualifier;
|
|
|
350 |
// Show or remove the homezone indicator.
|
|
|
351 |
if ( iHasHomezoneIndicator )
|
|
|
352 |
{
|
|
|
353 |
if ( iLastValidText.Length() )
|
|
|
354 |
{
|
|
|
355 |
TInt errorCode = RProperty::Set(
|
|
|
356 |
KPSUidNetworkInfo,
|
|
|
357 |
KNWHomeZoneStatus,
|
|
|
358 |
ENWHomeZone );
|
|
|
359 |
LOG2( NORMAL, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler \
|
|
|
360 |
show the homezone indicator and return %d", errorCode )
|
|
|
361 |
}
|
|
|
362 |
else
|
|
|
363 |
{
|
|
|
364 |
TInt errorCode = RProperty::Set(
|
|
|
365 |
KPSUidNetworkInfo,
|
|
|
366 |
KNWHomeZoneStatus,
|
|
|
367 |
ENWNone );
|
|
|
368 |
LOG2( NORMAL, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler \
|
|
|
369 |
remove the homezone indicator and return %d", errorCode )
|
|
|
370 |
}
|
|
|
371 |
}
|
|
|
372 |
|
|
|
373 |
iSetUpIdleModeTextRsp.iGeneralResult = RSat::KSuccess;
|
|
|
374 |
TerminalRsp( RSat::ESetUpIdleModeText, iSetUpIdleModeTextRspPckg );
|
|
|
375 |
}
|
|
|
376 |
|
|
|
377 |
LOG( SIMPLE,
|
|
|
378 |
"SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::HandleCommand exiting" )
|
|
|
379 |
}
|
|
|
380 |
|
|
|
381 |
// -----------------------------------------------------------------------------
|
|
|
382 |
// CSetUpIdleModeTextHandler::UiLaunchFailed
|
|
|
383 |
// -----------------------------------------------------------------------------
|
|
|
384 |
//
|
|
|
385 |
void CSetUpIdleModeTextHandler::UiLaunchFailed()
|
|
|
386 |
{
|
|
|
387 |
LOG( SIMPLE, "SETUPIDLEMODETEXT: \
|
|
|
388 |
CSetUpIdleModeTextHandler::UiLaunchFailed calling - exiting" )
|
|
|
389 |
// We don't need UI. This is derived function from CSatSCommandHandler,
|
|
|
390 |
// so this function must exist, even if it is never called.
|
|
|
391 |
}
|