sl@0
|
1 |
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#ifndef CLIREP_H
|
sl@0
|
17 |
#define CLIREP_H
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <centralrepository.h>
|
sl@0
|
20 |
#include "centralrepositoryinternal.h"
|
sl@0
|
21 |
|
sl@0
|
22 |
const TInt32 KCentRepFindWithLenghtBufSize = NCentralRepositoryConstants::KCentRepFindBufSize + 1;
|
sl@0
|
23 |
|
sl@0
|
24 |
class RRepositorySubSession;
|
sl@0
|
25 |
/** Client-side session.
|
sl@0
|
26 |
@internalComponent
|
sl@0
|
27 |
*/
|
sl@0
|
28 |
class RRepositorySession : public RSessionBase
|
sl@0
|
29 |
{
|
sl@0
|
30 |
public:
|
sl@0
|
31 |
RRepositorySession();
|
sl@0
|
32 |
TInt Connect();
|
sl@0
|
33 |
inline TInt IncrementSubSessionCounter();
|
sl@0
|
34 |
inline TInt DecrementSubSessionCounter();
|
sl@0
|
35 |
|
sl@0
|
36 |
#if defined(__CENTREP_SERVER_PERFTEST__) || defined(__CENTREP_SERVER_MEMTEST__) || defined(__CENTREP_SERVER_CACHETEST__)
|
sl@0
|
37 |
TInt SendReceive(TInt aFunction) const;
|
sl@0
|
38 |
TInt SendReceive(TInt aFunction, const TIpcArgs& aArgs) const;
|
sl@0
|
39 |
void SendReceive(TInt aFunction, const TIpcArgs& aArgs, TRequestStatus& aStatus) const;
|
sl@0
|
40 |
#endif
|
sl@0
|
41 |
|
sl@0
|
42 |
private:
|
sl@0
|
43 |
TInt iSubSessionCounter;
|
sl@0
|
44 |
};
|
sl@0
|
45 |
|
sl@0
|
46 |
/** Client-side subSession.
|
sl@0
|
47 |
@internalComponent
|
sl@0
|
48 |
*/
|
sl@0
|
49 |
class RRepositorySubSession : public RSubSessionBase
|
sl@0
|
50 |
{
|
sl@0
|
51 |
public:
|
sl@0
|
52 |
TInt Open(RRepositorySession* aSession,TInt aFunction,const TIpcArgs& aArgs);
|
sl@0
|
53 |
void Close();
|
sl@0
|
54 |
TInt SendReceive(TInt aFunction) const;
|
sl@0
|
55 |
TInt SendReceive(TInt aFunction, const TIpcArgs& aArgs) const;
|
sl@0
|
56 |
void SendReceive(TInt aFunction, const TIpcArgs& aArgs, TRequestStatus& aStatus) const;
|
sl@0
|
57 |
private:
|
sl@0
|
58 |
RRepositorySession* iSession;
|
sl@0
|
59 |
};
|
sl@0
|
60 |
|
sl@0
|
61 |
|
sl@0
|
62 |
/** Implementation of CRepository.
|
sl@0
|
63 |
@internalComponent
|
sl@0
|
64 |
*/
|
sl@0
|
65 |
NONSHARABLE_CLASS(CClientRepository) : public CRepository
|
sl@0
|
66 |
{
|
sl@0
|
67 |
friend class CRepository;
|
sl@0
|
68 |
public:
|
sl@0
|
69 |
static CClientRepository* NewLC(TUid aRepositoryUid);
|
sl@0
|
70 |
|
sl@0
|
71 |
~CClientRepository();
|
sl@0
|
72 |
|
sl@0
|
73 |
TInt Create(TUint32 aId, TInt aVal); // TInt
|
sl@0
|
74 |
TInt Create(TUint32 aId, const TReal& aVal); // TReal
|
sl@0
|
75 |
TInt Create(TUint32 aId, const TDesC8& aVal); // TDesC8
|
sl@0
|
76 |
TInt Create(TUint32 aId, const TDesC16& aVal); // TDesC16
|
sl@0
|
77 |
|
sl@0
|
78 |
TInt Delete(TUint32 aId);
|
sl@0
|
79 |
TInt Delete(TUint32 aPartialKey, TUint32 aMask, TUint32 &aErrorKey);
|
sl@0
|
80 |
|
sl@0
|
81 |
TInt Get(TUint32 aId, TInt& aVal);
|
sl@0
|
82 |
TInt Set(TUint32 aId, TInt aVal);
|
sl@0
|
83 |
|
sl@0
|
84 |
TInt Get(TUint32 aId, TReal& aVal);
|
sl@0
|
85 |
TInt Set(TUint32 aId, const TReal& aVal);
|
sl@0
|
86 |
|
sl@0
|
87 |
TInt Get(TUint32 aId, TDes8& aVal);
|
sl@0
|
88 |
TInt Get(TUint32 aId, TDes8& aVal, TInt& aActualLen);
|
sl@0
|
89 |
TInt Set(TUint32 aId, const TDesC8& aVal);
|
sl@0
|
90 |
|
sl@0
|
91 |
TInt Get(TUint32 aId, TDes& aVal);
|
sl@0
|
92 |
TInt Get(TUint32 aId, TDes& aVal, TInt& aActualLen);
|
sl@0
|
93 |
TInt Set(TUint32 aId, const TDesC& aVal);
|
sl@0
|
94 |
|
sl@0
|
95 |
TInt GetMeta(TUint32 aId, TUint32& aMeta);
|
sl@0
|
96 |
|
sl@0
|
97 |
TInt Move(TUint32 aSourcePartialId, TUint32 aTargetPartialId, TUint32 aIdMask, TUint32 &aErrorId) ;
|
sl@0
|
98 |
|
sl@0
|
99 |
TInt FindL(TUint32 aPartialId, TUint32 aIdMask, RArray<TUint32>& aFoundIds);
|
sl@0
|
100 |
|
sl@0
|
101 |
TInt FindEqL(TUint32 aPartialId, TUint32 aIdMask, TInt aVal, RArray<TUint32>& aFoundIds);
|
sl@0
|
102 |
TInt FindEqL(TUint32 aPartialId, TUint32 aIdMask, const TReal& aVal, RArray<TUint32>& aFoundIds);
|
sl@0
|
103 |
TInt FindEqL(TUint32 aPartialId, TUint32 aIdMask, const TDesC8& aVal, RArray<TUint32>& aFoundIds);
|
sl@0
|
104 |
TInt FindEqL(TUint32 aPartialId, TUint32 aIdMask, const TDesC& aVal, RArray<TUint32>& aFoundIds);
|
sl@0
|
105 |
|
sl@0
|
106 |
TInt FindNeqL(TUint32 aPartialId, TUint32 aIdMask, TInt aVal, RArray<TUint32>& aFoundIds);
|
sl@0
|
107 |
TInt FindNeqL(TUint32 aPartialId, TUint32 aIdMask, const TReal& aVal, RArray<TUint32>& aFoundIds);
|
sl@0
|
108 |
TInt FindNeqL(TUint32 aPartialId, TUint32 aIdMask, const TDesC8& aVal, RArray<TUint32>& aFoundIds);
|
sl@0
|
109 |
TInt FindNeqL(TUint32 aPartialId, TUint32 aIdMask, const TDesC& aVal, RArray<TUint32>& aFoundIds);
|
sl@0
|
110 |
|
sl@0
|
111 |
TInt NotifyRequest(TUint32 aId, TRequestStatus& aStatus);
|
sl@0
|
112 |
TInt NotifyRequest(TUint32 aPartialId, TUint32 aIdMask, TRequestStatus& aStatus);
|
sl@0
|
113 |
TInt NotifyCancel(TUint32 aId);
|
sl@0
|
114 |
TInt NotifyCancel(TUint32 aPartialId, TUint32 aIdMask);
|
sl@0
|
115 |
TInt NotifyCancelAll();
|
sl@0
|
116 |
|
sl@0
|
117 |
TInt Reset();
|
sl@0
|
118 |
TInt Reset(TUint32 aId);
|
sl@0
|
119 |
|
sl@0
|
120 |
TInt StartTransaction(TTransactionMode aMode);
|
sl@0
|
121 |
void StartTransaction(TTransactionMode aMode, TRequestStatus& aStatus);
|
sl@0
|
122 |
TInt CommitTransaction(TUint32& aKeyInfo);
|
sl@0
|
123 |
void CommitTransaction(TDes8& aKeyInfo, TRequestStatus& aStatus);
|
sl@0
|
124 |
void CancelTransaction();
|
sl@0
|
125 |
void CleanupCancelTransactionPushL();
|
sl@0
|
126 |
void FailTransaction();
|
sl@0
|
127 |
void CleanupFailTransactionPushL();
|
sl@0
|
128 |
TInt TransactionState();
|
sl@0
|
129 |
|
sl@0
|
130 |
private:
|
sl@0
|
131 |
CClientRepository();
|
sl@0
|
132 |
void ConstructL(TUid aRepositoryUid);
|
sl@0
|
133 |
TInt GetFindResult(const TFixedArray<TUint32, KCentRepFindWithLenghtBufSize>& aUids, RArray<TUint32>& aFoundIds);
|
sl@0
|
134 |
RRepositorySession* Session();
|
sl@0
|
135 |
private:
|
sl@0
|
136 |
RRepositorySubSession* iSubSession;
|
sl@0
|
137 |
TInt iClientErr;
|
sl@0
|
138 |
};
|
sl@0
|
139 |
|
sl@0
|
140 |
#endif // CLIREP_H
|
sl@0
|
141 |
|