29 #include "mtpdpconst.h" |
29 #include "mtpdpconst.h" |
30 #include "cmtpimagedpgetobjectpropdesc.h" |
30 #include "cmtpimagedpgetobjectpropdesc.h" |
31 #include "mtpimagedpconst.h" |
31 #include "mtpimagedpconst.h" |
32 #include "mtpimagedppanic.h" |
32 #include "mtpimagedppanic.h" |
33 #include "cmtpimagedp.h" |
33 #include "cmtpimagedp.h" |
34 |
34 #include "OstTraceDefinitions.h" |
35 __FLOG_STMT(_LIT8(KComponent,"GetObjectPropDesc");) |
35 #ifdef OST_TRACE_COMPILER_IN_USE |
|
36 #include "cmtpimagedpgetobjectpropdescTraces.h" |
|
37 #endif |
|
38 |
36 |
39 |
37 _LIT(KMtpObjDescObjFileName, "[a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~][a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~ ]{0, 7}\\.[[a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~][a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~ ]{0, 2}]?"); |
40 _LIT(KMtpObjDescObjFileName, "[a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~][a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~ ]{0, 7}\\.[[a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~][a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~ ]{0, 2}]?"); |
38 |
41 |
39 /** |
42 /** |
40 Two-phase construction method |
43 Two-phase construction method |
58 /** |
61 /** |
59 Destructor |
62 Destructor |
60 */ |
63 */ |
61 CMTPImageDpGetObjectPropDesc::~CMTPImageDpGetObjectPropDesc() |
64 CMTPImageDpGetObjectPropDesc::~CMTPImageDpGetObjectPropDesc() |
62 { |
65 { |
63 __FLOG(_L8(">> ~CMTPImageDpGetObjectPropDesc")); |
66 OstTraceFunctionEntry0( CMTPIMAGEDPGETOBJECTPROPDESC_CMTPIMAGEDPGETOBJECTPROPDESC_DES_ENTRY ); |
64 __FLOG(_L8(">> CMTPImageDpCopyObject::~CMTPImageDpCopyObject")); |
|
65 delete iObjectProperty; |
67 delete iObjectProperty; |
66 __FLOG(_L8("<< ~CMTPImageDpGetObjectPropDesc")); |
68 OstTraceFunctionExit0( CMTPIMAGEDPGETOBJECTPROPDESC_CMTPIMAGEDPGETOBJECTPROPDESC_DES_EXIT ); |
67 __FLOG_CLOSE; |
|
68 } |
69 } |
69 |
70 |
70 /** |
71 /** |
71 Standard c++ constructor |
72 Standard c++ constructor |
72 */ |
73 */ |
73 CMTPImageDpGetObjectPropDesc::CMTPImageDpGetObjectPropDesc( |
74 CMTPImageDpGetObjectPropDesc::CMTPImageDpGetObjectPropDesc( |
74 MMTPDataProviderFramework& aFramework, |
75 MMTPDataProviderFramework& aFramework, |
75 MMTPConnection& aConnection) |
76 MMTPConnection& aConnection) |
76 :CMTPRequestProcessor(aFramework, aConnection, 0, NULL) |
77 :CMTPRequestProcessor(aFramework, aConnection, 0, NULL) |
77 { |
78 { |
78 __FLOG_OPEN(KMTPSubsystem, KComponent); |
|
79 } |
79 } |
80 |
80 |
81 /** |
81 /** |
82 check property code |
82 check property code |
83 */ |
83 */ |
84 TMTPResponseCode CMTPImageDpGetObjectPropDesc::CheckRequestL() |
84 TMTPResponseCode CMTPImageDpGetObjectPropDesc::CheckRequestL() |
85 { |
85 { |
86 __FLOG(_L8(">> CMTPImageDpGetObjectPropDesc::CheckRequestL")); |
86 OstTraceFunctionEntry0( DUP1_CMTPIMAGEDPGETOBJECTPROPDESC_CHECKREQUESTL_ENTRY ); |
87 TMTPResponseCode response = CMTPRequestProcessor::CheckRequestL(); |
87 TMTPResponseCode response = CMTPRequestProcessor::CheckRequestL(); |
88 TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1); |
88 TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1); |
89 TUint32 formatCode = Request().Uint32(TMTPTypeRequest::ERequestParameter2); |
89 TUint32 formatCode = Request().Uint32(TMTPTypeRequest::ERequestParameter2); |
90 |
90 |
91 const TInt count = sizeof(KMTPImageDpSupportedProperties) / sizeof(TUint16); |
91 const TInt count = sizeof(KMTPImageDpSupportedProperties) / sizeof(TUint16); |
100 if(i == count) |
100 if(i == count) |
101 { |
101 { |
102 response = EMTPRespCodeInvalidObjectPropCode; |
102 response = EMTPRespCodeInvalidObjectPropCode; |
103 } |
103 } |
104 |
104 |
105 __FLOG(_L8("<< CMTPImageDpGetObjectPropDesc::CheckRequestL")); |
105 OstTraceFunctionExit0( DUP1_CMTPIMAGEDPGETOBJECTPROPDESC_CHECKREQUESTL_EXIT ); |
106 return response; |
106 return response; |
107 } |
107 } |
108 |
108 |
109 |
109 |
110 /** |
110 /** |
111 GetObjectPropDesc request handler |
111 GetObjectPropDesc request handler |
112 */ |
112 */ |
113 void CMTPImageDpGetObjectPropDesc::ServiceL() |
113 void CMTPImageDpGetObjectPropDesc::ServiceL() |
114 { |
114 { |
|
115 OstTraceFunctionEntry0( CMTPIMAGEDPGETOBJECTPROPDESC_SERVICEL_ENTRY ); |
115 delete iObjectProperty; |
116 delete iObjectProperty; |
116 iObjectProperty = NULL; |
117 iObjectProperty = NULL; |
117 |
118 |
118 TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1); |
119 TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1); |
119 __FLOG_VA((_L8(">> CMTPImageDpGetObjectPropDesc::ServiceL propcode %d"), propCode)); |
120 OstTrace1( TRACE_NORMAL, CMTPIMAGEDPGETOBJECTPROPDESC_SERVICEL, "propcode %d", propCode ); |
|
121 |
120 switch(propCode) |
122 switch(propCode) |
121 { |
123 { |
122 case EMTPObjectPropCodeStorageID: |
124 case EMTPObjectPropCodeStorageID: |
123 ServiceStorageIdL(); |
125 ServiceStorageIdL(); |
124 break; |
126 break; |
173 case EMTPObjectPropCodeRepresentativeSampleData: |
175 case EMTPObjectPropCodeRepresentativeSampleData: |
174 ServiceRepresentativeSampleDataL(); |
176 ServiceRepresentativeSampleDataL(); |
175 break; |
177 break; |
176 case EMTPObjectPropCodeNonConsumable: |
178 case EMTPObjectPropCodeNonConsumable: |
177 ServiceNonConsumableL(); |
179 ServiceNonConsumableL(); |
178 break; |
180 break; |
|
181 case EMTPObjectPropCodeHidden: |
|
182 ServiceHiddenL(); |
|
183 break; |
179 default: |
184 default: |
180 { |
185 { |
181 //Leave |
186 //Leave |
|
187 OstTrace1( TRACE_ERROR, DUP1_CMTPIMAGEDPGETOBJECTPROPDESC_SERVICEL, "Invalid property code %d", propCode ); |
182 User::Leave(KErrGeneral); |
188 User::Leave(KErrGeneral); |
183 } |
189 } |
184 break; |
190 break; |
185 } |
191 } |
186 |
192 |
187 __ASSERT_DEBUG(iObjectProperty, Panic(EMTPImageDpObjectPropertyNull)); |
193 __ASSERT_DEBUG(iObjectProperty, Panic(EMTPImageDpObjectPropertyNull)); |
188 |
194 |
189 iObjectProperty->SetUint32L(CMTPTypeObjectPropDesc::EGroupCode, GetPropertyGroupNumber(propCode)); |
195 iObjectProperty->SetUint32L(CMTPTypeObjectPropDesc::EGroupCode, GetPropertyGroupNumber(propCode)); |
190 SendDataL(*iObjectProperty); |
196 SendDataL(*iObjectProperty); |
191 |
197 |
192 __FLOG(_L8("<< CMTPImageDpGetObjectPropDesc::ServiceL")); |
198 OstTraceFunctionExit0( CMTPIMAGEDPGETOBJECTPROPDESC_SERVICEL_EXIT ); |
193 } |
199 } |
194 |
200 |
195 |
201 |
196 /** |
202 /** |
197 Second-phase construction |
203 Second-phase construction |
432 expectedForm->AppendSupportedValueL(data); |
438 expectedForm->AppendSupportedValueL(data); |
433 } |
439 } |
434 iObjectProperty = CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodeNonConsumable, *expectedForm); |
440 iObjectProperty = CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodeNonConsumable, *expectedForm); |
435 CleanupStack::PopAndDestroy(expectedForm); |
441 CleanupStack::PopAndDestroy(expectedForm); |
436 } |
442 } |
|
443 |
|
444 void CMTPImageDpGetObjectPropDesc::ServiceHiddenL() |
|
445 { |
|
446 CMTPTypeObjectPropDescEnumerationForm* expectedForm = CMTPTypeObjectPropDescEnumerationForm::NewL(EMTPTypeUINT16); |
|
447 CleanupStack::PushL(expectedForm); |
|
448 TUint16 values[] = {EMTPVisible,EMTPHidden}; |
|
449 TUint numValues((sizeof(values) / sizeof(values[0]))); |
|
450 for (TUint i = 0; i < numValues; i++) |
|
451 { |
|
452 TMTPTypeUint16 data(values[i]); |
|
453 expectedForm->AppendSupportedValueL(data); |
|
454 } |
|
455 iObjectProperty = CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodeHidden, *expectedForm); |
|
456 CleanupStack::PopAndDestroy(expectedForm); |
|
457 } |
437 |
458 |
438 TUint16 CMTPImageDpGetObjectPropDesc::GetPropertyGroupNumber(const TUint16 aPropCode) const |
459 TUint16 CMTPImageDpGetObjectPropDesc::GetPropertyGroupNumber(const TUint16 aPropCode) const |
439 { |
460 { |
440 for( TInt propCodeIndex = 0 ; propCodeIndex < KMTPImageDpGroupOneSize ; propCodeIndex++) |
461 for( TInt propCodeIndex = 0 ; propCodeIndex < KMTPImageDpGroupOneSize ; propCodeIndex++) |
441 { |
462 { |