25 #include "mtpplaybackcontroldpconst.h" |
25 #include "mtpplaybackcontroldpconst.h" |
26 #include "cmtpplaybackcontroldp.h" |
26 #include "cmtpplaybackcontroldp.h" |
27 #include "cmtpplaybackproperty.h" |
27 #include "cmtpplaybackproperty.h" |
28 #include "cmtpplaybackcommand.h" |
28 #include "cmtpplaybackcommand.h" |
29 #include "mtpplaybackcontrolpanic.h" |
29 #include "mtpplaybackcontrolpanic.h" |
30 |
30 #include "OstTraceDefinitions.h" |
31 // Class constants. |
31 #ifdef OST_TRACE_COMPILER_IN_USE |
32 __FLOG_STMT(_LIT8(KComponent,"SetPlaybackDevicePropValue");) |
32 #include "cmtppbcsetdevicepropvalueTraces.h" |
|
33 #endif |
|
34 |
33 |
35 |
34 /** |
36 /** |
35 Two-phase constructor. |
37 Two-phase constructor. |
36 @param aPlugin The data provider plugin |
38 @param aPlugin The data provider plugin |
37 @param aFramework The data provider framework |
39 @param aFramework The data provider framework |
40 */ |
42 */ |
41 MMTPRequestProcessor* CMTPPbcSetDevicePropValue::NewL(MMTPDataProviderFramework& aFramework, |
43 MMTPRequestProcessor* CMTPPbcSetDevicePropValue::NewL(MMTPDataProviderFramework& aFramework, |
42 MMTPConnection& aConnection, |
44 MMTPConnection& aConnection, |
43 CMTPPlaybackControlDataProvider& aDataProvider) |
45 CMTPPlaybackControlDataProvider& aDataProvider) |
44 { |
46 { |
|
47 OstTraceFunctionEntry0( CMTPPBCSETDEVICEPROPVALUE_NEWL_ENTRY ); |
45 CMTPPbcSetDevicePropValue* self = new (ELeave) CMTPPbcSetDevicePropValue(aFramework, aConnection, aDataProvider); |
48 CMTPPbcSetDevicePropValue* self = new (ELeave) CMTPPbcSetDevicePropValue(aFramework, aConnection, aDataProvider); |
|
49 OstTraceFunctionExit0( CMTPPBCSETDEVICEPROPVALUE_NEWL_EXIT ); |
46 return self; |
50 return self; |
47 } |
51 } |
48 |
52 |
49 /** |
53 /** |
50 Destructor |
54 Destructor |
51 */ |
55 */ |
52 CMTPPbcSetDevicePropValue::~CMTPPbcSetDevicePropValue() |
56 CMTPPbcSetDevicePropValue::~CMTPPbcSetDevicePropValue() |
53 { |
57 { |
54 __FLOG(_L8("~CMTPPbcSetDevicePropValue - Entry")); |
58 OstTraceFunctionEntry0( CMTPPBCSETDEVICEPROPVALUE_CMTPPBCSETDEVICEPROPVALUE_ENTRY ); |
55 delete iPbCmd; |
59 delete iPbCmd; |
56 __FLOG(_L8("~CMTPPbcSetDevicePropValue - Exit")); |
60 OstTraceFunctionExit0( CMTPPBCSETDEVICEPROPVALUE_CMTPPBCSETDEVICEPROPVALUE_EXIT ); |
57 __FLOG_CLOSE; |
|
58 } |
61 } |
59 |
62 |
60 /** |
63 /** |
61 Standard c++ constructor |
64 Standard c++ constructor |
62 */ |
65 */ |
64 MMTPConnection& aConnection, |
67 MMTPConnection& aConnection, |
65 CMTPPlaybackControlDataProvider& aDataProvider): |
68 CMTPPlaybackControlDataProvider& aDataProvider): |
66 CMTPRequestProcessor(aFramework, aConnection, 0, NULL), |
69 CMTPRequestProcessor(aFramework, aConnection, 0, NULL), |
67 iPlaybackControlDp(aDataProvider) |
70 iPlaybackControlDp(aDataProvider) |
68 { |
71 { |
69 //Open the log system |
72 OstTraceFunctionEntry0( DUP1_CMTPPBCSETDEVICEPROPVALUE_CMTPPBCSETDEVICEPROPVALUE_ENTRY ); |
70 __FLOG_OPEN(KMTPSubsystem, KComponent); |
73 OstTraceFunctionExit0( DUP1_CMTPPBCSETDEVICEPROPVALUE_CMTPPBCSETDEVICEPROPVALUE_EXIT ); |
71 } |
74 } |
72 |
75 |
73 /** |
76 /** |
74 CMTPPbcSetDevicePropValue request validator. |
77 CMTPPbcSetDevicePropValue request validator. |
75 @return EMTPRespCodeOK if request is verified, otherwise one of the error response codes |
78 @return EMTPRespCodeOK if request is verified, otherwise one of the error response codes |
76 */ |
79 */ |
77 TMTPResponseCode CMTPPbcSetDevicePropValue::CheckRequestL() |
80 TMTPResponseCode CMTPPbcSetDevicePropValue::CheckRequestL() |
78 { |
81 { |
79 __FLOG(_L8("CheckRequestL - Entry")); |
82 OstTraceFunctionEntry0( CMTPPBCSETDEVICEPROPVALUE_CHECKREQUESTL_ENTRY ); |
80 TMTPResponseCode respCode = CMTPRequestProcessor::CheckRequestL(); |
83 TMTPResponseCode respCode = CMTPRequestProcessor::CheckRequestL(); |
81 if(respCode == EMTPRespCodeOK) |
84 if(respCode == EMTPRespCodeOK) |
82 { |
85 { |
83 respCode = EMTPRespCodeDevicePropNotSupported; |
86 respCode = EMTPRespCodeDevicePropNotSupported; |
84 TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1); |
87 TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1); |
91 break; |
94 break; |
92 } |
95 } |
93 } |
96 } |
94 } |
97 } |
95 |
98 |
96 __FLOG(_L8("CheckRequestL - Exit")); |
99 OstTraceFunctionExit0( CMTPPBCSETDEVICEPROPVALUE_CHECKREQUESTL_EXIT ); |
97 return respCode; |
100 return respCode; |
98 } |
101 } |
99 |
102 |
100 /** |
103 /** |
101 Process the transaction response phase. |
104 Process the transaction response phase. |
102 */ |
105 */ |
103 TBool CMTPPbcSetDevicePropValue::DoHandleResponsePhaseL() |
106 TBool CMTPPbcSetDevicePropValue::DoHandleResponsePhaseL() |
104 { |
107 { |
105 __FLOG(_L8("DoHandleResponsePhaseL - Entry")); |
108 OstTraceFunctionEntry0( CMTPPBCSETDEVICEPROPVALUE_DOHANDLERESPONSEPHASEL_ENTRY ); |
106 |
109 |
107 CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap()); |
110 CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap()); |
108 //Destroy the previous playback command. |
111 //Destroy the previous playback command. |
109 delete iPbCmd; |
112 delete iPbCmd; |
110 iPbCmd = NULL; |
113 iPbCmd = NULL; |
124 } |
127 } |
125 else |
128 else |
126 { |
129 { |
127 SendResponseL(EMTPRespCodeInvalidDevicePropValue); |
130 SendResponseL(EMTPRespCodeInvalidDevicePropValue); |
128 } |
131 } |
129 |
132 |
130 __FLOG(_L8("DoHandleResponsePhaseL - Exit")); |
133 OstTraceFunctionExit0( CMTPPBCSETDEVICEPROPVALUE_DOHANDLERESPONSEPHASEL_EXIT ); |
131 return EFalse; |
134 return EFalse; |
132 } |
135 } |
133 |
136 |
134 void CMTPPbcSetDevicePropValue::ServiceL() |
137 void CMTPPbcSetDevicePropValue::ServiceL() |
135 { |
138 { |
136 __FLOG(_L8("ServiceL - Entry")); |
139 OstTraceFunctionEntry0( CMTPPBCSETDEVICEPROPVALUE_SERVICEL_ENTRY ); |
137 TMTPDevicePropertyCode propCode(static_cast<TMTPDevicePropertyCode>(Request(). |
140 TMTPDevicePropertyCode propCode(static_cast<TMTPDevicePropertyCode>(Request(). |
138 Uint32(TMTPTypeRequest::ERequestParameter1))); |
141 Uint32(TMTPTypeRequest::ERequestParameter1))); |
139 iData.iOptCode = EMTPOpCodeSetDevicePropValue; |
142 iData.iOptCode = EMTPOpCodeSetDevicePropValue; |
140 iData.iDevPropCode = propCode; |
143 iData.iDevPropCode = propCode; |
141 switch(propCode) |
144 switch(propCode) |
158 { |
161 { |
159 SendResponseL(EMTPRespCodeDevicePropNotSupported); |
162 SendResponseL(EMTPRespCodeDevicePropNotSupported); |
160 } |
163 } |
161 break; |
164 break; |
162 } |
165 } |
163 __FLOG(_L8("ServiceL - Exit")); |
166 OstTraceFunctionExit0( CMTPPBCSETDEVICEPROPVALUE_SERVICEL_EXIT ); |
164 } |
167 } |
165 |
168 |
166 void CMTPPbcSetDevicePropValue::HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr) |
169 void CMTPPbcSetDevicePropValue::HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr) |
167 { |
170 { |
168 __FLOG(_L8("HandlePlaybackCommandCompleteL - Entry")); |
171 OstTraceFunctionEntry0( CMTPPBCSETDEVICEPROPVALUE_HANDLEPLAYBACKCOMMANDCOMPLETEL_ENTRY ); |
169 __FLOG_1(_L8("aErr %d"), aErr); |
172 OstTrace1( TRACE_NORMAL, CMTPPBCSETDEVICEPROPVALUE_HANDLEPLAYBACKCOMMANDCOMPLETEL, "aErr %d", aErr ); |
170 |
173 |
171 //Handle error response. |
174 //Handle error response. |
172 TMTPResponseCode response; |
175 TMTPResponseCode response; |
173 switch(aErr) |
176 switch(aErr) |
174 { |
177 { |
211 SendResponseL(response); |
214 SendResponseL(response); |
212 |
215 |
213 if(aCmd != NULL) |
216 if(aCmd != NULL) |
214 { |
217 { |
215 __ASSERT_DEBUG((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), Panic(EMTPPBArgumentErr)); |
218 __ASSERT_DEBUG((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), Panic(EMTPPBArgumentErr)); |
216 __FLOG_1(_L8("aCmd %d"), aCmd->PlaybackCommand()); |
219 OstTrace1( TRACE_NORMAL, DUP1_CMTPPBCSETDEVICEPROPVALUE_HANDLEPLAYBACKCOMMANDCOMPLETEL, "aCmd %d", aCmd->PlaybackCommand() ); |
217 } |
220 } |
218 |
221 OstTraceFunctionExit0( CMTPPBCSETDEVICEPROPVALUE_HANDLEPLAYBACKCOMMANDCOMPLETEL_EXIT ); |
219 __FLOG(_L8("HandlePlaybackCommandCompleteL - Exit")); |
222 } |
220 } |
|