diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbstate.cpp --- a/usbengines/usbotgwatcher/src/cusbstate.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstate.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 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: Implementation + * Copyright (c) 2008-2009 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: Implementation + * + */ #include "cusbstate.h" @@ -25,7 +24,7 @@ // // --------------------------------------------------------------------------- // -CUsbState::CUsbState(CUsbOtgWatcher* aWatcher) : +CUsbState::CUsbState(CUsbOtgWatcher& aWatcher) : iWatcher(aWatcher) { } @@ -42,19 +41,6 @@ // // --------------------------------------------------------------------------- // -CUsbState* CUsbState::NewL(CUsbOtgWatcher* aWatcher) - { - CUsbState* self = new (ELeave) CUsbState(aWatcher); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// void CUsbState::ConstructL() { @@ -64,18 +50,9 @@ // // --------------------------------------------------------------------------- // -TUsbStateIds CUsbState::Id() - { - Panic(EIdForNotDefinedStateRequested); - return EUsbStateHostUndefined; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// void CUsbState::JustAdvancedToThisStateL() { + iWatcher.PrintStateToLog(); } // --------------------------------------------------------------------------- @@ -93,7 +70,7 @@ void CUsbState::ChangeStateL(TUsbStateIds aNewStateId) { - iWatcher->ChangeStateL(aNewStateId); + iWatcher.ChangeStateL(aNewStateId); } @@ -104,7 +81,7 @@ void CUsbState::ChangeHostStateL(TUsbStateIds aNewStateId) { - iWatcher->ChangeHostStateL(aNewStateId); + iWatcher.ChangeHostStateL(aNewStateId); } @@ -114,9 +91,11 @@ // void CUsbState::HandleL(TInt aWhat, TUsbStateIds aWhereToHandle) { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbState::HandleL aWhat = %d aWhere = %d" ), aWhat, aWhereToHandle)); + LOG_FUNC - iWatcher->HandleHostProblemL(aWhat, aWhereToHandle); + LOG2( "aWhat = %d aWhere = %d" , aWhat, aWhereToHandle); + + iWatcher.HandleHostProblemL(aWhat, aWhereToHandle); } // --------------------------------------------------------------------------- @@ -168,7 +147,7 @@ // void CUsbState::IdPinOffL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::IdPinOffL" ) ); + LOG_FUNC Panic(EIdPinOffNotExpected); } @@ -178,7 +157,7 @@ // void CUsbState::IdPinOnL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::IdPinOnL" ) ); + LOG_FUNC Panic(EIdPinOnNotExpected); } @@ -189,7 +168,7 @@ // void CUsbState::VBusDownL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::VBusDownL" ) ); + LOG_FUNC Panic(EVBusDownNotExpected); } @@ -199,8 +178,8 @@ // void CUsbState::VBusUpL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::VBusUpL" ) ); - Panic(EVBusUpNotExpected); + LOG_FUNC + Panic(EVBusUpNotExpected); } // From OTG state observer @@ -210,7 +189,7 @@ // void CUsbState::AIdleL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::AIdleL" ) ); + LOG_FUNC Panic(EAIdleNotExpected); } @@ -220,7 +199,7 @@ // void CUsbState::AHostL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::AHostL" ) ); + LOG_FUNC Panic(EAHostNotExpected); } @@ -230,7 +209,7 @@ // void CUsbState::APeripheralL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::APeripheralL" ) ); + LOG_FUNC Panic(EAPeripheralNotExpected); } @@ -240,7 +219,7 @@ // void CUsbState::AVBusErrorL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::AVBusErrorL" ) ); + LOG_FUNC Panic(EAVBusErrorNotExpected); } @@ -250,7 +229,7 @@ // void CUsbState::BIdleL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::BIdleL" ) ); + LOG_FUNC Panic(EBIdleNotExpected); } @@ -260,7 +239,7 @@ // void CUsbState::BPeripheralL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::BPeripheralL" ) ); + LOG_FUNC Panic(EBPeripheralNotExpected); } @@ -270,7 +249,7 @@ // void CUsbState::BHostL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::BHostL" ) ); + LOG_FUNC Panic(EBHostNotExpected); } @@ -281,7 +260,7 @@ // void CUsbState::BusIdleL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::BusIdleL" ) ); + LOG_FUNC Panic(EBusIdleNotExpected); } @@ -291,7 +270,7 @@ // void CUsbState::BusActiveL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::BusActiveL" ) ); + LOG_FUNC Panic(EBusActiveNotExpected); } @@ -302,7 +281,7 @@ // void CUsbState::DeviceAttachedL(TDeviceEventInformation) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DeviceAttachedL" ) ); + LOG_FUNC Panic(EDeviceAttachedNotExpected); } @@ -312,7 +291,7 @@ // void CUsbState::DeviceDetachedL(TDeviceEventInformation) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DeviceDetachedL" ) ); + LOG_FUNC Panic(EDeviceDetachedNotExpected); } @@ -322,7 +301,7 @@ // void CUsbState::DriverLoadSuccessL(TDeviceEventInformation) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DriverLoadSuccessL" ) ); + LOG_FUNC Panic(EDriverLoadSuccessNotExpected); } @@ -332,7 +311,7 @@ // void CUsbState::DriverLoadPartialSuccessL(TDeviceEventInformation) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DriverLoadPartialSuccessL" ) ); + LOG_FUNC Panic(EDriverLoadPartialSuccessNotExpected); } @@ -342,7 +321,7 @@ // void CUsbState::DriverLoadFailureL(TDeviceEventInformation) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DriverLoadFailureL" ) ); + LOG_FUNC Panic(EDriverLoadFailureNotExpected); } @@ -352,7 +331,7 @@ // void CUsbState::BadHubPositionL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::BadHubPositionL" ) ); + LOG_FUNC Panic(EBadHubPositionNotExpected); } @@ -362,7 +341,7 @@ // void CUsbState::VBusErrorL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::VBusErrorL" ) ); + LOG_FUNC Panic(EVBusErrorNotExpected); } @@ -372,7 +351,7 @@ // void CUsbState::MessageNotificationReceivedL(TInt) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::MessageNotificationReceivedL" ) ); + LOG_FUNC Panic(EMessageNotificationNotExpected); } @@ -382,7 +361,7 @@ // void CUsbState::SrpReceivedL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::SrpReceivedL" ) ); + LOG_FUNC Panic(ESrpNotExpected); } @@ -392,6 +371,6 @@ // void CUsbState::SessionRequestedL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::SessionRequestedL" ) ); + LOG_FUNC Panic(ESessionRequestNotExpected); }