|
1 // Copyright (c) 2006-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 // |
|
15 |
|
16 |
|
17 #include <mtp/tmtptyperequest.h> |
|
18 |
|
19 #include "mtpdevicedpprocessor.h" |
|
20 #include "cmtprequestprocessor.h" |
|
21 #include "cmtpgetdeviceinfo.h" |
|
22 #include "cmtpopensession.h" |
|
23 #include "cmtpclosesession.h" |
|
24 #include "cmtpgetstorageids.h" |
|
25 #include "cmtpgetstorageinfo.h" |
|
26 #include "cmtpgetnumobjects.h" |
|
27 #include "cmtpgetobjecthandles.h" |
|
28 #include "cmtpresetdevice.h" |
|
29 #include "cmtpgetdevicepropdesc.h" |
|
30 #include "cmtpgetdevicepropvalue.h" |
|
31 #include "cmtpsetdevicepropvalue.h" |
|
32 #include "cmtpdevrequestunknown.h" |
|
33 |
|
34 #include "cmtpcopyobject.h" |
|
35 #include "cmtpmoveobject.h" |
|
36 #include "cmtpdeleteobject.h" |
|
37 #include "cmtpgetobject.h" |
|
38 #include "cmtpgetobjectinfo.h" |
|
39 #include "cmtpgetobjectpropdesc.h" |
|
40 #include "cmtpgetobjectproplist.h" |
|
41 #include "cmtpgetobjectpropssupported.h" |
|
42 #include "cmtpgetobjectpropvalue.h" |
|
43 #include "cmtpgetreferences.h" |
|
44 #include "cmtpsendobjectinfo.h" |
|
45 #include "cmtpsetobjectproplist.h" |
|
46 #include "cmtpsetobjectpropvalue.h" |
|
47 #include "cmtpresetdevicepropvalue.h" |
|
48 #include "cmtpsetreferences.h" |
|
49 #include "cmtpresetdevicepropvalue.h" |
|
50 #include "cmtpgetinterdependentpropdesc.h" |
|
51 #include "cmtpgetserviceids.h" |
|
52 #include "cmtpgetserviceinfo.h" |
|
53 #include "cmtpgetformatcapabilities.h" |
|
54 /** |
|
55 device data provider mapping table from request ID to factory method of the request processor |
|
56 */ |
|
57 static const TMTPRequestProcessorEntry KMTPRequestProcessorTable[] = |
|
58 { |
|
59 {EMTPOpCodeGetDeviceInfo, CMTPGetDeviceInfo::NewL}, |
|
60 {EMTPOpCodeOpenSession, CMTPOpenSession::NewL}, |
|
61 {EMTPOpCodeCloseSession, CMTPCloseSession::NewL}, |
|
62 {EMTPOpCodeGetStorageIDs, CMTPGetStorageIds::NewL}, |
|
63 {EMTPOpCodeGetStorageInfo, CMTPGetStorageInfo::NewL}, |
|
64 {EMTPOpCodeGetNumObjects, CMTPGetNumObjects::NewL}, |
|
65 {EMTPOpCodeGetObjectHandles, CMTPGetObjectHandles::NewL}, |
|
66 {EMTPOpCodeResetDevice, CMTPResetDevice::NewL}, |
|
67 {EMTPOpCodeGetDevicePropDesc, CMTPGetDevicePropDesc::NewL}, |
|
68 {EMTPOpCodeGetDevicePropValue, CMTPGetDevicePropValue::NewL}, |
|
69 {EMTPOpCodeSetDevicePropValue, CMTPSetDevicePropValue::NewL}, |
|
70 {EMTPOpCodeMoveObject, CMTPMoveObject::NewL}, |
|
71 {EMTPOpCodeCopyObject, CMTPCopyObject::NewL}, |
|
72 {EMTPOpCodeDeleteObject, CMTPDeleteObject::NewL}, |
|
73 {EMTPOpCodeGetObject, CMTPGetObject::NewL}, |
|
74 {EMTPOpCodeGetObjectInfo, CMTPGetObjectInfo::NewL}, |
|
75 {EMTPOpCodeGetObjectPropDesc, CMTPGetObjectPropDesc::NewL}, |
|
76 {EMTPOpCodeGetObjectPropList, CMTPGetObjectPropList::NewL}, |
|
77 {EMTPOpCodeGetObjectPropsSupported, CMTPGetObjectPropsSupported::NewL}, |
|
78 {EMTPOpCodeGetObjectPropValue, CMTPGetObjectPropValue::NewL}, |
|
79 {EMTPOpCodeGetObjectReferences, CMTPGetReferences::NewL}, |
|
80 {EMTPOpCodeGetInterdependentPropDesc, CMTPGetInterDependentPropDesc::NewL}, |
|
81 {EMTPOpCodeSendObject, CMTPSendObjectInfo::NewL}, |
|
82 {EMTPOpCodeSendObjectInfo, CMTPSendObjectInfo::NewL}, |
|
83 {EMTPOpCodeSendObjectPropList, CMTPSendObjectInfo::NewL}, |
|
84 {EMTPOpCodeSetObjectPropList, CMTPSetObjectPropList::NewL}, |
|
85 {EMTPOpCodeSetObjectPropValue, CMTPSetObjectPropValue::NewL}, |
|
86 {EMTPOpCodeSetObjectReferences, CMTPSetReferences::NewL}, |
|
87 {EMTPOpCodeResetDevicePropValue, CMTPResetDevicePropValue::NewL}, |
|
88 {EMTPOpCodeGetServiceIDs, CMTPGetServiceIds::NewL}, |
|
89 {EMTPOpCodeGetServiceInfo, CMTPGetServiceInfo::NewL}, |
|
90 {EMTPOpCodeGetFormatCapabilities,CMTPGetFormatCapabilities::NewL} |
|
91 }; |
|
92 |
|
93 /** |
|
94 Create a request processor that matches the request |
|
95 @param aPlugin The reference to the data provider plugin |
|
96 @param aFramework The reference to the data provider framework |
|
97 @param aRequest The request to be processed |
|
98 @param aConnection The connection from which the request comes from |
|
99 @return a pointer to the request processor |
|
100 */ |
|
101 MMTPRequestProcessor* MTPDeviceDpProcessor::CreateL( |
|
102 MMTPDataProviderFramework& aFramework, |
|
103 const TMTPTypeRequest& aRequest, |
|
104 MMTPConnection& aConnection) |
|
105 { |
|
106 TMTPRequestProcessorCreateFunc createFunc = NULL; |
|
107 TUint16 operationCode = aRequest.Uint16(TMTPTypeRequest::ERequestOperationCode); |
|
108 TInt count = sizeof(KMTPRequestProcessorTable) / sizeof(TMTPRequestProcessorEntry); |
|
109 for(TInt i = 0; i < count; i++) |
|
110 { |
|
111 if(KMTPRequestProcessorTable[i].iOperationCode == operationCode) |
|
112 { |
|
113 createFunc = KMTPRequestProcessorTable[i].iCreateFunc; |
|
114 break; |
|
115 } |
|
116 } |
|
117 |
|
118 if(!createFunc) |
|
119 { |
|
120 createFunc = CMTPDevRequestUnknown::NewL; |
|
121 } |
|
122 |
|
123 return (*createFunc)(aFramework, aConnection); |
|
124 } |
|
125 |
|
126 |
|
127 |