|
1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Implements the avdtp stream |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #include <bluetooth/logger.h> |
|
24 #include "avdtpStream.h" |
|
25 #include "avdtpsap.h" |
|
26 #include "avdtp.h" |
|
27 #include "avdtputil.h" |
|
28 #include "avdtpSignallingChannel.h" |
|
29 #include "avdtpSignallingSession.h" |
|
30 #include "avdtpLocalSEP.h" |
|
31 |
|
32 #include "avdtputil.h" |
|
33 #include "btconsts.h" |
|
34 |
|
35 #ifdef __FLOG_ACTIVE |
|
36 _LIT8(KLogComponent, LOG_COMPONENT_AVDTP); |
|
37 #endif |
|
38 |
|
39 CAVStreamStateFactory* CAVStreamStateFactory::NewL() |
|
40 { |
|
41 LOG_STATIC_FUNC |
|
42 CAVStreamStateFactory* ret=new (ELeave) CAVStreamStateFactory(); |
|
43 CleanupStack::PushL(ret); |
|
44 ret->ConstructL(); |
|
45 CleanupStack::Pop(); |
|
46 return ret; |
|
47 } |
|
48 |
|
49 void CAVStreamStateFactory::ConstructL() |
|
50 { |
|
51 LOG_FUNC |
|
52 iStates[EStreamStateIdle]=new (ELeave) TAVStreamStateIdle(*this); |
|
53 iStates[EStreamStateWaitForSessions]=new (ELeave) TAVStreamStateWaitForSessions(*this); |
|
54 iStates[EStreamStateWaitingForLogicalChannels]=new (ELeave) TAVStreamStateWaitingForLogicalChannels(*this); |
|
55 iStates[EStreamStateCreatingLogicalChannels]=new (ELeave) TAVStreamStateCreatingLogicalChannels(*this); |
|
56 iStates[EStreamStateConfiguring]=new (ELeave) TAVStreamStateConfiguring(*this); |
|
57 iStates[EStreamStateINTConfigured]=new (ELeave) TAVStreamStateINTConfigured(*this); |
|
58 iStates[EStreamStateACPConfigured]=new (ELeave) TAVStreamStateACPConfigured(*this); |
|
59 iStates[EStreamStateOpening]=new (ELeave) TAVStreamStateOpening(*this); |
|
60 iStates[EStreamStateOpen]=new (ELeave) TAVStreamStateOpen(*this); |
|
61 iStates[EStreamStateReady]=new (ELeave) TAVStreamStateReady(*this); |
|
62 iStates[EStreamStateStarting]=new (ELeave) TAVStreamStateStarting(*this); |
|
63 iStates[EStreamStateSuspending]=new (ELeave) TAVStreamStateSuspending(*this); |
|
64 iStates[EStreamStateReconfiguring]=new (ELeave) TAVStreamStateReconfiguring(*this); |
|
65 iStates[EStreamStateReleasing]=new (ELeave) TAVStreamStateReleasing(*this); |
|
66 iStates[EStreamStateAborting]=new (ELeave) TAVStreamStateAborting(*this); |
|
67 iStates[EStreamStateStreaming]=new (ELeave) TAVStreamStateStreaming(*this); |
|
68 iStates[EStreamStateWaitForSessionsStartReceived]=new (ELeave) TAVStreamStateWaitForSessionsStartReceived(*this); |
|
69 } |
|
70 |
|
71 CAVStreamStateFactory::~CAVStreamStateFactory() |
|
72 { |
|
73 LOG_FUNC |
|
74 iStates.DeleteAll(); |
|
75 } |
|
76 |
|
77 const TAVStreamState& CAVStreamStateFactory::GetState(CAVStreamStateFactory::TAVStreamStates aState) const |
|
78 { |
|
79 LOG_FUNC |
|
80 __ASSERT_DEBUG(aState != EStreamMaxState, Panic(EAvdtpMuxerStateOutOfBounds)); |
|
81 return *iStates[aState]; |
|
82 } |
|
83 |
|
84 TInt CAVStreamStateFactory::StateIndex(const TAVStreamState* aState) const |
|
85 { |
|
86 TInt state; |
|
87 for (state = 0; state < EStreamMaxState; state++) |
|
88 { |
|
89 if (iStates[state] == aState) |
|
90 { |
|
91 return state; |
|
92 } |
|
93 } |
|
94 |
|
95 return KAvdtpUnknownState; |
|
96 } |
|
97 |
|
98 |
|
99 CAVStream* CAVStream::NewL(const TAvdtpSockAddr& aAddr, |
|
100 MAvdtpStreamNotify& aStreamNotify, |
|
101 CAvdtpProtocol& aProtocol, |
|
102 CLocalSEP& aLocalSEP) |
|
103 { |
|
104 LOG_STATIC_FUNC |
|
105 CAVStream* stream = new (ELeave) CAVStream(aAddr, |
|
106 aStreamNotify, |
|
107 aProtocol, |
|
108 aLocalSEP); |
|
109 CleanupStack::PushL(stream); |
|
110 stream->ConstructL(); |
|
111 CleanupStack::Pop(); |
|
112 return stream; |
|
113 } |
|
114 |
|
115 void CAVStream::ConstructL() |
|
116 { |
|
117 LOG_FUNC |
|
118 iWatchdogTimer = CWatchdogTimer::NewL(*this); |
|
119 // watchdog actually starts Just-in-time |
|
120 } |
|
121 |
|
122 CAVStream::CAVStream(const TAvdtpSockAddr& aAddr, |
|
123 MAvdtpStreamNotify& aStreamNotify, |
|
124 CAvdtpProtocol& aProtocol, |
|
125 CLocalSEP& aLocalSEP) |
|
126 : iProtocol(aProtocol), iStreamNotify(aStreamNotify), iLocalSEP(&aLocalSEP), iNotifiedACLStreamActive(EFalse) |
|
127 { |
|
128 LOG_FUNC |
|
129 iRemoteAddress = aAddr; |
|
130 __ASSERT_DEBUG(!iRemoteAddress.SEID().IsLocal(), Panic(EAvdtpSEIDHasWrongDomain)); |
|
131 __ASSERT_DEBUG(iLocalSEP->SEID().IsLocal(), Panic(EAvdtpSEIDHasWrongDomain)); |
|
132 |
|
133 iState = &iProtocol.StreamStateFactory().GetState(CAVStreamStateFactory::EStreamStateIdle); |
|
134 } |
|
135 |
|
136 CAVStream::~CAVStream() |
|
137 { |
|
138 LOG_FUNC |
|
139 |
|
140 // We might already have done this, but call again regardless, as |
|
141 // the dtor might be called whilst still in the streaming state |
|
142 AllowHostEncryptionKeyRefresh(); |
|
143 |
|
144 // cancel outstanding operations on signalling channel |
|
145 CSignallingChannel* sigCh = iProtocol.FindSignallingChannel(iRemoteAddress.BTAddr()); |
|
146 |
|
147 if (sigCh) |
|
148 { |
|
149 sigCh->CancelTransactions(*this); |
|
150 } |
|
151 |
|
152 iProtocol.LogicalChannelFactory().Cancel(iFactoryJob); |
|
153 |
|
154 if (iLocalSEP) |
|
155 { |
|
156 iLocalSEP->StreamDestroyed(*this); |
|
157 } |
|
158 // remove ourselves from protocol list |
|
159 iProtocol.RemoveStream(*this); |
|
160 |
|
161 // tidyup up any pre-allocated transport session IDs |
|
162 DeallocateUnclaimedTransportSessionIDs(); |
|
163 |
|
164 delete iWatchdogTimer; |
|
165 } |
|
166 |
|
167 void CAVStream::DeallocateUnclaimedTransportSessionIDs() |
|
168 { |
|
169 LOG_FUNC |
|
170 for (TInt i=0; i<=iMuxedTSIDs.Count()-1; i++) |
|
171 { |
|
172 iMuxedTSIDs[i].Close(); |
|
173 } |
|
174 } |
|
175 |
|
176 #ifdef _DEBUG |
|
177 void CAVStream::LocalSEPDestroyed(const CLocalSEP& aTerminator) |
|
178 #else |
|
179 void CAVStream::LocalSEPDestroyed(const CLocalSEP& /*aTerminator*/) |
|
180 #endif |
|
181 { |
|
182 LOG_FUNC |
|
183 __ASSERT_DEBUG(&aTerminator == iLocalSEP, Panic(EAvdtpBadLocalSEPInstructingStreamRelease)); |
|
184 // release the stream if needed |
|
185 iLocalSEP = NULL; |
|
186 Release(); |
|
187 } |
|
188 |
|
189 void CAVStream::StartWatchdog() |
|
190 { |
|
191 LOG_FUNC |
|
192 iWatchdogTimer->After(KAvdtpLogicalChannelsWatchdogTimeout); |
|
193 } |
|
194 |
|
195 void CAVStream::StopWatchdog() |
|
196 { |
|
197 LOG_FUNC |
|
198 iWatchdogTimer->Cancel(); |
|
199 } |
|
200 |
|
201 void CAVStream::WatchdogFired() |
|
202 { |
|
203 LOG_FUNC |
|
204 iState->WatchdogFired(*this); |
|
205 } |
|
206 |
|
207 void CAVStream::LogicalChannelFactoryRequestComplete(TLogicalChannelFactoryTicket aTicket, TInt aError) |
|
208 { |
|
209 LOG_FUNC |
|
210 iState->LogicalChannelsAvailable(*this, aTicket, aError); |
|
211 } |
|
212 |
|
213 |
|
214 void CAVStream::OpenConfirm(TInt aResult, TSEID aRemoteSEID) |
|
215 { |
|
216 LOG_FUNC |
|
217 iState->OpenConfirm(*this, aResult, aRemoteSEID); |
|
218 } |
|
219 |
|
220 void CAVStream::ReleaseConfirm(TInt aResult, TSEID aRemoteSEID) |
|
221 { |
|
222 LOG_FUNC |
|
223 iState->ReleaseConfirm(*this, aResult, aRemoteSEID); |
|
224 } |
|
225 |
|
226 void CAVStream::AbortConfirm(TSEID aRemoteSEID) |
|
227 { |
|
228 LOG_FUNC |
|
229 iState->AbortConfirm(*this, aRemoteSEID); |
|
230 } |
|
231 |
|
232 void CAVStream::Configured() |
|
233 { |
|
234 LOG_FUNC |
|
235 iState->Configured(*this); |
|
236 } |
|
237 |
|
238 void CAVStream::AwaitLogicalChannelsL() |
|
239 { |
|
240 LOG_FUNC |
|
241 iState->AwaitLogicalChannelsL(*this); |
|
242 } |
|
243 |
|
244 |
|
245 TBool CAVStream::IsStreaming() const |
|
246 { |
|
247 LOG_FUNC |
|
248 return iState->IsStreaming(*this); |
|
249 } |
|
250 |
|
251 void CAVStream::Started() |
|
252 { |
|
253 LOG_FUNC |
|
254 iState->Started(*this); |
|
255 } |
|
256 |
|
257 void CAVStream::Suspended() |
|
258 { |
|
259 LOG_FUNC |
|
260 iState->Suspended(*this); |
|
261 } |
|
262 |
|
263 TBool CAVStream::MultiplexingConfigured() const |
|
264 { |
|
265 return iLocalSEP->MultiplexingConfigured(); |
|
266 } |
|
267 |
|
268 /** |
|
269 Call from somewhere that an error needs to be forwarded to the transport sessions |
|
270 A session can tell us to tell others, but not tell itself |
|
271 */ |
|
272 void CAVStream::NotifyUserPlaneTransportSessionsError(CUserPlaneTransportSession* aErroredSession, TInt aError) |
|
273 { |
|
274 LOG_FUNC |
|
275 if (iMediaBinding.iSession && iMediaBinding.iSession != aErroredSession) |
|
276 { |
|
277 // although all streams must have media sessions, the session may not have bound yet (as when we are ACP) |
|
278 iMediaBinding.iSession->StreamError(aError); |
|
279 /* this stream error will eventually go through to the SAP, and then the |
|
280 transportsession will be deleted, this in turn causes a call through to |
|
281 the (public) ClearSession function that will NULL iMediaBinding.iSession |
|
282 so we don't use it again |
|
283 */ |
|
284 } |
|
285 |
|
286 if (iReportingBinding.iSession && iReportingBinding.iSession != aErroredSession) |
|
287 { |
|
288 iReportingBinding.iSession->StreamError(aError); |
|
289 /* this stream error will eventually go through to the SAP, and then the |
|
290 transportsession will be deleted, this in turn causes a call through to |
|
291 the (public) ClearSession function that will NULL iMediaBinding.iSession |
|
292 so we don't use it again |
|
293 */ |
|
294 } |
|
295 if (iRecoveryBinding.iSession && iRecoveryBinding.iSession != aErroredSession) |
|
296 { |
|
297 iRecoveryBinding.iSession->StreamError(aError); |
|
298 /* this stream error will eventually go through to the SAP, and then the |
|
299 transportsession will be deleted, this in turn causes a call through to |
|
300 the (public) ClearSession function that will NULL iMediaBinding.iSession |
|
301 so we don't use it again |
|
302 */ |
|
303 } |
|
304 } |
|
305 |
|
306 void CAVStream::Released() |
|
307 { |
|
308 LOG_FUNC |
|
309 |
|
310 if (iMediaBinding.iSession) |
|
311 { |
|
312 // the media binding would have detached now if it was actively shutdown thereby |
|
313 // leading to this release |
|
314 iMediaBinding.iSession->StreamReleased(); |
|
315 /* this stream release will eventually go through to the SAP, and then the |
|
316 transportsession will be deleted, this in turn causes a call through to |
|
317 the (public) ClearSession function that will NULL iMediaBinding.iSession |
|
318 so we don't use it again |
|
319 */ |
|
320 } |
|
321 |
|
322 if (iReportingBinding.iSession) |
|
323 { |
|
324 iReportingBinding.iSession->StreamReleased(); |
|
325 /* this stream release will eventually go through to the SAP, and then the |
|
326 transportsession will be deleted, this in turn causes a call through to |
|
327 the (public) ClearSession function that will NULL iMediaBinding.iSession |
|
328 so we don't use it again |
|
329 */ |
|
330 } |
|
331 if (iRecoveryBinding.iSession) |
|
332 { |
|
333 iRecoveryBinding.iSession->StreamReleased(); |
|
334 /* this stream release will eventually go through to the SAP, and then the |
|
335 transportsession will be deleted, this in turn causes a call through to |
|
336 the (public) ClearSession function that will NULL iMediaBinding.iSession |
|
337 so we don't use it again |
|
338 */ |
|
339 } |
|
340 |
|
341 delete this; |
|
342 } |
|
343 |
|
344 TInt CAVStream::AddSession(TAvdtpTransportSessionType aType, |
|
345 CUserPlaneTransportSession& aSession, |
|
346 CTransportChannel*& aChannel) |
|
347 { |
|
348 LOG_FUNC |
|
349 return iState->AddSession(*this, aType, aSession, aChannel); |
|
350 } |
|
351 |
|
352 void CAVStream::DropSession(TAvdtpTransportSessionType aType, CUserPlaneTransportSession& aSession) |
|
353 { |
|
354 LOG_FUNC |
|
355 iState->DropSession(*this, aType, aSession); |
|
356 } |
|
357 |
|
358 |
|
359 /** |
|
360 Called from states as common helper |
|
361 */ |
|
362 void CAVStream::TransportChannelsReady() |
|
363 { |
|
364 LOG_FUNC |
|
365 // notify the sessions - all the TCs are ready. phew. |
|
366 TBTDevAddr addr = iRemoteAddress.BTAddr(); |
|
367 |
|
368 iMediaBinding.iSession->Ready(addr); |
|
369 |
|
370 if (iReportingBinding.iSession) |
|
371 { |
|
372 iReportingBinding.iSession->Ready(addr); |
|
373 } |
|
374 if (iRecoveryBinding.iSession) |
|
375 { |
|
376 iRecoveryBinding.iSession->Ready(addr); |
|
377 } |
|
378 } |
|
379 |
|
380 /* this public vsn is used by transport session and avdtpSAP |
|
381 when deleting the session we're bound to |
|
382 */ |
|
383 void CAVStream::ClearSession(CUserPlaneTransportSession& aSession) |
|
384 { |
|
385 LOG_FUNC |
|
386 if (iMediaBinding.iSession == &aSession) |
|
387 { |
|
388 iMediaBinding.iSession = NULL; |
|
389 } |
|
390 else if (iReportingBinding.iSession == &aSession) |
|
391 { |
|
392 iReportingBinding.iSession = NULL; |
|
393 } |
|
394 else if (iRecoveryBinding.iSession == &aSession) |
|
395 { |
|
396 iRecoveryBinding.iSession = NULL; |
|
397 } |
|
398 } |
|
399 |
|
400 TAvdtpMultiplexingCapability* CAVStream::CreateMuxCapabilityL(TBool aRequireReporting, |
|
401 TBool aRequireRecovery, |
|
402 CSignallingChannel& aIDProvider) |
|
403 { |
|
404 LOG_FUNC |
|
405 // this is called for when we're muxing |
|
406 // try to get transport channel objects now (they won't ask for logical channels yet) |
|
407 // for transport sessions we have to wait as they MUST be associated with a SAP |
|
408 // which is created when user opens an RSocket... |
|
409 // so here we just satisfy the weird muxing requirements by allocating the TSID |
|
410 // then the session can acquire ownership of that later |
|
411 |
|
412 // the address used to find a suitable transport channel |
|
413 TAvdtpMultiplexingCapability* mux = new(ELeave) TAvdtpMultiplexingCapability; |
|
414 CleanupStack::PushL(mux); |
|
415 |
|
416 TAvdtpMultiplexingCapabilityHelper helper(*mux, aRequireReporting, aRequireRecovery); |
|
417 |
|
418 TAvdtpSockAddr addr(iRemoteAddress); |
|
419 addr.SetSession(EMedia); |
|
420 |
|
421 iMediaBinding.iChannel = iProtocol.GetTransportChannel(addr, ETrue); |
|
422 User::LeaveIfNull(iMediaBinding.iChannel); |
|
423 helper.SetMediaCID(iMediaBinding.iChannel->TCID()); |
|
424 User::LeaveIfError(aIDProvider.TSIDManager().GetTSID(iMuxedTSIDs[EMedia])); |
|
425 helper.SetMediaSID(iMuxedTSIDs[EMedia].TSID()); |
|
426 |
|
427 if (aRequireReporting) |
|
428 { |
|
429 User::LeaveIfError(aIDProvider.TSIDManager().GetTSID(iMuxedTSIDs[EReporting])); |
|
430 |
|
431 addr.SetSession(EReporting); |
|
432 iReportingBinding.iChannel = iProtocol.GetTransportChannel(addr, ETrue); |
|
433 User::LeaveIfNull(iReportingBinding.iChannel); |
|
434 helper.SetReportingCID(iReportingBinding.iChannel->TCID()); |
|
435 helper.SetReportingSID(iMuxedTSIDs[EReporting].TSID()); |
|
436 } |
|
437 |
|
438 if (aRequireRecovery) |
|
439 { |
|
440 User::LeaveIfError(aIDProvider.TSIDManager().GetTSID(iMuxedTSIDs[ERecovery])); |
|
441 |
|
442 addr.SetSession(ERecovery); |
|
443 iRecoveryBinding.iChannel = iProtocol.GetTransportChannel(addr, ETrue); |
|
444 User::LeaveIfNull(iRecoveryBinding.iChannel); |
|
445 helper.SetRecoveryCID(iRecoveryBinding.iChannel->TCID()); |
|
446 helper.SetRecoverySID(iMuxedTSIDs[ERecovery].TSID()); |
|
447 } |
|
448 |
|
449 CleanupStack::Pop(mux); |
|
450 return mux; |
|
451 } |
|
452 |
|
453 void CAVStream::GetTSID(RTSID& aTSID, TAvdtpTransportSessionType aSessionType) |
|
454 { |
|
455 LOG_FUNC |
|
456 aTSID.Acquire(iMuxedTSIDs[aSessionType]); |
|
457 } |
|
458 |
|
459 void CAVStream::Release() |
|
460 { |
|
461 LOG_FUNC |
|
462 iState->Release(*this); |
|
463 } |
|
464 |
|
465 void CAVStream::SetConfigurationL(RBuf8& aPacketBuffer, |
|
466 CSignallingChannel& aSignallingChannel, |
|
467 TBool aReportingConfigured, |
|
468 TBool aRecoveryConfigured) |
|
469 { |
|
470 LOG_FUNC |
|
471 iState->SetConfigurationL(*this, aPacketBuffer, aSignallingChannel, |
|
472 aReportingConfigured, aRecoveryConfigured); |
|
473 } |
|
474 |
|
475 void CAVStream::SetConfigConfirm(TInt aResult, TSEID aRemoteSEID, TAvdtpServiceCategory aFailedCategory) |
|
476 { |
|
477 LOG_FUNC |
|
478 iState->SetConfigConfirm(*this, aResult, aRemoteSEID, aFailedCategory); |
|
479 } |
|
480 |
|
481 void CAVStream::ReconfigConfirm(TInt aResult, TSEID aRemoteSEID, TAvdtpServiceCategory aFailedCategory) |
|
482 { |
|
483 LOG_FUNC |
|
484 iState->ReconfigConfirm(*this, aResult, aRemoteSEID, aFailedCategory); |
|
485 } |
|
486 |
|
487 void CAVStream::StartConfirm(TInt aResult, TSEID aRemoteSEID) |
|
488 { |
|
489 LOG_FUNC |
|
490 iState->StartConfirm(*this, aResult, aRemoteSEID); |
|
491 } |
|
492 |
|
493 void CAVStream::SuspendConfirm(TInt aResult, TSEID aRemoteSEID) |
|
494 { |
|
495 LOG_FUNC |
|
496 iState->SuspendConfirm(*this, aResult, aRemoteSEID); |
|
497 } |
|
498 |
|
499 TInt CAVStream::Start() |
|
500 { |
|
501 LOG_FUNC |
|
502 return iState->Start(*this); |
|
503 } |
|
504 |
|
505 TInt CAVStream::Suspend() |
|
506 { |
|
507 LOG_FUNC |
|
508 return iState->Suspend(*this); |
|
509 } |
|
510 |
|
511 void CAVStream::TryToAndThenPreventHostEncryptionKeyRefresh() |
|
512 { |
|
513 LOG_FUNC |
|
514 if (iTryToAndThenPreventHostEncryptionKeyRefreshToken) |
|
515 { |
|
516 LOG(_L("Already notified physical link of stream starting")); |
|
517 } |
|
518 else |
|
519 { |
|
520 iProtocol.ControlPlane().TryToAndThenPreventHostEncryptionKeyRefresh(DeviceAddress(), iTryToAndThenPreventHostEncryptionKeyRefreshToken); |
|
521 } |
|
522 } |
|
523 |
|
524 void CAVStream::AllowHostEncryptionKeyRefresh() |
|
525 { |
|
526 LOG_FUNC |
|
527 MBluetoothControlPlaneToken::Release(iTryToAndThenPreventHostEncryptionKeyRefreshToken); |
|
528 } |
|
529 |
|
530 void CAVStream::CanMuxFrag(TBool& aCanMux, TBool& aCanFrag) const |
|
531 { |
|
532 LOG_FUNC |
|
533 // we know our SEPs have this capability...so just check remote |
|
534 aCanFrag = EFalse; |
|
535 #ifdef __SYMBIAN_AVDTP_HIDE_MUX |
|
536 aCanMux = EFalse; |
|
537 #else |
|
538 aCanMux = iProtocol.RemoteSEPCache().HasCapability(iRemoteAddress.BTAddr(), RemoteSEID(), EServiceCategoryMultiplexing); |
|
539 #endif |
|
540 } |
|
541 |
|
542 TBool CAVStream::CheckConfigured(TAvdtpServiceCategory aCategory) const |
|
543 { |
|
544 LOG_FUNC |
|
545 return iLocalSEP->Configuration()[aCategory] ? ETrue : EFalse; |
|
546 } |
|
547 |
|
548 void CAVStream::BindLogicalAndTransportChannels(TLogicalChannelFactoryTicket aTicket, TInt aError) |
|
549 { |
|
550 LOG_FUNC |
|
551 // a record into which to claim the resulting bearers, one at a time |
|
552 TLogicalChannelRecord rec; |
|
553 |
|
554 // check we're muxing |
|
555 TBool mux = iLocalSEP->Configuration()[EServiceCategoryMultiplexing]!=NULL; |
|
556 |
|
557 TLogicalChannelFactoryTicketInspector inspector(aTicket, !!iReportingBinding.iChannel, !!iRecoveryBinding.iChannel, mux); |
|
558 |
|
559 if (aError==KErrNone) |
|
560 { |
|
561 rec = inspector.GetLogicalChannel(EMedia); |
|
562 } |
|
563 |
|
564 // bind the possible logical channel into the transport channel for media |
|
565 iMediaBinding.iChannel->LogicalChannelComplete(rec, aError); |
|
566 rec.Reset(); |
|
567 |
|
568 if (iReportingBinding.iChannel) |
|
569 { |
|
570 if (aError==KErrNone) |
|
571 { |
|
572 rec = inspector.GetLogicalChannel(EReporting); |
|
573 } |
|
574 iReportingBinding.iChannel->LogicalChannelComplete(rec, aError); |
|
575 } |
|
576 |
|
577 rec.Reset(); |
|
578 |
|
579 if (iRecoveryBinding.iChannel) |
|
580 { |
|
581 if (aError==KErrNone) |
|
582 { |
|
583 rec = inspector.GetLogicalChannel(ERecovery); |
|
584 } |
|
585 iRecoveryBinding.iChannel->LogicalChannelComplete(rec, aError); |
|
586 } |
|
587 } |
|
588 |
|
589 /** |
|
590 A start indication has been received from the remove. |
|
591 */ |
|
592 TInt CAVStream::StartIndication(TAvdtpTransactionLabel aLabel, TSEID aSeid) |
|
593 { |
|
594 // Take a copy of the current start info. This means that if the |
|
595 // state machine synchronously calls back it will find the correct |
|
596 // details, but if it doesn't accept this start indication we |
|
597 // can to restore the old info. |
|
598 TStartDetails oldDetails = iStartDetails; |
|
599 |
|
600 iStartDetails.iLabel = aLabel; |
|
601 iStartDetails.iSeid = aSeid; |
|
602 |
|
603 TInt ret = iState->StartReceived(*this); |
|
604 |
|
605 if(ret != KErrNone) |
|
606 { |
|
607 // restore old start info |
|
608 iStartDetails = oldDetails; |
|
609 } |
|
610 |
|
611 return ret; |
|
612 } |
|
613 |
|
614 TBool CAVStream::IsHostEncryptionKeyRefreshPrevented() |
|
615 { |
|
616 if(iTryToAndThenPreventHostEncryptionKeyRefreshToken) |
|
617 return ETrue; |
|
618 else |
|
619 return EFalse; |
|
620 } |
|
621 |
|
622 /** This is a delayed start indication issued from the state machine. |
|
623 We now need to pass this on the sig session. |
|
624 */ |
|
625 void CAVStream::ReadyForStartIndication() |
|
626 { |
|
627 LOG_FUNC |
|
628 |
|
629 iStreamNotify.StreamReadyForStartIndication(iStartDetails.iLabel, iStartDetails.iSeid); |
|
630 } |
|
631 |
|
632 CWatchdogTimer* CWatchdogTimer::NewL(CAVStream& aObserver) |
|
633 { |
|
634 LOG_STATIC_FUNC |
|
635 CWatchdogTimer* dog = new(ELeave) CWatchdogTimer(aObserver); |
|
636 CleanupStack::PushL(dog); |
|
637 dog->ConstructL(); |
|
638 CleanupStack::Pop(); |
|
639 return dog; |
|
640 } |
|
641 |
|
642 void CWatchdogTimer::ConstructL() |
|
643 { |
|
644 LOG_FUNC |
|
645 CTimer::ConstructL(); |
|
646 } |
|
647 |
|
648 CWatchdogTimer::CWatchdogTimer(CAVStream& aObserver) |
|
649 : CTimer(EPriorityStandard), iObserver(aObserver) |
|
650 { |
|
651 LOG_FUNC |
|
652 CActiveScheduler::Add(this); |
|
653 } |
|
654 |
|
655 void CWatchdogTimer::RunL() |
|
656 { |
|
657 LOG_FUNC |
|
658 iObserver.WatchdogFired(); |
|
659 } |
|
660 |