os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/controller/include/cusbhostmslogicalunit.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 CUSBHOSTMSLOGICALUNIT_H
    22 #define CUSBHOSTMSLOGICALUNIT_H
    23 
    24 
    25 class MTransport;
    26 class MProtocol;
    27 class THostMassStorageConfig;
    28 class TReadWrite;
    29 
    30 /**
    31 This class represents a Logical Unit supporting SCSI Mass Storage Class. The
    32 class provides inteface methods to read, write and get the media capacity of the
    33 Logical Unit. Each instance is identified by the LUN.
    34 */
    35 class CUsbHostMsLogicalUnit : public CBase
    36 {
    37 public:
    38 	static CUsbHostMsLogicalUnit* NewL(TLun aLun);
    39 	~CUsbHostMsLogicalUnit();
    40 private:
    41     void ConstructL();
    42     CUsbHostMsLogicalUnit(TLun aLun);
    43 
    44 public:
    45 	void InitL();
    46 	void UnInitL();
    47 	void ReadL(const RMessage2& aMessage);
    48 	void WriteL(const RMessage2& aMessage);
    49 	void EraseL(const RMessage2& aMessage);
    50 	void CapsL(const RMessage2& aMessage);
    51 
    52 	void NotifyChange(const RMessage2& aMessage);
    53     void ForceCompleteNotifyChangeL();
    54     void CancelChangeNotifierL();
    55 
    56 	void ReadyToSuspend();
    57 	TBool IsConnected();
    58 	TBool IsReadyToSuspend();
    59 	void CancelReadyToSuspend();
    60 
    61 	void SuspendL();
    62 	void ResumeL();
    63 	void DoLunReadyCheckL();
    64 
    65 	TInt InitialiseProtocolL(TLun aLun,
    66                              THostMassStorageConfig& aConfig,
    67                              MTransport& aTransport);
    68 
    69     TLun Lun() const;
    70 
    71 private:
    72     TInt CheckPosition(const TReadWrite& aReadWrite);
    73 
    74     /** The Protocol interface (Owned by this class) */
    75 	MProtocol* iProtocol;
    76     /** LUN */
    77     TLun iLun;
    78     /** The Size (updated by CapsL) */
    79     TPos iSize;
    80 
    81 	TBool iSuspendRequest;
    82     
    83     RBuf8 iDataBuf;
    84 };
    85 
    86 
    87 /**
    88 Get the LUN
    89 
    90 @return TLun The LUN
    91 */
    92 inline TLun CUsbHostMsLogicalUnit::Lun() const
    93     {
    94     return iLun;
    95     }
    96 
    97 #endif // CUSBHOSTMSLOGICALUNIT_H
    98