00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <mtp/tmtptyperequest.h>
00031
00032 #include "mtpexamplerequestprocessor.h"
00033 #include "cmtpexampledprequestprocessor.h"
00034 #include "cmtpexampledpvendordefinedop1.h"
00035 #include "cmtpexampledpvendordefinedop2.h"
00036 #include "cmtprequestunknown.h"
00037 #include "cmtpexampledpconst.h"
00038
00042 static const TMTPRequestProcessorEntry KMTPExampleDpRequestProcessorTable[] =
00043 {
00044 {EMTPOpVendorDefined1, CMTPExampleDpVendorDefinedOp1::NewL},
00045 {EMTPOpVendorDefined2 , CMTPExampleDpVendorDefinedOp2::NewL},
00046 {EMTPOpCodeSkip, CMTPExampleDpVendorDefinedOp2::NewL},
00047 };
00048
00057 MMTPExampleDpRequestProcessor* MTPExampleDpProcessor::CreateL(
00058 MMTPDataProviderFramework& aFramework,
00059 const TMTPTypeRequest& aRequest,
00060 MMTPConnection& aConnection)
00061 {
00062 TMTPRequestProcessorCreateFunc createFunc = NULL;
00063 TUint16 operationCode = aRequest.Uint16(TMTPTypeRequest::ERequestOperationCode);
00064 TInt count = sizeof(KMTPExampleDpRequestProcessorTable) / sizeof(TMTPRequestProcessorEntry);
00065 for(TInt i = 0; i < count; i++)
00066 {
00067 if(KMTPExampleDpRequestProcessorTable[i].iOperationCode == operationCode)
00068 {
00069 createFunc = KMTPExampleDpRequestProcessorTable[i].iCreateFunc;
00070 break;
00071 }
00072 }
00073
00074 if(!createFunc)
00075 {
00076 createFunc = CMTPRequestUnknown::NewL;
00077 }
00078
00079 return (*createFunc)(aFramework, aConnection);
00080 }
00081
00082
00083