os/kernelhwsrv/kerneltest/e32test/power/t_power_slave.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2002-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 the License "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 // e32test\power\t_power_slave.cpp
    15 // 
    16 //
    17 
    18 #include <e32power.h>
    19 #include <e32test.h>
    20 
    21 GLDEF_C TInt E32Main()
    22 	{
    23 	// Get arguments from the command line
    24 	TInt len = User::CommandLineLength();
    25 	TInt size = len * sizeof(TUint16);
    26 	__ASSERT_ALWAYS(size == sizeof(TInt),User::Invariant());
    27 	TInt arg;
    28 	TPtr cmd((TUint16*) &arg, len);
    29 	User::CommandLine(cmd);
    30 
    31 	TBool jit = User::JustInTime();
    32 	User::SetJustInTime(EFalse);
    33 
    34 	TRequestStatus status;
    35 	switch(arg)
    36 		{
    37 	case 0: 
    38 		Power::PowerDown();
    39 		break;
    40 	case 1:
    41 		Power::EnableWakeupEvents(EPwStandby);
    42 		break;
    43 	case 2:
    44 		Power::DisableWakeupEvents();	
    45 		break;
    46 	case 3:
    47 		Power::RequestWakeupEventNotification(status);
    48 		break;
    49 	case 4:
    50 		Power::CancelWakeupEventNotification();
    51 		break;
    52 	default:
    53 		break;
    54 		}
    55 
    56 	User::SetJustInTime(jit);
    57 	return KErrNone;
    58 	}