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