os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/mprotocol.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 // protocol.h
    15 // 
    16 //
    17 
    18 /**
    19  @file
    20  @internalTechnology
    21 */
    22 
    23 #ifndef MPROTOCOL_H
    24 #define MPROTOCOL_H
    25 
    26 class MTransport;
    27 struct TCapsInfo;
    28 
    29 /**
    30 Interface class to control a Mass Storage device
    31 */
    32 class MProtocol
    33     {
    34 public:
    35     /** Command to initialise LUN */
    36     virtual void InitialiseUnitL() = 0;
    37 
    38     /** Command to uninitialise the LUN */
    39     virtual void UninitialiseUnitL() = 0;
    40 
    41     /**
    42     Command to read the media.
    43 
    44     @param aPos
    45     @param aLen
    46     @param aCopybuf
    47     */
    48     virtual void ReadL(TUint64 aPos, TDes8& aCopybuf, TInt aLen) = 0;
    49 
    50     /**
    51     Command to write to the media.
    52 
    53     @param aPos
    54     @param aLen
    55     @param aCopybuf
    56     */
    57     virtual void WriteL(TUint64 aPos, TDesC8& aCopybuf, TInt aLen) = 0;
    58 
    59     /**
    60     command to find the capacity of the media
    61 
    62     @param aCopybuf
    63     */
    64     virtual void GetCapacityL(TCapsInfo& aCapsInfo) = 0;
    65 
    66     /** unit testing */
    67     virtual void CreateSbcInterfaceL(TUint32 aBlockLen, TUint32 aLastLba) = 0;
    68 
    69 	virtual void DoScsiReadyCheckEventL() = 0;
    70 
    71     /**
    72     Media change notification
    73 
    74     @param aMessage
    75     */
    76 	virtual	void NotifyChange(const RMessage2& aMessage) = 0;
    77 
    78     /**
    79     Force notification to be sent
    80     */
    81     virtual void ForceCompleteNotifyChangeL() = 0;
    82     /**
    83     Force notification to be sent
    84     */
    85     virtual void CancelChangeNotifierL() = 0;
    86     /**
    87     Suspends the logical unit
    88     */
    89 	virtual void SuspendL() = 0;
    90     /**
    91     Resumes the logical unit
    92     */
    93 	virtual void ResumeL() = 0;
    94     /**
    95     Resets the media change and finalisation request status check timer
    96     */
    97 	virtual TBool IsConnected() = 0;
    98 
    99     /** Destructor */
   100     virtual ~MProtocol();
   101     };
   102 
   103 inline MProtocol::~MProtocol()
   104     {
   105     }
   106 
   107 /**
   108 Interface class to encode SCSI request into a byte stream
   109 */
   110 class MClientCommandServiceReq
   111     {
   112 public:
   113     /**
   114     Encode the command data into a byte stream.
   115 
   116     @param aBuffer Buffer to place the encoded data into
   117     @return TInt Length of the encoded data
   118     */
   119     virtual TInt EncodeRequestL(TDes8& aBuffer) const = 0;
   120     };
   121 
   122 
   123 /**
   124 Interface class to decode a SCSI response from byte stream into corresponding
   125 class
   126 */
   127 class MClientCommandServiceResp
   128     {
   129 public:
   130     /**
   131     Returns the length of the RESPONSE data stream.
   132 
   133     @return TInt Length in bytes
   134     */
   135     virtual TInt DataLength() const = 0;
   136 
   137     /**
   138     Decode data into RESPONSE structure of implementation class.
   139 
   140     @param aPtr Descriptor (byte stream) containing the data to be decoded
   141     */
   142     virtual void DecodeL(const TDesC8& aPtr) = 0;
   143     };
   144 
   145 
   146 #endif // MPROTOCOL_H
   147