os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/controller/include/cusbhostmsdevice.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 /**
    17  @file
    18  @internalTechnology
    19 */
    20 
    21 #ifndef CUSBHOSTMSDEVICE_H
    22 #define CUSBHOSTMSDEVICE_H
    23 
    24 #include "tlogicalunitlist.h"
    25 
    26 class MTransport;
    27 class CUsbMsIfaceSuspendResume;
    28 class TLogicalUnitList;
    29 
    30 class CUsbHostMsDevice : public CBase
    31 	{
    32 public:
    33 
    34 	static CUsbHostMsDevice* NewL(THostMassStorageConfig& aConfig);
    35 	~CUsbHostMsDevice();
    36 	void InitialiseL(const RMessage2& aMessage);
    37     void UnInitialiseL();
    38 
    39 	TInt AddLunL(TLun aLun);
    40 	void RemoveLunL(TLun aLun);
    41 	TLun GetAndSetLunL(const RMessage2& aMessage);
    42     CUsbHostMsLogicalUnit& GetLuL(TInt aLunNum) const;
    43 
    44 	void SetLunL(TLun aLun);
    45 	void SetMaxLun(TLun aMaxLun);
    46 	TLun GetMaxLun() const;
    47 
    48 	TBool IsReady() const;
    49 	TBool IsSuspended() const;
    50 
    51 	void InitLunL(TLun aLun);
    52 
    53 	void SuspendLunL(TLun aLun);
    54 	void Resume(TRequestStatus& aStatus);
    55 	void ResumeLogicalUnitsL();
    56 	void ResumeCompletedL();
    57 
    58 	void DoHandleRemoteWakeupL();
    59 	void DoLunReadyCheckEventL();
    60 	void DoResumeLogicalUnitsL();
    61 
    62 private:
    63     void ConstructL();
    64     CUsbHostMsDevice(THostMassStorageConfig& aConfig);
    65 	MTransport* InitialiseTransportL(TTransportType aTransportId);
    66 	void StartTimer();
    67 	void StopTimer();
    68 	static TInt TimerCallback(TAny* obj);
    69 
    70 private:
    71     enum TDeviceState
    72         {
    73         EReady,
    74         ESuspended
    75         };
    76 
    77 	MTransport* iTransport;
    78 	TLun iMaxLun;
    79     TLogicalUnitList iLuList;
    80 	THostMassStorageConfig iConfig;
    81 	CUsbMsIfaceSuspendResume* iDeviceSuspendResume;
    82 	TDeviceState iState;
    83     /** The polling interval time as set by the MM - passed as part of THostMassStorageConfig */
    84 	TUint8 iStatusPollingInterval;
    85     /** An active object which triggers periodic check. */
    86 	CPeriodic* iTimer;
    87     /** The Timer status */
    88     TBool iTimerRunning;
    89 	};
    90 
    91 
    92 inline TLun CUsbHostMsDevice::GetMaxLun() const
    93     {
    94     return iMaxLun;
    95     }
    96 
    97 
    98 inline TBool CUsbHostMsDevice::IsReady() const
    99 	{
   100 	return (iState == EReady)? ETrue : EFalse;
   101 	}
   102 
   103 
   104 inline TBool CUsbHostMsDevice::IsSuspended() const
   105 	{
   106 	return (iState == ESuspended)? ETrue : EFalse;
   107 	}
   108 
   109 #endif // CUSBHOSTMSDEVICE_H
   110