|
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 #include <mtp/cmtptypearray.h> |
|
16 #include "cmtppictbridgegetobjectpropssupported.h" |
|
17 #include "mtppictbridgedpconst.h" |
|
18 |
|
19 /** |
|
20 Verification data for the GetObjectPropSupported request |
|
21 */ |
|
22 const TMTPRequestElementInfo KMTPGetObjectPropSupportedPolicy[] = |
|
23 { |
|
24 {TMTPTypeRequest::ERequestParameter1, EMTPElementTypeFormatCode, EMTPElementAttrNone, 1, EMTPFormatCodeUndefined, 0}, |
|
25 }; |
|
26 |
|
27 MMTPRequestProcessor* CMTPPictBridgeGetObjectPropsSupported::NewL( MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, CMTPPictBridgeDataProvider& aDataProvider ) |
|
28 { |
|
29 CMTPPictBridgeGetObjectPropsSupported* self = new (ELeave) CMTPPictBridgeGetObjectPropsSupported( aFramework, aConnection, aDataProvider ); |
|
30 CleanupStack::PushL(self); |
|
31 self->ConstructL(); |
|
32 CleanupStack::Pop(self); |
|
33 return self; |
|
34 } |
|
35 |
|
36 /** |
|
37 Destructor |
|
38 */ |
|
39 CMTPPictBridgeGetObjectPropsSupported::~CMTPPictBridgeGetObjectPropsSupported() |
|
40 { |
|
41 delete iObjectPropsSupported; |
|
42 } |
|
43 |
|
44 /** |
|
45 Standard c++ constructor |
|
46 */ |
|
47 CMTPPictBridgeGetObjectPropsSupported::CMTPPictBridgeGetObjectPropsSupported( MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, CMTPPictBridgeDataProvider& aDataProvider ) |
|
48 :CMTPRequestProcessor( aFramework, aConnection, sizeof(KMTPGetObjectPropSupportedPolicy)/sizeof(TMTPRequestElementInfo), KMTPGetObjectPropSupportedPolicy ), |
|
49 iPictBridgeDP( aDataProvider ) |
|
50 { |
|
51 |
|
52 } |
|
53 |
|
54 /** |
|
55 check format code |
|
56 */ |
|
57 TMTPResponseCode CMTPPictBridgeGetObjectPropsSupported::CheckRequestL() |
|
58 { |
|
59 TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL(); |
|
60 if ( EMTPRespCodeOK == responseCode ) |
|
61 { |
|
62 TUint32 formatCode = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); |
|
63 if( formatCode != EMTPFormatCodeScript ) |
|
64 { |
|
65 responseCode = EMTPRespCodeInvalidObjectFormatCode; |
|
66 } |
|
67 } |
|
68 |
|
69 return responseCode; |
|
70 } |
|
71 |
|
72 /** |
|
73 CMTPPictBridgeGetObjectPropsSupported request handler |
|
74 */ |
|
75 void CMTPPictBridgeGetObjectPropsSupported::ServiceL() |
|
76 { |
|
77 TInt count = sizeof(KMTPPictBridgeDpSupportedProperties) / sizeof(TUint16); |
|
78 for( TInt i = 0; i < count; i++ ) |
|
79 { |
|
80 iObjectPropsSupported->AppendUintL(KMTPPictBridgeDpSupportedProperties[i]); |
|
81 } |
|
82 SendDataL(*iObjectPropsSupported); |
|
83 } |
|
84 |
|
85 /** |
|
86 Second-phase construction |
|
87 */ |
|
88 void CMTPPictBridgeGetObjectPropsSupported::ConstructL() |
|
89 { |
|
90 iObjectPropsSupported = CMTPTypeArray::NewL(EMTPTypeAUINT16); |
|
91 } |