sl@0: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef CLIREP_H sl@0: #define CLIREP_H sl@0: sl@0: #include sl@0: #include "centralrepositoryinternal.h" sl@0: sl@0: const TInt32 KCentRepFindWithLenghtBufSize = NCentralRepositoryConstants::KCentRepFindBufSize + 1; sl@0: sl@0: class RRepositorySubSession; sl@0: /** Client-side session. sl@0: @internalComponent sl@0: */ sl@0: class RRepositorySession : public RSessionBase sl@0: { sl@0: public: sl@0: RRepositorySession(); sl@0: TInt Connect(); sl@0: inline TInt IncrementSubSessionCounter(); sl@0: inline TInt DecrementSubSessionCounter(); sl@0: sl@0: #if defined(__CENTREP_SERVER_PERFTEST__) || defined(__CENTREP_SERVER_MEMTEST__) || defined(__CENTREP_SERVER_CACHETEST__) sl@0: TInt SendReceive(TInt aFunction) const; sl@0: TInt SendReceive(TInt aFunction, const TIpcArgs& aArgs) const; sl@0: void SendReceive(TInt aFunction, const TIpcArgs& aArgs, TRequestStatus& aStatus) const; sl@0: #endif sl@0: sl@0: private: sl@0: TInt iSubSessionCounter; sl@0: }; sl@0: sl@0: /** Client-side subSession. sl@0: @internalComponent sl@0: */ sl@0: class RRepositorySubSession : public RSubSessionBase sl@0: { sl@0: public: sl@0: TInt Open(RRepositorySession* aSession,TInt aFunction,const TIpcArgs& aArgs); sl@0: void Close(); sl@0: TInt SendReceive(TInt aFunction) const; sl@0: TInt SendReceive(TInt aFunction, const TIpcArgs& aArgs) const; sl@0: void SendReceive(TInt aFunction, const TIpcArgs& aArgs, TRequestStatus& aStatus) const; sl@0: private: sl@0: RRepositorySession* iSession; sl@0: }; sl@0: sl@0: sl@0: /** Implementation of CRepository. sl@0: @internalComponent sl@0: */ sl@0: NONSHARABLE_CLASS(CClientRepository) : public CRepository sl@0: { sl@0: friend class CRepository; sl@0: public: sl@0: static CClientRepository* NewLC(TUid aRepositoryUid); sl@0: sl@0: ~CClientRepository(); sl@0: sl@0: TInt Create(TUint32 aId, TInt aVal); // TInt sl@0: TInt Create(TUint32 aId, const TReal& aVal); // TReal sl@0: TInt Create(TUint32 aId, const TDesC8& aVal); // TDesC8 sl@0: TInt Create(TUint32 aId, const TDesC16& aVal); // TDesC16 sl@0: sl@0: TInt Delete(TUint32 aId); sl@0: TInt Delete(TUint32 aPartialKey, TUint32 aMask, TUint32 &aErrorKey); sl@0: sl@0: TInt Get(TUint32 aId, TInt& aVal); sl@0: TInt Set(TUint32 aId, TInt aVal); sl@0: sl@0: TInt Get(TUint32 aId, TReal& aVal); sl@0: TInt Set(TUint32 aId, const TReal& aVal); sl@0: sl@0: TInt Get(TUint32 aId, TDes8& aVal); sl@0: TInt Get(TUint32 aId, TDes8& aVal, TInt& aActualLen); sl@0: TInt Set(TUint32 aId, const TDesC8& aVal); sl@0: sl@0: TInt Get(TUint32 aId, TDes& aVal); sl@0: TInt Get(TUint32 aId, TDes& aVal, TInt& aActualLen); sl@0: TInt Set(TUint32 aId, const TDesC& aVal); sl@0: sl@0: TInt GetMeta(TUint32 aId, TUint32& aMeta); sl@0: sl@0: TInt Move(TUint32 aSourcePartialId, TUint32 aTargetPartialId, TUint32 aIdMask, TUint32 &aErrorId) ; sl@0: sl@0: TInt FindL(TUint32 aPartialId, TUint32 aIdMask, RArray& aFoundIds); sl@0: sl@0: TInt FindEqL(TUint32 aPartialId, TUint32 aIdMask, TInt aVal, RArray& aFoundIds); sl@0: TInt FindEqL(TUint32 aPartialId, TUint32 aIdMask, const TReal& aVal, RArray& aFoundIds); sl@0: TInt FindEqL(TUint32 aPartialId, TUint32 aIdMask, const TDesC8& aVal, RArray& aFoundIds); sl@0: TInt FindEqL(TUint32 aPartialId, TUint32 aIdMask, const TDesC& aVal, RArray& aFoundIds); sl@0: sl@0: TInt FindNeqL(TUint32 aPartialId, TUint32 aIdMask, TInt aVal, RArray& aFoundIds); sl@0: TInt FindNeqL(TUint32 aPartialId, TUint32 aIdMask, const TReal& aVal, RArray& aFoundIds); sl@0: TInt FindNeqL(TUint32 aPartialId, TUint32 aIdMask, const TDesC8& aVal, RArray& aFoundIds); sl@0: TInt FindNeqL(TUint32 aPartialId, TUint32 aIdMask, const TDesC& aVal, RArray& aFoundIds); sl@0: sl@0: TInt NotifyRequest(TUint32 aId, TRequestStatus& aStatus); sl@0: TInt NotifyRequest(TUint32 aPartialId, TUint32 aIdMask, TRequestStatus& aStatus); sl@0: TInt NotifyCancel(TUint32 aId); sl@0: TInt NotifyCancel(TUint32 aPartialId, TUint32 aIdMask); sl@0: TInt NotifyCancelAll(); sl@0: sl@0: TInt Reset(); sl@0: TInt Reset(TUint32 aId); sl@0: sl@0: TInt StartTransaction(TTransactionMode aMode); sl@0: void StartTransaction(TTransactionMode aMode, TRequestStatus& aStatus); sl@0: TInt CommitTransaction(TUint32& aKeyInfo); sl@0: void CommitTransaction(TDes8& aKeyInfo, TRequestStatus& aStatus); sl@0: void CancelTransaction(); sl@0: void CleanupCancelTransactionPushL(); sl@0: void FailTransaction(); sl@0: void CleanupFailTransactionPushL(); sl@0: TInt TransactionState(); sl@0: sl@0: private: sl@0: CClientRepository(); sl@0: void ConstructL(TUid aRepositoryUid); sl@0: TInt GetFindResult(const TFixedArray& aUids, RArray& aFoundIds); sl@0: RRepositorySession* Session(); sl@0: private: sl@0: RRepositorySubSession* iSubSession; sl@0: TInt iClientErr; sl@0: }; sl@0: sl@0: #endif // CLIREP_H sl@0: