|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Scans metadata for new files, updated files |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMPXMETADATASCANNER_H |
|
20 #define CMPXMETADATASCANNER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 class CMPXMedia; |
|
25 class CMPXMediaArray; |
|
26 class CMPXCollectionType; |
|
27 class CMPXMetadataExtractor; |
|
28 class MMPXMetadataScanObserver; |
|
29 class MMPXFileScanStateObserver; |
|
30 |
|
31 enum TExtractType |
|
32 { |
|
33 ENewFiles = 0, |
|
34 EModFiles = 1, |
|
35 EMaxFile = 2 |
|
36 }; |
|
37 /** |
|
38 * CMPXMetadataScanner |
|
39 * |
|
40 * Extracts metadata from a list of files |
|
41 * |
|
42 * @lib mpxfilehandler.lib |
|
43 * @since S60 3.0 |
|
44 */ |
|
45 NONSHARABLE_CLASS( CMPXMetadataScanner ): public CActive |
|
46 { |
|
47 public: |
|
48 |
|
49 /** |
|
50 * Two phased constructor |
|
51 * @param aFs file server session |
|
52 * @param aAppArc apparc session |
|
53 * @param aTypesAry supported file types array |
|
54 * @param aObs metadata scanning observer |
|
55 * @param aStateObs scanning state observer |
|
56 * @return new instance of CMPXMetadataScanner |
|
57 */ |
|
58 static CMPXMetadataScanner* NewL( RFs& aFs, |
|
59 RApaLsSession& aAppArc, |
|
60 RPointerArray<CMPXCollectionType>& aTypesAry, |
|
61 MMPXMetadataScanObserver& aObs, |
|
62 MMPXFileScanStateObserver& aStateObs ); |
|
63 |
|
64 /** |
|
65 * Two phased constructor |
|
66 * @param aFs file server session |
|
67 * @param aAppArc apparc session |
|
68 * @param aTypesAry supported file types array |
|
69 * @param aObs metadata scanning observer |
|
70 * @param aStateObs scanning state observer |
|
71 * @return new instance of CMPXMetadataScanner |
|
72 */ |
|
73 static CMPXMetadataScanner* NewLC( RFs& aFs, |
|
74 RApaLsSession& aAppArc, |
|
75 RPointerArray<CMPXCollectionType>& aTypesAry, |
|
76 MMPXMetadataScanObserver& aObs, |
|
77 MMPXFileScanStateObserver& aStateObs ); |
|
78 |
|
79 /** |
|
80 * Virtual destructor |
|
81 */ |
|
82 virtual ~CMPXMetadataScanner(); |
|
83 |
|
84 public: // New Functions |
|
85 |
|
86 /** |
|
87 * Frees all memory allocated |
|
88 */ |
|
89 void Reset(); |
|
90 |
|
91 /** |
|
92 * Extracts metadata for the files in the file list |
|
93 */ |
|
94 void Start(); |
|
95 |
|
96 /** |
|
97 * Stops extraction of metadata for the files in the file list |
|
98 */ |
|
99 void Stop(); |
|
100 |
|
101 /** |
|
102 * Adds a new file to the scanning list |
|
103 * @param aFile file path to add to scan |
|
104 */ |
|
105 void AddNewFileToScanL( const TDesC& aFile ); |
|
106 |
|
107 /** |
|
108 * Adds a modified file to the scanning list |
|
109 * @param aFile file path to add to scan |
|
110 */ |
|
111 void AddModifiedFileToScanL( const TDesC& aFile ); |
|
112 |
|
113 /** |
|
114 * Extract the Media properties for a file |
|
115 * @param aFile file path to extract metadata |
|
116 * @return CMPXMedia* media for the file, ownership transferred |
|
117 */ |
|
118 CMPXMedia* ExtractFileL( const TDesC& aFile ); |
|
119 |
|
120 protected: // From base class |
|
121 |
|
122 /** |
|
123 * From CActive |
|
124 */ |
|
125 void DoCancel(); |
|
126 |
|
127 /** |
|
128 * From CActive |
|
129 */ |
|
130 void RunL(); |
|
131 |
|
132 private: // New Functions |
|
133 |
|
134 /** |
|
135 * Extract metadata from a few files |
|
136 * @return ETrue if there are no more files to extract |
|
137 * EFalse otherwise |
|
138 */ |
|
139 TBool DoExtractL(); |
|
140 |
|
141 private: |
|
142 |
|
143 /** |
|
144 * Private Constructor |
|
145 * @param aObs metadata scanning observer |
|
146 * @param aStateObs scanning state observer |
|
147 */ |
|
148 CMPXMetadataScanner( MMPXMetadataScanObserver& aObs, |
|
149 MMPXFileScanStateObserver& aStateObs ); |
|
150 |
|
151 /** |
|
152 * 2nd phase constructor |
|
153 * @param aAppArc apparc session |
|
154 * @param aTypesAry supported file types array |
|
155 */ |
|
156 void ConstructL( RFs& aFs, RApaLsSession& aAppArc, |
|
157 RPointerArray<CMPXCollectionType>& aTypesAry ); |
|
158 |
|
159 private: // data |
|
160 RPointerArray<HBufC> iNewFiles; |
|
161 RPointerArray<HBufC> iModifiedFiles; |
|
162 |
|
163 CMPXMediaArray* iNewFileProps; |
|
164 CMPXMediaArray* iModifiedFileProps; |
|
165 |
|
166 TBool iExtracting; // Are we extracting |
|
167 TInt iExtractType; // What are we extracting |
|
168 TInt iAryPos; // Current array position |
|
169 |
|
170 CMPXMetadataExtractor* iExtractor; // Metadata Utilities wrapper |
|
171 |
|
172 MMPXMetadataScanObserver& iObserver; |
|
173 MMPXFileScanStateObserver& iStateObserver; |
|
174 }; |
|
175 |
|
176 #endif // CMPXMETADATASCANNER_H |