|
1 /* |
|
2 * Copyright (c) 2004-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __CENTRALREPOSITORY_H__ |
|
20 #define __CENTRALREPOSITORY_H__ |
|
21 |
|
22 // Stub includes |
|
23 #include "mussettingskeys.h" |
|
24 // Stub forward declarations |
|
25 class CDesC8ArrayFlat; |
|
26 |
|
27 #include <e32base.h> |
|
28 |
|
29 |
|
30 namespace NCentralRepositoryConstants |
|
31 /** Namespace encapsulating the CentralRepository constants. |
|
32 @publishedAll |
|
33 @released |
|
34 */ |
|
35 { |
|
36 |
|
37 /** The maximum number of unicode characters that can be stored in a setting |
|
38 @publishedAll |
|
39 @released |
|
40 */ |
|
41 const TInt KMaxUnicodeStringLength = 1024; |
|
42 |
|
43 /** The maximum number of bytes that can be stored in a setting |
|
44 @publishedAll |
|
45 @released |
|
46 */ |
|
47 const TInt KMaxBinaryLength = KMaxUnicodeStringLength*2; |
|
48 |
|
49 /** Error key returned by CommitTransaction in case of an error that cannot be |
|
50 attributed to any single or partial key. Also notify value for spurious |
|
51 notifications (eg when a notification is cancelled or several values change at once ) |
|
52 @internalAll |
|
53 @released |
|
54 */ |
|
55 const TUint32 KUnspecifiedKey = 0xffffffffUL; |
|
56 |
|
57 /** Initial buffer size for Find~ API. Initial buffer is used to cut on the number |
|
58 of IPC calls required for each Find~ API call. If the number of settings found is |
|
59 less than or equal to KCentRepFindBufSize then all the settings can be retrieved with |
|
60 a single IPC. |
|
61 @internalAll |
|
62 */ |
|
63 const TInt KCentRepFindBufSize = 16; |
|
64 |
|
65 /** Use KUnspecifiedKey instead of this value. |
|
66 @publishedAll |
|
67 @deprecated |
|
68 */ |
|
69 const TUint32 KInvalidNotificationId = KUnspecifiedKey; |
|
70 |
|
71 /** The 8 most significant bits of a setting's meta-data are reserved for internal use. |
|
72 Clients should not make use of the reserved bits (unless it is specifically stated |
|
73 otherwise in Symbian developer documentation). Clients should not rely on the value |
|
74 of the reserved bits. Reserved bits are not guaranteed to be 0 or 1 and are not |
|
75 guaranteed to stay constant from one GetMeta call to the next. |
|
76 @publishedPartner |
|
77 @released |
|
78 @see CRepository::GetMeta |
|
79 @see KMetaUnreserved |
|
80 */ |
|
81 const TUint32 KMetaSymbianReserved = 0xFF000000; |
|
82 |
|
83 /** The 24 least significant bits of a setting's meta-data are available for use. Clients |
|
84 should make use of KMetaUnreserved to mask out the reserved bits following a call |
|
85 to GetMeta. Clients should not rely on the value of the reserved bits. Reserved bits |
|
86 are not guaranteed to be 0 or 1 and are not guaranteed to stay constant from one |
|
87 GetMeta call to the next. |
|
88 @publishedPartner |
|
89 @released |
|
90 @see CRepository::GetMeta |
|
91 @see KMetaSymbianReserved |
|
92 */ |
|
93 const TUint32 KMetaUnreserved = 0x00FFFFFF; |
|
94 |
|
95 } // namespace NCentralRepositoryConstants |
|
96 |
|
97 /** Provides access to a repository. |
|
98 |
|
99 There are potentially 2^32 repositories, each identified by a UID. Within each |
|
100 repository up to 2^32 settings can be stored. Settings within a repository are |
|
101 identified by a 32-bit key and may be of the types integer, real or descriptor. |
|
102 @publishedAll |
|
103 @released |
|
104 */ |
|
105 class CRepository : public CBase |
|
106 { |
|
107 public: |
|
108 |
|
109 /** Transaction mode chosen with StartTransaction. |
|
110 @publishedPartner |
|
111 @released */ |
|
112 enum TTransactionMode |
|
113 { |
|
114 /** Standard optimistic non-serialised transaction. Can be started at any time |
|
115 Commit fails with KErrLocked if another client interrupts it by first committing |
|
116 changes: transaction should be repeated until KErrLocked is not returned. */ |
|
117 EConcurrentReadWriteTransaction = 2, |
|
118 /** Pessimistic locking transaction intended for reading consistent values. |
|
119 Can only be started if EReadWriteTransaction is not in progress. |
|
120 Automatically promoted to EReadWriteTransaction on first write operation |
|
121 if no other read transaction is in progress (or fails if not attainable). |
|
122 Use ONLY if all clients can agree not to use EConcurrentReadWriteTransaction, |
|
123 and only make changes in an EReadWriteTransaction. */ |
|
124 EReadTransaction = 1, |
|
125 /** Pessimistic locking transaction intended for writing values. Can only be |
|
126 started if no EReadTransaction or EReadWriteTransactions are in progress. |
|
127 Use ONLY if all clients can agree not to use EConcurrentReadWriteTransaction, |
|
128 and only make changes in an EReadWriteTransaction. */ |
|
129 EReadWriteTransaction = 3 |
|
130 }; |
|
131 |
|
132 /** Buffer type for aKeyInfo parameter to asynchronous CommitTransaction. |
|
133 @see CRepository::CommitTransaction(TDes8& aKeyInfo, TRequestStatus& aStatus) |
|
134 @publishedPartner |
|
135 @released |
|
136 */ |
|
137 typedef TPckgBuf<TUint32> TTransactionKeyInfoBuf; |
|
138 |
|
139 IMPORT_C static CRepository* NewL(TUid aRepositoryUid); |
|
140 IMPORT_C static CRepository* NewLC(TUid aRepositoryUid); |
|
141 |
|
142 IMPORT_C virtual ~CRepository(); |
|
143 |
|
144 |
|
145 IMPORT_C TInt Create(TUint32 aKey, TInt aValue); |
|
146 //IMPORT_C TInt Create(TUint32 aKey, const TReal& aValue); |
|
147 IMPORT_C TInt Create(TUint32 aKey, const TDesC8& aValue); |
|
148 //IMPORT_C TInt Create(TUint32 aKey, const TDesC16& aValue); |
|
149 //IMPORT_C TInt Delete(TUint32 aKey); |
|
150 IMPORT_C TInt Delete(TUint32 aPartialKey, TUint32 aMask, TUint32 &aErrorKey) ; |
|
151 |
|
152 |
|
153 IMPORT_C TInt Get(TUint32 aKey, TInt& aValue); |
|
154 IMPORT_C TInt Set(TUint32 aKey, TInt aValue); |
|
155 |
|
156 /* |
|
157 IMPORT_C TInt Get(TUint32 aKey, TReal& aValue); |
|
158 IMPORT_C TInt Set(TUint32 aKey, const TReal& aValue); |
|
159 */ |
|
160 IMPORT_C TInt Get(TUint32 aKey, TDes8& aValue); |
|
161 //IMPORT_C TInt Get(TUint32 aId, TDes8& aValue, TInt& aActualLength); |
|
162 IMPORT_C TInt Set(TUint32 aKey, const TDesC8& aValue); |
|
163 |
|
164 IMPORT_C TInt Get(TUint32 aKey, TDes16& aValue); |
|
165 //IMPORT_C TInt Get(TUint32 aId, TDes16& aValue, TInt& aActualLength); |
|
166 IMPORT_C TInt Set(TUint32 aKey, const TDesC16& aValue); |
|
167 /* |
|
168 IMPORT_C TInt GetMeta(TUint32 aKey, TUint32& aMeta); |
|
169 |
|
170 IMPORT_C TInt Move (TUint32 aSourcePartialKey, TUint32 aTargetPartialKey, |
|
171 TUint32 aMask, TUint32 &aErrorKey) ; |
|
172 */ |
|
173 IMPORT_C TInt FindL(TUint32 aPartialKey, TUint32 aMask, |
|
174 RArray<TUint32>& aFoundKeys); |
|
175 /* |
|
176 IMPORT_C TInt FindEqL(TUint32 aPartialKey, TUint32 aMask, |
|
177 TInt aValue, RArray<TUint32>& aFoundKeys); |
|
178 IMPORT_C TInt FindEqL(TUint32 aPartialKey, TUint32 aMask, |
|
179 const TReal& aValue, RArray<TUint32>& aFoundKeys); |
|
180 */ |
|
181 IMPORT_C TInt FindEqL(TUint32 aPartialKey, TUint32 aMask, |
|
182 const TDesC8& aValue, RArray<TUint32>& aFoundKeys); |
|
183 /* |
|
184 IMPORT_C TInt FindEqL(TUint32 aPartialKey, TUint32 aMask, |
|
185 const TDesC16& aValue, RArray<TUint32>& aFoundKeys); |
|
186 |
|
187 IMPORT_C TInt FindNeqL(TUint32 aPartialKey, TUint32 aMask, |
|
188 TInt aValue, RArray<TUint32>& aFoundKeys); |
|
189 IMPORT_C TInt FindNeqL(TUint32 aPartialKey, TUint32 aMask, |
|
190 const TReal& aValue, RArray<TUint32>& aFoundKeys); |
|
191 IMPORT_C TInt FindNeqL(TUint32 aPartialKey, TUint32 aMask, |
|
192 const TDesC8& aValue, RArray<TUint32>& aFoundKeys); |
|
193 IMPORT_C TInt FindNeqL(TUint32 aPartialKey, TUint32 aMask, |
|
194 const TDesC16& aValue, RArray<TUint32>& aFoundKeys); |
|
195 |
|
196 IMPORT_C TInt NotifyRequest(TUint32 aKey, TRequestStatus& aStatus); |
|
197 IMPORT_C TInt NotifyRequest(TUint32 aPartialKey, TUint32 aMask, |
|
198 TRequestStatus& aStatus); |
|
199 |
|
200 IMPORT_C TInt NotifyCancel(TUint32 aKey); |
|
201 IMPORT_C TInt NotifyCancel(TUint32 aPartialKey, TUint32 aMask); |
|
202 IMPORT_C TInt NotifyCancelAll(); |
|
203 |
|
204 IMPORT_C TInt Reset(); |
|
205 IMPORT_C TInt Reset(TUint32 aKey); |
|
206 */ |
|
207 |
|
208 IMPORT_C TInt StartTransaction(TTransactionMode aMode); |
|
209 //IMPORT_C void StartTransaction(TTransactionMode aMode, TRequestStatus& aStatus); |
|
210 IMPORT_C TInt CommitTransaction(TUint32& aKeyInfo); |
|
211 //IMPORT_C void CommitTransaction(TDes8& aKeyInfo, TRequestStatus& aStatus); |
|
212 //IMPORT_C void CancelTransaction(); |
|
213 //IMPORT_C void CleanupCancelTransactionPushL(); |
|
214 //IMPORT_C void FailTransaction(); |
|
215 //IMPORT_C void CleanupFailTransactionPushL(); |
|
216 |
|
217 /** Same as CancelTransaction. |
|
218 @publishedPartner |
|
219 @released |
|
220 @see CancelTransaction */ |
|
221 /* |
|
222 inline void RollbackTransaction() |
|
223 { |
|
224 CancelTransaction(); |
|
225 } |
|
226 */ |
|
227 /** Same as CleanupCancelTransactionPushL. |
|
228 @publishedPartner |
|
229 @released |
|
230 @see CleanupCancelTransactionPushL */ |
|
231 /* |
|
232 inline void CleanupRollbackTransactionPushL() |
|
233 { |
|
234 CleanupCancelTransactionPushL(); |
|
235 } |
|
236 */ |
|
237 // IMPORT_C TInt TransactionState(); |
|
238 |
|
239 /** This API is for internal use only and for testing purposes. |
|
240 @internalAll |
|
241 */ |
|
242 // IMPORT_C static TInt SetGetParameters(const TIpcArgs& aArgs); |
|
243 |
|
244 |
|
245 |
|
246 |
|
247 private: // Stub functions |
|
248 |
|
249 CRepository( TUid aRepositoryUid ); |
|
250 |
|
251 public: // Stub functios |
|
252 |
|
253 void ResetKeysAndValues(); |
|
254 // Setter for static variable staticAvcConfigKeys. Reserves heap. |
|
255 static void SetStubAvcConfigKeysL( const TDesC8& aConfigKeys ); |
|
256 // Deletes heap reserved by previous function. |
|
257 static void DeleteStubAvcConfigKeys(); |
|
258 |
|
259 |
|
260 public: // Stub data |
|
261 |
|
262 static MusSettingsKeys::TOperatorVariant iOperatorVariant; |
|
263 |
|
264 // If the following value is ETrue, CenRep UID KCRUidSIPClientResolverConfig |
|
265 // exists and respository is possible to create with this value. Otherwise |
|
266 // CenRep instantiation leaves with KErrNone. |
|
267 static TBool iEmulateSawfishRepository; |
|
268 |
|
269 RArray<TUint32> iKeys; |
|
270 RArray<TInt> iValues; |
|
271 RArray<TUint32> iDesC8Keys; |
|
272 CDesC8ArrayFlat* iDesC8Values; |
|
273 |
|
274 static TInt iForceFailWithCode; |
|
275 |
|
276 static HBufC8* iStaticAvcConfigKeys; |
|
277 static TBool iStaticWriteAvcKeysToStaticData; |
|
278 |
|
279 static TInt iStaticEncoderUid; |
|
280 |
|
281 TUid iRepositoryUid; |
|
282 |
|
283 |
|
284 |
|
285 }; |
|
286 |
|
287 #endif // __CENTRALREPOSITORY_H__ |