|
1 // Copyright (c) 2005-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 // f32test\ext\t_testext.h |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __TEST_EXT_H__ |
|
19 #define __TEST_EXT_H__ |
|
20 |
|
21 #include <f32fsys.h> |
|
22 |
|
23 //#define TESTEXT_DEBUG |
|
24 |
|
25 #if (defined(_DEBUG) || defined(_DEBUG_RELEASE)) && defined(TESTEXT_DEBUG) |
|
26 #define __PRINT(t) {RDebug::Print(t);} |
|
27 #define __PRINT1(t,a) {RDebug::Print(t,a);} |
|
28 #define __PRINT2(t,a,b) {RDebug::Print(t,a,b);} |
|
29 #else |
|
30 #define __PRINT(t) |
|
31 #define __PRINT1(t,a) |
|
32 #define __PRINT2(t,a,b) |
|
33 #endif |
|
34 |
|
35 #define EExtCustom (KMaxTInt/2) |
|
36 |
|
37 |
|
38 /** |
|
39 This is the test proxy drive extension base class. |
|
40 Test proxy drives of specific file system should derive from this base class. |
|
41 @internalTechnology |
|
42 */ |
|
43 class CTestProxyDrive : public CBaseExtProxyDrive |
|
44 { |
|
45 public: |
|
46 enum TTestCmd |
|
47 { |
|
48 ESetEvent = EExtCustom, |
|
49 EMark, |
|
50 EUnmark, |
|
51 EUnmarkAll, |
|
52 EIsMarked, |
|
53 EDiskSize, |
|
54 ETestCmdEnd = EExtCustom + 100 |
|
55 }; |
|
56 enum TBadSectorEvent |
|
57 { |
|
58 ENone, ENext, EDeterministic, ERandom |
|
59 }; |
|
60 |
|
61 protected: |
|
62 CTestProxyDrive(CProxyDrive* aProxyDrive, CMountCB* aMount); |
|
63 virtual ~CTestProxyDrive(); |
|
64 |
|
65 public: |
|
66 // Derived functions from CBaseExtProxyDrive |
|
67 // Commented out because they are not changed. Sub-classes reimplement them |
|
68 // if interested. |
|
69 // virtual TInt Initialise(); |
|
70 // virtual TInt Dismounted(); |
|
71 // virtual TInt Enlarge(TInt aLength); |
|
72 // virtual TInt ReduceSize(TInt aPos, TInt aLength); |
|
73 // virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset,TInt aFlags); |
|
74 // virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset); |
|
75 // virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg); |
|
76 // virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags); |
|
77 // virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset); |
|
78 // virtual TInt Write(TInt64 aPos,const TDesC8& aSrc); |
|
79 // virtual TInt Caps(TDes8& anInfo); |
|
80 // virtual TInt Format(TFormatInfo& anInfo); |
|
81 // virtual TInt Format(TInt64 aPos,TInt aLength); |
|
82 // virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle); |
|
83 // virtual TInt ForceRemount(TUint aFlags=0); |
|
84 // virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword); |
|
85 // virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword); |
|
86 // virtual TInt Clear(TMediaPassword &aPassword); |
|
87 // virtual TInt ErasePassword(); |
|
88 virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2); |
|
89 virtual TInt GetLastErrorInfo(TDes8& aErrorInfo); |
|
90 |
|
91 protected: |
|
92 /** |
|
93 Return a pointer to a specified interface extension - to allow future extension of this class without breaking |
|
94 binary compatibility. |
|
95 @param aInterfaceId Interface identifier of the interface to be retrieved. |
|
96 @param aInterface A reference to a pointer that retrieves the specified interface. |
|
97 @param aInput An arbitrary input argument. |
|
98 @return KErrNone If the interface is supported, KErrNotSupported otherwise. |
|
99 */ |
|
100 // virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); |
|
101 |
|
102 protected: |
|
103 void InitL(); |
|
104 TInt SetEvent(TInt aType, TInt aValue); |
|
105 TInt Mark(TInt aSector); |
|
106 TInt Unmark(TInt aSector); |
|
107 TInt UnmarkAll(); |
|
108 TBool IsMarked(TInt aSector) const; |
|
109 TBool CheckEvent(TInt64 aPos, TInt aLength); |
|
110 virtual void DoInitL() = 0; |
|
111 virtual TBool DoCheckEvent(TInt64 aPos, TInt aLength) = 0; |
|
112 virtual TInt DoControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2) = 0; |
|
113 |
|
114 protected: |
|
115 CMountCB* iMount; // in CProxyDrive |
|
116 TUint8* iMap; |
|
117 TInt iTotalSectors; |
|
118 TBool iMountInitialised; |
|
119 TInt iEventType; |
|
120 TInt iCount; |
|
121 TInt iSuccessBytes; |
|
122 TErrorInfo::TReasonCode iLastErrorReason; |
|
123 }; |
|
124 |
|
125 #endif |