|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implement the operation: GetInterdenpendentPropDesc |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <mtp/cmtptypeinterdependentpropdesc.h> |
|
19 |
|
20 #include "cgetinterdependentpropdesc.h" |
|
21 #include "mmmtpdplogger.h" |
|
22 #include "mmmtpdpconfig.h" |
|
23 #include "cdescriptionutility.h" |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // CGetInterdependentPropDesc::NewL |
|
27 // Destructor |
|
28 // ----------------------------------------------------------------------------- |
|
29 // |
|
30 EXPORT_C MMmRequestProcessor* CGetInterdependentPropDesc::NewL( MMTPDataProviderFramework& aFramework, |
|
31 MMTPConnection& aConnection, |
|
32 MMmMtpDpConfig& aDpConfig ) |
|
33 { |
|
34 CGetInterdependentPropDesc* self = new ( ELeave ) CGetInterdependentPropDesc( aFramework, aConnection, aDpConfig ); |
|
35 |
|
36 CleanupStack::PushL(self); |
|
37 self->ConstructL(); |
|
38 CleanupStack::Pop(self); |
|
39 |
|
40 return self; |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CGetInterdependentPropDesc::~CGetInterdependentPropDesc |
|
45 // Destructor |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 EXPORT_C CGetInterdependentPropDesc::~CGetInterdependentPropDesc() |
|
49 { |
|
50 delete iDataset; |
|
51 iDataset = NULL; |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CMTPGetInterDependentPropDesc::CMTPGetInterDependentPropDesc |
|
56 // Standard c++ constructor |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 EXPORT_C CGetInterdependentPropDesc::CGetInterdependentPropDesc( MMTPDataProviderFramework& aFramework, |
|
60 MMTPConnection& aConnection, |
|
61 MMmMtpDpConfig& aDpConfig ) : |
|
62 CRequestProcessor( aFramework, aConnection, 0, NULL ), |
|
63 iDpConfig( aDpConfig ) |
|
64 { |
|
65 PRINT( _L( "Operation: GetInterdependentPropDesc(0x9807)" ) ); |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // CMediaDpMtpGetInterDependentPropDesc::ConstructL |
|
70 // Two-phase construction method |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 EXPORT_C void CGetInterdependentPropDesc::ConstructL() |
|
74 { |
|
75 // Do nothing |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // CGetInterdependentPropDesc::CheckRequestL |
|
80 // Verify the reqeust and returns it |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 EXPORT_C TMTPResponseCode CGetInterdependentPropDesc::CheckRequestL() |
|
84 { |
|
85 PRINT( _L( "MM MTP => CGetInterdependentPropDesc::CheckRequestL" ) ); |
|
86 |
|
87 TMTPResponseCode responseCode = CRequestProcessor::CheckRequestL(); |
|
88 iFormatCode = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); |
|
89 |
|
90 // check if it is what dp supported |
|
91 responseCode = EMTPRespCodeInvalidObjectFormatCode; |
|
92 |
|
93 const RArray<TUint>* format = iDpConfig.GetSupportedFormat(); |
|
94 TInt count = format->Count(); |
|
95 |
|
96 for ( TInt i = 0; i < count; i++ ) |
|
97 { |
|
98 if ( iFormatCode == ( *format )[i] ) |
|
99 { |
|
100 responseCode = EMTPRespCodeOK; |
|
101 break; |
|
102 } |
|
103 } |
|
104 |
|
105 // Clear the data set. |
|
106 delete iDataset; |
|
107 iDataset = NULL; |
|
108 |
|
109 PRINT2( _L( "MM MTP <= CGetInterdependentPropDesc::CheckRequestL, iFormatCode = 0x%x, responseCode = 0x%x" ), |
|
110 iFormatCode, |
|
111 responseCode ); |
|
112 |
|
113 return responseCode; |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CGetInterdependentPropDesc::ServiceL |
|
118 // service a request at request phase |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 EXPORT_C void CGetInterdependentPropDesc::ServiceL() |
|
122 { |
|
123 PRINT( _L( "MM MTP => CGetInterdependentPropDesc::ServiceL" ) ); |
|
124 |
|
125 iDataset = iDpConfig.DescriptionUtility()->NewInterdepentPropDescL( iDpConfig, iFormatCode ); |
|
126 |
|
127 // Send the dataset. |
|
128 SendDataL( *iDataset ); |
|
129 PRINT( _L( "MM MTP <= CGetInterdependentPropDesc::ServiceL" ) ); |
|
130 } |
|
131 |
|
132 // end of file |