sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // protocol.h sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #ifndef MPROTOCOL_H sl@0: #define MPROTOCOL_H sl@0: sl@0: class MTransport; sl@0: struct TCapsInfo; sl@0: sl@0: /** sl@0: Interface class to control a Mass Storage device sl@0: */ sl@0: class MProtocol sl@0: { sl@0: public: sl@0: /** Command to initialise LUN */ sl@0: virtual void InitialiseUnitL() = 0; sl@0: sl@0: /** Command to uninitialise the LUN */ sl@0: virtual void UninitialiseUnitL() = 0; sl@0: sl@0: /** sl@0: Command to read the media. sl@0: sl@0: @param aPos sl@0: @param aLen sl@0: @param aCopybuf sl@0: */ sl@0: virtual void ReadL(TUint64 aPos, TDes8& aCopybuf, TInt aLen) = 0; sl@0: sl@0: /** sl@0: Command to write to the media. sl@0: sl@0: @param aPos sl@0: @param aLen sl@0: @param aCopybuf sl@0: */ sl@0: virtual void WriteL(TUint64 aPos, TDesC8& aCopybuf, TInt aLen) = 0; sl@0: sl@0: /** sl@0: command to find the capacity of the media sl@0: sl@0: @param aCopybuf sl@0: */ sl@0: virtual void GetCapacityL(TCapsInfo& aCapsInfo) = 0; sl@0: sl@0: /** unit testing */ sl@0: virtual void CreateSbcInterfaceL(TUint32 aBlockLen, TUint32 aLastLba) = 0; sl@0: sl@0: virtual void DoScsiReadyCheckEventL() = 0; sl@0: sl@0: /** sl@0: Media change notification sl@0: sl@0: @param aMessage sl@0: */ sl@0: virtual void NotifyChange(const RMessage2& aMessage) = 0; sl@0: sl@0: /** sl@0: Force notification to be sent sl@0: */ sl@0: virtual void ForceCompleteNotifyChangeL() = 0; sl@0: /** sl@0: Force notification to be sent sl@0: */ sl@0: virtual void CancelChangeNotifierL() = 0; sl@0: /** sl@0: Suspends the logical unit sl@0: */ sl@0: virtual void SuspendL() = 0; sl@0: /** sl@0: Resumes the logical unit sl@0: */ sl@0: virtual void ResumeL() = 0; sl@0: /** sl@0: Resets the media change and finalisation request status check timer sl@0: */ sl@0: virtual TBool IsConnected() = 0; sl@0: sl@0: /** Destructor */ sl@0: virtual ~MProtocol(); sl@0: }; sl@0: sl@0: inline MProtocol::~MProtocol() sl@0: { sl@0: } sl@0: sl@0: /** sl@0: Interface class to encode SCSI request into a byte stream sl@0: */ sl@0: class MClientCommandServiceReq sl@0: { sl@0: public: sl@0: /** sl@0: Encode the command data into a byte stream. sl@0: sl@0: @param aBuffer Buffer to place the encoded data into sl@0: @return TInt Length of the encoded data sl@0: */ sl@0: virtual TInt EncodeRequestL(TDes8& aBuffer) const = 0; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Interface class to decode a SCSI response from byte stream into corresponding sl@0: class sl@0: */ sl@0: class MClientCommandServiceResp sl@0: { sl@0: public: sl@0: /** sl@0: Returns the length of the RESPONSE data stream. sl@0: sl@0: @return TInt Length in bytes sl@0: */ sl@0: virtual TInt DataLength() const = 0; sl@0: sl@0: /** sl@0: Decode data into RESPONSE structure of implementation class. sl@0: sl@0: @param aPtr Descriptor (byte stream) containing the data to be decoded sl@0: */ sl@0: virtual void DecodeL(const TDesC8& aPtr) = 0; sl@0: }; sl@0: sl@0: sl@0: #endif // MPROTOCOL_H sl@0: