# HG changeset patch # User Tom Pritchard # Date 1257762661 0 # Node ID 1972d8c2e3298ce162f9cdaa219c4f3dd4a644e3 # Parent a0210f210a3b9df7e032face685e833464e70d41 Tidying up initial files diff -r a0210f210a3b -r 1972d8c2e329 adaptationlayer/devicemodecontroller/internal/boot_reason_api_dummy/group/bld.inf --- a/adaptationlayer/devicemodecontroller/internal/boot_reason_api_dummy/group/bld.inf Sat Nov 07 22:37:59 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Used to implement boot reason api dummy implementation. -* -*/ - - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -../rom/boot_reason_api_dummy.iby NON_FOUNDATION_CORE_ADAPT_LAYER_IBY_EXPORT_PATH(boot_reason_api_dummy.iby) - -PRJ_MMPFILES -boot_reason_api_dummy.mmp - -// End of File diff -r a0210f210a3b -r 1972d8c2e329 adaptationlayer/devicemodecontroller/internal/boot_reason_api_dummy/group/boot_reason_api_dummy.mmp --- a/adaptationlayer/devicemodecontroller/internal/boot_reason_api_dummy/group/boot_reason_api_dummy.mmp Sat Nov 07 22:37:59 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This file provides the information required for building -* Boot Reason API dummy implemantion. This implementation -* will be replaced by the vendor implementation. -* -*/ - - - - -// Remove library warning -#define NO_EKERN_LIB -#include "kernel/kern_ext.mmh" -#include -#include -#include <../../../boot_reason_plat/group/boot_reason_api.mmh> -#include "../../../config/dmc.cfg" - -TARGET boot_reason_api.dll -TARGETTYPE kext - -OS_LAYER_SYSTEMINCLUDE - -USERINCLUDE ../../../boot_reason_plat/inc -USERINCLUDE ../../../dmc_ext/inc - -SOURCEPATH ../src -SOURCE boot_reason_api_dummy.cpp - -LIBRARY ekern.lib - -// End of File diff -r a0210f210a3b -r 1972d8c2e329 adaptationlayer/devicemodecontroller/internal/boot_reason_api_dummy/rom/boot_reason_api_dummy.iby --- a/adaptationlayer/devicemodecontroller/internal/boot_reason_api_dummy/rom/boot_reason_api_dummy.iby Sat Nov 07 22:37:59 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Boot Reason Dummy iby-file. -* -*/ - - -#ifndef BOOT_REASON_API_DUMMY_IBY -#define BOOT_REASON_API_DUMMY_IBY - -extension[VARID]=KERNEL_DIR\BUILD_DIR\boot_reason_api.dll \sys\bin\boot_reason_api.dll - -#endif // BOOT_REASON_API_DUMMY_IBY - -// End of File diff -r a0210f210a3b -r 1972d8c2e329 adaptationlayer/devicemodecontroller/internal/boot_reason_api_dummy/src/boot_reason_api_dummy.cpp --- a/adaptationlayer/devicemodecontroller/internal/boot_reason_api_dummy/src/boot_reason_api_dummy.cpp Sat Nov 07 22:37:59 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Implementation of Boot Reason API dummy. -* -*/ - - -// INCLUDES -#include -#include // Kern::Printf -#include "boot_reason_api.h" - -// MACROS -#ifdef _DEBUG - #define DUMMY_TRACE(a) Kern::Printf a - -#else // _DEBUG - - #define DUMMY_TRACE(a) -#endif // _DEBUG - - -class TBootReasonDummy - { - public: - TBootReasonDummy(); - }; - -DECLARE_STANDARD_EXTENSION() - { - Kern::Printf("DMC:DUMMY_BOOT: DECLARE_STANDARD_EXTENSION()"); - - - TBootReasonDummy* bootReasonAptPtr = new TBootReasonDummy; - - Kern::Printf("DMC:KERN_EXTEN: DECLARE_STANDARD_EXTENSION() - bootReasonAptPtr: 0x%x ", - bootReasonAptPtr); - - return KErrNone; - } - - -TBootReasonDummy::TBootReasonDummy() - { - DUMMY_TRACE(("DMC:DUMMY_BOOT: TBootReasonDummy() # IN")); - - DUMMY_TRACE(("DMC:DUMMY_BOOT: TBootReasonDummy() # OUT")); - } - -/** -* Boot Reason API dummy imlementations -*/ -EXPORT_C void TBootReason::GetStartupMode(TStartupMode& aStartupMode) - { - DUMMY_TRACE(("DMC:DUMMY_BOOT: GetStartupMode() # IN")); - - aStartupMode = TBootReason::EStartupModeCharging; - - DUMMY_TRACE((("DMC:DUMMY_BOOT: GetStartupMode() - aStartupMode: %d"), - aStartupMode)); - - DUMMY_TRACE(("DMC:DUMMY_BOOT: GetStartupMode() # OUT")); - } - - -EXPORT_C void TBootReason::SetTargetStartupMode(TStartupMode aTargetStartupMode) - { - DUMMY_TRACE((("DMC:DUMMY_BOOT: SetTargetStartupMode() # IN - aTargetStartupMode: %d"), - aTargetStartupMode)); - - DUMMY_TRACE(("DMC:DUMMY_BOOT: SetTargetStartupMode() # OUT")); - } - - -EXPORT_C void TBootReason::GetTargetStartupMode(TStartupMode& aStartupMode) - { - DUMMY_TRACE(("DMC:DUMMY_BOOT: GetTargetStartupMode() # IN")); - - aStartupMode = TBootReason::EStartupModeAlarm; - - DUMMY_TRACE((("DMC:DUMMY_BOOT: SetTargetStartupMode() # OUT - aStartupMode: %d"), - aStartupMode)); - } - - -EXPORT_C TBool TBootReason::IsHiddenReset() - { - DUMMY_TRACE(("DMC:DUMMY_BOOT: IsHiddenReset() # IN")); - - DUMMY_TRACE((("DMC:DUMMY_BOOT: IsHiddenReset() # OUT - IsHidden: %d"), - ETrue)); - - return ETrue; - } - - -EXPORT_C void TBootReason::SetSleepTest(TUint16 aTimeout) - { - DUMMY_TRACE((("DMC:DUMMY_BOOT: SetSleepTest() # IN - aTimeout: %d"), - aTimeout)); - - DUMMY_TRACE(("DMC:DUMMY_BOOT: # OUT")); - } - -// End of File diff -r a0210f210a3b -r 1972d8c2e329 adaptationlayer/devicemodecontroller/internal/dmc_tester/group/bld.inf --- a/adaptationlayer/devicemodecontroller/internal/dmc_tester/group/bld.inf Sat Nov 07 22:37:59 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* dmc_test application -* -*/ - - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -dmc_autoexec.bat NON_FOUNDATION_CORE_ADAPT_LAYER_IBY_EXPORT_PATH(dmc_autoexec.bat) -dmc_tester.iby NON_FOUNDATION_CORE_ADAPT_LAYER_IBY_EXPORT_PATH(dmc_tester.iby) - -PRJ_MMPFILES -./dmc_tester.mmp - -PRJ_TESTMMPFILES - -// End of File diff -r a0210f210a3b -r 1972d8c2e329 adaptationlayer/devicemodecontroller/internal/dmc_tester/group/dmc_autoexec.bat --- a/adaptationlayer/devicemodecontroller/internal/dmc_tester/group/dmc_autoexec.bat Sat Nov 07 22:37:59 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -@rem -@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of the License "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - -z: -dmc_tester.exe diff -r a0210f210a3b -r 1972d8c2e329 adaptationlayer/devicemodecontroller/internal/dmc_tester/group/dmc_tester.iby --- a/adaptationlayer/devicemodecontroller/internal/dmc_tester/group/dmc_tester.iby Sat Nov 07 22:37:59 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* dmc tester iby-file. -* -*/ - - - -#ifndef DMC_TESTER_IBY -#define DMC_TESTER_IBY - -data=ABI_DIR\BUILD_DIR\dmc_autoexec.bat autoexec.bat -file=ABI_DIR\BUILD_DIR\dmc_tester.exe dmc_tester.exe - -#endif // DMC_TESTER_IBY - -// End of File diff -r a0210f210a3b -r 1972d8c2e329 adaptationlayer/devicemodecontroller/internal/dmc_tester/group/dmc_tester.mmp --- a/adaptationlayer/devicemodecontroller/internal/dmc_tester/group/dmc_tester.mmp Sat Nov 07 22:37:59 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This file provides the information required for building -* DMC (Device Mode Controller) tester. -* -*/ - - -#include -#include - -TARGET dmc_tester.exe -TARGETTYPE exe -UID 0 -VENDORID VID_DEFAULT - -CAPABILITY ALL - -SOURCEPATH ../src -SOURCE dmc_tester.cpp - -OS_LAYER_SYSTEMINCLUDE -NON_FOUNDATION_ADAPT_LAYER_SYSTEMINCLUDE -USERINCLUDE ../../../dmc_ext/inc - -LIBRARY euser.lib -LIBRARY flogger.lib - -// End of File diff -r a0210f210a3b -r 1972d8c2e329 adaptationlayer/devicemodecontroller/internal/dmc_tester/src/dmc_tester.cpp --- a/adaptationlayer/devicemodecontroller/internal/dmc_tester/src/dmc_tester.cpp Sat Nov 07 22:37:59 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,678 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Implementation of DMC tester. -* -*/ - - -// INCLUDES -#include // CActive -#include -#include -#include // RDebug -#include // RFileLogger -#include // RTest - -#include "dmc_user_if.h" - -// CONSTANTS -_LIT(KDmcTesterName, "dmc_tester"); - -TInt OpenDmc(RDmc& aDmc); -/** - * Class for receiving events. - */ -class CDmcTstEventHandler : public CActive - { - public: - static CDmcTstEventHandler* NewL(RDmc& aDmc); - /** - * C++ default constructor. - */ - CDmcTstEventHandler(RDmc& aDmc); - - /** - * Destructor. - */ - virtual ~CDmcTstEventHandler(); - - private: // From CActive - - void RunL(); - void DoCancel(); - - private: // Data - RDmc iDmc; - RDmc::TEvent iEvent; - }; - -/** - * Small helper class that hides the interface specific - * operations and makes the test sequence more readable. - */ -class DmcTester : public CActive - { - public: - static DmcTester* NewL(RDmc& aDmc); - /** - * C++ default constructor. - */ - DmcTester(RDmc& aDmc); - - /** - * Destructor. - */ - virtual ~DmcTester(); - RDmc& Initialize(); - void GetTargetStartUpMode(); - void PowerOff(); - void GenerateReset(); - void GetHiddenResetStatus(); - void AskNextMode(); - - private: // From CActive - void RunL(); - void DoCancel(); - - private: // Data - RDmc iDmc; // Dmc logical device driver - RTest iTest; // test app - CConsoleBase* iConsolePtr; - }; - - -/** - * Execute tests. - */ -void ExecuteDmcTestsL() - { - RDebug::Printf("DMC:TST_TESTER: ExecuteDmcTestsL() # IN"); - - // Create the active scheduler - RDebug::Printf("DMC:TST_TESTER: Initialize() - Create activeSchedulerPtr"); - CActiveScheduler* activeSchedulerPtr = new (ELeave) CActiveScheduler; - CleanupStack::PushL(activeSchedulerPtr); - - RDebug::Printf("DMC:TST_TESTER: Initialize() - Install activeSchedulerPtr"); - CActiveScheduler::Install(activeSchedulerPtr); - - /* Client 1 */ - RDmc dmc1; - - RDebug::Printf("DMC:TST_TESTER: ExecuteDmcTestsL() - DmcTester::CDmcTstEventHandler::NewL()"); - DmcTester* dmcTesterPtr = DmcTester::NewL(dmc1); - CleanupStack::PushL(dmcTesterPtr); - -#if 0 - /* Client 2 for events*/ - RDmc dmc2; - - RDebug::Printf("DMC:TST_TESTER: Initialize() - Client 2, CDmcTstEventHandler::NewL()"); - CDmcTstEventHandler* eventHandlerPtr = CDmcTstEventHandler::NewL(dmc2); - CleanupStack::PushL(eventHandlerPtr); - - /* Client 3 for events*/ - RDmc dmc3; - - RDebug::Printf("DMC:TST_TESTER: Initialize() - Client 3, CDmcTstEventHandler::NewL()"); - CDmcTstEventHandler* eventHandlerPtr2 = CDmcTstEventHandler::NewL(dmc3); - CleanupStack::PushL(eventHandlerPtr2); -#endif // 0 - - RDebug::Printf("DMC:TST_TESTER: Initialize() - CActiveScheduler::Start()"); - CActiveScheduler::Start(); - - RDebug::Printf("DMC:TST_TESTER: Initialize() - CleanupStack::PopAndDestroy()"); - CleanupStack::PopAndDestroy(2, activeSchedulerPtr); - - RDebug::Printf("DMC:TST_TESTER: ExecuteDmcTestsL() # OUT"); - } - - -/** - * Open RDmc channel - */ -TInt OpenDmc(RDmc& aDmc) - { - RDebug::Printf("DMC:TST_TESTER: OpenDmc() # IN"); - - TInt err(KErrNone); - - err = aDmc.Open(); - - if (err != KErrNone) - { - RDebug::Printf("DMC:TST_TESTER: OpenDmc() - DMC opening Not OK"); - aDmc.Close(); - } - else - { - RDebug::Printf("DMC:TST_TESTER: OpenDmc() - DMC opening OK"); - } - - RDebug::Printf("DMC:TST_TESTER: OpenDmc() # OUT"); - - return err; - } - - -/****************************************************** - * - * Implementation of DmcTester. - * - * - ******************************************************/ - - -/** - * Constuctor - */ -DmcTester::DmcTester(RDmc& aDmc) - : CActive(CActive::EPriorityStandard) - , iDmc(aDmc) - , iTest(KDmcTesterName) - { - RDebug::Printf("DMC:TST_TESTER: DmcTester::DmcTester() # IN"); - iTest.Printf(_L("* DMC_TESTER *\n")); - - RDebug::Printf("DMC:TST_TESTER: DmcTester() - Add()"); - CActiveScheduler::Add(this); - - //RDebug::Printf("DMC:TST_TESTER: DmcTester() - iConsolePtr: 0x%x", iConsolePtr); - //CConsoleBase* iConsolePtr = iTest.Console(); - - TRequestStatus* statusPtr = &iStatus; - - RDebug::Printf("DMC:TST_TESTER: DmcTester() - *statusPtr: 0x%x", statusPtr); - RDebug::Printf("DMC:TST_TESTER: DmcTester() - User::RequestComplete, KErrNone"); - User::RequestComplete(statusPtr, KErrNone); - - if (!IsActive()) - { - RDebug::Printf("DMC:TST_TESTER: DmcTester() - SetActive()"); - SetActive(); - } - else - { - RDebug::Printf("DMC:TST_TESTER: DmcTester() - !IsActive() -> else"); - } - - RDebug::Printf("DMC:TST_TESTER: DmcTester::DmcTester() # OUT"); - } - - -/** - * Constructor - */ -DmcTester* DmcTester::NewL(RDmc& aDmc) - { - RDebug::Printf("DMC:TST_TESTER: NewL() # IN"); - - RDebug::Printf("DMC:TST_TESTER: NewL() - OpenDmc"); - (void)OpenDmc(aDmc); - - DmcTester* self = new (ELeave)DmcTester(aDmc); - - RDebug::Printf("DMC:TST_TESTER: NewL() # OUT"); - - return self; - } - - -/** - * Closes and releases DMC - */ -DmcTester::~DmcTester() - { - RDebug::Printf("DMC:TST_TESTER: ~DmcTester() # IN"); - - RDebug::Printf("DMC:TST_TESTER: ~DmcTester() - Close()"); - iDmc.Close(); - - RDebug::Printf("DMC:TST_TESTER: ~DmcTester # OUT"); - } - - -/** - * Ask the target startup mode - */ -void DmcTester::GetTargetStartUpMode() - { - RDebug::Printf("DMC:TST_TESTER: GetTargetStartUpMode() # IN"); - - RDmc::TTargetStartupMode dmcTargetMode(RDmc::EStartupModeNone); - - RDebug::Printf("DMC:TST_TESTER: GetTargetStartUpMode() - Asking DMC target startup mode"); - - TInt err = iDmc.GetStartUpMode(dmcTargetMode); - - if (err == KErrNone) - { - switch(dmcTargetMode) - { - case RDmc::EStartupModeNone: - { - iTest.Printf(_L("RDmc::EStartupModeNone\n")); - } - break; - - case RDmc::EStartupModeNormal: - { - iTest.Printf(_L("RDmc::EStartupModeNormal\n")); - } - break; - - case RDmc::EStartupModeCharging: - { - iTest.Printf(_L("RDmc::EStartupModeCharging\n")); - } - break; - - case RDmc::EStartupModeAlarm: - { - iTest.Printf(_L("RDmc::EStartupModeAlarm\n")); - } - break; - - case RDmc::EStartupModeTest: - { - iTest.Printf(_L("RDmc::EStartupModeTest\n")); - } - break; - - case RDmc::EStartupModeFota: - { - iTest.Printf(_L("RDmc::EStartupModeFota\n")); - } - break; - - default: - iTest.Printf(_L("Unknown starup mode\n")); - err = KErrGeneral; - break; - } - } - - if (err) - { - iTest.Printf(_L("Asking target startup mode return error: %d\n"), err); - User::Panic(KDmcTesterName, err); - } - - RDebug::Printf("DMC:TST_TESTER: GetTargetStartUpMode() # OUT"); - } - - -/** - * Power OFF the device - */ - -void DmcTester::PowerOff() - { - RDebug::Printf("DMC:TST_TESTER: PowerOff() # IN"); - - TInt err = iDmc.PowerOff(); - RDebug::Printf("DMC:TST_TESTER: PowerOff() - err: %d", err); - - err = UserHal::SwitchOff(); - RDebug::Printf("DMC:TST_TESTER: PowerOff() - UserHal::SwitchOff: %d", err); - - RDebug::Printf("DMC:TST_TESTER: PowerOff() # OUT"); - } - - -/** - * Generate reset - */ - -void DmcTester::GenerateReset() - { - RDebug::Printf("DMC:TST_TESTER: GenerateReset() # IN"); - - // Generate reset - RDebug::Printf("DMC:TST_TESTER: GenerateReset() - RDmc::EStartupModeTest"); - - RDmc::TTargetStartupMode dmcTargetMode(RDmc::EStartupModeTest); - - TInt err = iDmc.GenerateReset(dmcTargetMode); - RDebug::Printf("DMC:TST_TESTER: GenerateReset() - err: %d", err); - - err = UserHal::SwitchOff(); - RDebug::Printf("DMC:TST_TESTER: GenerateReset() - UserHal::SwitchOff: %d", err); - - RDebug::Printf("DMC:TST_TESTER: GenerateReset() # OUT"); - } - - - -/** - * Get Hidden Reset Status - */ - -void DmcTester::GetHiddenResetStatus() - { - RDebug::Printf("DMC:TST_TESTER: GetHiddenResetStatus() # IN"); - - TBool hidden(EFalse); - - TInt err = iDmc.IsHiddenReset(hidden); - - RDebug::Printf("DMC:TST_TESTER: GetHiddenResetStatus() - err: %d, hidden: %d", - err, hidden); - - RDebug::Printf("DMC:TST_TESTER: GetHiddenResetStatus() # OUT"); - } - - -/** - * Asks next boot mode from user - */ -void DmcTester::AskNextMode() - { - RDebug::Printf("DMC:TST_TESTER: AskNextMode() # IN"); - - iTest.Printf(_L("\nGive test case number.")); - iTest.Printf(_L("\n%d: Get Start-up Mode"), 1); - iTest.Printf(_L("\n%d: Power OFF"), 2); - iTest.Printf(_L("\n%d: Generate Reset"), 3); - iTest.Printf(_L("\n%d: Get Hidden Reset Status"), 4); - iTest.Printf(_L("\n%d: Quit"), 0); - - TUint menu_choice = (TUint)iTest.Getch(); - - // ascii to decimal translation: - if (menu_choice >= 0x30) - { - menu_choice -= 0x30; - } - - switch (menu_choice) - { - case 1: - { - iTest.Printf(_L("Get Start-up Mode\n\n")); - GetTargetStartUpMode(); - } - break; - - case 2: - { - iTest.Printf(_L("Power OFF\n\n")); - PowerOff(); - } - break; - - case 3: - { - iTest.Printf(_L("Generate Reset\n\n")); - GenerateReset(); - } - break; - - case 4: - { - iTest.Printf(_L("Get Hidden Reset Status\n\n")); - GetHiddenResetStatus(); - } - break; - - case 0: - { - iTest.Printf(_L("Quit\n\n")); - } - break; - - default: - { - iTest.Printf(_L("Pressed 0x%02x (not supported)\n\n"), menu_choice); - } - break; - } - - TRequestStatus* statusPtr = &iStatus; - - if (menu_choice == 0) - { - RDebug::Printf("DMC:TST_TESTER: AskNextMode(), Test finished"); - RDebug::Printf("DMC:TST_TESTER: AskNextMode() - User::RequestComplete(), KErrGeneral"); - User::RequestComplete(statusPtr, KErrGeneral); - } - else - { - RDebug::Printf("DMC:TST_TESTER: AskNextMode() - User::RequestComplete(), KErrNone"); - User::RequestComplete(statusPtr, KErrNone); - } - - RDebug::Printf("DMC:TST_TESTER: AskNextMode() # OUT"); - } - - -/** - * RunL() - */ -void DmcTester::RunL() - { - RDebug::Printf("DMC:TST_TESTER: RunL() # IN"); - - RDebug::Printf("DMC:TST_TESTER: RunL() - iStatus.Int(): %d", - iStatus.Int()); - RDebug::Printf("DMC:TST_TESTER: RunL() - &iStatus: 0x%x", &iStatus); - - switch (iStatus.Int()) - { - case KErrNone: - { - RDebug::Printf("DMC:TST_TESTER: RunL() - KErrNone"); - // Show menu and ask a next test step - AskNextMode(); - //TKeyCode keyCode = iConsolePtr->KeyCode(); - //RDebug::Printf("DMC:TST_TESTER: RunL() - keyCode: 0x%x", keyCode); - - //TText8 ch = (TText8)keyCode & 0xFF; - //TText8 ch = iConsolePtr->Getch(); - //RDebug::Printf("DMC:TST_TESTER: RunL() - ch: 0x%x", ch); - - // Continue receiving events - RDebug::Printf("DMC:TST_TESTER: RunL() - SetActive()"); - SetActive(); - } - break; - - case KErrGeneral: - { - RDebug::Printf("DMC:TST_TESTER: RunL - CActiveScheduler::Stop()"); - CActiveScheduler::Stop(); - } - break; - - default: - { - RDebug::Printf("DMC:TST_TESTER: RunL - default"); - } - break; - } - - RDebug::Printf("DMC:TST_TESTER: RunL # OUT"); - } - - -/** - * DoCancel() - */ -void DmcTester::DoCancel() - { - RDebug::Printf("DMC:TST_TESTER: DoCancel() - # IN"); - - RDebug::Printf("DMC:TST_TESTER: DoCancel() - # OUT"); - } - -/****************************************************** - * - * Implementation of CDmcTstEventHandler. - * Handles DMC events. - * - ******************************************************/ - - -/** - * Default constructor - */ -CDmcTstEventHandler::CDmcTstEventHandler(RDmc& aDmc) - : CActive(CActive::EPriorityStandard) - , iDmc(aDmc) - { - RDebug::Printf("DMC:TST_EVHAND: CDmcTstEventHandler() # IN"); - - RDebug::Printf("DMC:TST_EVHAND: CDmcTstEventHandler() - Add()"); - CActiveScheduler::Add(this); - - // Subscribe events - RDebug::Printf("DMC:TST_EVHAND: CDmcTstEventHandler - ReceiveEvents(), iStatus: 0x%x", &iStatus); - iDmc.ReceiveEvents(iStatus, iEvent); - - if (!IsActive()) - { - RDebug::Printf("DMC:TST_EVHAND: CDmcTstEventHandler() - SetActive()"); - SetActive(); - } - else - { - RDebug::Printf("DMC:TST_EVHAND: CDmcTstEventHandler() - !IsActive() -> else"); - } - - RDebug::Printf("DMC:TST_EVHAND: CDmcTstEventHandler() # OUT"); - } - - -/** - * Constructor - */ -CDmcTstEventHandler* CDmcTstEventHandler::NewL(RDmc& aDmc) - { - RDebug::Printf("DMC:TST_EVHAND: NewL() # IN"); - - RDebug::Printf("DMC:TST_EVHAND: NewL() - OpenDmc"); - (void)OpenDmc(aDmc); - - CDmcTstEventHandler* self = new (ELeave)CDmcTstEventHandler(aDmc); - - RDebug::Printf("DMC:TST_EVHAND: NewL() # OUT"); - - return self; - } - - -/** - * Destructor - */ -CDmcTstEventHandler::~CDmcTstEventHandler() - { - RDebug::Printf("DMC:TST_EVHAND: ~CDmcTstEventHandler() # IN"); - - RDebug::Printf("DMC:TST_EVHAND: RunL - CActiveScheduler::Cancel()"); - Cancel(); - - RDebug::Printf("DMC:TST_EVHAND: ~CDmcTstEventHandler() # OUT"); - } - - -/** - * RunL() - */ -void CDmcTstEventHandler::RunL() - { - RDebug::Printf("DMC:TST_EVHAND: RunL() # IN"); - - RDebug::Printf("DMC:TST_EVHAND: RunL() - iStatus.Int(): %d, iEvent: %d", - iStatus.Int(), iEvent); - RDebug::Printf("DMC:TST_EVHAND: CDmcTstEventHandler() - &iStatus: 0x%x", &iStatus); - - switch (iStatus.Int()) - { - case KErrNone: - { - if (iEvent == RDmc::EResetEvent) - { - RDebug::Printf("DMC:TST_EVHAND: RunL() - RDmc::EResetEvent"); - } - - if (iEvent == RDmc::EPowerOffEvent) - { - RDebug::Printf("DMC:TST_EVHAND: RunL() - RDmc::EPowerOffEvent"); - } - - RDebug::Printf("DMC:TST_EVHAND: RunL() - UserHal::SwitchOff()"); - - // Make switch off both in case of reset and power off - TInt err = UserHal::SwitchOff(); - } - break; - - default: - { - RDebug::Printf("DMC:TST_EVHAND: RunL - default"); - } - break; - } - -#if 0 - TRequestStatus& status = iStatus; - TRequestStatus* statusPtr = &status; - User::RequestComplete(statusPtr, KErrNone); -#endif // 0 - - // Continue receiving events - RDebug::Printf("DMC:TST_EVHAND: RunL - SetActive()"); - SetActive(); - - RDebug::Printf("DMC:TST_EVHAND: RunL # OUT"); - } - - -/** - * DoCancel() - */ -void CDmcTstEventHandler::DoCancel() - { - RDebug::Printf("DMC:TST_EVHAND: DoCancel() - # IN"); - - RDebug::Printf("DMC:TST_EVHAND: DoCancel() - # OUT"); - } - - - -/** - * The main entrypoint for application - */ -GLDEF_C TInt E32Main() - { - RDebug::Printf("DMC:TST_TESTER: E32Main\n"); - - __UHEAP_MARK; - - // get clean-up stack - CTrapCleanup* cleanupPtr = CTrapCleanup::New(); - - // start scheduler - TRAPD(error, ExecuteDmcTestsL()); - - // destroy a clean-up stack - delete cleanupPtr; - __UHEAP_MARKEND; - - return error; - } - -// End of File