1 /* |
1 /* |
2 * Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
27 #ifdef RD_LIGHT_CONTROL_CHANGE |
27 #ifdef RD_LIGHT_CONTROL_CHANGE |
28 #include "sysaplightpluginhandler.h" |
28 #include "sysaplightpluginhandler.h" |
29 #endif // RD_LIGHT_CONTROL_CHANGE |
29 #endif // RD_LIGHT_CONTROL_CHANGE |
30 |
30 |
31 #include "SysApFeatureManager.h" |
31 #include "SysApFeatureManager.h" |
|
32 #include "startupdomainpskeys.h" |
32 |
33 |
33 // CONSTANTS |
34 // CONSTANTS |
34 |
35 |
35 const TInt KLightsOffPeriodLockJustActivated ( 5 ); // 5 sec |
36 const TInt KLightsOffPeriodLockJustActivated ( 5 ); // 5 sec |
36 const TInt KMaxLightsOffPeriodForScreenSaverAnimation ( 30 ); // 30 sec |
37 const TInt KMaxLightsOffPeriodForScreenSaverAnimation ( 30 ); // 30 sec |
214 #ifdef RD_LIGHT_CONTROL_CHANGE |
215 #ifdef RD_LIGHT_CONTROL_CHANGE |
215 else |
216 else |
216 { |
217 { |
217 iLightPluginHandler->HandleEventNoAction( SysApLightExtension::EChargerConnection, TPckgBuf<TBool>(aConnected) ); |
218 iLightPluginHandler->HandleEventNoAction( SysApLightExtension::EChargerConnection, TPckgBuf<TBool>(aConnected) ); |
218 } |
219 } |
219 #endif // RD_LIGHT_CONTROL_CHANGE |
220 #endif // RD_LIGHT_CONTROL_CHANGE |
|
221 TInt state( 0 ); |
|
222 TInt error = RProperty::Get( KPSUidStartup, KPSGlobalSystemState, state ); |
|
223 if ( error == KErrNone && state == ESwStateCharging ) |
|
224 { |
|
225 EnableActivityManagerL(); |
|
226 } |
220 } |
227 } |
221 |
228 |
222 // ---------------------------------------------------------------------------- |
229 // ---------------------------------------------------------------------------- |
223 // CSysApLightsController::ChargingCompleteL() |
230 // CSysApLightsController::ChargingCompleteL() |
224 // ---------------------------------------------------------------------------- |
231 // ---------------------------------------------------------------------------- |
967 iLightPluginHandler->HandleCommand( SysApLightExtension::ELightCommandNoAction ); |
974 iLightPluginHandler->HandleCommand( SysApLightExtension::ELightCommandNoAction ); |
968 #endif // RD_LIGHT_CONTROL_CHANGE |
975 #endif // RD_LIGHT_CONTROL_CHANGE |
969 return; |
976 return; |
970 } |
977 } |
971 |
978 |
972 TInt err(KErrNone); |
979 TInt err(KErrNone); |
973 |
980 TInt state( 0 ); |
974 #ifdef RD_LIGHT_CONTROL_CHANGE |
981 TInt error = RProperty::Get( KPSUidStartup, KPSGlobalSystemState, state ); |
975 if ( !iLightPluginHandler->HandleCommand( SysApLightExtension::ELightCommandOff ) ) |
982 |
976 { |
983 if ( error == KErrNone && state != ESwStateCharging ) |
977 TRAP(err, iLight->LightOffL(CHWRMLight::ESystemTarget)); |
984 { |
978 } |
985 #ifdef RD_LIGHT_CONTROL_CHANGE |
|
986 if ( !iLightPluginHandler->HandleCommand( SysApLightExtension::ELightCommandOff ) ) |
|
987 { |
|
988 TRAP(err, iLight->LightOffL(CHWRMLight::ESystemTarget)); |
|
989 } |
979 #else // RD_LIGHT_CONTROL_CHANGE |
990 #else // RD_LIGHT_CONTROL_CHANGE |
980 TRAP(err, iLight->LightOffL(CHWRMLight::ESystemTarget)); |
991 TRAP(err, iLight->LightOffL(CHWRMLight::ESystemTarget)); |
981 #endif // RD_LIGHT_CONTROL_CHANGE |
992 #endif // RD_LIGHT_CONTROL_CHANGE |
|
993 } |
|
994 else |
|
995 { |
|
996 TRAP(err, iLight->LightOffL(CHWRMLight::ESystemTarget)); |
|
997 iSysApAppUi.StopChargingBatteryL(); |
|
998 } |
982 // Ignore unreserved in use warnings. |
999 // Ignore unreserved in use warnings. |
983 if ( err != KErrNone && err != KErrInUse ) |
1000 if ( err != KErrNone && err != KErrInUse ) |
984 { |
1001 { |
985 // Only trace as leaving here accomplishes nothing. |
1002 // Only trace as leaving here accomplishes nothing. |
986 TRACES( RDebug::Print( _L( "CSysApLightsController::SetLightsOffL failed: err: %d" ), err ) ); |
1003 TRACES( RDebug::Print( _L( "CSysApLightsController::SetLightsOffL failed: err: %d" ), err ) ); |
1076 if ( err == KErrNone ) |
1093 if ( err == KErrNone ) |
1077 { |
1094 { |
1078 iLightsCurrentlyOn = ETrue; |
1095 iLightsCurrentlyOn = ETrue; |
1079 iLastLightsOnTime.HomeTime(); |
1096 iLastLightsOnTime.HomeTime(); |
1080 } |
1097 } |
|
1098 |
|
1099 TInt state( 0 ); |
|
1100 TInt error = RProperty::Get( KPSUidStartup, KPSGlobalSystemState, state ); |
|
1101 if ( error == KErrNone && state == ESwStateCharging ) |
|
1102 { |
|
1103 iSysApAppUi.StartChargingBatteryL(); |
|
1104 } |
1081 } |
1105 } |
1082 else |
1106 else |
1083 { |
1107 { |
1084 TRACES( RDebug::Print( _L( "CSysApLightsController::SetLightsOnL - LIGHTS ON denied - Not necessary" ) ) ); |
1108 TRACES( RDebug::Print( _L( "CSysApLightsController::SetLightsOnL - LIGHTS ON denied - Not necessary" ) ) ); |
1085 #ifdef RD_LIGHT_CONTROL_CHANGE |
1109 #ifdef RD_LIGHT_CONTROL_CHANGE |