resourcemgmt/powerandmemorynotificationservice/src/power.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <power.h>
       
    17 #include <e32std.h>
       
    18 #include <hal.h>
       
    19 #include <e32svr.h>
       
    20 
       
    21 
       
    22 /**
       
    23 Bring the machine out of 'silent running' mode
       
    24 Switch on the User IO devices
       
    25 */
       
    26 EXPORT_C void PowerManager::SwitchOn()
       
    27 	{
       
    28 	// We tell if we are silent running by checking the screen state
       
    29 	TInt on=0;
       
    30 	TInt r=HAL::Get(HAL::EDisplayState, on);
       
    31 	r=r;
       
    32 	__ASSERT_DEBUG(r==KErrNone, User::Panic(_L("PWRCLI"), EPowerManagerCantGetDisplayState));
       
    33 	if (!on)
       
    34 		{
       
    35 		// This lets E32 know that user switch on has occured
       
    36 		// It goes to kernel PowerModel first, then WSERV,
       
    37 		// to turn on the screen, and finally to LafPowerMon
       
    38 		TRawEvent switchon;
       
    39 		switchon.Set(TRawEvent::ESwitchOn);
       
    40 		UserSvr::AddEvent(switchon);
       
    41 		}
       
    42 	}