williamr@2: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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 williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #ifndef __OBEXCLIENTMTM_H__ williamr@2: #define __OBEXCLIENTMTM_H__ williamr@2: williamr@2: williamr@2: williamr@2: #include //CBaseMtm williamr@2: williamr@2: // temporary forward declaration for now... williamr@2: class CObexHeaderList; williamr@2: williamr@2: class CMsvEntry; williamr@2: class CMtmDllRegistry; williamr@2: class CRichText; williamr@2: class TMsvEntry; williamr@2: class CRegisteredMtmDll; williamr@2: class CMsvSession; williamr@2: class CObexMtmHeader; williamr@2: williamr@2: extern const TInt KMaxObexPasswordLength; williamr@2: williamr@2: williamr@2: williamr@2: class TObexMtmProgress williamr@2: /** williamr@2: Used to determine the progress for the current obex send operation. williamr@2: williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: williamr@2: ///The current state the send operation is in williamr@2: enum TSendState williamr@2: { williamr@2: ENullOp = 0, ///< Undefined state williamr@2: EInitialise, ///< Initialise Obex client object williamr@2: EConnect, ///< Trying to connect williamr@2: EConnectAttemptComplete, ///< Connection complete williamr@2: ESendObject, ///< Send Obex object williamr@2: ESendNextObject, ///< Send next Obex object williamr@2: ESendComplete, ///< Send complete williamr@2: EDisconnected, ///< Disconnected williamr@2: EUserCancelled, ///< User has cancelled the send, the current operation is unimportant williamr@2: ESendError, ///< Problem with the send williamr@2: EInitialised, ///< Initialisation complete williamr@2: EMovedToSent ///< Move sent message to outbox (not supported from v7.0s) williamr@2: }; williamr@2: TSendState iSendState; ///< Current state of send operation williamr@2: TInt iTotalEntryCount; ///< Total number of objects to send williamr@2: TInt iEntriesDone; ///< Number of entries sent williamr@2: TInt iCurrentEntrySize; ///< Length attribute of the current object (bytes) williamr@2: TInt iCurrentBytesTrans;///< Number of bytes sent of the current object williamr@2: TInt iError; ///< Operation error code williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: class CObexClientMtm : public CBaseMtm williamr@2: /** williamr@2: CObexClientMtm williamr@2: williamr@2: Abstract base class for Client Mtms that send obex objects williamr@2: williamr@2: The functionality missing is an implementation of InvokeAsyncFunctionL() williamr@2: which should return a messaging operation for a specific transport, InitialiseHeaderL() which is used williamr@2: to create a CObexMtmHeader derived object of the appropriate type, and TestInvariant() which is used to williamr@2: perform invariant testing of the derived types (in debug only). williamr@2: These pure-virtual functions are the transport specific aspects of the MTM. williamr@2: williamr@2: @internalTechnology williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: williamr@2: /// Contains the connect the timeout values for connect and put operations williamr@2: struct STimeouts williamr@2: { williamr@2: TInt iConnectTimeout; williamr@2: TInt iPutTimeout; williamr@2: }; williamr@2: williamr@2: //CBaseMtm Implementation williamr@2: williamr@2: /** williamr@2: * Commits cached changes to the message store, by calling CommitChangesL. williamr@2: * williamr@2: * @leave KErrXxx System-wide error codes if message cannot be saved. williamr@2: */ williamr@2: williamr@2: IMPORT_C virtual void SaveMessageL(); williamr@2: williamr@2: /** williamr@2: * This function loads the header from the message store williamr@2: * williamr@2: * @leave KErrXXX system-wide error codes williamr@2: */ williamr@2: williamr@2: IMPORT_C virtual void LoadMessageL(); williamr@2: williamr@2: /** williamr@2: * Ensure that the current message context part indicated is valid. Currently only works on KMsvMessagePartRecipient--all other parts williamr@2: * are assumed to be valid williamr@2: * williamr@2: * @param aPartList Bitmask indicating parts of message to be validated williamr@2: * @return Bitmask of any invalid parts--KErrNone otherwise williamr@2: */ williamr@2: williamr@2: IMPORT_C virtual TUint ValidateMessage(TMsvPartList aPartList); williamr@2: williamr@2: /** williamr@2: * Finds the given text within the specified parts of the current message context. NOT IMPLEMENTED! williamr@2: * williamr@2: * @param aTextToFind Reference to the text to search for in the specified message parts williamr@2: * @param aPartList Bitmask indicating parts of message to be searched for the text williamr@2: * @return Bitmask of any parts containing the message text williamr@2: */ williamr@2: williamr@2: IMPORT_C virtual TMsvPartList Find(const TDesC& aTextToFind, TMsvPartList aPartList); williamr@2: williamr@2: /** williamr@2: * Unsupported williamr@2: * williamr@2: * @leave Leaves always with KErrNotSupported williamr@2: */ williamr@2: williamr@2: IMPORT_C virtual CMsvOperation* ReplyL (TMsvId aReplyEntryId, TMsvPartList aPartlist, TRequestStatus& aCompletionStatus); williamr@2: williamr@2: /** williamr@2: * Unsupported williamr@2: * williamr@2: * @leave Leaves always with KErrNotSupported williamr@2: */ williamr@2: williamr@2: IMPORT_C virtual CMsvOperation* ForwardL(TMsvId aForwardEntryId, TMsvPartList aPartList, TRequestStatus& aCompletionStatus); williamr@2: // addresssee list (used by objects with no MTM knowledge) williamr@2: williamr@2: /** williamr@2: * Adds addressee to the addressee "list". Note that this MUST be a TDesC containing binary data representing williamr@2: * the TSockAddress of the addressee, usually as a TDesC16. This function will then package the data directly into williamr@2: * 8 bit data. williamr@2: * NB: Only ONE addressee is supported williamr@2: * williamr@2: * @param aRealAddress Reference to the address of the recipient williamr@2: * @leave KErrXXX if address cannot be appended williamr@2: * @leave KErrAlreadyExists if the Addressee "list" already contains an entry williamr@2: */ williamr@2: williamr@2: IMPORT_C virtual void AddAddresseeL(const TDesC& aRealAddress); williamr@2: williamr@2: /** williamr@2: * Adds addressee to the addressee "list". Note that this MUST be a TDesC containing binary data representing williamr@2: * the TSockAddress of the addressee, usually as a TDesC16. This function will then package the data directly into williamr@2: * 8 bit data. williamr@2: * NB: Only ONE addressee is supported williamr@2: * williamr@2: * @param aRealAddress Reference to the address of the recipient williamr@2: * @param aAlias Reference to the alias of the recipient--ignored in this implementation williamr@2: * @leave KErrXXX if address cannot be appended williamr@2: * @leave KErrAlreadyExists if the Addressee "list" already contains an entry williamr@2: */ williamr@2: williamr@2: IMPORT_C virtual void AddAddresseeL(const TDesC& aRealAddress, const TDesC& aAlias); williamr@2: williamr@2: /** williamr@2: * Removes addressee at index aIndex from the addressee "list". williamr@2: * williamr@2: * @param aIndex zero-based index of the addressee (ignored since "there can be only one"). williamr@2: */ williamr@2: williamr@2: IMPORT_C virtual void RemoveAddressee(TInt aIndex); williamr@2: williamr@2: /** williamr@2: * Sets the subject of the current message context williamr@2: * williamr@2: * @param aSubject Reference to the new message subject text williamr@2: * @leave Leaves if creation of new HBufC fails williamr@2: */ williamr@2: williamr@2: IMPORT_C void SetSubjectL(const TDesC& aSubject); williamr@2: williamr@2: /** williamr@2: * Returns the subject of the current message context. Will not leave. williamr@2: * williamr@2: * @return const TPtrC representation of the Subject, or an empty TPtrC if the subject hasn't been set williamr@2: * @leave Never williamr@2: */ williamr@2: williamr@2: IMPORT_C const TPtrC SubjectL() const; williamr@2: williamr@2: IMPORT_C void CreateMessageAttachmentL(TMsvId aAttachmentId); williamr@2: williamr@2: williamr@2: // --- RTTI functions --- williamr@2: williamr@2: /** williamr@2: * Gives the capability of the MTM. williamr@2: * williamr@2: * @param aCapability capability to be queried williamr@2: * @param aResponse capability dependent return value. williamr@2: * @return KErrNone if the capability is supported, or KErrNotSupported if not. williamr@2: */ williamr@2: williamr@2: IMPORT_C virtual TInt QueryCapability(TUid aCapability, TInt& aResponse); williamr@2: williamr@2: IMPORT_C virtual void InvokeSyncFunctionL(TInt aFunctionId,const CMsvEntrySelection& aSelection, TDes8& aParameter); williamr@2: williamr@2: /** williamr@2: * Create a new message for this MTM. This creates a new messaging entry, then williamr@2: * re-initialises the MTM's CObexMtmHeader object. williamr@2: * williamr@2: * @param aServiceId The ID of the service for which the message is to be created williamr@2: * @leave KErrXxx Standard EPOC error codes if construction of new objects fails williamr@2: */ williamr@2: williamr@2: IMPORT_C virtual void CreateMessageL(TMsvId /*aServiceId*/); williamr@2: williamr@2: /** williamr@2: * Destructor deletes FileNameExternaliser and Header williamr@2: */ williamr@2: williamr@2: IMPORT_C ~CObexClientMtm(); williamr@2: williamr@2: /** williamr@2: * Commits cached changes to the message store. williamr@2: * williamr@2: * @leave KErrXxx System-wide error codes if changes cannot be committed. williamr@2: */ williamr@2: williamr@2: IMPORT_C void CommitChangesL(); williamr@2: williamr@2: /** williamr@2: * This function calculates the size of all attachments to the message by either: williamr@2: * williamr@2: * @li summing the sizes of each of the children or; williamr@2: * @li reading in all of the filenames from the store, and summing their sizes.* williamr@2: * williamr@2: * @return total size of the attachments. williamr@2: * @leave KErrXXX system-wide error codes williamr@2: */ williamr@2: williamr@2: IMPORT_C TInt32 GetAttachmentSizeL(); williamr@2: williamr@2: williamr@2: protected: williamr@2: williamr@2: /** williamr@2: * Constructor. Initialises iMsgTypeUid with Uid provided by the derived class. williamr@2: * williamr@2: * @param aRegisteredMtmDll Registration data for MTM DLL. williamr@2: * @param aMsvSession CMsvSession of the client requesting the object. williamr@2: * @param aMsgTypeUid Uid of the message williamr@2: */ williamr@2: williamr@2: IMPORT_C CObexClientMtm(CRegisteredMtmDll& aRegisteredMtmDll, CMsvSession& aMsvSession, TUid aMsgTypeUid); williamr@2: williamr@2: /** williamr@2: * Empty implementation provided for future-proofing. williamr@2: */ williamr@2: williamr@2: IMPORT_C void ConstructL(); williamr@2: williamr@2: williamr@2: /// Initialises header information (must be overidden in derived class) williamr@2: virtual void InitialiseHeaderL() = 0; williamr@2: williamr@2: /** williamr@2: * Resets the MTM when the context is switched. williamr@2: * Must be called by the derived class's ContextEntrySwitched prior to constructing a new header. williamr@2: */ williamr@2: williamr@2: IMPORT_C void ContextEntrySwitched(); // called after the context of this instance has been changed to another entry williamr@2: williamr@2: protected: williamr@2: CObexMtmHeader* iHeader; ///