os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/mprotocol.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/mprotocol.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,147 @@
     1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// protocol.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +/**
    1.22 + @file
    1.23 + @internalTechnology
    1.24 +*/
    1.25 +
    1.26 +#ifndef MPROTOCOL_H
    1.27 +#define MPROTOCOL_H
    1.28 +
    1.29 +class MTransport;
    1.30 +struct TCapsInfo;
    1.31 +
    1.32 +/**
    1.33 +Interface class to control a Mass Storage device
    1.34 +*/
    1.35 +class MProtocol
    1.36 +    {
    1.37 +public:
    1.38 +    /** Command to initialise LUN */
    1.39 +    virtual void InitialiseUnitL() = 0;
    1.40 +
    1.41 +    /** Command to uninitialise the LUN */
    1.42 +    virtual void UninitialiseUnitL() = 0;
    1.43 +
    1.44 +    /**
    1.45 +    Command to read the media.
    1.46 +
    1.47 +    @param aPos
    1.48 +    @param aLen
    1.49 +    @param aCopybuf
    1.50 +    */
    1.51 +    virtual void ReadL(TUint64 aPos, TDes8& aCopybuf, TInt aLen) = 0;
    1.52 +
    1.53 +    /**
    1.54 +    Command to write to the media.
    1.55 +
    1.56 +    @param aPos
    1.57 +    @param aLen
    1.58 +    @param aCopybuf
    1.59 +    */
    1.60 +    virtual void WriteL(TUint64 aPos, TDesC8& aCopybuf, TInt aLen) = 0;
    1.61 +
    1.62 +    /**
    1.63 +    command to find the capacity of the media
    1.64 +
    1.65 +    @param aCopybuf
    1.66 +    */
    1.67 +    virtual void GetCapacityL(TCapsInfo& aCapsInfo) = 0;
    1.68 +
    1.69 +    /** unit testing */
    1.70 +    virtual void CreateSbcInterfaceL(TUint32 aBlockLen, TUint32 aLastLba) = 0;
    1.71 +
    1.72 +	virtual void DoScsiReadyCheckEventL() = 0;
    1.73 +
    1.74 +    /**
    1.75 +    Media change notification
    1.76 +
    1.77 +    @param aMessage
    1.78 +    */
    1.79 +	virtual	void NotifyChange(const RMessage2& aMessage) = 0;
    1.80 +
    1.81 +    /**
    1.82 +    Force notification to be sent
    1.83 +    */
    1.84 +    virtual void ForceCompleteNotifyChangeL() = 0;
    1.85 +    /**
    1.86 +    Force notification to be sent
    1.87 +    */
    1.88 +    virtual void CancelChangeNotifierL() = 0;
    1.89 +    /**
    1.90 +    Suspends the logical unit
    1.91 +    */
    1.92 +	virtual void SuspendL() = 0;
    1.93 +    /**
    1.94 +    Resumes the logical unit
    1.95 +    */
    1.96 +	virtual void ResumeL() = 0;
    1.97 +    /**
    1.98 +    Resets the media change and finalisation request status check timer
    1.99 +    */
   1.100 +	virtual TBool IsConnected() = 0;
   1.101 +
   1.102 +    /** Destructor */
   1.103 +    virtual ~MProtocol();
   1.104 +    };
   1.105 +
   1.106 +inline MProtocol::~MProtocol()
   1.107 +    {
   1.108 +    }
   1.109 +
   1.110 +/**
   1.111 +Interface class to encode SCSI request into a byte stream
   1.112 +*/
   1.113 +class MClientCommandServiceReq
   1.114 +    {
   1.115 +public:
   1.116 +    /**
   1.117 +    Encode the command data into a byte stream.
   1.118 +
   1.119 +    @param aBuffer Buffer to place the encoded data into
   1.120 +    @return TInt Length of the encoded data
   1.121 +    */
   1.122 +    virtual TInt EncodeRequestL(TDes8& aBuffer) const = 0;
   1.123 +    };
   1.124 +
   1.125 +
   1.126 +/**
   1.127 +Interface class to decode a SCSI response from byte stream into corresponding
   1.128 +class
   1.129 +*/
   1.130 +class MClientCommandServiceResp
   1.131 +    {
   1.132 +public:
   1.133 +    /**
   1.134 +    Returns the length of the RESPONSE data stream.
   1.135 +
   1.136 +    @return TInt Length in bytes
   1.137 +    */
   1.138 +    virtual TInt DataLength() const = 0;
   1.139 +
   1.140 +    /**
   1.141 +    Decode data into RESPONSE structure of implementation class.
   1.142 +
   1.143 +    @param aPtr Descriptor (byte stream) containing the data to be decoded
   1.144 +    */
   1.145 +    virtual void DecodeL(const TDesC8& aPtr) = 0;
   1.146 +    };
   1.147 +
   1.148 +
   1.149 +#endif // MPROTOCOL_H
   1.150 +