1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
10 // |
10 // |
11 // Contributors: |
11 // Contributors: |
39 const TInt KMaxBinaryLength = KMaxUnicodeStringLength*2; |
42 const TInt KMaxBinaryLength = KMaxUnicodeStringLength*2; |
40 |
43 |
41 /** Error key returned by CommitTransaction in case of an error that cannot be |
44 /** Error key returned by CommitTransaction in case of an error that cannot be |
42 attributed to any single or partial key. Also notify value for spurious |
45 attributed to any single or partial key. Also notify value for spurious |
43 notifications (eg when a notification is cancelled or several values change at once ) |
46 notifications (eg when a notification is cancelled or several values change at once ) |
44 @internalAll |
47 @publishedAll |
45 @released |
48 @released |
46 */ |
49 */ |
47 const TUint32 KUnspecifiedKey = 0xffffffffUL; |
50 const TUint32 KUnspecifiedKey = 0xffffffffUL; |
48 |
|
49 /** Initial buffer size for Find~ API. Initial buffer is used to cut on the number |
|
50 of IPC calls required for each Find~ API call. If the number of settings found is |
|
51 less than or equal to KCentRepFindBufSize then all the settings can be retrieved with |
|
52 a single IPC. |
|
53 @internalAll |
|
54 */ |
|
55 const TInt KCentRepFindBufSize = 16; |
|
56 |
51 |
57 /** Use KUnspecifiedKey instead of this value. |
52 /** Use KUnspecifiedKey instead of this value. |
58 @publishedAll |
53 @publishedAll |
59 @deprecated |
54 @deprecated |
60 */ |
55 */ |
63 /** The 8 most significant bits of a setting's meta-data are reserved for internal use. |
58 /** The 8 most significant bits of a setting's meta-data are reserved for internal use. |
64 Clients should not make use of the reserved bits (unless it is specifically stated |
59 Clients should not make use of the reserved bits (unless it is specifically stated |
65 otherwise in Symbian developer documentation). Clients should not rely on the value |
60 otherwise in Symbian developer documentation). Clients should not rely on the value |
66 of the reserved bits. Reserved bits are not guaranteed to be 0 or 1 and are not |
61 of the reserved bits. Reserved bits are not guaranteed to be 0 or 1 and are not |
67 guaranteed to stay constant from one GetMeta call to the next. |
62 guaranteed to stay constant from one GetMeta call to the next. |
68 @publishedPartner |
|
69 @released |
63 @released |
70 @see CRepository::GetMeta |
64 @see CRepository::GetMeta |
71 @see KMetaUnreserved |
65 @see KMetaUnreserved |
72 */ |
66 */ |
73 const TUint32 KMetaSymbianReserved = 0xFF000000; |
67 const TUint32 KMetaSymbianReserved = 0xFF000000; |
75 /** The 24 least significant bits of a setting's meta-data are available for use. Clients |
69 /** The 24 least significant bits of a setting's meta-data are available for use. Clients |
76 should make use of KMetaUnreserved to mask out the reserved bits following a call |
70 should make use of KMetaUnreserved to mask out the reserved bits following a call |
77 to GetMeta. Clients should not rely on the value of the reserved bits. Reserved bits |
71 to GetMeta. Clients should not rely on the value of the reserved bits. Reserved bits |
78 are not guaranteed to be 0 or 1 and are not guaranteed to stay constant from one |
72 are not guaranteed to be 0 or 1 and are not guaranteed to stay constant from one |
79 GetMeta call to the next. |
73 GetMeta call to the next. |
80 @publishedPartner |
|
81 @released |
74 @released |
82 @see CRepository::GetMeta |
75 @see CRepository::GetMeta |
83 @see KMetaSymbianReserved |
76 @see KMetaSymbianReserved |
84 */ |
77 */ |
85 const TUint32 KMetaUnreserved = 0x00FFFFFF; |
78 const TUint32 KMetaUnreserved = 0x00FFFFFF; |
97 class CRepository : public CBase |
90 class CRepository : public CBase |
98 { |
91 { |
99 public: |
92 public: |
100 |
93 |
101 /** Transaction mode chosen with StartTransaction. |
94 /** Transaction mode chosen with StartTransaction. |
102 @publishedPartner |
95 */ |
103 @released */ |
|
104 enum TTransactionMode |
96 enum TTransactionMode |
105 { |
97 { |
106 /** Standard optimistic non-serialised transaction. Can be started at any time |
98 /** Standard optimistic non-serialised transaction. Can be started at any time |
107 Commit fails with KErrLocked if another client interrupts it by first committing |
99 Commit fails with KErrLocked if another client interrupts it by first committing |
108 changes: transaction should be repeated until KErrLocked is not returned. */ |
100 changes: transaction should be repeated until KErrLocked is not returned. |
|
101 */ |
109 EConcurrentReadWriteTransaction = 2, |
102 EConcurrentReadWriteTransaction = 2, |
110 /** Pessimistic locking transaction intended for reading consistent values. |
103 /** Pessimistic locking transaction intended for reading consistent values. |
111 Can only be started if EReadWriteTransaction is not in progress. |
104 Can only be started if EReadWriteTransaction is not in progress. |
112 Automatically promoted to EReadWriteTransaction on first write operation |
105 Automatically promoted to EReadWriteTransaction on first write operation |
113 if no other read transaction is in progress (or fails if not attainable). |
106 if no other read transaction is in progress (or fails if not attainable). |
114 Use ONLY if all clients can agree not to use EConcurrentReadWriteTransaction, |
107 Use ONLY if all clients can agree not to use EConcurrentReadWriteTransaction, |
115 and only make changes in an EReadWriteTransaction. */ |
108 and only make changes in an EReadWriteTransaction. |
|
109 */ |
116 EReadTransaction = 1, |
110 EReadTransaction = 1, |
117 /** Pessimistic locking transaction intended for writing values. Can only be |
111 /** Pessimistic locking transaction intended for writing values. Can only be |
118 started if no EReadTransaction or EReadWriteTransactions are in progress. |
112 started if no EReadTransaction or EReadWriteTransactions are in progress. |
119 Use ONLY if all clients can agree not to use EConcurrentReadWriteTransaction, |
113 Use ONLY if all clients can agree not to use EConcurrentReadWriteTransaction, |
120 and only make changes in an EReadWriteTransaction. */ |
114 and only make changes in an EReadWriteTransaction. |
|
115 */ |
121 EReadWriteTransaction = 3 |
116 EReadWriteTransaction = 3 |
122 }; |
117 }; |
123 |
118 |
124 /** Buffer type for aKeyInfo parameter to asynchronous CommitTransaction. |
119 /** Buffer type for aKeyInfo parameter to asynchronous CommitTransaction. |
125 @see CRepository::CommitTransaction(TDes8& aKeyInfo, TRequestStatus& aStatus) |
120 @see CRepository::CommitTransaction(TDes8& aKeyInfo, TRequestStatus& aStatus) |
126 @publishedPartner |
|
127 @released |
|
128 */ |
121 */ |
129 typedef TPckgBuf<TUint32> TTransactionKeyInfoBuf; |
122 typedef TPckgBuf<TUint32> TTransactionKeyInfoBuf; |
130 |
123 |
131 IMPORT_C static CRepository* NewL(TUid aRepositoryUid); |
124 IMPORT_C static CRepository* NewL(TUid aRepositoryUid); |
132 IMPORT_C static CRepository* NewLC(TUid aRepositoryUid); |
125 IMPORT_C static CRepository* NewLC(TUid aRepositoryUid); |
199 IMPORT_C void CleanupCancelTransactionPushL(); |
192 IMPORT_C void CleanupCancelTransactionPushL(); |
200 IMPORT_C void FailTransaction(); |
193 IMPORT_C void FailTransaction(); |
201 IMPORT_C void CleanupFailTransactionPushL(); |
194 IMPORT_C void CleanupFailTransactionPushL(); |
202 |
195 |
203 /** Same as CancelTransaction. |
196 /** Same as CancelTransaction. |
204 @publishedPartner |
197 @see CancelTransaction |
205 @released |
198 */ |
206 @see CancelTransaction */ |
|
207 inline void RollbackTransaction() |
199 inline void RollbackTransaction() |
208 { |
200 { |
209 CancelTransaction(); |
201 CancelTransaction(); |
210 } |
202 } |
211 |
203 |
212 /** Same as CleanupCancelTransactionPushL. |
204 /** Same as CleanupCancelTransactionPushL. |
213 @publishedPartner |
205 @see CleanupCancelTransactionPushL |
214 @released |
206 */ |
215 @see CleanupCancelTransactionPushL */ |
|
216 inline void CleanupRollbackTransactionPushL() |
207 inline void CleanupRollbackTransactionPushL() |
217 { |
208 { |
218 CleanupCancelTransactionPushL(); |
209 CleanupCancelTransactionPushL(); |
219 } |
210 } |
220 |
|
221 IMPORT_C TInt TransactionState(); |
|
222 |
|
223 /** This API is for internal use only and for testing purposes. |
|
224 @internalAll |
|
225 */ |
|
226 IMPORT_C static TInt SetGetParameters(const TIpcArgs& aArgs); |
|
227 }; |
211 }; |
228 |
212 |
229 #endif // __CENTRALREPOSITORY_H__ |
213 #endif // __CENTRALREPOSITORY_H__ |