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