sl@0: // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test/usb\t_usb_device\src\activestallnotifier.cpp sl@0: // USB Test Program T_USB_DEVICE, functional part. sl@0: // Device-side part, to work against T_USB_HOST running on the host. sl@0: // sl@0: // sl@0: sl@0: #include "general.h" // CActiveControl, CActiveRW sl@0: #include "activestallnotifier.h" sl@0: sl@0: extern RTest test; sl@0: extern TBool gVerbose; sl@0: extern TBool gSkip; sl@0: extern TBool gStopOnFail; sl@0: extern TInt gSoakCount; sl@0: sl@0: // sl@0: // --- class CActiveStallNotifier --------------------------------------------------------- sl@0: // sl@0: sl@0: CActiveStallNotifier::CActiveStallNotifier(CConsoleBase* aConsole, RDEVCLIENT* aPort) sl@0: : CActive(EPriorityNormal), sl@0: iConsole(aConsole), sl@0: iPort(aPort), sl@0: iEndpointState(0) sl@0: { sl@0: CActiveScheduler::Add(this); sl@0: } sl@0: sl@0: CActiveStallNotifier* CActiveStallNotifier::NewL(CConsoleBase* aConsole, RDEVCLIENT* aPort) sl@0: { sl@0: CActiveStallNotifier* self = new (ELeave) CActiveStallNotifier(aConsole, aPort); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(); // self sl@0: return self; sl@0: } sl@0: sl@0: sl@0: void CActiveStallNotifier::ConstructL() sl@0: {} sl@0: sl@0: sl@0: CActiveStallNotifier::~CActiveStallNotifier() sl@0: { sl@0: TUSB_VERBOSE_PRINT("CActiveStallNotifier::~CActiveStallNotifier()"); sl@0: Cancel(); // base class sl@0: } sl@0: sl@0: sl@0: void CActiveStallNotifier::DoCancel() sl@0: { sl@0: TUSB_VERBOSE_PRINT("CActiveStallNotifier::DoCancel()"); sl@0: iPort->EndpointStatusNotifyCancel(); sl@0: } sl@0: sl@0: sl@0: void CActiveStallNotifier::RunL() sl@0: { sl@0: // This just displays the bitmap, showing which endpoints (if any) are now stalled. sl@0: // In a real world program, the user could take here appropriate action (cancel a sl@0: // transfer request or whatever). sl@0: TUSB_VERBOSE_PRINT1("StallNotifier: Endpointstate 0x%x\n", iEndpointState); sl@0: Activate(); sl@0: } sl@0: sl@0: sl@0: void CActiveStallNotifier::Activate() sl@0: { sl@0: __ASSERT_ALWAYS(!IsActive(), User::Panic(KActivePanic, 666)); sl@0: iPort->EndpointStatusNotify(iStatus, iEndpointState); sl@0: SetActive(); sl@0: } sl@0: sl@0: sl@0: sl@0: // -eof-