diff -r e9b96e674847 -r 5b2a402e96ac usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbidpinobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbidpinobserver.cpp Thu Aug 19 10:54:11 2010 +0300 @@ -0,0 +1,112 @@ +/* +* 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 +#include + +#include "stifassertmacros.h" +#include "mockcusbidpinobserver.h" + +#include "debug.h" +#include "panic.h" + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CUsbIdPinObserver::CUsbIdPinObserver() : iIdPinOn(EFalse) + { + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CUsbIdPinObserver::ConstructL() + { + iWait = new ( ELeave )CActiveSchedulerWait(); + } + +CUsbIdPinObserver* CUsbIdPinObserver::NewL() + { + LOG( "[USBOTGWATCHER]\tMockCUsbIdPinObserver::NewL" ); + + CUsbIdPinObserver* self = new( ELeave ) CUsbIdPinObserver(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CUsbIdPinObserver::~CUsbIdPinObserver() + { + LOG( ( "[USBOTGWATCHER]\tMockCUsbIdPinObserver::~CUsbIdPinObserver" ) ); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CUsbIdPinObserver::TState CUsbIdPinObserver::IdPin() /* const! But for some reason RProperty::Get is not const! */ + { + // not found in Symbian docs clear definition of this property. Verification is needed + return (0 == iIdPinOn? EIdPinOff : EIdPinOn); + } + + +void CUsbIdPinObserver::SubscribeL(MUsbIdPinObserver& aObserver) + { + //iLog->Log(_L("[USBOTGWATCHER] >>MockCUsbIdPinObserver::SubscribeL")); + LOG(("[USBOTGWATCHER]\tMockCUsbIdPinObserver::SubscribeL")); + STIF_ASSERT_NOT_NULL(&aObserver); + + iObserver = &aObserver; + + //iLog->Log(_L("[USBOTGWATCHER] <IdPinOnL(); + LOG(("[USBOTGWATCHER] <IdPinOffL(); + }