1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
335 // Session is not closed before returning as this owns the handle |
335 // Session is not closed before returning as this owns the handle |
336 } |
336 } |
337 |
337 |
338 EXPORT_C TInt RStarterSession::ResetNetwork() |
338 EXPORT_C TInt RStarterSession::ResetNetwork() |
339 { |
339 { |
|
340 TInt requestResult; |
340 RSsmStateManager session; |
341 RSsmStateManager session; |
341 // Set session to use the handle stored in this |
342 // Set session to use the handle stored in this |
342 session.SetHandle(Handle()); |
343 session.SetHandle(Handle()); |
343 |
344 |
344 // Make request and return success. |
345 //Perform state transition instead of SwP transition if KSsmGracefulOffline is enabled |
345 TUint rfStatusPropertyKey = CSsmUiSpecific::RFStatusPropertyKey(); |
346 if (IsSsmGracefulOffline()) |
346 TSsmSwp swpRFStatus(rfStatusPropertyKey, ESsmRfOff); |
347 { |
347 |
348 DEBUGPRINT1A( "KSsmGracefulOffline is enabled perform state transition" ); |
348 RSsmSystemWideProperty swp; |
349 TSsmStateTransition stateinfo(ESsmNormal, ESsmNormalRfOffSubState, KSsmCLayerNullReason); |
349 swp.Connect(rfStatusPropertyKey); |
350 // Make request for substate transition to offline |
350 |
351 requestResult = session.RequestStateTransition(stateinfo); |
351 TRequestStatus status; |
352 DEBUGPRINT2A( "State transition to ESsmNormalRfOffSubState returned : %d", requestResult); |
352 //Subscribe for SwP changes |
353 if (KErrNone == requestResult) |
353 swp.Subscribe(status); |
354 { |
354 |
355 TSsmStateTransition stateinfo(ESsmNormal, ESsmNormalRfOnSubState, KSsmCLayerNullReason); |
355 TInt requestResult= session.RequestSwpChange(swpRFStatus); |
356 // Make request for substate transition to online |
356 if(KErrNone == requestResult) |
357 requestResult = session.RequestStateTransition(stateinfo); |
357 { |
358 DEBUGPRINT2A( "State transition to ESsmNormalRfOnSubState returned : %d", requestResult); |
358 // Wait for SwP Change |
359 } |
359 User::WaitForRequest(status); |
360 } |
360 swpRFStatus.Set(rfStatusPropertyKey, ESsmRfOn); |
361 else |
|
362 { |
|
363 // Make request and return success. |
|
364 TUint rfStatusPropertyKey = CSsmUiSpecific::RFStatusPropertyKey(); |
|
365 TSsmSwp swpRFStatus(rfStatusPropertyKey, ESsmRfOff); |
|
366 |
|
367 RSsmSystemWideProperty swp; |
|
368 swp.Connect(rfStatusPropertyKey); |
|
369 |
|
370 TRequestStatus status; |
|
371 //Subscribe for SwP changes |
|
372 swp.Subscribe(status); |
|
373 |
361 requestResult = session.RequestSwpChange(swpRFStatus); |
374 requestResult = session.RequestSwpChange(swpRFStatus); |
362 } |
375 DEBUGPRINT2A( "RF SwP transition to ESsmRfOff returned : %d", requestResult); |
363 swp.Close(); |
376 if (KErrNone == requestResult) |
|
377 { |
|
378 // Wait for SwP Change |
|
379 User::WaitForRequest(status); |
|
380 swpRFStatus.Set(rfStatusPropertyKey, ESsmRfOn); |
|
381 requestResult = session.RequestSwpChange(swpRFStatus); |
|
382 DEBUGPRINT2A( "RF SwP transition to ESsmRfOn returned : %d", requestResult); |
|
383 } |
|
384 swp.Close(); |
|
385 } |
364 // Session is not closed before returning as this owns the handle |
386 // Session is not closed before returning as this owns the handle |
|
387 DEBUGPRINT2A( "ResetNetwork() is returning requestResult as: %d", requestResult); |
365 return requestResult; |
388 return requestResult; |
366 } |
389 } |
367 |
390 |
368 EXPORT_C TBool RStarterSession::IsRTCTimeValid() |
391 EXPORT_C TBool RStarterSession::IsRTCTimeValid() |
369 { |
392 { |