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