os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbmssuspendresume.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 /**
    17  @file
    18  @internalTechnology
    19 */
    20 
    21 #include <e32base.h>
    22 #include <d32usbdi.h>
    23 
    24 #include <d32usbtransfers.h>
    25 #include "msctypes.h"
    26 #include "shared.h"
    27 #include "msgservice.h"
    28 #include "botmsctypes.h"
    29 
    30 #include "mprotocol.h"
    31 #include "mtransport.h"
    32 #include "cusbhostmslogicalunit.h"
    33 #include "cusbhostmsdevice.h"
    34 #include "cbulkonlytransport.h"
    35 #include "cusbmssuspendresume.h"
    36 
    37 #include "msdebug.h"
    38 #include "debug.h"
    39 
    40 
    41 void CUsbMsIfaceSuspendResume::RunL()
    42     {
    43     __MSFNLOG
    44 	iDevice->ResumeCompletedL();
    45 	if(iCancelSuspend)
    46 		{
    47 		User::RequestComplete(iDeviceStatus, iStatus.Int());
    48 		iDeviceStatus = NULL;
    49 		}
    50 	else
    51 		{
    52 		iDevice->DoHandleRemoteWakeupL();
    53 		}
    54     }
    55 
    56 /**
    57 Cancellation of outstanding request
    58 */
    59 void CUsbMsIfaceSuspendResume::DoCancel()
    60 	{
    61     __MSFNLOG
    62 	}
    63 
    64 TInt CUsbMsIfaceSuspendResume::RunError(TInt aError)
    65 	{
    66     __MSFNLOG
    67     return KErrNone;
    68 	}
    69 
    70 
    71 void CUsbMsIfaceSuspendResume::Resume(TRequestStatus& aStatus)
    72 	{
    73     __MSFNLOG
    74 	iCancelSuspend = ETrue;
    75     aStatus = KRequestPending;
    76 	iDeviceStatus = &aStatus;
    77 	iTransport->Resume();
    78 	}
    79 
    80 void CUsbMsIfaceSuspendResume::Suspend()
    81 	{
    82     __MSFNLOG
    83 	if(!IsActive())
    84 		SetActive();
    85 	iCancelSuspend = EFalse;
    86 	iTransport->Suspend(iStatus);
    87 	}
    88 
    89 CUsbMsIfaceSuspendResume* CUsbMsIfaceSuspendResume::NewL(MTransport *aTransport, CUsbHostMsDevice *aDevice)
    90 	{
    91 	return new (ELeave) CUsbMsIfaceSuspendResume(aTransport, aDevice);
    92 	}
    93 
    94 CUsbMsIfaceSuspendResume::CUsbMsIfaceSuspendResume(MTransport* aTransport, CUsbHostMsDevice* aDevice)
    95 :	CActive(EPriorityHigh),
    96     iTransport(aTransport),
    97     iDevice(aDevice),
    98     iCancelSuspend(EFalse)
    99 	{
   100     __MSFNLOG
   101 	CActiveScheduler::Add(this);
   102 	}
   103 
   104 CUsbMsIfaceSuspendResume::~CUsbMsIfaceSuspendResume()
   105 	{
   106     __MSFNLOG
   107 	Cancel();
   108 	}
   109