usbmgmt/usbmgrtest/usbmsapp/usbms_stub/inc/usbms_stub.h
changeset 0 c9bc50fca66e
child 15 f92a4f87e424
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 * Adheres to the UsbMan USB Class API and talks to C32
       
    16 * to manage the stub3.CSY that is used to provide a virtual
       
    17 * serial port service to clients
       
    18 * 
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @file
       
    26 */
       
    27 
       
    28 #ifndef __CUSBstub3CLASSCONTROLLER_H__
       
    29 #define __CUSBstub3CLASSCONTROLLER_H__
       
    30 
       
    31 #include <e32std.h>
       
    32 #include <cusbclasscontrollerplugin.h>
       
    33 #include <d32usbc.h>
       
    34 
       
    35 class MUsbClassControllerNotify;
       
    36 
       
    37 const TInt Kstub3StartupPriority = 2;
       
    38 
       
    39 const TInt Kstub3CCDefaultDelay = 500; //0.5 sec default delay for start and stop
       
    40 
       
    41 const TInt Kstub3NumberOfInterfacesPerstub3Function = 2; // data and control interfaces
       
    42 
       
    43 // The name of the ini file specifying the number of functions required different from default
       
    44 /*
       
    45 _LIT(Kstub3FunctionsIniFileName, "NumberOfstub3Functions.ini");
       
    46 _LIT(Kstub3ConfigSection,"stub3_CONF");
       
    47 _LIT(KNumberOfstub3FunctionsKeyWord,"NumberOfstub3Functions");
       
    48 */
       
    49 // Lengths of the various bits of the  descriptor. Taken from the USB
       
    50 // WMCDC specification, v1.0.
       
    51 const TInt Kstub3InterfaceDescriptorLength = 3;
       
    52 const TInt Kstub3CcHeaderDescriptorLength = 5;
       
    53 const TInt Kstub3FunctionalDescriptorLength = 4;
       
    54 const TInt Kstub3CcUfdDescriptorLength = 5;
       
    55 const TInt Kstub3NotificationEndpointDescriptorLength = 7;
       
    56 const TInt Kstub3DataClassInterfaceDescriptorLength = 3;
       
    57 const TInt Kstub3DataClassHeaderDescriptorLength = 5;
       
    58 const TInt Kstub3DataClassEndpointInDescriptorLength = 7;
       
    59 const TInt Kstub3DataClassEndpointOutDescriptorLength = 7;
       
    60 
       
    61 const TInt Kstub3DescriptorLength =
       
    62 	Kstub3InterfaceDescriptorLength +
       
    63 	Kstub3CcHeaderDescriptorLength +
       
    64 	Kstub3FunctionalDescriptorLength +
       
    65 	Kstub3CcUfdDescriptorLength +
       
    66 	Kstub3NotificationEndpointDescriptorLength +
       
    67 	Kstub3DataClassInterfaceDescriptorLength +
       
    68 	Kstub3DataClassHeaderDescriptorLength +
       
    69 	Kstub3DataClassEndpointInDescriptorLength +
       
    70 	Kstub3DataClassEndpointOutDescriptorLength;
       
    71 	
       
    72 /**
       
    73  * The CUsbstub3ClassController class
       
    74  *
       
    75  * Implements the USB Class Controller API and manages the stub3.CSY
       
    76  */
       
    77 NONSHARABLE_CLASS(CUsbstub3ClassController) : public CUsbClassControllerPlugIn
       
    78 	{
       
    79 
       
    80 public: // New functions.
       
    81 	static CUsbstub3ClassController* NewL(MUsbClassControllerNotify& aOwner);
       
    82 
       
    83 public: // Functions derived from CBase.
       
    84 	virtual ~CUsbstub3ClassController();
       
    85 
       
    86 public: // Functions derived from CActive.
       
    87 	virtual void RunL();
       
    88 	virtual void DoCancel();
       
    89 	virtual TInt RunError(TInt aError);
       
    90 
       
    91 public: // Functions derived from CUsbClassControllerBase
       
    92 	virtual void Start(TRequestStatus& aStatus);
       
    93 	virtual void Stop(TRequestStatus& aStatus);
       
    94 
       
    95 	virtual void GetDescriptorInfo(TUsbDescriptor& aDescriptorInfo) const;
       
    96 
       
    97 protected:
       
    98 	CUsbstub3ClassController(MUsbClassControllerNotify& aOwner);
       
    99 	void ConstructL();
       
   100 
       
   101 
       
   102 
       
   103 private:
       
   104 	TInt SetUpInterface();
       
   105 
       
   106 
       
   107 	// delays in microseconds
       
   108 	TInt iStartDelay;
       
   109 	TInt iStopDelay;
       
   110 	
       
   111 	TBool iFailToStart;
       
   112 	TBool iFailToStop;
       
   113 	
       
   114 	RTimer iTimer;
       
   115 	TRequestStatus* iReportStatus;
       
   116 	RDevUsbcClient  iLdd;
       
   117 
       
   118 	
       
   119 	
       
   120 	};
       
   121 
       
   122 #endif //__CUSBstub3CLASSCONTROLLER_H__