mtpfws/mtpfw/dataproviders/dputility/inc/cmtpsvccompoundprocessor.h
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2008-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 "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // mw/remoteconn/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpsvccompoundprocessor.h
       
    15 
       
    16 
       
    17 /**
       
    18  @file
       
    19  @internalComponent
       
    20  */
       
    21 
       
    22 #ifndef __CMTPSVCCOMPOUNDPROCESSOR_H__
       
    23 #define __CMTPSVCCOMPOUNDPROCESSOR_H__
       
    24 
       
    25 #include "cmtprequestprocessor.h"
       
    26 
       
    27 class MMTPServiceDataProvider;
       
    28 class MMTPSvcObjectHandler;
       
    29 class CMTPTypeObjectInfo;
       
    30 class CMTPTypeObjectPropList;
       
    31 class CMTPObjectMetaData;
       
    32 
       
    33 /** 
       
    34 Implements the service data provider's CMTPCompoundProcessor request processor.
       
    35 The processor is responsible for SendObjectInfo, SendObjectPropList, UpdateObjectPropList 
       
    36 and SendObject requests handling, it will create new object or update existing object. 
       
    37 @internalComponent
       
    38 */
       
    39 class CMTPSvcCompoundProcessor : public CMTPRequestProcessor
       
    40 	{
       
    41 public:
       
    42 	IMPORT_C static MMTPRequestProcessor* NewL(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, MMTPServiceDataProvider& aDataProvider);    
       
    43 	IMPORT_C ~CMTPSvcCompoundProcessor();
       
    44 
       
    45 private:
       
    46 	CMTPSvcCompoundProcessor(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, MMTPServiceDataProvider& aDataProvider);
       
    47 	void ConstructL();
       
    48 
       
    49 	// From CMTPRequestProcessor
       
    50 	TBool Match(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection) const;
       
    51 	TBool HasDataphase() const;
       
    52 	
       
    53 	TMTPResponseCode CheckRequestL();
       
    54 	TMTPResponseCode CheckSendingStateL();
       
    55 	TMTPResponseCode CheckRequestParametersL();
       
    56 	TMTPResponseCode CheckStoreAndParent();
       
    57 	
       
    58 	void ServiceL();
       
    59 	void ServiceObjectPropertiesL();
       
    60 	void ServiceSendObjectInfoL();
       
    61 	void ServiceSendObjectPropListL();
       
    62 	void ServiceSendObjectL();
       
    63 	
       
    64 	TBool DoHandleCompletingPhaseL();
       
    65 	TBool DoHandleResponsePhaseL();
       
    66 	TBool DoHandleResponseSendObjectInfoL();
       
    67 	TBool DoHandleResponseSendObjectPropListL();
       
    68 	TBool DoHandleResponseUpdateObjectPropListL();
       
    69 	TBool DoHandleResponseSendObjectL();
       
    70 	
       
    71 	/**
       
    72 	Extract objectsize property value from UpdateObjectPropList dataset
       
    73 	@return See MTP response code definition
       
    74 	*/
       
    75 	TMTPResponseCode ExtractObjectSizeL();
       
    76 	/**
       
    77 	Reserve object handle from framework for SendObjectInfo or SendObjectPropList
       
    78 	*/
       
    79 	void ReserveObjectL();
       
    80 	/**
       
    81 	Register route next SendObject from framework and send response code
       
    82 	*/
       
    83 	void RegisterRequestAndSendResponseL(TMTPResponseCode aResponseCode);
       
    84 	
       
    85 	// Cleanup Item operation for commit rollback including handle and temp object rollback
       
    86 	static void RollBackObject(TAny* aObject);
       
    87 	void RollBack();
       
    88 	
       
    89 	// Check object format and set object handler pointer
       
    90 	TMTPResponseCode CheckFmtAndSetHandler(TUint32 aFormatCode);
       
    91 	TMTPResponseCode SendObjectPropListL(const CMTPTypeObjectPropList& aObjectPropList, TUint32& aParentHandle, 
       
    92 															TUint32& aParameter, TDes& aSuid, TUint64 aObjectSize);
       
    93 	TMTPResponseCode UpdateObjectPropListL(CMTPObjectMetaData& aObjectMetaData, 
       
    94 															const CMTPTypeObjectPropList& aObjectPropList, 
       
    95 															TUint32& aParameter);
       
    96 
       
    97 private:
       
    98 	enum TMTPSendingObjectState
       
    99 		{
       
   100 		EIdle,
       
   101 		EObjectInfoProcessing,
       
   102 		EObjectInfoSucceed,
       
   103 		EObjectSendProcessing,
       
   104 		EObjectSendSucceed,
       
   105 		EObjectSendFail
       
   106 		};
       
   107 
       
   108 	TUint16                      iOperationCode;   // Current operation code
       
   109 	TUint16                      iLastInfoOperationCode;   // Last info category operation code
       
   110 	TUint32                      iFormatCode;
       
   111 	TUint32                      iStorageId;
       
   112 	TUint32                      iParentHandle;
       
   113 	TUint64                      iObjectSize;
       
   114 	
       
   115 	MMTPServiceDataProvider&     iDataProvider;
       
   116 	MMTPSvcObjectHandler*        iObjectHandler; // Not own
       
   117 	MMTPType*                    iObjectContent; // Not own
       
   118 	CMTPTypeObjectInfo*          iObjectInfo;
       
   119 	CMTPTypeObjectPropList*      iObjectPropList;
       
   120 	CMTPObjectMetaData*          iReceivedObjectMetaData;
       
   121 
       
   122 	TMTPSendingObjectState       iState; // Compound processor state machine
       
   123 	TMTPTypeRequest              iExpectedSendObjectRequest; // Use for register next SendObject
       
   124 	TUint32                      iLastTransactionID; // Last valid transaction id
       
   125 	TUint32                      iLastSessionID; // Last valid session id
       
   126 	TBool                        iIsCommited; // Is received ObjectInfo or ObjectPropList commited
       
   127 	TBool                        iIsRollBackHandlerObject; // Roll back handle which has been insert in handler db
       
   128 	/**
       
   129 	FLOGGER debug trace member variable.
       
   130 	*/
       
   131 	__FLOG_DECLARATION_MEMBER_MUTABLE;
       
   132 	};
       
   133 
       
   134 #endif // __CMTPSVCCOMPOUNDPROCESSOR_H__
       
   135