112 // ----------------------------------------------------------------------------- |
116 // ----------------------------------------------------------------------------- |
113 // CPhoneMediatorSender::RegisterGenericEvents |
117 // CPhoneMediatorSender::RegisterGenericEvents |
114 // ----------------------------------------------------------------------------- |
118 // ----------------------------------------------------------------------------- |
115 // |
119 // |
116 void CPhoneMediatorSender::RegisterGenericEvents() |
120 void CPhoneMediatorSender::RegisterGenericEvents() |
117 { |
121 { |
118 __LOGMETHODSTARTEND( EPhoneMediatorCenter, "CPhoneMediatorSender::RegisterGenericEvents( ) "); |
122 __LOGMETHODSTARTEND( EPhoneMediatorCenter, "CPhoneMediatorSender::RegisterGenericEvents( ) "); |
119 TCapabilitySet caps; |
123 TCapabilitySet caps; |
120 caps.SetEmpty(); |
124 caps.SetEmpty(); |
121 |
125 |
122 MediatorService::TEvent newEvent; |
126 MediatorService::TEvent newEvent; |
123 newEvent.iEventId = EPhoneEventCallData; |
127 newEvent.iEventId = EPhoneEventCallData; |
124 newEvent.iVersion = TVersion( KTelephonyEventsVersionMajor, |
128 newEvent.iVersion = TVersion( KTelephonyEventsVersionMajor, |
125 KTelephonyEventsVersionMinor, |
129 KTelephonyEventsVersionMinor, |
126 KTelephonyEventsVersionBuild ); |
130 KTelephonyEventsVersionBuild ); |
127 newEvent.iCaps = caps; |
131 newEvent.iCaps = caps; |
128 |
132 |
129 TRAPD( errorCode, iGenericEvents.AppendL( newEvent )); |
133 TRAPD( errorCode, iGenericEvents.AppendL( newEvent )); |
130 if( errorCode == ECCPErrorNone ) |
134 if( errorCode == ECCPErrorNone ) |
131 { |
135 { |
132 TInt res = iEventSender->RegisterEvent( KMediatorTelephonyDomain, |
136 TInt res = iEventSender->RegisterEvent( KMediatorTelephonyDomain, |
133 KCatEventsFromTelephony, |
137 KCatEventsFromTelephony, |
134 iGenericEvents ); |
138 iGenericEvents ); |
135 __ASSERT_DEBUG( !res, Panic( EPhoneMediatorCenterRegistrationFailed ) ); |
139 __ASSERT_DEBUG( !res, Panic( EPhoneMediatorCenterRegistrationFailed ) ); |
136 } |
140 } |
137 } |
141 } |
138 |
142 |
139 // ----------------------------------------------------------------------------- |
143 // ----------------------------------------------------------------------------- |
140 // CPhoneMediatorSender::SendEvent |
144 // CPhoneMediatorSender::SendEvent |
141 // ----------------------------------------------------------------------------- |
145 // ----------------------------------------------------------------------------- |
142 // |
146 // |
149 // ----------------------------------------------------------------------------- |
153 // ----------------------------------------------------------------------------- |
150 // CPhoneMediatorSender::SendEvent |
154 // CPhoneMediatorSender::SendEvent |
151 // ----------------------------------------------------------------------------- |
155 // ----------------------------------------------------------------------------- |
152 // |
156 // |
153 EXPORT_C void CPhoneMediatorSender::SendEvent( const TPhoneViewCommandId aCommandId, |
157 EXPORT_C void CPhoneMediatorSender::SendEvent( const TPhoneViewCommandId aCommandId, |
154 const TInt aCallId ) const |
158 const TInt aCallId ) const |
155 { |
159 { |
156 switch( aCommandId ) |
160 switch( aCommandId ) |
157 { |
161 { |
158 case EPhoneViewRemoveCallHeader: |
162 case EPhoneViewRemoveCallHeader: |
159 { |
163 { |
160 __PHONELOG1( EBasic, EPhoneMediatorCenter, |
164 __PHONELOG1( EBasic, EPhoneMediatorCenter, |
161 "CPhoneMediatorSender::SendEvent - EPhoneEventCallData iCallId:%d" ,aCallId ); |
165 "CPhoneMediatorSender::SendEvent - EPhoneEventCallData iCallId:%d" ,aCallId ); |
162 TTelephonyCallDataParam callDataParam; |
166 TTelephonyCallDataParam callDataParam; |
163 callDataParam.iCallId = aCallId; |
167 callDataParam.iCallId = aCallId; |
164 callDataParam.iCallState = ECallStateIdle; |
168 callDataParam.iCallState = ECallStateIdle; |
165 TTelephonyCallDataParamPackage callDataParamPackage( callDataParam ); |
169 TTelephonyCallDataParamPackage callDataParamPackage( callDataParam ); |
166 iEventSender->RaiseEvent( KMediatorTelephonyDomain, |
170 iEventSender->RaiseEvent( KMediatorTelephonyDomain, |
167 KCatEventsFromTelephony, |
171 KCatEventsFromTelephony, |
168 EPhoneEventCallData, |
172 EPhoneEventCallData, |
169 TVersion( KTelephonyEventsVersionMajor, |
173 TVersion( KTelephonyEventsVersionMajor, |
170 KTelephonyEventsVersionMinor, |
174 KTelephonyEventsVersionMinor, |
171 KTelephonyEventsVersionBuild ), |
175 KTelephonyEventsVersionBuild ), |
172 callDataParamPackage ); |
176 callDataParamPackage ); |
173 } |
177 } |
174 break; |
178 break; |
175 |
179 |
176 default: |
180 default: |
177 break; |
181 break; |
178 } |
182 } |
179 } |
183 } |
180 |
184 |
181 // ----------------------------------------------------------------------------- |
185 // ----------------------------------------------------------------------------- |
182 // CPhoneMediatorSender::SendEvent |
186 // CPhoneMediatorSender::SendEvent |
183 // ----------------------------------------------------------------------------- |
187 // ----------------------------------------------------------------------------- |
184 // |
188 // |
185 EXPORT_C void CPhoneMediatorSender::SendEvent( const TPhoneViewCommandId aCommandId, |
189 EXPORT_C void CPhoneMediatorSender::SendEvent( const TPhoneViewCommandId aCommandId, |
186 TPhoneCommandParam& aCommandParam ) |
190 TPhoneCommandParam& aCommandParam ) |
187 { |
191 { |
188 switch( aCommandId ) |
192 switch( aCommandId ) |
189 { |
193 { |
190 case EPhoneViewActivateMuteUIChanges: |
194 case EPhoneViewActivateMuteUIChanges: |
191 { |
195 { |
192 TPhoneCmdParamBoolean& booleanParam = static_cast<TPhoneCmdParamBoolean&>( aCommandParam ); |
196 TPhoneCmdParamBoolean& booleanParam = static_cast<TPhoneCmdParamBoolean&>( aCommandParam ); |
193 const TBool audioMute( booleanParam.Boolean() ); |
197 const TBool audioMute( booleanParam.Boolean() ); |
194 TInt response = KErrNone; |
198 TInt response = KErrNone; |
195 TInt command = -1; |
199 // <-- QT PHONE START --> |
|
200 TInt command = -1; |
196 if( audioMute ) |
201 if( audioMute ) |
197 { |
202 { |
198 __PHONELOG( EBasic, EPhoneMediatorCenter, |
203 __PHONELOG( EBasic, EPhoneMediatorCenter, |
199 "CPhoneMediatorSender::SendEvent - transformed to Mediator Command EVtCmdMute" ); |
204 "CPhoneMediatorSender::SendEvent - transformed to Mediator Command EVtCmdMute" ); |
200 command = EVtCmdMute; |
205 command = EVtCmdMute; |
201 response = IssueCommand( KMediatorVideoTelephonyDomain, |
206 response = IssueCommand( KMediatorVideoTelephonyDomain, |
202 KCatPhoneToVideotelCommands, |
207 KCatPhoneToVideotelCommands, |
203 command, |
208 command, |
204 TVersion( KPhoneToVideotelCmdVersionMajor, |
209 TVersion( KPhoneToVideotelCmdVersionMajor, |
205 KPhoneToVideotelCmdVersionMinor, |
210 KPhoneToVideotelCmdVersionMinor, |
206 KPhoneToVideotelCmdVersionBuild ), |
211 KPhoneToVideotelCmdVersionBuild ), |
207 KNullDesC8 ); |
212 KNullDesC8 ); |
208 } |
213 } |
209 else |
214 else |
210 { |
215 { |
211 __PHONELOG( EBasic, EPhoneMediatorCenter, |
216 __PHONELOG( EBasic, EPhoneMediatorCenter, |
212 "CPhoneMediatorSender::SendEvent - transformed to Mediator Command EVtCmdUnmute" ); |
217 "CPhoneMediatorSender::SendEvent - transformed to Mediator Command EVtCmdUnmute" ); |
213 command = EVtCmdUnmute; |
218 command = EVtCmdUnmute; |
214 response = IssueCommand( KMediatorVideoTelephonyDomain, |
219 response = IssueCommand( KMediatorVideoTelephonyDomain, |
215 KCatPhoneToVideotelCommands, |
220 KCatPhoneToVideotelCommands, |
216 command, |
221 command, |
217 TVersion( KPhoneToVideotelCmdVersionMajor, |
222 TVersion( KPhoneToVideotelCmdVersionMajor, |
218 KPhoneToVideotelCmdVersionMinor, |
223 KPhoneToVideotelCmdVersionMinor, |
219 KPhoneToVideotelCmdVersionBuild ), |
224 KPhoneToVideotelCmdVersionBuild ), |
220 KNullDesC8 ); |
225 KNullDesC8 ); |
221 } |
226 } |
222 |
227 |
223 if( ( response == KErrInUse ) && ( iCommandBuffer.iCommandId == KErrNotFound ) ) |
228 if( ( response == KErrInUse ) && ( iCommandBuffer.iCommandId == KErrNotFound ) ) |
224 { |
229 { |
225 // Previous command wasn't handled yet so buffer the last unhandled command. |
230 // Previous command wasn't handled yet so buffer the last unhandled command. |
226 // This command will be sent after we get response to the previous command |
231 // This command will be sent after we get response to the previous command |
227 iCommandBuffer.iCommandId = command; |
232 iCommandBuffer.iCommandId = command; |
228 iCommandBuffer.iDomainUid = KMediatorVideoTelephonyDomain; |
233 iCommandBuffer.iDomainUid = KMediatorVideoTelephonyDomain; |
229 iCommandBuffer.iCategoryUid = KCatPhoneToVideotelCommands; |
234 iCommandBuffer.iCategoryUid = KCatPhoneToVideotelCommands; |
230 iCommandBuffer.iVersion = TVersion( KPhoneToVideotelCmdVersionMajor, |
235 iCommandBuffer.iVersion = TVersion( KPhoneToVideotelCmdVersionMajor, |
231 KPhoneToVideotelCmdVersionMinor, |
236 KPhoneToVideotelCmdVersionMinor, |
232 KPhoneToVideotelCmdVersionBuild ); |
237 KPhoneToVideotelCmdVersionBuild ); |
233 } |
238 } |
|
239 // <-- QT PHONE END --> |
234 } |
240 } |
235 break; |
241 break; |
236 |
242 |
237 default: |
243 default: |
238 break; |
244 break; |
239 } |
245 } |
240 } |
246 } |
241 |
247 |
242 // ----------------------------------------------------------------------------- |
248 // ----------------------------------------------------------------------------- |
243 // CPhoneMediatorSender::SendEvent |
249 // CPhoneMediatorSender::SendEvent |
244 // ----------------------------------------------------------------------------- |
250 // ----------------------------------------------------------------------------- |
245 // |
251 // |
246 EXPORT_C void CPhoneMediatorSender::SendEvent( const TPhoneViewCommandId aCommandId, |
252 EXPORT_C void CPhoneMediatorSender::SendEvent( const TPhoneViewCommandId aCommandId, |
247 const TInt aCallId, TPhoneCommandParam& aCommandParam ) const |
253 const TInt aCallId, TPhoneCommandParam& aCommandParam ) const |
248 { |
254 { |
249 switch( aCommandId ) |
255 switch( aCommandId ) |
250 { |
256 { |
251 case EPhoneViewCreateCallHeader: |
257 case EPhoneViewCreateCallHeader: |
252 { |
258 { |
253 TPhoneCmdParamCallHeaderData& callHeaderParam = static_cast<TPhoneCmdParamCallHeaderData&>( aCommandParam ); |
259 TPhoneCmdParamCallHeaderData& callHeaderParam = static_cast<TPhoneCmdParamCallHeaderData&>( aCommandParam ); |
254 __PHONELOG2( EBasic, EPhoneMediatorCenter, |
260 __PHONELOG2( EBasic, EPhoneMediatorCenter, |
255 "CPhoneMediatorSender::SendEvent - EPhoneEventCallData iCallId:%d iCLIText:%S", |
261 "CPhoneMediatorSender::SendEvent - EPhoneEventCallData iCallId:%d iCLIText:%S", |
256 aCallId, &callHeaderParam.CLIText() ); |
262 aCallId, &callHeaderParam.CLIText() ); |
257 TTelephonyCallDataParam callDataParam; |
263 TTelephonyCallDataParam callDataParam; |
258 callDataParam.iCallId = aCallId; |
264 callDataParam.iCallId = aCallId; |
259 callDataParam.iCLIText = callHeaderParam.CLIText(); |
265 callDataParam.iCLIText = callHeaderParam.CLIText(); |
260 callDataParam.iCallState = MapCallState( callHeaderParam.CallState() ); |
266 callDataParam.iCallState = MapCallState( callHeaderParam.CallState() ); |
261 callDataParam.iRemotePhoneNumber = callHeaderParam.RemotePhoneNumber(); |
267 callDataParam.iRemotePhoneNumber = callHeaderParam.RemotePhoneNumber(); |
262 callDataParam.iCallType = MapCallType( callHeaderParam.CallType() ); |
268 callDataParam.iCallType = MapCallType( callHeaderParam.CallType() ); |
263 TTelephonyCallDataParamPackage callDataParamPackage( callDataParam ); |
269 TTelephonyCallDataParamPackage callDataParamPackage( callDataParam ); |
264 iEventSender->RaiseEvent( KMediatorTelephonyDomain, |
270 iEventSender->RaiseEvent( KMediatorTelephonyDomain, |
265 KCatEventsFromTelephony, |
271 KCatEventsFromTelephony, |
266 EPhoneEventCallData, |
272 EPhoneEventCallData, |
267 TVersion( KTelephonyEventsVersionMajor, |
273 TVersion( KTelephonyEventsVersionMajor, |
268 KTelephonyEventsVersionMinor, |
274 KTelephonyEventsVersionMinor, |
269 KTelephonyEventsVersionBuild ), |
275 KTelephonyEventsVersionBuild ), |
270 callDataParamPackage ); |
276 callDataParamPackage ); |
271 } |
277 } |
272 break; |
278 break; |
273 |
279 |
274 default: |
280 default: |
275 break; |
281 break; |
276 } |
282 } |
277 } |
283 } |
278 |
284 |
279 // ----------------------------------------------------------------------------- |
285 // ----------------------------------------------------------------------------- |
280 // CPhoneMediatorSender::SendEvent |
286 // CPhoneMediatorSender::SendEvent |
281 // ----------------------------------------------------------------------------- |
287 // ----------------------------------------------------------------------------- |
282 // |
288 // |
296 MPhoneShutdownCommand* aShutdownCommand ) |
302 MPhoneShutdownCommand* aShutdownCommand ) |
297 { |
303 { |
298 __LOGMETHODSTARTEND( EPhoneMediatorCenter, "CPhoneMediatorSender::IssueCommand( ) "); |
304 __LOGMETHODSTARTEND( EPhoneMediatorCenter, "CPhoneMediatorSender::IssueCommand( ) "); |
299 __PHONELOG3( EBasic, EPhoneMediatorCenter, |
305 __PHONELOG3( EBasic, EPhoneMediatorCenter, |
300 "aCommandId = %d, aDomain = %d, aCategory = %d", aCommandId, aDomain, aCategory ); |
306 "aCommandId = %d, aDomain = %d, aCategory = %d", aCommandId, aDomain, aCategory ); |
301 if( aShutdownCommand ) |
307 if( aShutdownCommand ) |
302 { |
308 { |
303 iShutdownCommand = aShutdownCommand; |
309 iShutdownCommand = aShutdownCommand; |
304 } |
310 } |
305 |
311 |
306 return iCommandInitiator->IssueCommand( |
312 return iCommandInitiator->IssueCommand( |
307 aDomain, |
313 aDomain, |
308 aCategory, |
314 aCategory, |
309 aCommandId, |
315 aCommandId, |
310 aVersion, |
316 aVersion, |
311 aData ); |
317 aData ); |
312 } |
318 } |
313 |
319 |
314 // ----------------------------------------------------------------------------- |
320 // ----------------------------------------------------------------------------- |
315 // CPhoneMediatorSender::CommandResponseL |
321 // CPhoneMediatorSender::CommandResponseL |
316 // ----------------------------------------------------------------------------- |
322 // ----------------------------------------------------------------------------- |
317 // |
323 // |
318 void CPhoneMediatorSender::CommandResponseL( TUid aDomain, TUid aCategory, |
324 void CPhoneMediatorSender::CommandResponseL( TUid aDomain, TUid aCategory, |
319 TInt aCommandId, TInt /*aStatus*/, const TDesC8& /*aData*/ ) |
325 TInt aCommandId, TInt /*aStatus*/, const TDesC8& /*aData*/ ) |
320 { |
326 { |
321 // First check for buffered command |
327 // First check for buffered command |
322 if( iCommandBuffer.iCommandId != KErrNotFound ) |
328 if( iCommandBuffer.iCommandId != KErrNotFound ) |
323 { |
329 { |
324 // We have a buffered command waiting |
330 // We have a buffered command waiting |
325 __PHONELOG( EBasic, EPhoneMediatorCenter, |
331 __PHONELOG( EBasic, EPhoneMediatorCenter, |
326 "CPhoneMediatorSender::VideoTelephonyCommandResponse - Buffered Command waiting" ); |
332 "CPhoneMediatorSender::VideoTelephonyCommandResponse - Buffered Command waiting" ); |
327 if( iCommandBuffer.iCommandId != aCommandId ) |
333 if( iCommandBuffer.iCommandId != aCommandId ) |
328 { |
334 { |
329 // And it's not identical to the command which response we now received |
335 // And it's not identical to the command which response we now received |
330 // so it's necessary to re-send it |
336 // so it's necessary to re-send it |
331 __PHONELOG1( EBasic, EPhoneMediatorCenter, |
337 __PHONELOG1( EBasic, EPhoneMediatorCenter, |
332 "CPhoneMediatorSender::VideoTelephonyCommandResponse - Resending command %d", iCommandBuffer.iCommandId ); |
338 "CPhoneMediatorSender::VideoTelephonyCommandResponse - Resending command %d", iCommandBuffer.iCommandId ); |
333 IssueCommand( iCommandBuffer.iDomainUid, |
339 IssueCommand( iCommandBuffer.iDomainUid, |
334 iCommandBuffer.iCategoryUid, |
340 iCommandBuffer.iCategoryUid, |
335 iCommandBuffer.iCommandId, |
341 iCommandBuffer.iCommandId, |
336 iCommandBuffer.iVersion, |
342 iCommandBuffer.iVersion, |
337 KNullDesC8 ); |
343 KNullDesC8 ); |
338 |
344 |
339 ResetCommandBuffer(); |
345 ResetCommandBuffer(); |
340 } |
346 } |
341 } |
347 } |
342 |
348 // <-- QT PHONE START --> |
343 if( ( aDomain == KMediatorVideoTelephonyDomain ) && |
349 |
344 ( aCategory == KCatPhoneToVideotelCommands ) ) |
350 if( ( aDomain == KMediatorVideoTelephonyDomain ) && |
345 { |
351 ( aCategory == KCatPhoneToVideotelCommands ) ) |
346 VideoTelephonyCommandResponse( aCommandId ); |
352 { |
347 } |
353 VideoTelephonyCommandResponse( aCommandId ); |
348 } |
354 } |
|
355 |
|
356 // <-- QT PHONE END --> |
|
357 } |
349 |
358 |
350 // ----------------------------------------------------------------------------- |
359 // ----------------------------------------------------------------------------- |
351 // CPhoneMediatorSender::VideoTelephonyCommandResponse |
360 // CPhoneMediatorSender::VideoTelephonyCommandResponse |
352 // ----------------------------------------------------------------------------- |
361 // ----------------------------------------------------------------------------- |
353 // |
362 // |
354 void CPhoneMediatorSender::VideoTelephonyCommandResponse( TInt aCommandId ) |
363 void CPhoneMediatorSender::VideoTelephonyCommandResponse( TInt aCommandId ) |
355 { |
364 { |
356 __LOGMETHODSTARTEND( EPhoneMediatorCenter, "CPhoneMediatorSender::VideoTelephonyCommandResponse( ) "); |
365 __LOGMETHODSTARTEND( EPhoneMediatorCenter, "CPhoneMediatorSender::VideoTelephonyCommandResponse( ) "); |
357 __PHONELOG1( EBasic, EPhoneMediatorCenter, |
366 __PHONELOG1( EBasic, EPhoneMediatorCenter, |
358 "VideoTelephonyCommandResponse aCommandId = %d", aCommandId ); |
367 "VideoTelephonyCommandResponse aCommandId = %d", aCommandId ); |
|
368 // <-- QT PHONE START --> |
359 |
369 |
360 switch( aCommandId ) |
370 switch( aCommandId ) |
361 { |
371 { |
362 case EVtCmdReleaseDataport: |
372 case EVtCmdReleaseDataport: |
363 __ASSERT_DEBUG( iShutdownCommand, Panic( EPhoneMediatorCenterParameterNotInitialized ) ); |
373 __ASSERT_DEBUG( iShutdownCommand, Panic( EPhoneMediatorCenterParameterNotInitialized ) ); |
364 TRAP_IGNORE( iShutdownCommand->ExecuteLD()); |
374 TRAP_IGNORE( iShutdownCommand->ExecuteLD()); |
365 break; |
375 break; |
366 |
376 |
367 default: |
377 default: |
368 break; |
378 break; |
369 } |
379 } |
|
380 |
|
381 // <-- QT PHONE END --> |
370 } |
382 } |
371 |
383 |
372 // ----------------------------------------------------------------------------- |
384 // ----------------------------------------------------------------------------- |
373 // CPhoneMediatorSender::MapCallState |
385 // CPhoneMediatorSender::MapCallState |
374 // ----------------------------------------------------------------------------- |
386 // ----------------------------------------------------------------------------- |