21 #include <mtp/mmtpobjectmgr.h> |
21 #include <mtp/mmtpobjectmgr.h> |
22 |
22 |
23 #include "cmtpsvcgetreferences.h" |
23 #include "cmtpsvcgetreferences.h" |
24 #include "mmtpservicedataprovider.h" |
24 #include "mmtpservicedataprovider.h" |
25 #include "mmtpsvcobjecthandler.h" |
25 #include "mmtpsvcobjecthandler.h" |
|
26 #include "OstTraceDefinitions.h" |
|
27 #ifdef OST_TRACE_COMPILER_IN_USE |
|
28 #include "cmtpsvcgetreferencesTraces.h" |
|
29 #endif |
26 |
30 |
27 __FLOG_STMT(_LIT8(KComponent,"SvcGetRef");) |
31 |
28 |
32 |
29 EXPORT_C MMTPRequestProcessor* CMTPSvcGetReferences::NewL(MMTPDataProviderFramework& aFramework, |
33 EXPORT_C MMTPRequestProcessor* CMTPSvcGetReferences::NewL(MMTPDataProviderFramework& aFramework, |
30 MMTPConnection& aConnection, |
34 MMTPConnection& aConnection, |
31 MMTPServiceDataProvider& aDataProvider) |
35 MMTPServiceDataProvider& aDataProvider) |
32 { |
36 { |
37 /** |
41 /** |
38 Destructor |
42 Destructor |
39 */ |
43 */ |
40 EXPORT_C CMTPSvcGetReferences::~CMTPSvcGetReferences() |
44 EXPORT_C CMTPSvcGetReferences::~CMTPSvcGetReferences() |
41 { |
45 { |
42 __FLOG(_L8("~CMTPSvcGetReferences - Entry")); |
46 OstTraceFunctionEntry0( CMTPSVCGETREFERENCES_CMTPSVCGETREFERENCES_DES_ENTRY ); |
43 delete iReferences; |
47 delete iReferences; |
44 delete iReceivedObjectMetaData; |
48 delete iReceivedObjectMetaData; |
45 __FLOG(_L8("~CMTPSvcGetReferences - Exit")); |
49 OstTraceFunctionExit0( CMTPSVCGETREFERENCES_CMTPSVCGETREFERENCES_DES_EXIT ); |
46 __FLOG_CLOSE; |
|
47 } |
50 } |
48 |
51 |
49 /** |
52 /** |
50 Standard c++ constructor |
53 Standard c++ constructor |
51 */ |
54 */ |
53 MMTPConnection& aConnection, |
56 MMTPConnection& aConnection, |
54 MMTPServiceDataProvider& aDataProvider) |
57 MMTPServiceDataProvider& aDataProvider) |
55 :CMTPRequestProcessor(aFramework, aConnection, 0, NULL), |
58 :CMTPRequestProcessor(aFramework, aConnection, 0, NULL), |
56 iDataProvider(aDataProvider) |
59 iDataProvider(aDataProvider) |
57 { |
60 { |
58 __FLOG_OPEN(KMTPSubsystem, KComponent); |
61 OstTraceFunctionEntry0( CMTPSVCGETREFERENCES_CMTPSVCGETREFERENCES_CONS_ENTRY ); |
59 __FLOG(_L8("Constructed")); |
62 OstTraceFunctionExit0( CMTPSVCGETREFERENCES_CMTPSVCGETREFERENCES_CONS_EXIT ); |
60 } |
63 } |
61 |
64 |
62 TMTPResponseCode CMTPSvcGetReferences::CheckRequestL() |
65 TMTPResponseCode CMTPSvcGetReferences::CheckRequestL() |
63 { |
66 { |
64 __FLOG(_L8("CheckRequestL - Entry")); |
67 OstTraceFunctionEntry0( CMTPSVCGETREFERENCES_CHECKREQUESTL_ENTRY ); |
65 |
68 |
66 TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL(); |
69 TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL(); |
67 if (EMTPRespCodeOK == responseCode) |
70 if (EMTPRespCodeOK == responseCode) |
68 { |
71 { |
69 TUint32 objectHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter1); |
72 TUint32 objectHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter1); |
75 { |
78 { |
76 // Check whether the owner of this object is correct data provider |
79 // Check whether the owner of this object is correct data provider |
77 if (iReceivedObjectMetaData->Uint(CMTPObjectMetaData::EDataProviderId) != iFramework.DataProviderId()) |
80 if (iReceivedObjectMetaData->Uint(CMTPObjectMetaData::EDataProviderId) != iFramework.DataProviderId()) |
78 { |
81 { |
79 responseCode = EMTPRespCodeInvalidObjectHandle; |
82 responseCode = EMTPRespCodeInvalidObjectHandle; |
80 __FLOG(_L8("CheckRequestL - DataProviderId dismatch")); |
83 OstTrace0( TRACE_WARNING, DUP1_CMTPSVCGETREFERENCES_CHECKREQUESTL, "CheckRequestL - DataProviderId dismatch" ); |
81 } |
84 } |
82 else |
85 else |
83 { |
86 { |
84 // Check format code |
87 // Check format code |
85 TUint16 formatCode = iReceivedObjectMetaData->Uint(CMTPObjectMetaData::EFormatCode); |
88 TUint16 formatCode = iReceivedObjectMetaData->Uint(CMTPObjectMetaData::EFormatCode); |
92 else |
95 else |
93 { |
96 { |
94 responseCode = EMTPRespCodeInvalidObjectHandle; |
97 responseCode = EMTPRespCodeInvalidObjectHandle; |
95 } |
98 } |
96 } |
99 } |
97 __FLOG_VA((_L8("CheckRequestL - Exit with code: 0x%04X"), responseCode)); |
100 OstTrace1( TRACE_NORMAL, CMTPSVCGETREFERENCES_CHECKREQUESTL, "Exit with code: 0x%04X", responseCode ); |
|
101 OstTraceFunctionExit0( CMTPSVCGETREFERENCES_CHECKREQUESTL_EXIT ); |
98 return responseCode; |
102 return responseCode; |
99 } |
103 } |
100 |
104 |
101 void CMTPSvcGetReferences::ServiceL() |
105 void CMTPSvcGetReferences::ServiceL() |
102 { |
106 { |
103 __FLOG(_L8("ServiceL - Entry")); |
107 OstTraceFunctionEntry0( CMTPSVCGETREFERENCES_SERVICEL_ENTRY ); |
104 TUint16 formatCode = iReceivedObjectMetaData->Uint(CMTPObjectMetaData::EFormatCode); |
108 TUint16 formatCode = iReceivedObjectMetaData->Uint(CMTPObjectMetaData::EFormatCode); |
105 delete iReferences; |
109 delete iReferences; |
106 iReferences = NULL; |
110 iReferences = NULL; |
107 iReferences = CMTPTypeArray::NewL(EMTPTypeAUINT32); |
111 iReferences = CMTPTypeArray::NewL(EMTPTypeAUINT32); |
108 iDataProvider.ObjectHandler(formatCode)->GetObjectReferenceL(*iReceivedObjectMetaData, *iReferences); |
112 iDataProvider.ObjectHandler(formatCode)->GetObjectReferenceL(*iReceivedObjectMetaData, *iReferences); |
109 SendDataL(*iReferences); |
113 SendDataL(*iReferences); |
110 __FLOG(_L8("ServiceL - Exit")); |
114 OstTraceFunctionExit0( CMTPSVCGETREFERENCES_SERVICEL_EXIT ); |
111 } |
115 } |