usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/ActiveReader.cpp
branchRCL_3
changeset 15 f92a4f87e424
parent 0 c9bc50fca66e
child 16 012cc2ee6408
equal deleted inserted replaced
14:d3e8e7d462dd 15:f92a4f87e424
     1 /*
     1 /*
     2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    20 #include "ActiveReader.h"
    20 #include "ActiveReader.h"
    21 #include "AcmConstants.h"
    21 #include "AcmConstants.h"
    22 #include "AcmPanic.h"
    22 #include "AcmPanic.h"
    23 #include "ReadObserver.h"
    23 #include "ReadObserver.h"
    24 #include "AcmUtils.h"
    24 #include "AcmUtils.h"
    25 #include <usb/usblogger.h>
    25 #include "OstTraceDefinitions.h"
    26 
    26 #ifdef OST_TRACE_COMPILER_IN_USE
    27 #ifdef __FLOG_ACTIVE
    27 #include "ActiveReaderTraces.h"
    28 _LIT8(KLogComponent, "ECACM");
       
    29 #endif
    28 #endif
    30 
    29 
    31 CActiveReader::CActiveReader(MReadObserver& aParent, RDevUsbcClient& aLdd, TEndpointNumber aEndpoint)
    30 CActiveReader::CActiveReader(MReadObserver& aParent, RDevUsbcClient& aLdd, TEndpointNumber aEndpoint)
    32  :	CActive(KEcacmAOPriority), 
    31  :	CActive(KEcacmAOPriority), 
    33 	iParent(aParent),
    32 	iParent(aParent),
    40  * complete.
    39  * complete.
    41  * @param aLdd The LDD handle to be used for posting read requests.
    40  * @param aLdd The LDD handle to be used for posting read requests.
    42  * @param aEndpoint The endpoint to read from.
    41  * @param aEndpoint The endpoint to read from.
    43  */
    42  */
    44 	{
    43 	{
       
    44 	OstTraceFunctionEntry0( CACTIVEREADER_CACTIVEREADER_CONS_ENTRY );
    45 	CActiveScheduler::Add(this);
    45 	CActiveScheduler::Add(this);
       
    46 	OstTraceFunctionExit0( CACTIVEREADER_CACTIVEREADER_CONS_EXIT );
    46 	}
    47 	}
    47 
    48 
    48 CActiveReader::~CActiveReader()
    49 CActiveReader::~CActiveReader()
    49 /**
    50 /**
    50  * Destructor.
    51  * Destructor.
    51  */
    52  */
    52 	{
    53 	{
    53 	LOG_FUNC
    54 	OstTraceFunctionEntry0( CACTIVEREADER_CACTIVEREADER_DES_ENTRY );
    54 
       
    55 	Cancel();
    55 	Cancel();
       
    56 	OstTraceFunctionExit0( CACTIVEREADER_CACTIVEREADER_DES_EXIT );
    56 	}
    57 	}
    57 
    58 
    58 CActiveReader* CActiveReader::NewL(MReadObserver& aParent, 
    59 CActiveReader* CActiveReader::NewL(MReadObserver& aParent, 
    59 								   RDevUsbcClient& aLdd,
    60 								   RDevUsbcClient& aLdd,
    60 								   TEndpointNumber aEndpoint)
    61 								   TEndpointNumber aEndpoint)
    66  * @param aLdd The LDD handle to be used for posting read requests.
    67  * @param aLdd The LDD handle to be used for posting read requests.
    67  * @param aEndpoint The endpoint to read from.
    68  * @param aEndpoint The endpoint to read from.
    68  * @return Ownership of a new CActiveReader object.
    69  * @return Ownership of a new CActiveReader object.
    69  */
    70  */
    70 	{
    71 	{
    71 	LOG_STATIC_FUNC_ENTRY
    72 	OstTraceFunctionEntry0( CACTIVEREADER_NEWL_ENTRY );
    72 
       
    73 	CActiveReader* self = new(ELeave) CActiveReader(aParent, aLdd, aEndpoint);
    73 	CActiveReader* self = new(ELeave) CActiveReader(aParent, aLdd, aEndpoint);
       
    74 	OstTraceFunctionExit0( CACTIVEREADER_NEWL_EXIT );
    74 	return self;
    75 	return self;
    75 	}
    76 	}
    76 
    77 
    77 void CActiveReader::Read(TDes8& aDes, TInt aLen)
    78 void CActiveReader::Read(TDes8& aDes, TInt aLen)
    78 /**
    79 /**
    80  *
    81  *
    81  * @param aDes A descriptor into which to read.
    82  * @param aDes A descriptor into which to read.
    82  * @param aLen The length to read.
    83  * @param aLen The length to read.
    83  */
    84  */
    84 	{
    85 	{
    85 	LOG_FUNC
    86 	OstTraceFunctionEntry0( CACTIVEREADER_READ_ENTRY );
    86 
       
    87 	iLdd.Read(iStatus, iEndpoint, aDes, aLen); 
    87 	iLdd.Read(iStatus, iEndpoint, aDes, aLen); 
    88 	SetActive();
    88 	SetActive();
       
    89 	OstTraceFunctionExit0( CACTIVEREADER_READ_EXIT );
    89 	}
    90 	}
    90 
    91 
    91 void CActiveReader::DoCancel()
    92 void CActiveReader::DoCancel()
    92 /**
    93 /**
    93  * Cancel an outstanding read.
    94  * Cancel an outstanding read.
    94  */
    95  */
    95 	{
    96 	{
    96 	LOG_FUNC
    97 	OstTraceFunctionEntry0( CACTIVEREADER_DOCANCEL_ENTRY );
    97 
       
    98 	iLdd.ReadCancel(iEndpoint);
    98 	iLdd.ReadCancel(iEndpoint);
       
    99 	OstTraceFunctionExit0( CACTIVEREADER_DOCANCEL_EXIT );
    99 	}
   100 	}
   100 
   101 
   101 void CActiveReader::RunL()
   102 void CActiveReader::RunL()
   102 /**
   103 /**
   103  * This function will be called when the read completes. It notifies the 
   104  * This function will be called when the read completes. It notifies the 
   104  * parent class of the completion.
   105  * parent class of the completion.
   105  */
   106  */
   106 	{
   107 	{
   107 	LOG_LINE
   108 	OstTraceFunctionEntry0( CACTIVEREADER_RUNL_ENTRY );
   108 	LOGTEXT2(_L8(">>CActiveReader::RunL iStatus=%d"), iStatus.Int());
   109 	OstTrace1( TRACE_NORMAL, CACTIVEREADER_RUNL, "CActiveReader::RunL;RunL iStatus=%d", iStatus.Int() );
   109 
       
   110 	iParent.ReadCompleted(iStatus.Int());
   110 	iParent.ReadCompleted(iStatus.Int());
   111 
   111 	OstTraceFunctionExit0( CACTIVEREADER_RUNL_EXIT );
   112 	LOGTEXT(_L8("<<CActiveReader::RunL"));
       
   113 	}
   112 	}
   114 
   113 
   115 //
   114 //
   116 // End of file
   115 // End of file