userlibandfileserver/fileserver/shostmassstorage/server/controller/include/cusbhostmsdevicethread.h
changeset 31 56f325a607ea
parent 0 a41df078684a
equal deleted inserted replaced
15:4122176ea935 31:56f325a607ea
    45 
    45 
    46 private:
    46 private:
    47 	CUsbHostMsLogicalUnit& iLu;
    47 	CUsbHostMsLogicalUnit& iLu;
    48     };
    48     };
    49 
    49 
       
    50 class CUsbHostMsSession;
    50 
    51 
    51 class CUsbHostMsDeviceThread : public CActive
    52 class CUsbHostMsDeviceThread : public CActive
    52     {
    53     {
    53 public:
    54 public:
    54     static const TInt KMaxNumMessage = 32;
    55     static const TInt KMaxNumMessage = 32;
    55 
    56 
       
    57 	static CUsbHostMsDeviceThread* NewL(CUsbHostMsSession& aUsbHostMsSession, TUint aToken);
       
    58 	~CUsbHostMsDeviceThread();
       
    59 
       
    60 private:
       
    61     CUsbHostMsDeviceThread(CUsbHostMsSession& aUsbHostMsSession, TUint aToken);
       
    62 
       
    63 public:
    56 	static TInt Entry(TAny* aPtr);
    64 	static TInt Entry(TAny* aPtr);
       
    65 	TInt QueueMsg(const RMessage2& aMsg);
       
    66     void Lock();
       
    67     void Unlock();
       
    68 
       
    69 
       
    70 private:
       
    71     void Start();
       
    72 
    57 	void RunL();
    73 	void RunL();
    58 	inline void DoCancel()	{	};
    74 	void DoCancel();
    59 	void Lock();
    75     TInt RunError(TInt aError);
    60 	void Unlock();
    76 
    61 	TInt QueueMsg(const RMessage2& aMsg);
       
    62 	void HandleMessage(const RMessage2& aMessage);
    77 	void HandleMessage(const RMessage2& aMessage);
    63 	static CUsbHostMsDeviceThread* NewL(TUint aToken);
    78 
    64 	void UnRegisterInterfaceL(const RMessage2& aMessage);
    79 	void UnRegisterInterfaceL(const RMessage2& aMessage);
    65 	~CUsbHostMsDeviceThread();
    80 
    66 private:
    81 private:
    67     static void DoStartServerL(TAny* aPtr);
    82     static void DoStartServerL(TAny* aPtr);
    68 	CUsbHostMsDeviceThread(TUint);
    83 
    69 	void RegisterInterfaceL(const RMessage2& aMessage);
    84 	void RegisterInterfaceL(const RMessage2& aMessage);
    70 	void InitialiseInterfaceL(const RMessage2& aMessage);
    85 	void InitialiseInterfaceL(const RMessage2& aMessage);
    71 	void GetNumLunL(const RMessage2& aMessage);
    86 	void GetNumLunL(const RMessage2& aMessage);
    72 	void RegisterLogicalUnitL(const RMessage2& aMessage);
    87 	void RegisterLogicalUnitL(const RMessage2& aMessage);
    73 	TInt Shutdown();
    88 	TInt Shutdown();
    74 
    89 
    75 public:
    90 private:
    76 	TBool iIsSignalled;
    91     CUsbHostMsSession& iUsbHostMsSession;
    77 
    92 
    78 private:
       
    79 	CUsbHostMsDevice* iUsbHostMsDevice;
    93 	CUsbHostMsDevice* iUsbHostMsDevice;
    80 
    94 
    81 	RMessage2 iRMessage2[KMaxNumMessage];
    95 	RMessage2 iRMessage2[KMaxNumMessage];
    82 	RMutex iMutex;
    96 	RMutex iMutex;
    83 
    97 
    84 	TInt iQueueIndex;
    98 	TInt iQueueIndex;
    85 	TInt iDequeueIndex;
    99 	TInt iDequeueIndex;
    86 	TBool iQueueFull;
   100 	TBool iQueueFull;
    87     };
   101     };
    88 
   102 
       
   103 
       
   104 inline void CUsbHostMsDeviceThread::Lock()
       
   105 	{
       
   106 	iMutex.Wait();
       
   107 	}
       
   108 
       
   109 
       
   110 inline void CUsbHostMsDeviceThread::Unlock()
       
   111 	{
       
   112 	iMutex.Signal();
       
   113 	}
       
   114 
       
   115 
    89 #endif // CUSBMASSSTORAGEDEVICETHREAD_H
   116 #endif // CUSBMASSSTORAGEDEVICETHREAD_H