diff -r 25fce757be94 -r e02eb84a14d2 usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/src/USBObexApiTestActiveObject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/src/USBObexApiTestActiveObject.cpp Wed Sep 01 12:20:49 2010 +0100 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "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: +* +*/ + +#include "USBObexApiTestActiveObject.h" + +// ----------------------------------------------------------------------------- +// CUSBObexApiTestActiveObject::CUSBObexApiTestActiveObject +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CUSBObexApiTestActiveObject::CUSBObexApiTestActiveObject( CStifLogger* aLog, + CUsbClassControllerPlugIn* aUsbClassControllerPlugIn ) : + CActive( EPriorityStandard ) + { + iUsbClassControllerPlugIn = aUsbClassControllerPlugIn; + iLog = aLog; + } + +// Destructor +CUSBObexApiTestActiveObject::~CUSBObexApiTestActiveObject() + { + Cancel(); + } + +// --------------------------------------------------------------------------- +// CUSBObexApiTestActiveObject::RunL +// --------------------------------------------------------------------------- +// +void CUSBObexApiTestActiveObject::RunL() + { + iLog->Log( _L("ActiveTestObject::RunL")); + CActiveScheduler::Stop(); + iLog->Log( _L("ActiveScheduler Stopped")); + iUsbServiceState = iUsbClassControllerPlugIn -> State(); + } + +// ----------------------------------------------------------------------------- +// CUSBObexApiTestActiveObject::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CUSBObexApiTestActiveObject* CUSBObexApiTestActiveObject::NewL( + CStifLogger* aLog, CUsbClassControllerPlugIn* aUsbClassControllerPlugIn ) + { + CUSBObexApiTestActiveObject* self = new ( ELeave )CUSBObexApiTestActiveObject( aLog, aUsbClassControllerPlugIn ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CUSBObexApiTestActiveObject::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CUSBObexApiTestActiveObject::ConstructL() + { + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// CUSBObexApiTestActiveObject::DoCancel +// --------------------------------------------------------------------------- +// +void CUSBObexApiTestActiveObject::DoCancel() + { + iLog->Log( _L("ActiveTestObject::DoCancel")); + } + +// --------------------------------------------------------------------------- +// CUSBObexApiTestActiveObject::Start +// --------------------------------------------------------------------------- +// +void CUSBObexApiTestActiveObject::Start() + { + iUsbClassControllerPlugIn -> Start( iStatus ); + SetActive(); + iLog->Log( _L("Obex Controller Started")); + } + +// --------------------------------------------------------------------------- +// CUSBObexApiTestActiveObject::Stop +// --------------------------------------------------------------------------- +// +void CUSBObexApiTestActiveObject::Stop() + { + iUsbClassControllerPlugIn -> Stop( iStatus ); + SetActive(); + iLog->Log( _L("Obex Controller Stopped")); + } +