usbmgmt/usbmgr/device/classcontroller/public/CUsbClassControllerBase.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 * Implements part of UsbMan USB Class Framework.
       
    16 * All USB classes to be managed by UsbMan must derive
       
    17 * from this class.
       
    18 *
       
    19 */
       
    20 
       
    21 /**
       
    22  @file
       
    23 */
       
    24 
       
    25 #ifndef __CUSBCLASSCONTROLLERBASE_H__
       
    26 #define __CUSBCLASSCONTROLLERBASE_H__
       
    27 
       
    28 #include <e32base.h>
       
    29 #include <usbstates.h>
       
    30 
       
    31 class MUsbClassControllerNotify;
       
    32 class TUsbDescriptor;
       
    33 
       
    34 class CUsbClassControllerBase : public CActive
       
    35 /** Base class for Class Controllers.
       
    36 
       
    37   @publishedPartner
       
    38   @released 
       
    39  */
       
    40 	{
       
    41 public:
       
    42 	/** Owner
       
    43 		@return The owner of the class controller.
       
    44 		*/
       
    45 	IMPORT_C MUsbClassControllerNotify& Owner() const;
       
    46 
       
    47 	/** State
       
    48 		@return The service state.
       
    49 		*/
       
    50 	IMPORT_C TUsbServiceState State() const;
       
    51 
       
    52 	/** StartupPriority
       
    53 		@return The relative priority of this class controller.
       
    54 		*/
       
    55 	IMPORT_C TInt StartupPriority() const;
       
    56 
       
    57 	/** Compare
       
    58 		Static function to compare two class controllers on the basis of their 
       
    59 		startup priorities.
       
    60 		@param aFirst First class controller.
       
    61 		@param aSecond Second class controller.
       
    62 		@return Result of comparison of two class controllers.
       
    63 		*/
       
    64 	IMPORT_C static TInt Compare(const CUsbClassControllerBase&  aFirst, 
       
    65 		const CUsbClassControllerBase& aSecond);
       
    66 		
       
    67 public: // Functions derived from CActive to be implemented by derived classes.
       
    68 	/** RunL
       
    69 		Framework function. Class controllers are Active Objects, and may if 
       
    70 		relevant use that to register interfaces asynchronously.
       
    71 		*/
       
    72 	virtual void RunL() = 0;
       
    73 	
       
    74 	/** DoCancel
       
    75 		Framework function. 
       
    76 		*/
       
    77 	virtual void DoCancel() = 0;
       
    78 	
       
    79 	/** RunError
       
    80 		@param aError The error with which RunL left.
       
    81 		@return Error. 
       
    82 		*/
       
    83 	virtual TInt RunError(TInt aError) = 0;
       
    84 
       
    85 public:
       
    86 	/** Destructor
       
    87 	*/
       
    88 	IMPORT_C virtual ~CUsbClassControllerBase();
       
    89 
       
    90 public:
       
    91 	/** Start
       
    92 		Called by the server to get this class controller to register its 
       
    93 		interfaces.
       
    94 		@param aStatus TRequestStatus to signal completion of the request.
       
    95 		*/
       
    96 	virtual void Start(TRequestStatus& aStatus) = 0;
       
    97 
       
    98 	/** Stop
       
    99 		Called by the server to get this class controller to deregister its 
       
   100 		interfaces.
       
   101 		@param aStatus TRequestStatus to signal completion of the request.
       
   102 		*/
       
   103 	virtual void Stop(TRequestStatus& aStatus) = 0;
       
   104 
       
   105 	/** GetDescriptorInfo
       
   106 		Returns information on the class controller's descriptors.
       
   107 		@param aDescriptorInfo Structure to return information in.
       
   108 		*/
       
   109 	virtual void GetDescriptorInfo(TUsbDescriptor& aDescriptorInfo) const = 0;
       
   110 
       
   111 protected:
       
   112 	/** Constructor
       
   113 		@param aOwner Owner.
       
   114 		@param aStartupPriority Relative startup priority of this class controller.
       
   115 		*/
       
   116 	IMPORT_C CUsbClassControllerBase(MUsbClassControllerNotify& aOwner, TInt aStartupPriority);
       
   117 
       
   118 protected:
       
   119 	/**
       
   120 		The relative priority of this class controller. The class controllers 
       
   121 		are sorted using their priorities to determine what order to start 
       
   122 		them in. 
       
   123 		*/
       
   124 	const TInt iStartupPriority;
       
   125 
       
   126 	/**
       
   127 		The current service state. This must be kept up-to-date depending on 
       
   128 		whether this class controller's interfaces are registered or not.
       
   129 		*/
       
   130 	TUsbServiceState iState;
       
   131 
       
   132 	/**
       
   133 		Owner.
       
   134 		*/
       
   135 	MUsbClassControllerNotify& iOwner;
       
   136 	};
       
   137 
       
   138 #endif //__CUSBCLASSCONTROLLERBASE_H__
       
   139