kerneltest/e32test/power/t_power_slave.cpp
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     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 	}