sl@0: // Copyright (c) 2005-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: // f32test\ext\t_testext.h sl@0: // sl@0: // sl@0: sl@0: #ifndef __TEST_EXT_H__ sl@0: #define __TEST_EXT_H__ sl@0: sl@0: #include sl@0: sl@0: //#define TESTEXT_DEBUG sl@0: sl@0: #if (defined(_DEBUG) || defined(_DEBUG_RELEASE)) && defined(TESTEXT_DEBUG) sl@0: #define __PRINT(t) {RDebug::Print(t);} sl@0: #define __PRINT1(t,a) {RDebug::Print(t,a);} sl@0: #define __PRINT2(t,a,b) {RDebug::Print(t,a,b);} sl@0: #else sl@0: #define __PRINT(t) sl@0: #define __PRINT1(t,a) sl@0: #define __PRINT2(t,a,b) sl@0: #endif sl@0: sl@0: #define EExtCustom (KMaxTInt/2) sl@0: sl@0: sl@0: /** sl@0: This is the test proxy drive extension base class. sl@0: Test proxy drives of specific file system should derive from this base class. sl@0: @internalTechnology sl@0: */ sl@0: class CTestProxyDrive : public CBaseExtProxyDrive sl@0: { sl@0: public: sl@0: enum TTestCmd sl@0: { sl@0: ESetEvent = EExtCustom, sl@0: EMark, sl@0: EUnmark, sl@0: EUnmarkAll, sl@0: EIsMarked, sl@0: EDiskSize, sl@0: ETestCmdEnd = EExtCustom + 100 sl@0: }; sl@0: enum TBadSectorEvent sl@0: { sl@0: ENone, ENext, EDeterministic, ERandom sl@0: }; sl@0: sl@0: protected: sl@0: CTestProxyDrive(CProxyDrive* aProxyDrive, CMountCB* aMount); sl@0: virtual ~CTestProxyDrive(); sl@0: sl@0: public: sl@0: // Derived functions from CBaseExtProxyDrive sl@0: // Commented out because they are not changed. Sub-classes reimplement them sl@0: // if interested. sl@0: // virtual TInt Initialise(); sl@0: // virtual TInt Dismounted(); sl@0: // virtual TInt Enlarge(TInt aLength); sl@0: // virtual TInt ReduceSize(TInt aPos, TInt aLength); sl@0: // virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset,TInt aFlags); sl@0: // virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset); sl@0: // virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg); sl@0: // virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags); sl@0: // virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset); sl@0: // virtual TInt Write(TInt64 aPos,const TDesC8& aSrc); sl@0: // virtual TInt Caps(TDes8& anInfo); sl@0: // virtual TInt Format(TFormatInfo& anInfo); sl@0: // virtual TInt Format(TInt64 aPos,TInt aLength); sl@0: // virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle); sl@0: // virtual TInt ForceRemount(TUint aFlags=0); sl@0: // virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword); sl@0: // virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword); sl@0: // virtual TInt Clear(TMediaPassword &aPassword); sl@0: // virtual TInt ErasePassword(); sl@0: virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2); sl@0: virtual TInt GetLastErrorInfo(TDes8& aErrorInfo); sl@0: sl@0: protected: sl@0: /** sl@0: Return a pointer to a specified interface extension - to allow future extension of this class without breaking sl@0: binary compatibility. sl@0: @param aInterfaceId Interface identifier of the interface to be retrieved. sl@0: @param aInterface A reference to a pointer that retrieves the specified interface. sl@0: @param aInput An arbitrary input argument. sl@0: @return KErrNone If the interface is supported, KErrNotSupported otherwise. sl@0: */ sl@0: // virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); sl@0: sl@0: protected: sl@0: void InitL(); sl@0: TInt SetEvent(TInt aType, TInt aValue); sl@0: TInt Mark(TInt aSector); sl@0: TInt Unmark(TInt aSector); sl@0: TInt UnmarkAll(); sl@0: TBool IsMarked(TInt aSector) const; sl@0: TBool CheckEvent(TInt64 aPos, TInt aLength); sl@0: virtual void DoInitL() = 0; sl@0: virtual TBool DoCheckEvent(TInt64 aPos, TInt aLength) = 0; sl@0: virtual TInt DoControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2) = 0; sl@0: sl@0: protected: sl@0: CMountCB* iMount; // in CProxyDrive sl@0: TUint8* iMap; sl@0: TInt iTotalSectors; sl@0: TBool iMountInitialised; sl@0: TInt iEventType; sl@0: TInt iCount; sl@0: TInt iSuccessBytes; sl@0: TErrorInfo::TReasonCode iLastErrorReason; sl@0: }; sl@0: sl@0: #endif