|
1 /* |
|
2 * Copyright (c) 2010 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: Indexer utility create indexes for each drive |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPIXINDERUTILS_H_ |
|
20 #define CPIXINDERUTILS_H_ |
|
21 #include <e32base.h> |
|
22 #include <f32file.h> |
|
23 #include <rsearchserversession.h> |
|
24 |
|
25 //Forward declaration |
|
26 class CCPixIndexer; |
|
27 |
|
28 NONSHARABLE_CLASS(CCPixIndexerUtils) : public CBase |
|
29 { |
|
30 public: |
|
31 /* |
|
32 * Constructrion |
|
33 * @param RSearchServerSession& aSession valid search session |
|
34 * @return instance of Indexer util |
|
35 */ |
|
36 static CCPixIndexerUtils* NewL(RSearchServerSession& aSession); |
|
37 /* |
|
38 * Constructrion |
|
39 * @param RSearchServerSession& aSession valid search session |
|
40 * @return instance of Indexer util |
|
41 */ |
|
42 static CCPixIndexerUtils* NewLC(RSearchServerSession& aSession); |
|
43 /* |
|
44 * Destruction |
|
45 */ |
|
46 virtual ~CCPixIndexerUtils(); |
|
47 /* |
|
48 * Mount all available drives |
|
49 * TDesC& aBaseAppClassGeneric generic base app class |
|
50 * TDesC& aPath path of database e.g. \\root\\media\\audio |
|
51 */ |
|
52 void MountAllAvailableDriveL(const TDesC& aBaseAppClassGeneric,const TDesC& aPath); |
|
53 /* |
|
54 * Unmount all available drives |
|
55 * TDesC& aBaseAppClassGeneric generic base app class |
|
56 * TBool aUndefine needs to be undefined or not |
|
57 */ |
|
58 void UnMountAllDrivesL(const TDesC& aBaseAppClassGeneric,TBool aUndefine = EFalse); |
|
59 /* |
|
60 * Mount drive |
|
61 * TDriveNumber aMedia drive to be mounted |
|
62 * TDesC& aBaseAppClassGeneric generic base app class |
|
63 * TDesC& aPath path of database |
|
64 */ |
|
65 void MountDriveL(TDriveNumber aMedia,const TDesC& aBaseAppClassGeneric,const TDesC& aPath); |
|
66 /* |
|
67 * UnMount drive |
|
68 * TDriveNumber aMedia drive to be mounted |
|
69 * TDesC& aBaseAppClassGeneric generic base app class |
|
70 * TBool aUndefine needs to be undefined or not |
|
71 */ |
|
72 void UnMountDriveL(TDriveNumber aMedia,const TDesC& aBaseAppClassGeneric,TBool aUndefine = EFalse); |
|
73 /* |
|
74 * Checks Media is removable or not |
|
75 * TDriveNumber& aDrive drive to check |
|
76 * @return ETrue if removable else EFalse |
|
77 */ |
|
78 TBool IsMediaRemovableL(const TDriveNumber& aDrive); |
|
79 /* |
|
80 * Checks drive can be mounted not |
|
81 * TDriveNumber aDrive drive to check |
|
82 * @return ETrue if mountable else EFalse |
|
83 */ |
|
84 TBool IsDriveCanbeMountedL(TDriveNumber aDrive); |
|
85 /* |
|
86 * Get Indexer for drive |
|
87 * TDriveNumber aDrive drive to check |
|
88 * @return instance of CCPixIndexer* ownership not passed |
|
89 */ |
|
90 CCPixIndexer* GetIndexerFromDrive(TDriveNumber aMedia); |
|
91 /* |
|
92 * Get Indexer From media Id |
|
93 * TUint aUniqueID media Id |
|
94 * @return instance of CCPixIndexer* ownership not passed |
|
95 */ |
|
96 CCPixIndexer* GetIndexerFromMediaId(TUint aUniqueID); |
|
97 /* |
|
98 * Checks if Drive already mounted |
|
99 * TDriveNumber aMedia |
|
100 * @return ETrue if mounted else EFalse |
|
101 */ |
|
102 TBool IsAlreadyAvilable(TDriveNumber aMedia); |
|
103 /* |
|
104 * Reset all indexes |
|
105 */ |
|
106 void ResetAllL(); |
|
107 /* |
|
108 * Get array of all mounted drives |
|
109 * @return array of mounted drives |
|
110 */ |
|
111 RArray<TDriveNumber>& GetMountedDriveList(); |
|
112 /* |
|
113 * Internale method GetDrive from media Id |
|
114 * @param TUint aUniqueID media Id |
|
115 * TDriveNumber& drive number in return |
|
116 */ |
|
117 void GetDriveFromMediaId(TUint aUniqueID,TDriveNumber&); |
|
118 private: |
|
119 /* |
|
120 * Default constructor |
|
121 */ |
|
122 CCPixIndexerUtils(); |
|
123 /* |
|
124 * Second phase constructor |
|
125 */ |
|
126 void ConstructL(RSearchServerSession& aSession); |
|
127 /* |
|
128 * Form base app class for media |
|
129 * @param TDriveNumber aMedia media drive |
|
130 * @param TDesC& aBaseAppClassGeneric base app class |
|
131 * @param TDes& aBaseAppClass generated value of base app class |
|
132 * @return KErrNone on success else error |
|
133 */ |
|
134 TInt FormBaseAppClass(TDriveNumber aMedia, const TDesC& aBaseAppClassGeneric, TDes& aBaseAppClass); |
|
135 /* |
|
136 * Database path for drive |
|
137 * @param TDriveNumber aMedia media drive |
|
138 * @param TDesC& aPath path of database |
|
139 * @return database path generated |
|
140 */ |
|
141 HBufC* DatabasePathLC(TDriveNumber aMedia,const TDesC& aPath); |
|
142 /* |
|
143 * Remove unmounted drive from Mounted list |
|
144 * @param TDriveNumber aMedia drive |
|
145 */ |
|
146 void RemoveUnmountedDrive(TDriveNumber aMedia); |
|
147 private: |
|
148 RArray<TDriveNumber> iMountedDrives; //Array of mounted drives |
|
149 CCPixIndexer *iIndexer[EDriveZ + 1];//Array of all Indexers |
|
150 RFs iFs; //File session |
|
151 RSearchServerSession iSearchSession; //Search session |
|
152 }; |
|
153 |
|
154 #endif /* CPIXINDERUTILS_H_ */ |