diff -r f345bda72bc4 -r 43e37759235e Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/cmtpexampledprequestprocessor_8h-source.html --- a/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/cmtpexampledprequestprocessor_8h-source.html Tue Mar 30 11:56:28 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,166 +0,0 @@ - -
-00001 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -00002 // All rights reserved. -00003 // This component and the accompanying materials are made available -00004 // under the terms of "Eclipse Public License v1.0" -00005 // which accompanies this distribution, and is available -00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html". -00007 // -00008 // Initial Contributors: -00009 // Nokia Corporation - initial contribution. -00010 // -00011 // Contributors: -00012 // -00013 // Description: -00014 // -00015 -00016 -00017 #ifndef __CMTPEXAMPLEDPREQUESTPROCESSOR_H__ -00018 #define __CMTPEXAMPLEDPREQUESTPROCESSOR_H__ -00019 -00020 #include <e32base.h> -00021 #include <mtp/mtpdataproviderapitypes.h> -00022 #include <mtp/mtpprotocolconstants.h> -00023 #include <mtp/tmtptyperesponse.h> -00024 #include <mtp/tmtptypenull.h> -00025 -00026 -00027 class TMTPTypeRequest; -00028 class CMTPDataProviderPlugin; -00029 class MMTPDataProviderFramework; -00030 class TMTPTypeEvent; -00031 -00032 struct TMTPRequestElementInfo; -00033 -00039 class MMTPExampleDpRequestProcessor -00040 { -00041 public: -00042 /* -00043 Process a request from the initiator -00044 @param aRequest The request to be processed -00045 @param aPhase The transaction phase of the request -00046 @return ETrue to signal that the processor object can be deleted, EFalse to keep the processor object -00047 */ -00048 virtual TBool HandleRequestL(const TMTPTypeRequest& aRequest, TMTPTransactionPhase aPhase) = 0; -00049 -00050 /* -00051 Process an event from the initiator -00052 @param aEvent The event to be processed -00053 */ -00054 virtual void HandleEventL(const TMTPTypeEvent& aEvent) = 0; -00055 -00056 /* -00057 Check if the processor matches the request on the connection -00058 @param aRequest The request to be checked -00059 @param aConnection The connection from which the request comes -00060 @return ETrue to indicate the processor can handle the request, otherwise, EFalse -00061 */ -00062 virtual TBool Match(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection) const = 0; -00063 -00064 /* -00065 Check if the processor matches the event on the connection -00066 @param aEvent The event to be checked -00067 @param aConnection The connection from which the event comes -00068 @return ETrue to indicate the processor can handle the event, otherwise, EFalse -00069 */ -00070 virtual TBool Match(const TMTPTypeEvent& aEvent, MMTPConnection& aConnection) const = 0; -00071 -00072 /* -00073 Get the request object which the processor is currently handling -00074 @return the request object which the processor is currently handling -00075 */ -00076 virtual const TMTPTypeRequest& Request() const = 0; -00077 -00078 /* -00079 Get the connection object associated with the current request object -00080 @return the connection object associated with the current request object -00081 */ -00082 virtual MMTPConnection& Connection() const = 0; -00083 /* -00084 Get the Session ID associated with the current request object -00085 @return Session ID associated with the current request object -00086 */ -00087 -00088 virtual TUint32 SessionId() = 0; -00089 /* -00090 delete the request processor object -00091 */ -00092 virtual void Release() = 0; -00093 -00094 }; -00095 -00099 typedef MMTPExampleDpRequestProcessor* (*TMTPRequestProcessorCreateFunc)( -00100 MMTPDataProviderFramework& aFramework, -00101 MMTPConnection& aConnection); -00102 -00106 typedef struct -00107 { -00108 TUint16 iOperationCode; -00109 TMTPRequestProcessorCreateFunc iCreateFunc; -00110 }TMTPRequestProcessorEntry; -00111 -00112 class CMTPExampleDpRequestProcessor : public MMTPExampleDpRequestProcessor -00113 { -00114 protected: -00115 CMTPExampleDpRequestProcessor( -00116 MMTPDataProviderFramework& aFramework, -00117 MMTPConnection& aConnection, -00118 TInt aElementCount, -00119 const TMTPRequestElementInfo* aElements); -00120 virtual ~CMTPExampleDpRequestProcessor(); -00121 -00122 protected: //utility methods -00123 void SendResponseL(TMTPResponseCode aResponseCode, TInt aParameterCount = 0, TUint32* aParams = NULL); -00124 void CompleteRequestL(); -00125 -00126 protected: // from MMTPRequestProcessor -00127 virtual TBool HandleRequestL(const TMTPTypeRequest& aRequest, TMTPTransactionPhase aPhase); -00128 virtual void HandleEventL(const TMTPTypeEvent& aEvent); -00129 virtual void Release(); -00130 virtual TBool Match(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection) const; -00131 virtual TBool Match(const TMTPTypeEvent& aEvent, MMTPConnection& aConnection) const; -00132 virtual const TMTPTypeRequest& Request() const; -00133 virtual MMTPConnection& Connection() const; -00134 virtual TUint32 SessionId(); -00135 -00136 -00137 protected: //new virtuals -00138 virtual TBool DoHandleResponsePhaseL(); -00139 virtual TBool DoHandleCompletingPhaseL(); -00140 -00141 /* -00142 service a request at request phase -00143 */ -00144 virtual void ServiceL() = 0; -00145 -00146 private: -00147 void ExtractSessionTransactionId(); -00148 -00149 protected: -00150 MMTPDataProviderFramework& iFramework; -00151 const TMTPTypeRequest* iRequest; //the pending request object. -00152 MMTPConnection& iConnection; //the connection from which the request comes. -00153 TMTPTypeResponse iResponse; //the response object to send to the initiator. -00154 TBool iCancelled; //indicates whether the data phase (send/receive) has been cancelled. -00155 TInt iElementCount; //number of verification elements used for request checker. -00156 const TMTPRequestElementInfo* iElements; //pointer to an array of verification elements. -00157 TUint32 iSessionId; //session id for the pending request. -00158 TUint32 iTransactionCode; //transaction code for the pending request. -00159 -00160 private: -00161 TMTPResponseCode iResponseCode; // contains response from CheckRequestL call. -00162 }; -00163 -00164 #endif // __CMTPEXAMPLEDPREQUESTPROCESSOR_H__ -00165 -