examples/RemoteConn/MtpDataProviderExample/src/mtpexamplerequestprocessor.cpp

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 #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 

Generated by  doxygen 1.6.2