18 |
18 |
19 #ifndef CMEDIAMTPDATAPROVIDERENUMERATOR_H |
19 #ifndef CMEDIAMTPDATAPROVIDERENUMERATOR_H |
20 #define CMEDIAMTPDATAPROVIDERENUMERATOR_H |
20 #define CMEDIAMTPDATAPROVIDERENUMERATOR_H |
21 |
21 |
22 #include <e32base.h> |
22 #include <e32base.h> |
23 #include <d32dbms.h> |
|
24 |
|
25 #include "mmmtpenumerationcallback.h" |
23 #include "mmmtpenumerationcallback.h" |
26 #include "cmmmtpdpperflog.h" |
24 #include "cmmmtpdpperflog.h" |
27 |
25 |
28 // Forward declarations |
26 // Forward declarations |
29 class MMTPDataProviderFramework; |
27 class MMTPDataProviderFramework; |
30 class MMTPObjectMgr; |
|
31 class CMTPObjectMetaData; |
|
32 class CMediaMtpDataProvider; |
28 class CMediaMtpDataProvider; |
33 |
29 |
34 /** |
30 /** |
35 * Defines file enumerator. Enumerates all files/directories under a |
31 * Defines file enumerator. Enumerates all files/directories under a |
36 * specified path or storage |
32 * specified path or storage |
90 * Called when the enumeration is completed |
89 * Called when the enumeration is completed |
91 */ |
90 */ |
92 void SignalCompleteL( MMTPEnumerationCallback& aCallback, |
91 void SignalCompleteL( MMTPEnumerationCallback& aCallback, |
93 TInt aError = KErrNone ); |
92 TInt aError = KErrNone ); |
94 |
93 |
95 void ScanStorageL( TUint32 aStorageId ); |
|
96 |
|
97 /** |
|
98 * Scan next storage |
|
99 */ |
|
100 void ScanNextStorageL(); |
|
101 |
|
102 /** |
|
103 * Scans directory at aPath recursing into subdirectories on a depth |
|
104 * first basis. |
|
105 * |
|
106 * Directory entries are kept in iDirStack - which is a LIFO stack. |
|
107 * The current path, needed since TEntries don't keep track of it, |
|
108 * is kept in iPath. |
|
109 * |
|
110 * The algorithm works as follows: |
|
111 * |
|
112 * 1. Read directory entries. |
|
113 * 2. ProcessEntriesL is called if no error occurs and >= 1 entries are |
|
114 * read. |
|
115 * 3. ProcessEntriesL adds entries to database, if entry is directory |
|
116 * add to iDirStack. |
|
117 * 4. When all entries are processed pop entry off the dirstack, |
|
118 * if entry is empty TEntry remove one directory from iPath. |
|
119 * 5. Append entry name onto iPath - to update path with new depth |
|
120 * (parent/subdir). |
|
121 * 6. Push an empty TEntry onto iDirStack - this tells us we have |
|
122 * recursed one, think of it as pushing the '\' separator onto |
|
123 * iDirStack. |
|
124 * 7. Repeat 1-7 until iDirStack is empty. |
|
125 */ |
|
126 void ScanDirL(); |
|
127 |
|
128 /** |
|
129 * Recurse into the next directory on the stack |
|
130 * and scan it for entries. |
|
131 */ |
|
132 void ScanNextDirL(); |
|
133 |
|
134 /** |
|
135 * Scan next sub dir |
|
136 */ |
|
137 void ScanNextSubdirL(); |
|
138 |
|
139 /** |
|
140 * Iterates iEntries adding entries as needed to object manager and |
|
141 * iDirStack. |
|
142 */ |
|
143 void ProcessEntriesL(); |
|
144 |
|
145 /** |
|
146 * Add a file entry to the object store |
|
147 * @param aFullFileName current scanned file path |
|
148 */ |
|
149 void AddEntryL( const TDesC& aFullFileName ); |
|
150 |
|
151 /** |
|
152 * Returns a TMTPFormatCode for the requested object |
|
153 */ |
|
154 TMTPFormatCode GetObjectFormatCode( const TDesC& aFullFileName ); |
|
155 |
|
156 /** |
|
157 * @param aFullFileName the object file name |
|
158 * @return the file if needed to be enumeratored? |
|
159 */ |
|
160 TBool IsFileAccepted( const TDesC& aFullFileName ); |
|
161 |
|
162 /** |
|
163 * start count system tick |
|
164 */ |
|
165 void StartEnumerationCount(); |
|
166 |
|
167 /** |
|
168 * check if the system tick more than predefined value |
|
169 * @retuan if more than the predefined value, return true |
|
170 * else return false |
|
171 */ |
|
172 TBool IsOverThreshold(); |
|
173 |
|
174 /** |
94 /** |
175 * Get modified content and report to Symbian MTP Framework |
95 * Get modified content and report to Symbian MTP Framework |
176 */ |
96 */ |
177 void GetModifiedContentL( const TDesC& aStorageRoot ); |
97 void GetModifiedContentL( const TDesC& aStorageRoot ); |
178 |
98 |
179 private: |
99 private: |
180 // Owned |
100 // Owned |
181 /** MMTPDataProviderFramework used to access MTP components*/ |
101 /** MMTPDataProviderFramework used to access MTP components*/ |
182 MMTPDataProviderFramework& iFramework; |
102 MMTPDataProviderFramework& iFramework; |
183 |
103 |
184 /** MTP Object Manager */ |
|
185 MMTPObjectMgr& iObjectMgr; |
|
186 |
|
187 /** MTP Data Provider ID */ |
|
188 TUint iDataProviderId; |
|
189 |
|
190 CMediaMtpDataProvider& iDataProvider; |
104 CMediaMtpDataProvider& iDataProvider; |
191 TParse iPath; |
|
192 RDir iDir; |
|
193 TEntryArray iEntries; |
|
194 TInt iFirstUnprocessed; |
|
195 RPointerArray<TEntry> iDirStack; |
|
196 RArray<TUint> iStorages; |
105 RArray<TUint> iStorages; |
197 TUint32 iStorageId; |
106 TUint32 iStorageId; |
198 TUint32 iParentHandle; |
|
199 TMTPFormatCode iFormatCode; |
|
200 TBool iScanningDir; |
|
201 |
|
202 // record the system tick |
|
203 TUint iTickCountBegin; |
|
204 TInt iTickPeriod; |
|
205 |
107 |
206 #if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) |
108 #if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) |
207 CMmMtpDpPerfLog* iPerfLog; |
109 CMmMtpDpPerfLog* iPerfLog; |
208 #endif |
110 #endif |
209 |
111 |