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.
sl@0
     1
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
 @internalTechnology
sl@0
    19
*/
sl@0
    20
sl@0
    21
#ifndef CUSBHOSTMSLOGICALUNIT_H
sl@0
    22
#define CUSBHOSTMSLOGICALUNIT_H
sl@0
    23
sl@0
    24
sl@0
    25
class MTransport;
sl@0
    26
class MProtocol;
sl@0
    27
class THostMassStorageConfig;
sl@0
    28
class TReadWrite;
sl@0
    29
sl@0
    30
/**
sl@0
    31
This class represents a Logical Unit supporting SCSI Mass Storage Class. The
sl@0
    32
class provides inteface methods to read, write and get the media capacity of the
sl@0
    33
Logical Unit. Each instance is identified by the LUN.
sl@0
    34
*/
sl@0
    35
class CUsbHostMsLogicalUnit : public CBase
sl@0
    36
{
sl@0
    37
public:
sl@0
    38
	static CUsbHostMsLogicalUnit* NewL(TLun aLun);
sl@0
    39
	~CUsbHostMsLogicalUnit();
sl@0
    40
private:
sl@0
    41
    void ConstructL();
sl@0
    42
    CUsbHostMsLogicalUnit(TLun aLun);
sl@0
    43
sl@0
    44
public:
sl@0
    45
	void InitL();
sl@0
    46
	void UnInitL();
sl@0
    47
	void ReadL(const RMessage2& aMessage);
sl@0
    48
	void WriteL(const RMessage2& aMessage);
sl@0
    49
	void EraseL(const RMessage2& aMessage);
sl@0
    50
	void CapsL(const RMessage2& aMessage);
sl@0
    51
sl@0
    52
	void NotifyChange(const RMessage2& aMessage);
sl@0
    53
    void ForceCompleteNotifyChangeL();
sl@0
    54
    void CancelChangeNotifierL();
sl@0
    55
sl@0
    56
	void ReadyToSuspend();
sl@0
    57
	TBool IsConnected();
sl@0
    58
	TBool IsReadyToSuspend();
sl@0
    59
	void CancelReadyToSuspend();
sl@0
    60
sl@0
    61
	void SuspendL();
sl@0
    62
	void ResumeL();
sl@0
    63
	void DoLunReadyCheckL();
sl@0
    64
sl@0
    65
	TInt InitialiseProtocolL(TLun aLun,
sl@0
    66
                             THostMassStorageConfig& aConfig,
sl@0
    67
                             MTransport& aTransport);
sl@0
    68
sl@0
    69
    TLun Lun() const;
sl@0
    70
sl@0
    71
private:
sl@0
    72
    TInt CheckPosition(const TReadWrite& aReadWrite);
sl@0
    73
sl@0
    74
    /** The Protocol interface (Owned by this class) */
sl@0
    75
	MProtocol* iProtocol;
sl@0
    76
    /** LUN */
sl@0
    77
    TLun iLun;
sl@0
    78
    /** The Size (updated by CapsL) */
sl@0
    79
    TPos iSize;
sl@0
    80
sl@0
    81
	TBool iSuspendRequest;
sl@0
    82
    
sl@0
    83
    RBuf8 iDataBuf;
sl@0
    84
};
sl@0
    85
sl@0
    86
sl@0
    87
/**
sl@0
    88
Get the LUN
sl@0
    89
sl@0
    90
@return TLun The LUN
sl@0
    91
*/
sl@0
    92
inline TLun CUsbHostMsLogicalUnit::Lun() const
sl@0
    93
    {
sl@0
    94
    return iLun;
sl@0
    95
    }
sl@0
    96
sl@0
    97
#endif // CUSBHOSTMSLOGICALUNIT_H
sl@0
    98