|
1 /* |
|
2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Contains implementation of CBTSACGavdp class which uses GAVDP API. |
|
15 * Two other classes CAVStreamEndPoint and CAVSEPManager are helper |
|
16 * classes to use GAVDP. This class also constructs CBTSACStreamerController |
|
17 * class. |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include "btsacGavdp.h" |
|
24 #include "btsacGavdpObserver.h" |
|
25 #include "debug.h" |
|
26 #include "btsacStreamerController.h" |
|
27 #include "btsacStreamEndPoint.h" |
|
28 #include "btsacSEPManager.h" |
|
29 #include "btsacdefs.h" |
|
30 |
|
31 // CONSTANTS |
|
32 |
|
33 // DATA TYPES |
|
34 |
|
35 // A2DP codec-specific element definitions |
|
36 // in bluetoothAV.h |
|
37 using namespace SymbianBluetoothAV; |
|
38 |
|
39 // Subband codec-specific values |
|
40 // in bluetoothAV.h |
|
41 using namespace SymbianSBC; |
|
42 |
|
43 // MODULE DATA STRUCTURES |
|
44 |
|
45 // ================= MEMBER FUNCTIONS ======================= |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // CBTSACGavdp::NewL |
|
49 // Two-phased constructor. |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CBTSACGavdp* CBTSACGavdp::NewL(MInternalGavdpUser* aObserver ) |
|
53 { |
|
54 CBTSACGavdp* self = new (ELeave) CBTSACGavdp(aObserver); |
|
55 CleanupStack::PushL( self ); |
|
56 self->ConstructL(); |
|
57 CleanupStack::Pop( self ); |
|
58 return self; |
|
59 } |
|
60 |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // Destructor. |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 CBTSACGavdp::~CBTSACGavdp() |
|
67 { |
|
68 TRACE_FUNC |
|
69 StopSrc(); |
|
70 iSockServ.Close(); |
|
71 |
|
72 if(iA2dpSourceSDPrecordHandle != 0) // unregister sdp |
|
73 { |
|
74 if(iBTConnectionPtr) |
|
75 { |
|
76 TRACE_INFO((_L("CBTSACGavdp::~CBTSACGavdp():Unregister SDP Settings"))) |
|
77 TInt err = iBTConnectionPtr->DeleteSdpRecord(iA2dpSourceSDPrecordHandle); |
|
78 if(err) |
|
79 { |
|
80 TRACE_INFO((_L("CBTSACGavdp::~CBTSACGavdp():Unregister SDP Settings failed %d."), err)) |
|
81 } |
|
82 } |
|
83 iA2dpSourceSDPrecordHandle = 0; |
|
84 } |
|
85 delete iBTConnectionPtr; |
|
86 } |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // CBTSACGavdp::CBTSACGavdp |
|
90 // C++ default constructor. |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 CBTSACGavdp::CBTSACGavdp( MInternalGavdpUser* aObserver ) |
|
94 : iObserver ( aObserver ), |
|
95 iA2dpSourceSDPrecordHandle( 0 ) |
|
96 { |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CBTSACGavdp::ConstructL |
|
101 // Symbian 2nd phase constructor. |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 void CBTSACGavdp::ConstructL() |
|
105 { |
|
106 TRACE_FUNC |
|
107 TSessionPref pref; |
|
108 pref.iAddrFamily = KBTAddrFamily; |
|
109 pref.iProtocol = KAVDTP; |
|
110 User::LeaveIfError(iSockServ.Connect(pref, KESockDefaultMessageSlots)); |
|
111 iBTConnectionPtr = CBTEngDiscovery::NewL(); |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // CBTSACGavdp::StartSrc |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 TInt CBTSACGavdp::StartSrc(CBTSACSEPManager& aLocalSEPs, TSBCCodecCapabilities& aSbc) |
|
119 { |
|
120 TRACE_FUNC |
|
121 TInt err = KErrGeneral; |
|
122 // register sdp |
|
123 // For hardware only, in ConstructL SDP is not ready and hence this causes a crash in emulator |
|
124 TRACE_INFO((_L("CBTSACGavdp::StartSrc():Register A2DP SDP settings."))) |
|
125 if(iBTConnectionPtr) |
|
126 { |
|
127 err = iBTConnectionPtr->RegisterSdpRecord( |
|
128 KAudioSourceUUID, // btsdp.h |
|
129 0, // There is no channel number used for A2DP |
|
130 iA2dpSourceSDPrecordHandle ); |
|
131 } |
|
132 |
|
133 if( !err ) |
|
134 { |
|
135 err = iGavdp.Open(*this, iSockServ); |
|
136 if ( !err ) |
|
137 { |
|
138 err = RegisterSEPs(aLocalSEPs, aSbc); |
|
139 } |
|
140 } |
|
141 |
|
142 TRACE_INFO((_L("CBTSACGavdp::StartSrc() completed. Return: %d"), err)) |
|
143 return err; |
|
144 } |
|
145 |
|
146 // ----------------------------------------------------------------------------- |
|
147 // CBTSACGavdp::RegisterSEPs |
|
148 // ----------------------------------------------------------------------------- |
|
149 // |
|
150 TInt CBTSACGavdp::RegisterSEPs(CBTSACSEPManager& aLocalSEPs, TSBCCodecCapabilities& aSbc ) |
|
151 { |
|
152 TRACE_FUNC |
|
153 |
|
154 // This hard-coded value would be recieved from Audio Subsystem later |
|
155 // Currently our implementation supports only SBC Encoding |
|
156 const TInt KNumSEPs = 1; |
|
157 |
|
158 TInt err; |
|
159 TFixedArray<TAvdtpSEPInfo, KNumSEPs> sepInfos; |
|
160 |
|
161 for (TInt i=0; i<KNumSEPs; i++) |
|
162 { |
|
163 TAvdtpSEPInfo& info = sepInfos[i]; |
|
164 info.SetMediaType(i==2 ? EAvdtpMediaTypeVideo : EAvdtpMediaTypeAudio); |
|
165 info.SetIsSink(i==2); // make nth one video sink |
|
166 info.SetSEID(TSEID(i+1,ETrue)); |
|
167 |
|
168 TRACE_INFO((_L("CBTSACGavdp::RegisterSEPs() calling Gavdp..."))) |
|
169 err = iGavdp.RegisterSEP(info); |
|
170 |
|
171 if ( err==KErrNone ) |
|
172 { |
|
173 TRAP(err,aLocalSEPs.NewSEPL(info)); |
|
174 if (err==KErrNone) |
|
175 { |
|
176 aLocalSEPs.SetState(info.SEID(), CBTSACStreamEndPoint::ERegistered, &info); |
|
177 } |
|
178 } |
|
179 else |
|
180 { |
|
181 TRACE_INFO((_L("CBTSACGavdp::RegisterSEPs() Registering SEP [SEID 1] - completed with error %d"), err)) |
|
182 return err; |
|
183 } |
|
184 } // for |
|
185 |
|
186 |
|
187 // add some caps, not to all though |
|
188 err = iGavdp.BeginConfiguringLocalSEP( TSEID(1, ETrue) ); |
|
189 if ( err ) |
|
190 { |
|
191 TRACE_INFO((_L("CBTSACGavdp::RegisterSEPs() Begin config Local SEP [SEID 1] - completed with error %d"), err)) |
|
192 return err; |
|
193 } |
|
194 |
|
195 TAvdtpMediaTransportCapabilities media; |
|
196 err = iGavdp.AddSEPCapability(media); |
|
197 if ( err ) |
|
198 { |
|
199 TRACE_INFO((_L("CBTSACGavdp::RegisterSEPs() Add configuration [Category %d] - completed with error %d"), media.Category(), err)) |
|
200 return err; |
|
201 } |
|
202 |
|
203 err = iGavdp.AddSEPCapability(aSbc); |
|
204 if ( err ) |
|
205 { |
|
206 TRACE_INFO((_L("CBTSACGavdp::RegisterSEPs() error %d"), err)) |
|
207 return err; |
|
208 } |
|
209 |
|
210 // that's ASYNC! Wait for callback before configuring more seps |
|
211 iGavdp.CommitSEPConfiguration(); |
|
212 |
|
213 TRACE_INFO((_L("CBTSACGavdp::RegisterSEPs() Commit configuration [SEID 1]"))) |
|
214 return err; |
|
215 } |
|
216 |
|
217 // ----------------------------------------------------------------------------- |
|
218 // CBTSACGavdp::StopSrc |
|
219 // ----------------------------------------------------------------------------- |
|
220 // |
|
221 void CBTSACGavdp::StopSrc() |
|
222 { |
|
223 TRACE_FUNC |
|
224 iGavdp.Close(); |
|
225 TRACE_INFO((_L("CBTSACGavdp::StopSrc() completed."))) |
|
226 } |
|
227 |
|
228 // ----------------------------------------------------------------------------- |
|
229 // CBTSACGavdp::AbortStreaming |
|
230 // ----------------------------------------------------------------------------- |
|
231 // |
|
232 void CBTSACGavdp::AbortStreaming(TSEID& aRemoteSEPId) |
|
233 { |
|
234 TRACE_INFO((_L("CBTSACGavdp::AbortStreaming() RemoteSEPId: %d"), aRemoteSEPId.SEID())) |
|
235 iGavdp.AbortStream(aRemoteSEPId); |
|
236 } |
|
237 |
|
238 // ----------------------------------------------------------------------------- |
|
239 // CBTSACGavdp::Shutdown |
|
240 // ----------------------------------------------------------------------------- |
|
241 // |
|
242 TInt CBTSACGavdp::Shutdown() |
|
243 { |
|
244 TRACE_FUNC |
|
245 return(iGavdp.Shutdown()); |
|
246 } |
|
247 |
|
248 |
|
249 // ----------------------------------------------------------------------------- |
|
250 // CBTSACGavdp::SendSecurityControl |
|
251 // ----------------------------------------------------------------------------- |
|
252 // |
|
253 void CBTSACGavdp::SendSecurityControl() |
|
254 { |
|
255 |
|
256 TRACE_FUNC |
|
257 TInt seid = 1; |
|
258 TBuf8<KBTDevAddrReadable> secBuf(_L8("Danger!")); |
|
259 iGavdp.SendSecurityControl(TSEID(seid, EFalse), secBuf); |
|
260 } |
|
261 |
|
262 // ----------------------------------------------------------------------------- |
|
263 // CBTSACGavdp::GetCapabilities |
|
264 // ----------------------------------------------------------------------------- |
|
265 // |
|
266 void CBTSACGavdp::GetCapabilities(TSEID& aId) |
|
267 { |
|
268 TRACE_FUNC |
|
269 // we're getting all capabilities |
|
270 // we could register interest in only those capabilities that we can select |
|
271 // we keep it so in order to print out all capabilities in GAVDP_SEPCapability |
|
272 TAvdtpServiceCategories caps; |
|
273 caps.SetCapability(EAllServiceCategories); |
|
274 iGavdp.GetRemoteSEPCapabilities(aId, caps); |
|
275 } |
|
276 |
|
277 // ----------------------------------------------------------------------------- |
|
278 // CBTSACGavdp::Connect |
|
279 // ----------------------------------------------------------------------------- |
|
280 // |
|
281 void CBTSACGavdp::Connect( const TBTDevAddr& aAddr ) |
|
282 { |
|
283 TRACE_FUNC |
|
284 RProperty property; |
|
285 TBuf8<KBTDevAddrSize> addr; |
|
286 TInt err = property.Get(KPropertyUidBluetoothCategory, |
|
287 KPropertyKeyBluetoothLocalDeviceAddress, addr); |
|
288 |
|
289 if ((err) || (addr.Length()!=KBTDevAddrSize)) |
|
290 { |
|
291 TRACE_INFO((_L("CBTSACGavdp::Connect() P&S: ERROR retrieving local address"))) |
|
292 } |
|
293 else |
|
294 { |
|
295 TBTDevAddr localAddr(addr); |
|
296 TRACE_INFO_SEG( |
|
297 {TBuf<KBTDevAddrReadable> bufLocal; TBuf<KBTDevAddrReadable> bufRemote; localAddr.GetReadable(bufLocal); aAddr.GetReadable(bufRemote); |
|
298 Trace(_L("CBTSACGavdp::Connect() Local address = 0x%S, Using Remote Addr = 0x%S"), &bufLocal, &bufRemote);}) |
|
299 } |
|
300 iGavdp.Connect(aAddr); |
|
301 TRACE_INFO((_L("CBTSACGavdp::Connect() completed"))) |
|
302 } |
|
303 |
|
304 // ----------------------------------------------------------------------------- |
|
305 // CBTSACGavdp::Listen |
|
306 // ----------------------------------------------------------------------------- |
|
307 // |
|
308 TInt CBTSACGavdp::Listen() |
|
309 { |
|
310 TRACE_FUNC |
|
311 return iGavdp.Listen(); |
|
312 } |
|
313 |
|
314 // ----------------------------------------------------------------------------- |
|
315 // CBTSACGavdp::Cancel |
|
316 // ----------------------------------------------------------------------------- |
|
317 // |
|
318 void CBTSACGavdp::Cancel() |
|
319 { |
|
320 TRACE_FUNC |
|
321 iGavdp.Cancel(); |
|
322 } |
|
323 |
|
324 // ----------------------------------------------------------------------------- |
|
325 // CBTSACGavdp::CreateBearers |
|
326 // ----------------------------------------------------------------------------- |
|
327 // |
|
328 TInt CBTSACGavdp::CreateBearers(TSEID& aRemoteSEPId) |
|
329 { |
|
330 TRACE_FUNC |
|
331 TInt ret; |
|
332 ret = iGavdp.CreateBearerSockets(aRemoteSEPId, EFalse, EFalse); |
|
333 TRACE_INFO((_L("CBTSACGavdp::CreateBearers() Asking for Bearers..(sync_result) %d."), ret)) |
|
334 return ret; |
|
335 } |
|
336 |
|
337 // ----------------------------------------------------------------------------- |
|
338 // CBTSACGavdp::DiscoverSEPs |
|
339 // ----------------------------------------------------------------------------- |
|
340 // |
|
341 void CBTSACGavdp::DiscoverSEPs() |
|
342 { |
|
343 TRACE_FUNC |
|
344 iGavdp.DiscoverRemoteSEPs(); |
|
345 } |
|
346 |
|
347 // ----------------------------------------------------------------------------- |
|
348 // CBTSACGavdp::Close |
|
349 // ----------------------------------------------------------------------------- |
|
350 // |
|
351 void CBTSACGavdp::Close() |
|
352 { |
|
353 TRACE_FUNC |
|
354 iGavdp.Close(); |
|
355 } |
|
356 |
|
357 // ----------------------------------------------------------------------------- |
|
358 // CBTSACGavdp::Open |
|
359 // ----------------------------------------------------------------------------- |
|
360 // |
|
361 TInt CBTSACGavdp::Open() |
|
362 { |
|
363 TRACE_FUNC |
|
364 return( iGavdp.Open(*this, iSockServ) ); |
|
365 } |
|
366 |
|
367 |
|
368 ///////////////////// Call Backs from GAVDP /////////////////// |
|
369 |
|
370 // ----------------------------------------------------------------------------- |
|
371 // CBTSACGavdp::GAVDP_SEPCapability |
|
372 // ----------------------------------------------------------------------------- |
|
373 // |
|
374 void CBTSACGavdp::GAVDP_SEPCapability(TAvdtpServiceCapability* aCapability) |
|
375 { |
|
376 TRACE_INFO((_L("CBTSACGavdp::GAVDP_SEPCapability() Capability = %d"), aCapability->Category())) |
|
377 |
|
378 switch (aCapability->Category()) |
|
379 { |
|
380 case EServiceCategoryMediaCodec: |
|
381 { |
|
382 // print name of codec |
|
383 TAvdtpMediaCodecCapabilities& codecCaps = static_cast<TAvdtpMediaCodecCapabilities&>(*aCapability); |
|
384 switch ( codecCaps.MediaType() ) |
|
385 { |
|
386 case EAvdtpMediaTypeAudio: |
|
387 TRACE_INFO((_L("CBTSACGavdp::GAVDP_SEPCapability() Audio:"))) |
|
388 break; |
|
389 case EAvdtpMediaTypeVideo: |
|
390 TRACE_INFO((_L("CBTSACGavdp::GAVDP_SEPCapability() Video:"))) |
|
391 break; |
|
392 case EAvdtpMediaTypeMultimedia: |
|
393 TRACE_INFO((_L("CBTSACGavdp::GAVDP_SEPCapability() Multimedia:"))) |
|
394 break; |
|
395 } |
|
396 switch (codecCaps.MediaCodecType()) |
|
397 { |
|
398 case EAudioCodecSBC: |
|
399 TRACE_INFO((_L("CBTSACGavdp::GAVDP_SEPCapability() SBC"))) |
|
400 break; |
|
401 case EAudioCodecMPEG12Audio: |
|
402 TRACE_INFO((_L("CBTSACGavdp::GAVDP_SEPCapability() MPEG1,2 Audio"))) |
|
403 break; |
|
404 case EAudioCodecMPEG24AAC: |
|
405 TRACE_INFO((_L("CBTSACGavdp::GAVDP_SEPCapability() MPEG 2,4 AAC"))) |
|
406 break; |
|
407 case EAudioCodecATRAC: |
|
408 TRACE_INFO((_L("CBTSACGavdp::GAVDP_SEPCapability() ATRAC"))) |
|
409 break; |
|
410 |
|
411 default: |
|
412 TRACE_INFO((_L("CBTSACGavdp::GAVDP_SEPCapability() Unknown codec"))) |
|
413 break; |
|
414 } |
|
415 break; |
|
416 } // case |
|
417 |
|
418 case EServiceCategoryRecovery: |
|
419 { |
|
420 TAvdtpRecoveryCapabilities* RecCaps = static_cast<TAvdtpRecoveryCapabilities*>(aCapability); |
|
421 switch ( RecCaps->RecoveryType() ) |
|
422 { |
|
423 case EForbiddenRecovery: |
|
424 TRACE_INFO((_L("CBTSACGavdp::GAVDP_SEPCapability() Forbidden Recovery"))) |
|
425 break; |
|
426 case ERFC2733Recovery: |
|
427 TRACE_INFO((_L("CBTSACGavdp::GAVDP_SEPCapability() RFC2733 Recovery"))) |
|
428 break; |
|
429 default: |
|
430 TRACE_INFO((_L("CBTSACGavdp::GAVDP_SEPCapability() Unknown Recovery"))) |
|
431 break; |
|
432 } |
|
433 break; |
|
434 } // case |
|
435 |
|
436 case EServiceCategoryReporting: |
|
437 { |
|
438 TRACE_INFO((_L("CBTSACGavdp::GAVDP_SEPCapability() Capable of Reporting"))) |
|
439 break; |
|
440 }//case |
|
441 |
|
442 case EServiceCategoryMediaTransport: |
|
443 { |
|
444 TRACE_INFO((_L("CBTSACGavdp::GAVDP_SEPCapability() Capable of a Media Transport"))) |
|
445 break; |
|
446 } |
|
447 |
|
448 } // switch Category |
|
449 |
|
450 // state handles the call-back |
|
451 iObserver->GAVDP_SEPCapability(aCapability); |
|
452 |
|
453 } |
|
454 |
|
455 // ----------------------------------------------------------------------------- |
|
456 // CBTSACGavdp::GAVDP_SEPDiscoveryComplete |
|
457 // ----------------------------------------------------------------------------- |
|
458 // |
|
459 void CBTSACGavdp::GAVDP_SEPDiscoveryComplete() |
|
460 { |
|
461 TRACE_FUNC |
|
462 // state handles the call-back |
|
463 iObserver->GAVDP_SEPDiscoveryComplete(); |
|
464 } |
|
465 |
|
466 // ----------------------------------------------------------------------------- |
|
467 // CBTSACGavdp::GAVDP_SEPCapabilityComplete |
|
468 // ----------------------------------------------------------------------------- |
|
469 // |
|
470 void CBTSACGavdp::GAVDP_SEPCapabilityComplete() |
|
471 { |
|
472 TRACE_INFO((_L("CBTSACGavdp::GAVDP_SEPCapabilityComplete() GAVDP:SEP has no more capabilities."))) |
|
473 iObserver->GAVDP_SEPCapabilityComplete(); |
|
474 } |
|
475 |
|
476 // ----------------------------------------------------------------------------- |
|
477 // CBTSACGavdp::GAVDP_ConnectConfirm |
|
478 // ----------------------------------------------------------------------------- |
|
479 // |
|
480 void CBTSACGavdp::GAVDP_ConnectConfirm(const TBTDevAddr& aAddr) |
|
481 { |
|
482 TRACE_INFO((_L("CBTSACGavdp::GAVDP_ConnectConfirm() Signalling channel connected = GAVDP ready"))) |
|
483 // inform observer |
|
484 iObserver->GAVDP_ConnectConfirm(aAddr); |
|
485 } |
|
486 |
|
487 // ----------------------------------------------------------------------------- |
|
488 // CBTSACGavdp::GAVDP_SEPDiscovered |
|
489 // ----------------------------------------------------------------------------- |
|
490 // |
|
491 void CBTSACGavdp::GAVDP_SEPDiscovered(const TAvdtpSEPInfo& aSEPInfo) |
|
492 { |
|
493 TRACE_FUNC |
|
494 // state handles the call-back |
|
495 iObserver->GAVDP_SEPDiscovered(aSEPInfo); |
|
496 } |
|
497 |
|
498 // ----------------------------------------------------------------------------- |
|
499 // CBTSACGavdp::GAVDP_AbortStreamConfirm |
|
500 // ----------------------------------------------------------------------------- |
|
501 // |
|
502 void CBTSACGavdp::GAVDP_AbortStreamConfirm() |
|
503 { |
|
504 TRACE_FUNC |
|
505 // state handles the call-back |
|
506 iObserver->GAVDP_AbortStreamConfirm(); |
|
507 } |
|
508 |
|
509 // ----------------------------------------------------------------------------- |
|
510 // CBTSACGavdp::GAVDP_SecurityControlConfirm |
|
511 // ----------------------------------------------------------------------------- |
|
512 // |
|
513 void CBTSACGavdp::GAVDP_SecurityControlConfirm(const TDesC8& aResponseData) |
|
514 { |
|
515 TRACE_FUNC |
|
516 // state handles the call-back |
|
517 iObserver->GAVDP_SecurityControlConfirm(aResponseData); |
|
518 } |
|
519 |
|
520 // ----------------------------------------------------------------------------- |
|
521 // CBTSACGavdp::GAVDP_StartStreamsConfirm |
|
522 // ----------------------------------------------------------------------------- |
|
523 // |
|
524 void CBTSACGavdp::GAVDP_StartStreamsConfirm() |
|
525 { |
|
526 TRACE_FUNC |
|
527 iObserver->GAVDP_StartStreamsConfirm(); |
|
528 } |
|
529 |
|
530 // ----------------------------------------------------------------------------- |
|
531 // CBTSACGavdp::GAVDP_SuspendStreamsConfirm |
|
532 // ----------------------------------------------------------------------------- |
|
533 // |
|
534 void CBTSACGavdp::GAVDP_SuspendStreamsConfirm() |
|
535 { |
|
536 TRACE_FUNC |
|
537 // state handles the call-back |
|
538 iObserver->GAVDP_SuspendStreamsConfirm(); |
|
539 } |
|
540 |
|
541 // ----------------------------------------------------------------------------- |
|
542 // CBTSACGavdp::GAVDP_ConfigurationConfirm |
|
543 // ----------------------------------------------------------------------------- |
|
544 // |
|
545 void CBTSACGavdp::GAVDP_ConfigurationConfirm() |
|
546 { |
|
547 TRACE_FUNC |
|
548 // state handles the call-back |
|
549 iObserver->GAVDP_ConfigurationConfirm(); |
|
550 } |
|
551 |
|
552 |
|
553 // ----------------------------------------------------------------------------- |
|
554 // CBTSACGavdp::GAVDP_Error |
|
555 // ----------------------------------------------------------------------------- |
|
556 // |
|
557 void CBTSACGavdp::GAVDP_Error(TInt aError, const TDesC8& aErrorData) |
|
558 { |
|
559 TRACE_INFO((_L("CBTSACGavdp::GAVDP_Error() **Error**: %d:"), aError)) |
|
560 iObserver->GAVDP_Error(aError, aErrorData); |
|
561 } |
|
562 |
|
563 |
|
564 // passive gubbins |
|
565 // ----------------------------------------------------------------------------- |
|
566 // CBTSACGavdp::GAVDP_ConfigurationStartIndication |
|
567 // ----------------------------------------------------------------------------- |
|
568 // |
|
569 void CBTSACGavdp::GAVDP_ConfigurationStartIndication(TSEID aLocalSEID, TSEID aRemoteSEID) |
|
570 { |
|
571 // ah - remote is attempting to confuigure us |
|
572 TRACE_INFO((_L("CBTSACGavdp::GAVDP_ConfigurationStartIndication() Remote SEP [SEID %d] is configuring Local SEP [SEID %d]"), aRemoteSEID.SEID(), aLocalSEID.SEID())) |
|
573 // state handles the call-back |
|
574 iObserver->GAVDP_ConfigurationStartIndication(aLocalSEID, aRemoteSEID); |
|
575 } |
|
576 |
|
577 // ----------------------------------------------------------------------------- |
|
578 // CBTSACGavdp::GAVDP_ConfigurationIndication |
|
579 // ----------------------------------------------------------------------------- |
|
580 // |
|
581 TInt CBTSACGavdp::GAVDP_ConfigurationIndication(TAvdtpServiceCapability* aCapability) |
|
582 { |
|
583 // the new capability proposed by remote |
|
584 TRACE_INFO((_L("CBTSACGavdp::GAVDP_ConfigurationIndication() Configuration proposed: category %d"), aCapability->Category())) |
|
585 // state handles the call-back |
|
586 return (iObserver->GAVDP_ConfigurationIndication(aCapability)); |
|
587 } |
|
588 |
|
589 // ----------------------------------------------------------------------------- |
|
590 // CBTSACGavdp::GAVDP_ConfigurationEndIndication |
|
591 // ----------------------------------------------------------------------------- |
|
592 // |
|
593 TInt CBTSACGavdp::GAVDP_ConfigurationEndIndication() |
|
594 { |
|
595 TRACE_INFO((_L("CBTSACGavdp::GAVDP_ConfigurationEndIndication() Remote configuration proposals now finished"))) |
|
596 // state handles the call-back |
|
597 TInt ret = iObserver->GAVDP_ConfigurationEndIndication(); |
|
598 return (ret); |
|
599 } |
|
600 |
|
601 // ----------------------------------------------------------------------------- |
|
602 // CBTSACGavdp::GAVDP_StartIndication |
|
603 // ----------------------------------------------------------------------------- |
|
604 // |
|
605 TInt CBTSACGavdp::GAVDP_StartIndication(TSEID aLocalSEID) |
|
606 { |
|
607 TRACE_INFO((_L("CBTSACGavdp::GAVDP_StartIndication() Start indication for Local SEID %d"), aLocalSEID.SEID())) |
|
608 // state handles the call-back |
|
609 return (iObserver->GAVDP_StartIndication(aLocalSEID)); |
|
610 } |
|
611 |
|
612 // ----------------------------------------------------------------------------- |
|
613 // CBTSACGavdp::GAVDP_AbortIndication |
|
614 // ----------------------------------------------------------------------------- |
|
615 // |
|
616 void CBTSACGavdp::GAVDP_AbortIndication(TSEID aSEID) |
|
617 { |
|
618 TRACE_INFO((_L("CBTSACGavdp::GAVDP_AbortIndication() Stream %d ABORTED by peer"), aSEID.SEID())) |
|
619 // state handles the call-back |
|
620 iObserver->GAVDP_AbortIndication(aSEID); |
|
621 } |
|
622 |
|
623 // ----------------------------------------------------------------------------- |
|
624 // CBTSACGavdp::GAVDP_ReleaseIndication |
|
625 // ----------------------------------------------------------------------------- |
|
626 // |
|
627 void CBTSACGavdp::GAVDP_ReleaseIndication(TSEID aSEID) |
|
628 { |
|
629 TRACE_INFO((_L("CBTSACGavdp::GAVDP_ReleaseIndication() Stream %d RELEASED by peer"), aSEID.SEID())) |
|
630 // state handles the call-back |
|
631 iObserver->GAVDP_ReleaseIndication(aSEID); |
|
632 } |
|
633 |
|
634 // ----------------------------------------------------------------------------- |
|
635 // CBTSACGavdp::GAVDP_SuspendIndication |
|
636 // ----------------------------------------------------------------------------- |
|
637 // |
|
638 TInt CBTSACGavdp::GAVDP_SuspendIndication(TSEID aSEID) |
|
639 { |
|
640 TRACE_INFO((_L("CBTSACGavdp::GAVDP_SuspendIndication() Suspend indication for seid %d!"), aSEID.SEID())) |
|
641 // state handles the call-back |
|
642 return iObserver->GAVDP_SuspendIndication(aSEID); |
|
643 } |
|
644 |
|
645 // ----------------------------------------------------------------------------- |
|
646 // CBTSACGavdp::GAVDP_SecurityControlIndication |
|
647 // ----------------------------------------------------------------------------- |
|
648 // |
|
649 TInt CBTSACGavdp::GAVDP_SecurityControlIndication(TSEID aSEID, TDes8& aSecurityData) |
|
650 { |
|
651 TRACE_INFO((_L("CBTSACGavdp::GAVDP_SecurityControlIndication() Got security control data length %d for SEID %d"), aSEID.SEID(), aSecurityData.Length())) |
|
652 // state handles the call-back |
|
653 return (iObserver->GAVDP_SecurityControlIndication(aSEID, aSecurityData)); |
|
654 } |
|
655 |
|
656 // ----------------------------------------------------------------------------- |
|
657 // CBTSACGavdp::GAVDP_BearerReady |
|
658 // ----------------------------------------------------------------------------- |
|
659 // |
|
660 void CBTSACGavdp::GAVDP_BearerReady(RSocket aNewSocket, const TAvdtpSockAddr& aAddr) |
|
661 { |
|
662 // wrap socket with active wrapper... |
|
663 TRACE_INFO((_L("CBTSACGavdp::GAVDP_BearerReady() Got a bearer, for session %d"), aAddr.Session())) |
|
664 |
|
665 // AV sockets don't foward opts yet so use addr version |
|
666 RBTPhysicalLinkAdapter phy; |
|
667 TBTDevAddr RemoteBDAddr = aAddr.BTAddr(); |
|
668 TInt err = phy.Open(iSockServ, RemoteBDAddr); |
|
669 TUint16 packets = EAnyACLPacket; |
|
670 err = phy.RequestChangeSupportedPacketTypes(packets); |
|
671 TRACE_INFO((_L("CBTSACGavdp::GAVDP_BearerReady() Modified PHY, result %d"), err)) |
|
672 |
|
673 // state handles the call-back |
|
674 iObserver->GAVDP_BearerReady(aNewSocket, aAddr); |
|
675 } |
|
676 ///////////////////// Call Backs from GAVDP End./////////////////// |
|
677 |
|
678 |
|
679 // ----------------------------------------------------------------------------- |
|
680 // CBTSACGavdp::StartStreams |
|
681 // ----------------------------------------------------------------------------- |
|
682 // |
|
683 void CBTSACGavdp::StartStreams(TSEID& aRemoteSEPId) |
|
684 { |
|
685 TRACE_INFO((_L("CBTSACGavdp::GAVDP_StartStreams() Starting remoteSEP %d streaming..."), aRemoteSEPId.SEID())) |
|
686 iGavdp.StartStream(aRemoteSEPId); |
|
687 } |
|
688 |
|
689 // ----------------------------------------------------------------------------- |
|
690 // CBTSACGavdp::SuspendStreams |
|
691 // ----------------------------------------------------------------------------- |
|
692 // |
|
693 void CBTSACGavdp::SuspendStreams(TSEID& aRemoteSEPId) |
|
694 { |
|
695 TRACE_INFO((_L("CBTSACGavdp::SuspendStreams() Suspending remoteSEP %d streaming..."), aRemoteSEPId.SEID())) |
|
696 iGavdp.SuspendStream(aRemoteSEPId); |
|
697 } |
|
698 |
|
699 // ----------------------------------------------------------------------------- |
|
700 // CBTSACGavdp::ConfigureSEP |
|
701 // ----------------------------------------------------------------------------- |
|
702 // |
|
703 TInt CBTSACGavdp::ConfigureSEP(TSEID aLocalSEPId, TSEID aRemoteSEPId, |
|
704 TSBCCodecCapabilities& aSBCCaps, TAvdtpMediaTransportCapabilities& aMedTranCaps ) |
|
705 { |
|
706 TRACE_INFO((_L("CBTSACGavdp::ConfigureSEP() Local SEP Id: %d, Remote SEP Id: %d"), aLocalSEPId.SEID(), aRemoteSEPId.SEID())) |
|
707 |
|
708 TInt res; |
|
709 res = iGavdp.BeginConfiguringRemoteSEP(aRemoteSEPId, aLocalSEPId); |
|
710 TRACE_INFO((_L("CBTSACGavdp::GAVDP_ConfigureSEP() Begin configuring remote SEP returned %d"), res)) |
|
711 |
|
712 if (res) |
|
713 { |
|
714 return res; |
|
715 } |
|
716 |
|
717 res = iGavdp.AddSEPCapability(aMedTranCaps); |
|
718 TRACE_INFO((_L("CBTSACGavdp::GAVDP_ConfigureSEP() AddSEPCapability returned %d"), res)) |
|
719 |
|
720 if ( res ) |
|
721 { |
|
722 return res; |
|
723 } |
|
724 |
|
725 res = iGavdp.AddSEPCapability(aSBCCaps); |
|
726 if ( !res ) |
|
727 { |
|
728 TRACE_INFO((_L("CBTSACGavdp::GAVDP_ConfigureSEP() Commiting configuration..."))) |
|
729 iGavdp.CommitSEPConfiguration(); |
|
730 } |
|
731 TRACE_INFO((_L("CBTSACGavdp::GAVDP_ConfigureSEP() completed: %d"), res)) |
|
732 return res; |
|
733 } |
|
734 |
|
735 // ----------------------------------------------------------------------------- |
|
736 // CBTSACGavdp::RegisterObserver |
|
737 // ----------------------------------------------------------------------------- |
|
738 // |
|
739 void CBTSACGavdp::RegisterObserver(MInternalGavdpUser* aObserver, const TDesC& aName) |
|
740 { |
|
741 TRACE_INFO((_L("CBTSACGavdp::RegisterObserver(%S)"), &aName)) |
|
742 (void) aName; |
|
743 iObserver = aObserver; |
|
744 } |
|
745 |
|
746 // End of File |