|
1 // Copyright (c) 2006-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 "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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalTechnology |
|
19 */ |
|
20 |
|
21 #ifndef CMTPDATAPROVIDERCONTROLLER_H |
|
22 #define CMTPDATAPROVIDERCONTROLLER_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <ecom/ecom.h> |
|
26 #include <mtp/mtpdataproviderapitypes.h> |
|
27 |
|
28 #include "rmtpframework.h" |
|
29 #include "mtpdebug.h" |
|
30 #include <swi/sisregistrysession.h> |
|
31 #include <swi/sisregistryentry.h> |
|
32 #include <swi/sisregistrypackage.h> |
|
33 |
|
34 |
|
35 class CMTPDataProvider; |
|
36 class CMTPDataProviderConfig; |
|
37 |
|
38 /** |
|
39 Implements the MTP framework data provider controller singleton. This is a |
|
40 container class responsible for loading, storing, and managing |
|
41 @see CMTPDataProviderPlugin instances and their associated |
|
42 @see CMTPDataProvider bindings. The ECOM framework is used to load data |
|
43 @see CMTPDataProviderPlugin instances when instructed to do so by the MTP |
|
44 framework, either on start-up or when a mode switch occurs. |
|
45 @internalTechnology |
|
46 |
|
47 */ |
|
48 |
|
49 |
|
50 |
|
51 class CMTPDataProviderController : public CActive |
|
52 { |
|
53 public: |
|
54 /** |
|
55 The active data provider set enumeration states. |
|
56 */ |
|
57 enum TEnumerationStates |
|
58 { |
|
59 EUnenumerated = 0, |
|
60 EEnumerationStarting = 1, |
|
61 EEnumeratingFrameworkStorages = 2, |
|
62 EEnumeratingDataProviderStorages = 3, |
|
63 EEnumeratingFrameworkObjects = 4, |
|
64 EEnumeratingDataProviderObjects = 5, |
|
65 EEnumerated = 6, |
|
66 }; |
|
67 |
|
68 public: |
|
69 |
|
70 static CMTPDataProviderController* NewL(); |
|
71 ~CMTPDataProviderController(); |
|
72 |
|
73 IMPORT_C void LoadDataProvidersL(); |
|
74 IMPORT_C void UnloadDataProviders(); |
|
75 IMPORT_C void NotifyDataProvidersL(TMTPNotification aNotification, const TAny* aParams); |
|
76 IMPORT_C void NotifyDataProvidersL(TUint aDPId, TMTPNotification aNotification, const TAny* aParams); |
|
77 |
|
78 IMPORT_C TUint Count(); |
|
79 IMPORT_C CMTPDataProvider& DataProviderL(TUint aId); |
|
80 IMPORT_C CMTPDataProvider& DataProviderByIndexL(TUint aIndex); |
|
81 IMPORT_C TBool IsDataProviderLoaded(TUint aId) const; |
|
82 IMPORT_C TInt DeviceDpId(); |
|
83 IMPORT_C TInt DpId(TUint aUid); |
|
84 IMPORT_C TInt ProxyDpId(); |
|
85 IMPORT_C TUint EnumerateState(); |
|
86 IMPORT_C TInt FileDpId(); |
|
87 |
|
88 void EnumerationStateChangedL(const CMTPDataProvider& aDp); |
|
89 TMTPOperationalMode Mode(); |
|
90 |
|
91 IMPORT_C void WaitForEnumerationComplete(); |
|
92 TBool FreeEnumerationWaiter(); |
|
93 private: // From CActive |
|
94 |
|
95 void DoCancel(); |
|
96 void RunL(); |
|
97 TInt RunError(TInt aError); |
|
98 |
|
99 private: |
|
100 |
|
101 CMTPDataProviderController(); |
|
102 void ConstructL(); |
|
103 |
|
104 CMTPDataProviderConfig* CreateConfigLC(const TDesC& aResourceFilename); |
|
105 void EnumerateDataProviderObjectsL(TUint aId); |
|
106 TBool IsObjectsEnumerationNeededL(CMTPDataProvider& dp); |
|
107 void LoadInstalledDataProvidersL(const CImplementationInformation* aImplementations); |
|
108 TBool LoadROMDataProvidersL(const TDesC& aResourceFilename, const RImplInfoPtrArray& aImplementations); |
|
109 TBool LoadDataProviderL(const TDesC& aResourceFilename); |
|
110 TInt Uid(const TDesC& aResourceFilename, TUint& aUid); |
|
111 void Schedule(); |
|
112 void CreateRegistrySessionAndEntryL(); |
|
113 void CloseRegistrySessionAndEntryL(); |
|
114 |
|
115 static void ImplementationsCleanup(TAny* aData); |
|
116 static TInt ImplementationsLinearOrderUid(const TUid* aUid, const CImplementationInformation& aObject); |
|
117 static TInt ImplementationsLinearOrderUid(const CImplementationInformation& aL, const CImplementationInformation& aR); |
|
118 |
|
119 private: // Owned |
|
120 /** |
|
121 FLOGGER debug trace member variable. |
|
122 */ |
|
123 __FLOG_DECLARATION_MEMBER_MUTABLE; |
|
124 |
|
125 /** |
|
126 The active data provider set container, ordered bit implementation |
|
127 UID. |
|
128 */ |
|
129 RPointerArray<CMTPDataProvider> iDataProviders; |
|
130 |
|
131 /** |
|
132 The active data provider identifier container, ordered by enumeration phase. |
|
133 */ |
|
134 RArray<TUint> iDataProviderIds; |
|
135 |
|
136 /** |
|
137 The device data provider identifier. |
|
138 */ |
|
139 TUint iDpIdDeviceDp; |
|
140 |
|
141 /** |
|
142 The proxy data provider identifier. |
|
143 */ |
|
144 TUint iDpIdProxyDp; |
|
145 |
|
146 /** |
|
147 The file data provider identifier. |
|
148 */ |
|
149 TUint iDpIdFileDp; |
|
150 |
|
151 /** |
|
152 The actively enumerating data providers. |
|
153 */ |
|
154 RArray<TUint> iEnumeratingDps; |
|
155 |
|
156 /** |
|
157 The actively enumerating storage IDs. |
|
158 */ |
|
159 RArray<TUint> iEnumeratingStorages; |
|
160 |
|
161 /** |
|
162 The active data provider set enumeration states. |
|
163 */ |
|
164 TEnumerationStates iEnumerationState; |
|
165 |
|
166 /** |
|
167 The active data provider set enumeration phases. |
|
168 */ |
|
169 TUint iEnumerationPhase; |
|
170 |
|
171 /** |
|
172 The index used for iterating through the iDataProviderIds array. |
|
173 */ |
|
174 TUint iDpIdArrayIndex; |
|
175 |
|
176 /** |
|
177 A general purpose index used for iterating through the active data provider |
|
178 set. |
|
179 */ |
|
180 TUint iNextDpId; |
|
181 |
|
182 /** |
|
183 The framework singletons. |
|
184 */ |
|
185 RMTPFramework iSingletons; |
|
186 |
|
187 /** |
|
188 Current operation mode |
|
189 */ |
|
190 TMTPOperationalMode iMode ; |
|
191 |
|
192 /** |
|
193 Session for sisRegistry |
|
194 */ |
|
195 Swi::RSisRegistrySession iSisSession; |
|
196 |
|
197 /** |
|
198 Registry Entry |
|
199 */ |
|
200 Swi::RSisRegistryEntry iSisEntry; |
|
201 |
|
202 /** |
|
203 Stub Found |
|
204 */ |
|
205 TBool iStubFound; |
|
206 |
|
207 /** |
|
208 opensession waiter |
|
209 */ |
|
210 CActiveSchedulerWait *iOpenSessionWaiter; |
|
211 |
|
212 /** |
|
213 Flag for Create DBSnapshot |
|
214 */ |
|
215 TUint8 iFlagDb; |
|
216 |
|
217 }; |
|
218 |
|
219 #endif |