|
1 // Copyright (c) 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 #include <mtp/cmtptypearray.h> |
|
17 #include <mtp/mmtpdataproviderframework.h> |
|
18 #include <mtp/tmtptyperequest.h> |
|
19 #include <mtp/cmtpobjectmetadata.h> |
|
20 #include <mtp/mmtpreferencemgr.h> |
|
21 |
|
22 #include "cmtpimagedpgetobjectreferences.h" |
|
23 #include "mtpimagedputilits.h" |
|
24 #include "cmtpimagedp.h" |
|
25 |
|
26 __FLOG_STMT(_LIT8(KComponent,"GetObjectReferences");) |
|
27 |
|
28 /** |
|
29 Two-phase construction method |
|
30 @param aPlugin The data provider plugin |
|
31 @param aFramework The data provider framework |
|
32 @param aConnection The connection from which the request comes |
|
33 @return a pointer to the created request processor object |
|
34 */ |
|
35 MMTPRequestProcessor* CMTPImageDpGetObjectReferences::NewL(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, CMTPImageDataProvider& /*aDataProvider*/) |
|
36 { |
|
37 CMTPImageDpGetObjectReferences* self = new (ELeave) CMTPImageDpGetObjectReferences(aFramework, aConnection); |
|
38 CleanupStack::PushL(self); |
|
39 self->ConstructL(); |
|
40 CleanupStack::Pop(self); |
|
41 return self; |
|
42 } |
|
43 |
|
44 /** |
|
45 Destructor |
|
46 */ |
|
47 CMTPImageDpGetObjectReferences::~CMTPImageDpGetObjectReferences() |
|
48 { |
|
49 __FLOG(_L8(">> CMTPImageDpGetObjectReferences::~CMTPImageDpGetObjectReferences")); |
|
50 delete iReferences; |
|
51 __FLOG(_L8("<< CMTPImageDpGetObjectReferences::~CMTPImageDpGetObjectReferences")); |
|
52 __FLOG_CLOSE; |
|
53 } |
|
54 |
|
55 /** |
|
56 Standard c++ constructor |
|
57 */ |
|
58 CMTPImageDpGetObjectReferences::CMTPImageDpGetObjectReferences(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) |
|
59 :CMTPRequestProcessor(aFramework, aConnection, 0, NULL) |
|
60 { |
|
61 } |
|
62 |
|
63 /** |
|
64 Second phase constructor |
|
65 */ |
|
66 void CMTPImageDpGetObjectReferences::ConstructL() |
|
67 { |
|
68 __FLOG_OPEN(KMTPSubsystem, KComponent); |
|
69 __FLOG(_L8(">> CMTPImageDpGetObjectReferences::ConstructL")); |
|
70 __FLOG(_L8("<< CMTPImageDpGetObjectReferences::ConstructL")); |
|
71 } |
|
72 |
|
73 TMTPResponseCode CMTPImageDpGetObjectReferences::CheckRequestL() |
|
74 { |
|
75 __FLOG(_L8(">> CMTPImageDpGetObjectReferences::CheckRequestL")); |
|
76 |
|
77 TUint32 objectHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter1); |
|
78 CMTPObjectMetaData* objectInfo = CMTPObjectMetaData::NewLC(); |
|
79 TMTPResponseCode responseCode = MTPImageDpUtilits::VerifyObjectHandleL(iFramework, objectHandle, *objectInfo); |
|
80 CleanupStack::PopAndDestroy(objectInfo); |
|
81 |
|
82 __FLOG_VA((_L8("CheckRequestL - Exit with responseCode = 0x%04X"), responseCode)); |
|
83 __FLOG(_L8("<< CMTPImageDpGetObjectReferences::CheckRequestL")); |
|
84 return responseCode; |
|
85 } |
|
86 |
|
87 /** |
|
88 GetReferences request handler |
|
89 */ |
|
90 void CMTPImageDpGetObjectReferences::ServiceL() |
|
91 { |
|
92 __FLOG(_L8(">> CMTPImageDpCopyObject::ServiceL")); |
|
93 |
|
94 TUint32 objectHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter1); |
|
95 MMTPReferenceMgr& referenceMgr = iFramework.ReferenceMgr(); |
|
96 delete iReferences; |
|
97 iReferences = NULL; |
|
98 iReferences = referenceMgr.ReferencesLC(TMTPTypeUint32(objectHandle)); |
|
99 CleanupStack::Pop(iReferences); |
|
100 SendDataL(*iReferences); |
|
101 __FLOG(_L8("<< CMTPImageDpCopyObject::ServiceL")); |
|
102 } |
|
103 |
|
104 |