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