epoc32/include/mclient.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 // Copyright (c) 1998-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #if !defined(__MCLIENT_H__)
    17 #define __MCLIENT_H__
    18 
    19 #if !defined(__E32BASE_H__)
    20 #include <e32base.h>
    21 #endif
    22 
    23 #if !defined(__MSVSTD_H__)
    24 #include <msvstd.h>
    25 #endif
    26 
    27 #if !defined(__MSVIPC_H__)
    28 #include <msvipc.h>
    29 #endif
    30 
    31 #if !defined(__MSVREG_H__)
    32 #include <msvreg.h>
    33 #endif
    34 
    35 #include <mmsvstoremanager.h>
    36 #include <tnonoperationmtmdata.h>
    37 
    38 // Forward declarations
    39 class CMsvClientEntry;
    40 class TCapabilitySet;
    41 class TMsvSystemProgress;
    42 
    43 //**********************************
    44 //RMsvSession
    45 //**********************************
    46 //
    47 // NOTE most functions are exported for test purposes only
    48 //
    49 /**
    50 Low level client-side API to access the message server. 
    51 
    52 It should not be used directly by client applications. They should use higher-level helper classes such as 
    53 CMsvSession, CMsEntry, and CMsvStore. These helper classes access the message server through RMsvServerSession.
    54 
    55 @internalTechnology
    56 */
    57 class RMsvServerSession : public RSessionBase, public MRegisteredMtmDllObserver, public MMsvStoreManager
    58 	{
    59 public:
    60 	IMPORT_C RMsvServerSession();
    61 	IMPORT_C virtual ~RMsvServerSession();
    62 	IMPORT_C TInt Connect(RFs& aFs);
    63 	IMPORT_C TVersion Version() const;
    64 	// Synchronous message
    65 	IMPORT_C TInt GetEntry(TMsvId aId, TMsvId& aService, TMsvEntry& aEntry);
    66 	IMPORT_C TInt GetChildren(TMsvId aId, CArrayPtrFlat<CMsvClientEntry>& aEntries, const TMsvSelectionOrdering& aOrdering);
    67 	IMPORT_C TInt LockEntry(TMsvId aId);
    68 	IMPORT_C TInt ReleaseEntry(TMsvId aId);
    69 	IMPORT_C TInt ReadStore(TMsvId aId);
    70 	IMPORT_C TInt LockStore(TMsvId aId);
    71 	IMPORT_C TInt ReleaseStore(TMsvId aId);
    72 	TInt DecStoreReaderCount(TMsvId aId);
    73 	IMPORT_C TInt OperationProgress(TMsvOp aId, TDes8& aProgress);
    74 	IMPORT_C TInt OperationSystemProgress(TMsvOp aId, TMsvSystemProgress& aProgress);
    75 	IMPORT_C TInt OperationCompletion(TMsvOp aId, TDes8& aProgress);
    76 	IMPORT_C TInt CancelOperation(TMsvOp aId, TDes8& aProgress);
    77 	IMPORT_C TInt CancelSessionEventRequest();
    78 	IMPORT_C TInt OperationMtmL(TMsvId aId1, TMsvId aId2, TUid& aMtm, TMsvId& aService);
    79 	inline TInt OperationMtmL(TMsvId aId1, TUid& aMtm, TMsvId& aService);
    80 	IMPORT_C void CreateEntryL(const TMsvEntry& aEntry, TMsvOp aOperationId, TSecureId aOwnerId);
    81 	IMPORT_C void ChangeEntryL(const TMsvEntry& aEntry, TMsvOp aOperationId, TSecureId aOwnerId);
    82 	IMPORT_C void MoveEntriesL(const CMsvEntrySelection& aSelection, TMsvId aTarget, TMsvOp aOperationId);
    83 	IMPORT_C void CopyEntriesL(const CMsvEntrySelection& aSelection, TMsvId aTarget, TMsvOp aOperationId);
    84 	IMPORT_C void DeleteEntriesL(const CMsvEntrySelection& aSelection, TMsvOp aOperationId);
    85 	IMPORT_C void ChangeAttributesL(const CMsvEntrySelection& aSelection, TUint aSetAttributes, TUint aClearAttributes);
    86 	IMPORT_C void GetChildIdsL(TMsvId aId, const CMsvEntryFilter& aFilter, CMsvEntrySelection& aSelection);
    87 	TInt OutstandingOperationsL();
    88 	// Asynchronous messages
    89 	IMPORT_C void CreateEntryL(const TMsvEntry& aEntry, TMsvOp aOperationId, TSecureId aOwnerId, TRequestStatus& aRequestStatus);
    90 	IMPORT_C void ChangeEntryL(const TMsvEntry& aEntry, TMsvOp aOperationId, TSecureId aOwnerId, TRequestStatus& aRequestStatus);
    91 	IMPORT_C void DeleteEntriesL(const CMsvEntrySelection& aSelection, TMsvOp aOperationId, TRequestStatus& aRequestStatus);
    92 	IMPORT_C void MoveEntriesL(const CMsvEntrySelection& aSelection, TMsvId aTarget, TMsvOp aOperationId, TRequestStatus& aRequestStatus);
    93 	IMPORT_C void CopyEntriesL(const CMsvEntrySelection& aSelection, TMsvId aTarget, TMsvOp aOperationId, TRequestStatus& aRequestStatus);
    94 	IMPORT_C void TransferCommandL(const CMsvEntrySelection& aSelection, TInt aCommandId, const TDesC8& aParameter, TMsvOp aOperationId, TRequestStatus& aStatus);
    95 	IMPORT_C TInt TransferCommandL(const CMsvEntrySelection& aSelection, TInt aCommandId, const TDesC8& aParameter, TMsvOp aOperationId);
    96 	IMPORT_C void QueueSessionEventRequest(TDes8& aChange, TDes8& aSequence, TRequestStatus& aRequestStatus);
    97 	void ChangeDriveL(TInt aDrive, TMsvOp aOperationId, TRequestStatus& aRequestStatus);
    98 	void CopyStoreL(const TDriveUnit& aDrive, TMsvOp aOperationId, TRequestStatus& aStatus);
    99 	void DeleteStoreL(const TDriveUnit& aDrive, TMsvOp aOperationId, TRequestStatus& aStatus);
   100 	// MTM 
   101 	IMPORT_C TInt FillRegisteredMtmDllArray(TUid aMtmDllTypeUid,CRegisteredMtmDllArray& aRegisteredMtmDllArray,TTimeIntervalMicroSeconds32 aTimeoutMicroSeconds32);  // Fill array with Dlls whose second uid is aMtmDllTypeUid
   102 	IMPORT_C TInt InstallMtmGroup(const TDesC& aFullName);
   103 	IMPORT_C TInt DeInstallMtmGroup(const TDesC& aFullName); 
   104 	IMPORT_C TInt UseMtmGroup(TUid aMtmTypeUid);
   105 	IMPORT_C TInt ReleaseMtmGroup(TUid aMtmTypeUid);  
   106 	IMPORT_C CMtmGroupData* GetMtmGroupDataL(TUid aMtmTypeUid);  
   107 	void GetMtmRequiredCapabilitiesL(TUid aMtmTypeUid, TCapabilitySet& aCapSet) const;
   108 	TBool GetAndClearIndexCorruptFlagL();
   109 	TBool DriveContainsStoreL(TDriveUnit aDrive);
   110 	// Server
   111 	IMPORT_C void CloseMessageServer();
   112 	IMPORT_C void RemoveEntry(TMsvId aId);
   113 	IMPORT_C TInt GetMessageDirectory(TDes& aDirectory);
   114 	TInt SetSessionAsObserver();
   115 	TUint32 NotifySequenceL();
   116 	IMPORT_C TInt SetReceiveEntryEvents(TBool aReceive);
   117 	// Services
   118 	IMPORT_C TInt StopService(TMsvId aServiceId);
   119 	IMPORT_C TBool ServiceActive(TMsvId aServiceId);
   120 	IMPORT_C TInt ServiceProgress(TMsvId aServiceId, TDes8& aProgress);
   121 	//
   122 	IMPORT_C void SetFailure(TInt aType, TInt aArg1 = 0, TInt aArg2 = 0, TInt aArg3 = 0);
   123 	TInt GetMessageDrive();
   124 
   125 	TInt GetNonOperationMtmData(TMsvId aServiceId, const TNonOperationMtmDataType& aType, TDes8& aMtmData);
   126 
   127 	// from MMsvStoreManager
   128 	IMPORT_C TBool CreateAttachmentForWriteL(TMsvId aEntryId, TDes& aFilename, RFile& aFile);
   129 	IMPORT_C void ReplaceAttachmentForWriteL(TMsvId aEntryId, TDes& aFilename, RFile& aFile);
   130 	IMPORT_C void OpenAttachmentL(TMsvId aEntryId, const TDesC& aFilePath, RFile& aFile);
   131 	IMPORT_C void OpenAttachmentForWriteL(TMsvId aEntryId, const TDesC& aFilePath, RFile& aFile);
   132 	IMPORT_C TInt DeleteAttachment(TMsvId aEntryId, const TDesC& aFilePath);
   133 	IMPORT_C TInt RenameAttachment(TMsvId aEntryId, const TDesC& aOldFilePath, const TDesC& aNewName);
   134 	IMPORT_C TBool FileExistsL(const TDesC& aFilePath);
   135 	IMPORT_C void AttachmentFilePathL(TMsvId aEntryId, TDes& aFilePath);
   136 	IMPORT_C TInt OpenFileStoreForRead(TMsvId aEntryId, RFile& aFile);
   137 	IMPORT_C void OpenTempStoreFileL(TMsvId aEntryId, RFile& aFile);
   138 	IMPORT_C void ReplaceFileStoreL(TMsvId aEntryId);
   139 	IMPORT_C void DeleteFileStoreL(TMsvId aEntryId);
   140 	IMPORT_C TBool FileStoreExistsL(TMsvId aEntryId) const;
   141 	IMPORT_C TBool MessageStoreDrivePresentL();
   142 	IMPORT_C TBool CreateShareProtectedAttachmentForWriteL(TMsvId aEntryId, TDes& aFilename, RFile& aFile);
   143 	IMPORT_C void BodyTextFilePathL(TMsvId aBodyTextId, TDes& aFilePath);
   144 	IMPORT_C void OpenBodyTextFileForReadL(RFile& aFile, TMsvId aBodyTextId, const TDesC& aFilePath);
   145     IMPORT_C void CreatePlainTextFileL(RFile& aFile, TMsvId aBodyTextId);
   146 	IMPORT_C void DeletePlainTextFileL(TMsvId aBodyTextId);
   147 	IMPORT_C void ReplacePlainTextFileL(TMsvId aBodyTextId);
   148 private:
   149 	void DoGetChildrenL(TMsvId aId, CArrayPtrFlat<CMsvClientEntry>& aEntries, const TMsvSelectionOrdering& aOrdering);
   150 	void DoGetRemainingChildrenL(TPckgBuf<TMsvChildrenDetails>& aDetails, CArrayPtrFlat<CMsvClientEntry>& aEntries);
   151 	void PackEntryIntoBufferL(const TMsvEntry& aEntry);
   152 	void SendEntryDataL(TMsvOp aOperationId, const TMsvEntry& aEntry);
   153 	void SendOperationDataL(TMsvOp aOperationId, const CMsvEntrySelection& aSelection, TInt aParameter1=0, TInt aParameter2=0);
   154 	void SendCommandDataL(TMsvOp aOperationId, const CMsvEntrySelection& aSelection, TInt aCommand, const TDesC8& aParameter);
   155 	void TestSlotAvailableL();
   156 	void PackOperationDataL(const CMsvEntrySelection& aSelection, TInt aParameter1, TInt aParameter2);
   157 	void DoGetEntryL(TMsvId aId, TMsvId& aService, TMsvEntry& aEntry);
   158 	
   159 private:
   160 	HBufC8* iBuffer;
   161 	};
   162 
   163 /**
   164 Gets the MTM that would perform an operation on a specified entry.
   165 
   166 @param aId1 ID of the entry
   167 @param aMtm On return, the UID of the MTM that would be used 
   168 @param aService On return, the ID of the service that would be used 
   169 @return System wide error code
   170 
   171 @capability None
   172 */
   173 inline TInt RMsvServerSession::OperationMtmL(TMsvId aId1, TUid& aMtm, TMsvId& aService)
   174 	{
   175 	return OperationMtmL(aId1, aId1, aMtm, aService);
   176 	}
   177 
   178 #endif // __MCLIENT_H__