--- a/usbengines/usbotgwatcher/src/cusbidpinobserver.cpp Fri Feb 19 23:50:33 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbidpinobserver.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 <usbotgdefs.h>
@@ -40,8 +39,7 @@
//
void CUsbIdPinObserver::ConstructL()
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::ConstructL" ) );
+ LOG_FUNC
User::LeaveIfError(iIdPin.Attach(KUidUsbManCategory,
KUsbOtgIdPinPresentProperty));
@@ -54,8 +52,7 @@
//
CUsbIdPinObserver* CUsbIdPinObserver::NewL()
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::NewL" ) );
+ LOG_FUNC
CUsbIdPinObserver* self = new (ELeave) CUsbIdPinObserver();
CleanupStack::PushL(self);
@@ -70,8 +67,7 @@
//
CUsbIdPinObserver::~CUsbIdPinObserver()
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::~CUsbIdPinObserver" ) );
+ LOG_FUNC
Cancel();
@@ -89,20 +85,16 @@
/* this getter is not const, because for some reason RProperty::Get is not const */
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::IdPin" ) );
-
TInt val(0);
TInt err = iIdPin.Get(val);
if (KErrNone != err)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::IdPin CanNotGetIdPinProperty" ) );
- Panic(ECanNotGetIdPinProperty);
+ LOG("CanNotGetIdPinProperty" );
+ Panic( ECanNotGetIdPinProperty);
}
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::IdPin = %d" ), val ));
-
return (EFalse == val ? EIdPinOff : EIdPinOn);
}
@@ -112,12 +104,13 @@
//
void CUsbIdPinObserver::SubscribeL(MUsbIdPinObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::SubscribeL" ) );
+ LOG_FUNC
+
// check if the same observer already exist in a list
- if(KErrNotFound != iObservers.Find(&aObserver))
+ if (KErrNotFound != iObservers.Find(&aObserver))
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::SubscribeL Observer already exists." ) );
- Panic(EObserverAlreadyExists);
+ LOG("Observer already exists" );
+ Panic( EObserverAlreadyExists);
return;
}
iObservers.AppendL(&aObserver);
@@ -136,18 +129,18 @@
//
void CUsbIdPinObserver::UnsubscribeL(MUsbIdPinObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::UnsubscribeL" ) );
-
+ LOG_FUNC
+
TInt i(iObservers.Find(&aObserver));
- if(KErrNotFound == i)
+ if (KErrNotFound == i)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::UnsubscribeL Observer not found." ) );
- Panic(ECanNotFindIdPinObserver);
+ LOG("Observer not found");
+ Panic( ECanNotFindIdPinObserver);
return;
}
-
+
iObservers.Remove(i);
-
+
if (0 == iObservers.Count()) // no observers anymore
{
// cancel pending request
@@ -161,17 +154,19 @@
//
void CUsbIdPinObserver::RunL()
{
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::RunL iStatus = %d" ), iStatus.Int()));
+ LOG_FUNC
+
+ LOG1( "iStatus = %d" , iStatus.Int());
- // if error occured, tell to Observers
- if(KErrNone != iStatus.Int())
+ // if error occured, tell to Observers
+ if (KErrNone != iStatus.Int())
+ {
+ for (TInt i(0); i < iObservers.Count(); ++i)
{
- for (TInt i(0); i < iObservers.Count(); ++i)
- {
- iObservers[i]->IdPinErrorL(iStatus.Int());
- }
- return;
+ iObservers[i]->IdPinErrorL(iStatus.Int());
}
+ return;
+ }
// re-issue request first
iIdPin.Subscribe(iStatus);
@@ -185,7 +180,7 @@
{
case EIdPinOn:
{
- FLOG(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::RunL IdPin ON"));
+ LOG("IdPin ON");
for (TInt i(0); i < iObservers.Count(); ++i)
{
@@ -197,7 +192,7 @@
case EIdPinOff:
{
- FLOG(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::RunL IdPin OFF"));
+ LOG("IdPin OFF");
for (TInt i(0); i < iObservers.Count(); ++i)
{
@@ -209,8 +204,8 @@
default:
{
- FLOG(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::RunL WrongIdPinState"));
- Panic(EWrongIdPinState);
+ LOG("WrongIdPinState");
+ Panic( EWrongIdPinState);
}
}
@@ -231,8 +226,9 @@
//
TInt CUsbIdPinObserver::RunError(TInt aError)
{
+ LOG_FUNC
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::RunError aError = %d" ), aError));
+ LOG1( "aError = %d", aError);
// try to continue
return KErrNone;