os/kernelhwsrv/kerneltest/e32test/power/t_power_slave.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/power/t_power_slave.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,58 @@
     1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32test\power\t_power_slave.cpp
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#include <e32power.h>
    1.22 +#include <e32test.h>
    1.23 +
    1.24 +GLDEF_C TInt E32Main()
    1.25 +	{
    1.26 +	// Get arguments from the command line
    1.27 +	TInt len = User::CommandLineLength();
    1.28 +	TInt size = len * sizeof(TUint16);
    1.29 +	__ASSERT_ALWAYS(size == sizeof(TInt),User::Invariant());
    1.30 +	TInt arg;
    1.31 +	TPtr cmd((TUint16*) &arg, len);
    1.32 +	User::CommandLine(cmd);
    1.33 +
    1.34 +	TBool jit = User::JustInTime();
    1.35 +	User::SetJustInTime(EFalse);
    1.36 +
    1.37 +	TRequestStatus status;
    1.38 +	switch(arg)
    1.39 +		{
    1.40 +	case 0: 
    1.41 +		Power::PowerDown();
    1.42 +		break;
    1.43 +	case 1:
    1.44 +		Power::EnableWakeupEvents(EPwStandby);
    1.45 +		break;
    1.46 +	case 2:
    1.47 +		Power::DisableWakeupEvents();	
    1.48 +		break;
    1.49 +	case 3:
    1.50 +		Power::RequestWakeupEventNotification(status);
    1.51 +		break;
    1.52 +	case 4:
    1.53 +		Power::CancelWakeupEventNotification();
    1.54 +		break;
    1.55 +	default:
    1.56 +		break;
    1.57 +		}
    1.58 +
    1.59 +	User::SetJustInTime(jit);
    1.60 +	return KErrNone;
    1.61 +	}