usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/inc/ActiveWriter.h
changeset 0 c9bc50fca66e
equal deleted inserted replaced
-1:000000000000 0:c9bc50fca66e
       
     1 /*
       
     2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __ACTIVEWRITER_H__
       
    19 #define __ACTIVEWRITER_H__
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <d32usbc.h>
       
    23 
       
    24 class RDevUsbcClient;
       
    25 class MWriteObserver;
       
    26 
       
    27 NONSHARABLE_CLASS(CActiveWriter) : public CActive
       
    28 /**
       
    29  * Active object to post write requests on the LDD.
       
    30  */
       
    31 	{
       
    32 public: 									   
       
    33 	static CActiveWriter* NewL(MWriteObserver& aParent, RDevUsbcClient& aLdd, TEndpointNumber aEndpoint);
       
    34 	~CActiveWriter();
       
    35 
       
    36 public:
       
    37 	void Write(const TDesC8& aDes, 
       
    38 		TInt aLen, 
       
    39 		TBool aZlp);
       
    40 
       
    41 private:
       
    42 	CActiveWriter(MWriteObserver& aParent, RDevUsbcClient& aLdd, TEndpointNumber aEndpoint);
       
    43 
       
    44 private: // from CActive
       
    45 	virtual void DoCancel();
       
    46 	virtual void RunL();
       
    47 
       
    48 private: // unowned
       
    49 	MWriteObserver& iParent;
       
    50 	RDevUsbcClient& iLdd;
       
    51 
       
    52 private: // owned
       
    53 	TEndpointNumber iEndpoint;
       
    54 
       
    55 	enum TWritingState
       
    56 		{
       
    57 		EFirstMessagePart,
       
    58 		EFinalMessagePart,
       
    59 		ECompleteMessage,		
       
    60 		};
       
    61 		
       
    62 	enum
       
    63 		{
       
    64 		KMaxPacketSize = 64, 
       
    65 		};
       
    66 		
       
    67 	TWritingState iWritingState;
       
    68 	TPtrC8 iFirstPortion;
       
    69 	TPtrC8 iSecondPortion;
       
    70 	};
       
    71 
       
    72 #endif // __ACTIVEWRITER_H__