usbmgmt/usbmgr/usbman/server/INC/CUsbServer.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 a Symbian OS server that exposes the RUsb API
       
    16 * 
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file
       
    24 */
       
    25 
       
    26 #ifndef __CUSBSERVER_H__
       
    27 #define __CUSBSERVER_H__
       
    28 
       
    29 
       
    30 _LIT(KUsbSvrPncCat, "CUsbServer");
       
    31 
       
    32 enum TUsbPanicServer
       
    33 	{
       
    34 	EICSInvalidCount 			= 0x00,
       
    35 	EDCSInvalidCount 			= 0x10,
       
    36 	ELSTNSNotIdle 				= 0x20,
       
    37 	ENullPersonalityPointer 	= 0x30,
       
    38 	EMaxClassUidsBufTooSmall	= 0x40
       
    39 	};
       
    40 
       
    41 //
       
    42 // Forward declarations
       
    43 //
       
    44 class CUsbDevice;
       
    45 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
       
    46 class CUsbOtg;
       
    47 class CUsbHost;
       
    48 #endif // SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
       
    49 
       
    50 /**
       
    51  * The CUsbServer class
       
    52  *
       
    53  * Implements a Symbian OS server that exposes the RUsb API
       
    54  */
       
    55  NONSHARABLE_CLASS(CUsbServer) : public CPolicyServer
       
    56 	{
       
    57 public:
       
    58 	static CUsbServer* NewLC();
       
    59 	virtual ~CUsbServer();
       
    60 
       
    61 	virtual CSession2* NewSessionL(const TVersion &aVersion, const RMessage2& aMessage) const;
       
    62 	void Error(TInt aError);
       
    63 
       
    64 	inline CUsbDevice& Device() const;
       
    65 
       
    66 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
       
    67 	inline CUsbOtg& Otg() const;
       
    68 	inline CUsbHost& Host() const;
       
    69 #endif // SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
       
    70 
       
    71 	void IncrementSessionCount();
       
    72 	void DecrementSessionCount();
       
    73 	inline TInt SessionCount() const;
       
    74 	void LaunchShutdownTimerIfNoSessions();
       
    75 
       
    76 protected:
       
    77 	CUsbServer();
       
    78 	void ConstructL();
       
    79 	
       
    80 private:
       
    81 	CUsbDevice* iUsbDevice;
       
    82 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
       
    83 	CUsbOtg* iUsbOtg;
       
    84 	CUsbHost* iUsbHost;
       
    85 #endif // SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
       
    86 
       
    87 	TInt iSessionCount;
       
    88 	enum {KShutdownDelay = 2 * 1000 * 1000};	// 2 seconds
       
    89 	class CShutdownTimer : public CTimer
       
    90 		{
       
    91 	public:
       
    92 		CShutdownTimer();
       
    93 		void ConstructL();
       
    94 		virtual void RunL();
       
    95 		};
       
    96 	CShutdownTimer* iShutdownTimer;
       
    97 	};
       
    98 
       
    99 #include "CUsbServer.inl"
       
   100 
       
   101 #endif