|
1 /* |
|
2 * Copyright (c) 2007 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: PCS Server Plugin Interface |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "CPcsPluginInterface.h" |
|
21 #include "CPcsPlugin.h" |
|
22 #include "CPcsDebug.h" |
|
23 |
|
24 // ============================== MEMBER FUNCTIONS ============================ |
|
25 |
|
26 // ---------------------------------------------------------------------------- |
|
27 // CPcsPluginInterface::NewL |
|
28 // Two Phase Construction |
|
29 // ---------------------------------------------------------------------------- |
|
30 CPcsPluginInterface* CPcsPluginInterface::NewL() |
|
31 { |
|
32 PRINT ( _L("Enter CPcsPluginInterface::NewL") ); |
|
33 |
|
34 CPcsPluginInterface* self = CPcsPluginInterface::NewLC(); |
|
35 CleanupStack::Pop( self ); |
|
36 |
|
37 PRINT ( _L("End CPcsPluginInterface::NewL") ); |
|
38 |
|
39 return self; |
|
40 } |
|
41 |
|
42 // ---------------------------------------------------------------------------- |
|
43 // CPcsPluginInterface::NewLC |
|
44 // Two Phase Construction |
|
45 // ---------------------------------------------------------------------------- |
|
46 CPcsPluginInterface* CPcsPluginInterface::NewLC() |
|
47 { |
|
48 PRINT ( _L("Enter CPcsPluginInterface::NewLC") ); |
|
49 |
|
50 CPcsPluginInterface* self = new( ELeave ) CPcsPluginInterface(); |
|
51 CleanupStack::PushL( self ); |
|
52 self->ConstructL(); |
|
53 |
|
54 PRINT ( _L("End CPcsPluginInterface::NewLC") ); |
|
55 |
|
56 return self; |
|
57 } |
|
58 |
|
59 // ---------------------------------------------------------------------------- |
|
60 // CPcsPluginInterface::CPcsPluginInterface |
|
61 // Constructor |
|
62 // ---------------------------------------------------------------------------- |
|
63 CPcsPluginInterface::CPcsPluginInterface() |
|
64 { |
|
65 PRINT ( _L("Enter CPcsPluginInterface::CPcsPluginInterface") ); |
|
66 PRINT ( _L("End CPcsPluginInterface::CPcsPluginInterface") ); |
|
67 } |
|
68 |
|
69 // ---------------------------------------------------------------------------- |
|
70 // CPcsPluginInterface::ConstructL |
|
71 // 2nd phase constructor |
|
72 // ---------------------------------------------------------------------------- |
|
73 void CPcsPluginInterface::ConstructL() |
|
74 { |
|
75 PRINT ( _L("Enter CPcsPluginInterface::ConstructL") ); |
|
76 PRINT ( _L("End CPcsPluginInterface::ConstructL") ); |
|
77 } |
|
78 |
|
79 // ---------------------------------------------------------------------------- |
|
80 // CPcsPluginInterface::~CPcsPluginInterface |
|
81 // Constructor |
|
82 // ---------------------------------------------------------------------------- |
|
83 CPcsPluginInterface::~CPcsPluginInterface( ) |
|
84 { |
|
85 PRINT ( _L("Enter CPcsPluginInterface::~CPcsPluginInterface") ); |
|
86 |
|
87 UnloadPlugIns(); |
|
88 iPcsPluginInstances.ResetAndDestroy(); |
|
89 |
|
90 PRINT ( _L("End CPcsPluginInterface::~CPcsPluginInterface") ); |
|
91 } |
|
92 |
|
93 // ---------------------------------------------------------------------------- |
|
94 // CPcsPluginInterface::InstantiateAllPlugInsL |
|
95 // Instantiates all plugins |
|
96 // ---------------------------------------------------------------------------- |
|
97 void CPcsPluginInterface::InstantiateAlgorithmL( TDes& aAlgorithm ) |
|
98 { |
|
99 PRINT ( _L("Enter CPcsPluginInterface::InstantiateAlgorithmL") ); |
|
100 |
|
101 RImplInfoPtrArray infoArray; |
|
102 |
|
103 // Get list of all implementations |
|
104 ListAllImplementationsL( infoArray ); |
|
105 |
|
106 // Instantiate plugins for all impUIds by calling |
|
107 // InstantiatePlugInFromImpUidL |
|
108 for ( TInt i=0; i<infoArray.Count(); i++ ) |
|
109 { |
|
110 // Get imp info |
|
111 CImplementationInformation& info( *infoArray[i] ); |
|
112 |
|
113 if ( info.DisplayName() == aAlgorithm ) |
|
114 { |
|
115 // Get imp UID |
|
116 TUid impUid ( info.ImplementationUid() ); |
|
117 |
|
118 PRINT ( _L("------------- PCS Algorithm Details -----------")); |
|
119 PRINT1 ( _L("Name: %S"), &(info.DisplayName()) ); |
|
120 PRINT1 ( _L("UID: %X"), impUid.iUid ); |
|
121 iAlgorithmInUse.iUid = impUid.iUid; |
|
122 PRINT ( _L("-----------------------------------------------")); |
|
123 |
|
124 CPcsPlugin* searchPlugin = NULL; |
|
125 |
|
126 //instantiate plugin for impUid |
|
127 searchPlugin = InstantiatePlugInFromImpUidL( impUid ); |
|
128 if ( searchPlugin ) |
|
129 { |
|
130 iPcsPluginInstances.AppendL( searchPlugin ); |
|
131 } |
|
132 |
|
133 break; |
|
134 } |
|
135 } |
|
136 |
|
137 infoArray.ResetAndDestroy(); |
|
138 |
|
139 PRINT ( _L("End CPcsPluginInterface::InstantiateAlgorithmL") ); |
|
140 } |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // CPcsPluginInterface::UnloadPlugIns |
|
144 // Unloads plugins |
|
145 // ----------------------------------------------------------------------------- |
|
146 void CPcsPluginInterface::UnloadPlugIns() |
|
147 { |
|
148 PRINT ( _L("Enter CPcsPluginInterface::UnloadPlugIns") ); |
|
149 |
|
150 REComSession::FinalClose(); |
|
151 |
|
152 PRINT ( _L("End CPcsPluginInterface::UnloadPlugIns") ); |
|
153 } |
|
154 |
|
155 // ---------------------------------------------------------------------------- |
|
156 // CPcsPluginInterface::InstantiatePlugInFromImpUidL |
|
157 // Instantiates plugin |
|
158 // ---------------------------------------------------------------------------- |
|
159 CPcsPlugin* CPcsPluginInterface::InstantiatePlugInFromImpUidL( const TUid& aImpUid ) |
|
160 { |
|
161 PRINT ( _L("Enter CPcsPluginInterface::InstantiatePlugInFromImpUidL") ); |
|
162 |
|
163 CPcsPlugin* search = CPcsPlugin::NewL(aImpUid); |
|
164 |
|
165 PRINT ( _L("End CPcsPluginInterface::InstantiatePlugInFromImpUidL") ); |
|
166 |
|
167 return search; |
|
168 } |
|
169 |
|
170 |
|
171 // ---------------------------------------------------------------------------- |
|
172 // CPcsPluginInterface::PerformSearchL |
|
173 // Search |
|
174 // ---------------------------------------------------------------------------- |
|
175 void CPcsPluginInterface::PerformSearchL(CPsSettings& aSettings, |
|
176 CPsQuery& aCondition, |
|
177 RPointerArray<CPsClientData>& aPsData, |
|
178 RPointerArray<CPsPattern>& aPattern) |
|
179 { |
|
180 PRINT ( _L("Enter CPcsPluginInterface::PerformSearchL") ); |
|
181 |
|
182 for ( TInt idx = 0; idx < iPcsPluginInstances.Count(); idx++ ) |
|
183 { |
|
184 iPcsPluginInstances[idx]->PerformSearchL( aSettings, |
|
185 aCondition, |
|
186 aPsData, |
|
187 aPattern ); |
|
188 } |
|
189 |
|
190 PRINT ( _L("End CPcsPluginInterface::PerformSearchL") ); |
|
191 } |
|
192 |
|
193 // ---------------------------------------------------------------------------- |
|
194 // CPcsPluginInterface::SearchInputL |
|
195 // Search |
|
196 // ---------------------------------------------------------------------------- |
|
197 void CPcsPluginInterface::SearchInputL(CPsQuery& aSearchQuery, |
|
198 TDesC& aSearchData, |
|
199 RPointerArray<TDesC>& aMatchSet, |
|
200 RArray<TPsMatchLocation>& aMatchLocation) |
|
201 { |
|
202 PRINT ( _L("Enter CPcsPluginInterface::SearchInputL") ); |
|
203 |
|
204 for ( TInt idx = 0; idx < iPcsPluginInstances.Count(); idx++ ) |
|
205 { |
|
206 iPcsPluginInstances[idx]->SearchInputL( aSearchQuery, |
|
207 aSearchData, |
|
208 aMatchSet, |
|
209 aMatchLocation ); |
|
210 } |
|
211 |
|
212 PRINT ( _L("End CPcsPluginInterface::SearchInputL") ); |
|
213 } |
|
214 |
|
215 // ---------------------------------------------------------------------------- |
|
216 // CPcsPluginInterface::SearchMatchStringL |
|
217 // Search |
|
218 // ---------------------------------------------------------------------------- |
|
219 void CPcsPluginInterface::SearchMatchStringL(CPsQuery& aSearchQuery, |
|
220 TDesC& aSearchData, |
|
221 TDes& aMatch ) |
|
222 { |
|
223 PRINT ( _L("Enter CPcsPluginInterface::SearchMatchStringL") ); |
|
224 |
|
225 for ( TInt idx = 0; idx < iPcsPluginInstances.Count(); idx++ ) |
|
226 { |
|
227 iPcsPluginInstances[idx]->SearchMatchStringL( aSearchQuery, |
|
228 aSearchData, |
|
229 aMatch ); |
|
230 } |
|
231 |
|
232 PRINT ( _L("End CPcsPluginInterface::SearchMatchStringL") ); |
|
233 } |
|
234 |
|
235 // ---------------------------------------------------------------------------- |
|
236 // CPcsPluginInterface::IsLanguageSupported |
|
237 // |
|
238 // ---------------------------------------------------------------------------- |
|
239 TBool CPcsPluginInterface::IsLanguageSupportedL(const TUint32 aLanguage) |
|
240 { |
|
241 return(iPcsPluginInstances[0]->IsLanguageSupportedL(aLanguage)); |
|
242 } |
|
243 |
|
244 // ---------------------------------------------------------------------------- |
|
245 // CPcsPluginInterface::GetDataOrderL |
|
246 // |
|
247 // ---------------------------------------------------------------------------- |
|
248 void CPcsPluginInterface::GetDataOrderL(TDesC& aURI, RArray<TInt>& aDataOrder) |
|
249 { |
|
250 return(iPcsPluginInstances[0]->GetDataOrderL(aURI, aDataOrder)); |
|
251 } |
|
252 |
|
253 // ---------------------------------------------------------------------------- |
|
254 // CPcsPluginInterface::GetSortOrderL |
|
255 // |
|
256 // ---------------------------------------------------------------------------- |
|
257 void CPcsPluginInterface::GetSortOrderL(TDesC& aURI, RArray<TInt>& aSortOrder) |
|
258 { |
|
259 return(iPcsPluginInstances[0]->GetSortOrderL(aURI, aSortOrder)); |
|
260 } |
|
261 |
|
262 // ---------------------------------------------------------------------------- |
|
263 // CPcsPluginInterface::ChangeSortOrderL |
|
264 // |
|
265 // ---------------------------------------------------------------------------- |
|
266 void CPcsPluginInterface::ChangeSortOrderL(TDesC& aURI, RArray<TInt>& aSortOrder) |
|
267 { |
|
268 return(iPcsPluginInstances[0]->ChangeSortOrderL(aURI, aSortOrder)); |
|
269 } |
|
270 // End of file |