--- a/userlibandfileserver/fileserver/smassstorage/cactivedevicestatenotifierbase.cpp Wed Oct 06 17:13:14 2010 +0100
+++ b/userlibandfileserver/fileserver/smassstorage/cactivedevicestatenotifierbase.cpp Mon Oct 11 17:54:41 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
@@ -11,157 +11,147 @@
*
* Contributors:
*
-* Description:
+* Description:
* Class definition for Device State Notifier Base Class
*
*/
-/**
+/**
@file
@internalTechnology
*/
#include <e32base.h>
+#include "mtransport.h"
+#include "mldddevicestatenotification.h"
+#include "drivemanager.h"
+#include "cusbmassstoragecontroller.h"
+#include "cbulkonlytransport.h"
+
#include "cactivedevicestatenotifierbase.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cactivedevicestatenotifierbaseTraces.h"
+#endif
+
+
CActiveDeviceStateNotifierBase::CActiveDeviceStateNotifierBase(CBulkOnlyTransport& aBot,
MLddDeviceStateNotification& aLddDeviceStateNotification)
-/**
- *
- */
- : CActive(EPriorityStandard),
- iBot(aBot),
+ : CActive(EPriorityStandard),
+ iBot(aBot),
iLddDeviceStateNotification(aLddDeviceStateNotification),
- iDeviceState(EUsbcNoState),
- iOldDeviceState(EUsbcNoState)
- {
+ iDeviceState(EUsbcNoState),
+ iOldDeviceState(EUsbcNoState)
+ {
- }
+ }
CActiveDeviceStateNotifierBase* CActiveDeviceStateNotifierBase::NewL(CBulkOnlyTransport& aBot,
MLddDeviceStateNotification& aLddDeviceStateNotification)
-/**
- *
- */
- {
- CActiveDeviceStateNotifierBase* self = new (ELeave) CActiveDeviceStateNotifierBase(aBot, aLddDeviceStateNotification);
- CleanupStack::PushL(self);
- self->ConstructL();
- CActiveScheduler::Add(self);
- CleanupStack::Pop(); // self
- return (self);
- }
+ {
+ CActiveDeviceStateNotifierBase* self = new (ELeave) CActiveDeviceStateNotifierBase(aBot, aLddDeviceStateNotification);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CActiveScheduler::Add(self);
+ CleanupStack::Pop(); // self
+ return (self);
+ }
void CActiveDeviceStateNotifierBase::ConstructL()
-/**
- *
- */
- {
- __FNLOG("CActiveDeviceStateNotifierBase::ConstructL");
- }
+ {
+ }
CActiveDeviceStateNotifierBase::~CActiveDeviceStateNotifierBase()
-/**
- *
- */
- {
- __PRINT(_L("CActiveDeviceStateNotifierBase::~CActiveDeviceStateNotifierBase()"));
- Cancel(); // base class
- }
+ {
+ Cancel(); // base class
+ }
void CActiveDeviceStateNotifierBase::DoCancel()
-/**
- *
- */
- {
- __PRINT(_L("CActiveDeviceStateNotifierBase::DoCancel()"));
- iLddDeviceStateNotification.Cancel();
- }
+ {
+ iLddDeviceStateNotification.Cancel();
+ }
void CActiveDeviceStateNotifierBase::RunL()
-/**
- *
- */
- {
- __FNLOG("CActiveDeviceStateNotifierBase::RunL");
- // This displays the device state.
- // In a real world program, the user could take here appropriate action (cancel a
- // transfer request or whatever).
- __PRINT1(_L("DeviceState Notification = %d"), iDeviceState);
+ {
+ // This displays the device state.
+ // In a real world program, the user could take here appropriate action (cancel a
+ // transfer request or whatever).
+
+ OstTrace1(TRACE_SMASSSTORAGE_STATE, CACTIVEDEVICESTATENOTIFIERBASE_100,
+ "DeviceState Notification = %d", iDeviceState);
- if (!(iDeviceState & KUsbAlternateSetting))
- {
- switch (iDeviceState)
- {
- case EUsbcDeviceStateUndefined: //0
- case EUsbcDeviceStateDefault: //3
- iBot.HwStop();
- break;
+ if (!(iDeviceState & KUsbAlternateSetting))
+ {
+ switch (iDeviceState)
+ {
+ case EUsbcDeviceStateUndefined: //0
+ case EUsbcDeviceStateDefault: //3
+ iBot.HwStop();
+ break;
- case EUsbcDeviceStateAttached: //1
- case EUsbcDeviceStatePowered: //2
+ case EUsbcDeviceStateAttached: //1
+ case EUsbcDeviceStatePowered: //2
// do nothing
break;
- case EUsbcDeviceStateAddress: //4
- if (iOldDeviceState == EUsbcDeviceStateConfigured)
+ case EUsbcDeviceStateAddress: //4
+ if (iOldDeviceState == EUsbcDeviceStateConfigured)
{
iBot.StopBulkOnlyEndpoint();
}
- break;
+ break;
- case EUsbcDeviceStateConfigured: //5
- if (iOldDeviceState == EUsbcDeviceStateSuspended)
- {
- iBot.HwResume();
- }
- else
- {
- iBot.HwStart();
- }
- break;
- case EUsbcDeviceStateSuspended: //6
- if (iOldDeviceState == EUsbcDeviceStateConfigured)
- {
- iBot.HwSuspend();
- }
- break;
- default:
- __PRINT(_L("Device State notifier: ***BAD***\n"));
- iBot.HwStop();
- break;
- }
- iOldDeviceState = iDeviceState;
- }
- else if (iDeviceState & KUsbAlternateSetting)
- {
- __PRINT1(_L("Device State notifier: Alternate interface setting has changed: now %d\n"), iDeviceState & ~KUsbAlternateSetting);
- }
- Activate();
- }
+ case EUsbcDeviceStateConfigured: //5
+ if (iOldDeviceState == EUsbcDeviceStateSuspended)
+ {
+ iBot.HwResume();
+ }
+ else
+ {
+ iBot.HwStart();
+ }
+ break;
+ case EUsbcDeviceStateSuspended: //6
+ if (iOldDeviceState == EUsbcDeviceStateConfigured)
+ {
+ iBot.HwSuspend();
+ }
+ break;
+ default:
+ OstTrace0(TRACE_SMASSSTORAGE_STATE, CACTIVEDEVICESTATENOTIFIERBASE_101,
+ "Device State notifier: ***BAD***");
+ iBot.HwStop();
+ break;
+ }
+ iOldDeviceState = iDeviceState;
+ }
+ else if (iDeviceState & KUsbAlternateSetting)
+ {
+ OstTrace1(TRACE_SMASSSTORAGE_STATE, CACTIVEDEVICESTATENOTIFIERBASE_102,
+ "Device State notifier: Alternate interface setting has changed: now %d",
+ iDeviceState & ~KUsbAlternateSetting);
+ }
+ Activate();
+ }
void CActiveDeviceStateNotifierBase::Activate()
-/**
- *
- */
- {
- __FNLOG("CActiveDeviceStateNotifierBase::Activate");
- if (IsActive())
- {
- __PRINT(_L("Still active\n"));
- return;
- }
- iLddDeviceStateNotification.Activate(iStatus, iDeviceState);
- SetActive();
- }
+ {
+ if (IsActive())
+ {
+ return;
+ }
+ iLddDeviceStateNotification.Activate(iStatus, iDeviceState);
+ SetActive();
+ }