|
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 // |
|
15 |
|
16 #include <bluetoothav.h> |
|
17 #include "gavdpinterface.h" |
|
18 |
|
19 enum TBTAVPanic |
|
20 { |
|
21 EBadArgument, |
|
22 EBTAVBadSEID, |
|
23 EBTAVUnusedOrdinal, |
|
24 }; |
|
25 |
|
26 void Panic(TBTAVPanic aPanic) |
|
27 { |
|
28 _LIT(KBTAVPanicName, "BluetoothAV Panic"); |
|
29 User::Panic(KBTAVPanicName, aPanic); |
|
30 } |
|
31 |
|
32 const TInt KAVDTPPortSessionOffset =8; |
|
33 const TInt KAVDTPPortSessionMask =0x03; |
|
34 const TInt KAVDTPPortSEIDOffset =0; |
|
35 const TInt KAVDTPPortSEIDMask =0x3f; |
|
36 |
|
37 // const TInt KMinMediaCodecLOSC = 2; // mediatype, codectype - see figure8-50 AVDTP |
|
38 // const TInt KMinContentProtectionLOSC = 2; // protectiontype |
|
39 |
|
40 static const TUint KAvdtpSockAddrLocalMask = static_cast<TUint>(1<<31); |
|
41 |
|
42 /** |
|
43 Default constructor using 0 as the parameter for setPort() |
|
44 @publishedPartner |
|
45 @released |
|
46 */ |
|
47 EXPORT_C TAvdtpSockAddr::TAvdtpSockAddr() : TBTSockAddr() |
|
48 { |
|
49 SetPort(0); |
|
50 } |
|
51 |
|
52 /** |
|
53 Copy constructor |
|
54 @publishedPartner |
|
55 @released |
|
56 @param aAddr reference to the original socket address |
|
57 */ |
|
58 EXPORT_C TAvdtpSockAddr::TAvdtpSockAddr(const TSockAddr& aAddr) |
|
59 : TBTSockAddr(aAddr) |
|
60 { |
|
61 } |
|
62 |
|
63 /** |
|
64 Sets the AVDTP session type into the socket address |
|
65 @publishedPartner |
|
66 @released |
|
67 @param aSession the session (eg EMedia) |
|
68 */ |
|
69 EXPORT_C void TAvdtpSockAddr::SetSession(TAvdtpTransportSessionType aSession) |
|
70 { |
|
71 TInt port = Port(); |
|
72 // clear out current session part |
|
73 port &= ~(KAVDTPPortSessionMask << KAVDTPPortSessionOffset); |
|
74 // set new session part |
|
75 port |= (aSession & KAVDTPPortSessionMask) << KAVDTPPortSessionOffset; |
|
76 SetPort(port); |
|
77 } |
|
78 |
|
79 /** |
|
80 Getter for session from socket address |
|
81 @publishedPartner |
|
82 @released |
|
83 @return the session type |
|
84 */ |
|
85 EXPORT_C TAvdtpTransportSessionType TAvdtpSockAddr::Session() const |
|
86 { |
|
87 return static_cast<TAvdtpTransportSessionType> |
|
88 ((Port() >> KAVDTPPortSessionOffset) & KAVDTPPortSessionMask); |
|
89 } |
|
90 |
|
91 /** |
|
92 Sets the Stream endpoint identifier (SEID) into the socket address |
|
93 @publishedPartner |
|
94 @released |
|
95 @param aSEID the SEID to set - can be remote or local |
|
96 */ |
|
97 EXPORT_C void TAvdtpSockAddr::SetSEID(TSEID aSEID) |
|
98 { |
|
99 /* |
|
100 format of port is |
|
101 lowest octet: used for SEID (only l.s.6 bits meaningful at present) |
|
102 next octet : used for session type (only l.s.2 bits at present) |
|
103 |
|
104 */ |
|
105 TUint port = Port(); |
|
106 // clear out current SEID part |
|
107 port &= ~(KAVDTPPortSEIDMask << KAVDTPPortSEIDOffset); |
|
108 |
|
109 // put local info at top bit |
|
110 port &= ~KAvdtpSockAddrLocalMask; |
|
111 if (aSEID.IsLocal()) |
|
112 { |
|
113 port |= KAvdtpSockAddrLocalMask; |
|
114 } |
|
115 |
|
116 // set new SEID part |
|
117 port |= (aSEID.Value() & KAVDTPPortSEIDMask) << KAVDTPPortSEIDOffset; |
|
118 SetPort(port); |
|
119 } |
|
120 |
|
121 /** |
|
122 Getter for the stream endpoint identifier (SEID) from the socket address |
|
123 @publishedPartner |
|
124 @released |
|
125 @return the SEID |
|
126 */ |
|
127 EXPORT_C TSEID TAvdtpSockAddr::SEID() const |
|
128 { |
|
129 TUint port = Port(); |
|
130 // see if LocalSeid |
|
131 TBool isLocal = port & KAvdtpSockAddrLocalMask; |
|
132 // clear out that bit |
|
133 port &=~KAvdtpSockAddrLocalMask; |
|
134 return TSEID((port & KAVDTPPortSEIDMask) >> KAVDTPPortSEIDOffset, isLocal); |
|
135 } |
|
136 |
|
137 /** |
|
138 Utility function to downcast a TSockAddr to a TAvdtpSockAddr |
|
139 @publishedPartner |
|
140 @released |
|
141 @param aAddr reference to base class socket address |
|
142 @return the downcast reference |
|
143 */ |
|
144 EXPORT_C TAvdtpSockAddr& TAvdtpSockAddr::Cast(const TSockAddr& aAddr) |
|
145 { |
|
146 return *const_cast<TAvdtpSockAddr*>(static_cast<const TAvdtpSockAddr*>(&aAddr)); |
|
147 } |
|
148 |
|
149 const TUint TSEID::KInvalidSEID = KMaxTUint8; |
|
150 |
|
151 |
|
152 /** |
|
153 Default constructor using KInvalidSEID as the stream endpoint identifier (SEID) value |
|
154 @publishedPartner |
|
155 @released |
|
156 */ |
|
157 EXPORT_C TSEID::TSEID() : iValue(KInvalidSEID) |
|
158 { |
|
159 } |
|
160 |
|
161 /** |
|
162 Constructor taking a stream endpoint identifier (SEID) value, and whether it refers to a local or remote endpoint |
|
163 @publishedPartner |
|
164 @released |
|
165 @param aSEID, the SEID |
|
166 @param aIsLocal ETrue if refers to a local endpoint, else EFalse |
|
167 */ |
|
168 EXPORT_C TSEID::TSEID(TUint aSEID, TBool aIsLocal) : iValue(aSEID) |
|
169 { |
|
170 iValue|=aIsLocal ? KIsLocalBit : 0; |
|
171 } |
|
172 |
|
173 /** |
|
174 Constructor taking a direct stream endpoint identifier (SEID) value |
|
175 @internalTechnology |
|
176 @param aValue, the direct value |
|
177 */ |
|
178 EXPORT_C TSEID::TSEID(TUint aValue) |
|
179 { |
|
180 iValue = aValue; |
|
181 } |
|
182 |
|
183 /** |
|
184 Getter for the stream endpoint identifier (SEID) value, regardless of whether local or remote |
|
185 @publishedPartner |
|
186 @released |
|
187 @return the SEID value |
|
188 */ |
|
189 EXPORT_C TUint TSEID::SEID() const |
|
190 { |
|
191 // clear local bit |
|
192 return (iValue&~KIsLocalBit); |
|
193 } |
|
194 |
|
195 /** |
|
196 Getter for INTERNAL stream endpoint identifier (SEID) value - for actual SEID value use SEID() |
|
197 @internalTechnology |
|
198 @see SEID |
|
199 @return internal value |
|
200 */ |
|
201 EXPORT_C TUint TSEID::Value() const |
|
202 { |
|
203 return iValue; |
|
204 } |
|
205 |
|
206 /** |
|
207 Getter for SEID value in packet format |
|
208 @internalTechnology |
|
209 @return Packet value of SEID |
|
210 */ |
|
211 EXPORT_C TUint TSEID::PacketValue() const |
|
212 { |
|
213 __ASSERT_ALWAYS(IsValid(), Panic(EBTAVBadSEID)); |
|
214 return (SEID() << KAvdtpPacketSEIDOffset); |
|
215 } |
|
216 |
|
217 /** |
|
218 Checks whether the SEID is allowed by the AVDTP Specification |
|
219 @publishedPartner |
|
220 @released |
|
221 @return ETrue if valid, else EFalse |
|
222 */ |
|
223 EXPORT_C TBool TSEID::IsValid() const |
|
224 { |
|
225 return (SEID()>=KMinimumRealSEID && SEID()<=KMaximumRealSEID); |
|
226 } |
|
227 |
|
228 /** |
|
229 Set SEID value directly |
|
230 @internalTechnology |
|
231 @param aValue value to set |
|
232 */ |
|
233 EXPORT_C void TSEID::Set(TUint aValue) |
|
234 { |
|
235 // don't allow changing of local/remoteness |
|
236 iValue = aValue | (iValue & KIsLocalBit); |
|
237 __ASSERT_ALWAYS(IsValid(), Panic(EBTAVBadSEID)); |
|
238 } |
|
239 |
|
240 /** |
|
241 Comparison operator |
|
242 @publishedPartner |
|
243 @released |
|
244 @param right hand operand |
|
245 @return ETrue if aSEID equal to this SEID (the right hand operand), else EFalse |
|
246 */ |
|
247 EXPORT_C TBool TSEID::operator==(TSEID aSEID) const |
|
248 { |
|
249 return aSEID.Value()==Value(); |
|
250 } |
|
251 |
|
252 /** |
|
253 Negative comparison operator |
|
254 @publishedPartner |
|
255 @released |
|
256 @param right hand operand |
|
257 @return EFalse if aSEID equal to this SEID (the right hand operand), else ETrue |
|
258 */ |
|
259 EXPORT_C TBool TSEID::operator!=(TSEID aSEID) const |
|
260 { |
|
261 return aSEID.Value()!=Value(); |
|
262 } |
|
263 |
|
264 |
|
265 /** |
|
266 Not used |
|
267 @internalTechnology |
|
268 */ |
|
269 /*static*/ EXPORT_C TSEID TSEID::_Spare(TUint8 /*aUnused*/) |
|
270 { |
|
271 Panic(EBTAVUnusedOrdinal); |
|
272 return TSEID(0); |
|
273 } |
|
274 |
|
275 /** |
|
276 Helper to create a SEID from a packet value. Leaves if invalid |
|
277 @internalTechnology |
|
278 @param aPacketValue the value in the packet format |
|
279 @leave EAvdtpBadACPSEID (converts to -18062) if created SEID is invalid |
|
280 @return new SEID object |
|
281 */ |
|
282 EXPORT_C /*static*/ TSEID TSEID::FromPacketL(TUint8 aPacketValue, TBool aIsLocal) |
|
283 { |
|
284 TSEID seid((aPacketValue>>KAvdtpPacketSEIDOffset) & KAvdtpPacketSEIDMask, aIsLocal); |
|
285 if (!seid.IsValid()) |
|
286 { |
|
287 User::Leave(SymbianBluetoothAV::ConvertToSymbianError::AvdtpError(EAvdtpBadACPSEID)); |
|
288 } |
|
289 return seid; |
|
290 } |
|
291 |
|
292 /** |
|
293 Reset any internal state and values |
|
294 @publishedPartner |
|
295 @released |
|
296 */ |
|
297 EXPORT_C void TSEID::Reset() |
|
298 { |
|
299 iValue = KInvalidSEID; |
|
300 } |
|
301 |
|
302 /** |
|
303 Tests whether the SEID refers to a local endpoint |
|
304 @publishedPartner |
|
305 @released |
|
306 @return ETrue if SEID refers to local endpoint, else EFalse |
|
307 */ |
|
308 EXPORT_C TBool TSEID::IsLocal() const |
|
309 { |
|
310 return (iValue & KIsLocalBit ? ETrue : EFalse); |
|
311 } |
|
312 |
|
313 /** |
|
314 Constructor of object returned during Discover phase |
|
315 @publishedPartner |
|
316 @released |
|
317 @see AVDTP specification, AVDTP_DiscoverRsp |
|
318 */ |
|
319 EXPORT_C TAvdtpSEPInfo::TAvdtpSEPInfo() |
|
320 :iInUse(EFalse) |
|
321 { |
|
322 // SEID default constructed - others don't care |
|
323 } |
|
324 |
|
325 /** |
|
326 Getter for the SEID |
|
327 @publishedPartner |
|
328 @released |
|
329 @return the SEID |
|
330 */ |
|
331 EXPORT_C TSEID TAvdtpSEPInfo::SEID() const |
|
332 { |
|
333 return iSEID; |
|
334 } |
|
335 |
|
336 /** |
|
337 Getter for whether the Stream End Point (SEP) is in use |
|
338 @publishedPartner |
|
339 @released |
|
340 @return ETrue if the SEP is in use, else EFalse |
|
341 */ |
|
342 EXPORT_C TBool TAvdtpSEPInfo::InUse() const |
|
343 { |
|
344 return iInUse; |
|
345 } |
|
346 |
|
347 /** |
|
348 Getter for the SEP mediatype |
|
349 @publishedPartner |
|
350 @released |
|
351 @return Media type of SEP |
|
352 */ |
|
353 EXPORT_C SymbianBluetoothAV::TBluetoothMediaType TAvdtpSEPInfo::MediaType() const |
|
354 { |
|
355 return iMediaType; |
|
356 } |
|
357 |
|
358 /** |
|
359 Getter for whether the SEP is sink or source |
|
360 @publishedPartner |
|
361 @released |
|
362 @return ETrue if SEP is a sink, else EFalse; |
|
363 */ |
|
364 EXPORT_C TBool TAvdtpSEPInfo::IsSink() const |
|
365 { |
|
366 return iIsSink; |
|
367 } |
|
368 |
|
369 /** |
|
370 Setter for the SEID of the Stream End Point (SEP) |
|
371 @internalTechnology |
|
372 @param aSEID the SEID to set |
|
373 */ |
|
374 EXPORT_C void TAvdtpSEPInfo::SetSEID(TSEID aSEID) |
|
375 { |
|
376 iSEID = aSEID; |
|
377 } |
|
378 |
|
379 /** |
|
380 Setter for the SEP's inUse flag |
|
381 @internalTechnology |
|
382 @param aIsInUse ETrue if in use |
|
383 */ |
|
384 EXPORT_C void TAvdtpSEPInfo::SetInUse(TBool aIsInUse) |
|
385 { |
|
386 iInUse = aIsInUse; |
|
387 } |
|
388 |
|
389 /** |
|
390 Setter for the SEP mediatype |
|
391 @publishedPartner |
|
392 @released |
|
393 @param aMediaType Mediatype of SEP |
|
394 */ |
|
395 EXPORT_C void TAvdtpSEPInfo::SetMediaType(SymbianBluetoothAV::TBluetoothMediaType aMediaType) |
|
396 { |
|
397 iMediaType = aMediaType; |
|
398 } |
|
399 |
|
400 /** |
|
401 Setter for whether the SEP is source or sink |
|
402 @publishedPartner |
|
403 @released |
|
404 @param aIsSink ETrue if SEP is a sink, else ETrue; |
|
405 */ |
|
406 EXPORT_C void TAvdtpSEPInfo::SetIsSink(TBool aIsSink) |
|
407 { |
|
408 iIsSink = aIsSink; |
|
409 } |
|
410 |
|
411 /** |
|
412 Constructor |
|
413 @internalTechnology |
|
414 */ |
|
415 EXPORT_C CCapabilitySummaryVisitor::CCapabilitySummaryVisitor() |
|
416 { |
|
417 } |
|
418 |
|
419 /** |
|
420 Setter for the seen capabilities |
|
421 @internalTechnology |
|
422 @param aCat the Service Category |
|
423 @return ETrue |
|
424 */ |
|
425 TBool CCapabilitySummaryVisitor::Capability(TAvdtpServiceCategory aCat) |
|
426 { |
|
427 // can ignore payload |
|
428 |
|
429 // just mask in category to "seen" record! |
|
430 iSeen.SetCapability(aCat); |
|
431 return ETrue; // always continue |
|
432 } |
|
433 |
|
434 /** |
|
435 Getter for the seen capabilities |
|
436 @internalTechnology |
|
437 @return the seen capabilities |
|
438 */ |
|
439 EXPORT_C TAvdtpServiceCategories CCapabilitySummaryVisitor::CapabilitiesPresent() const |
|
440 { |
|
441 return iSeen; |
|
442 } |
|
443 |
|
444 |
|
445 /** |
|
446 Constructor |
|
447 @internalTechnology |
|
448 @param aRequiredCapability the required capability |
|
449 */ |
|
450 EXPORT_C CCapabilityPresentVisitor::CCapabilityPresentVisitor(TAvdtpServiceCategory aRequiredCapability) |
|
451 : iRequiredCapability(aRequiredCapability) |
|
452 { |
|
453 } |
|
454 |
|
455 /** |
|
456 Checks if a capability is the required one |
|
457 @internalTechnology |
|
458 @param aCat the capability |
|
459 @return ETrue if the capability is required else EFalse |
|
460 */ |
|
461 |
|
462 TBool CCapabilityPresentVisitor::Capability(TAvdtpServiceCategory aCat) |
|
463 { |
|
464 iPresent = (aCat==iRequiredCapability); |
|
465 return !iPresent; |
|
466 } |
|
467 |
|
468 /** |
|
469 Constructor |
|
470 @internalTechnology |
|
471 @param aRequiredCategories the required capabilities |
|
472 */ |
|
473 EXPORT_C CCapabilityParseVisitor::CCapabilityParseVisitor(TAvdtpServiceCategories aRequiredCategories) |
|
474 : iRequiredCategories(aRequiredCategories) |
|
475 { |
|
476 } |
|
477 |
|
478 /** |
|
479 Sets up a capability |
|
480 @internalTechnology |
|
481 @param aCat the capability category |
|
482 @param aCapPayload the capability payload |
|
483 @return ETrue if the visitor could continue with setting another cabability else EFalse |
|
484 */ |
|
485 TBool CCapabilityParseVisitor::Capability(TAvdtpServiceCategory aCat) |
|
486 { |
|
487 TInt result = KErrNone; |
|
488 |
|
489 iCapabilities[aCat] = NULL; |
|
490 if (aCat & iRequiredCategories()) |
|
491 { |
|
492 TRAP(result, iCapabilities[aCat] = TAvdtpServiceCapability::AllocFromPDUL(aCat, CapabilityPayload())); |
|
493 } |
|
494 |
|
495 // return true as we try to parse all of the required caps, unless failed, then try to continue |
|
496 // - the visitor loop can decide when it's got to the end of the data |
|
497 TBool keepGoing = EFalse; |
|
498 if ((result == KErrNone) || (result == KErrNotSupported)) |
|
499 { |
|
500 keepGoing = ETrue; |
|
501 } |
|
502 |
|
503 return keepGoing; |
|
504 } |
|
505 |
|
506 /** |
|
507 Transfer ownership of capabilities array |
|
508 @internalTechnology |
|
509 @return the capabilities array |
|
510 */ |
|
511 EXPORT_C TCapabilitiesArray CCapabilityParseVisitor::GetCapabilities() |
|
512 { |
|
513 TCapabilitiesArray array = iCapabilities; |
|
514 iCapabilities.Reset(); // since we're transferring ownership |
|
515 return array; |
|
516 } |
|
517 |
|
518 /** |
|
519 Destructor |
|
520 @publishedPartner |
|
521 @released |
|
522 */ |
|
523 CCapabilityParseVisitor::~CCapabilityParseVisitor() |
|
524 { |
|
525 // we may not have transferred ownership of capabilities, so release all if non-NULL |
|
526 iCapabilities.DeleteAll(); |
|
527 } |
|
528 |
|
529 EXPORT_C CCapabilityVisitor::CCapabilityVisitor(): iCapabilityPtr(NULL, 0) |
|
530 { |
|
531 } |
|
532 /** |
|
533 Checks for valid capabilities within a signalling message |
|
534 @internalTechnology |
|
535 @param aCapabilityPDUDomain the message |
|
536 */ |
|
537 EXPORT_C void CCapabilityVisitor::Process(TDes8& aCapabilityPDUDomain) |
|
538 { |
|
539 // walk through structure and allow visitor to operate on each cap |
|
540 TInt index =0; |
|
541 TInt capsLen = aCapabilityPDUDomain.Length()-KAvdtpServiceCapabilitiesHeaderLen; |
|
542 while(index <= capsLen) |
|
543 { |
|
544 TPtrC8 hdr; |
|
545 hdr.Set(aCapabilityPDUDomain.Mid(index, KAvdtpServiceCapabilitiesHeaderLen)); |
|
546 |
|
547 TAvdtpServiceCategory cat = static_cast<TAvdtpServiceCategory>(hdr[0]); |
|
548 TInt losc = static_cast<TInt>(hdr[1]); // (losc is Length of Service Capability) |
|
549 |
|
550 // check for badly formed capabilities |
|
551 if (losc<=aCapabilityPDUDomain.Length()-index-KAvdtpServiceCapabilitiesHeaderLen) |
|
552 { |
|
553 iCapabilityPtr.Set(aCapabilityPDUDomain.MidTPtr(index, KAvdtpServiceCapabilitiesHeaderLen + losc)); |
|
554 iCapabilityPayload.Set(aCapabilityPDUDomain.Mid(index+KAvdtpServiceCapabilitiesHeaderLen, losc)); |
|
555 |
|
556 TBool repeat = Capability(cat); |
|
557 |
|
558 if (!repeat) |
|
559 { |
|
560 break; |
|
561 } |
|
562 else |
|
563 { |
|
564 /* |
|
565 We need to delete the end of iCapabilityPtr that the derived class has chomped |
|
566 |
|
567 We are currently processing capability n |
|
568 _______________________________________________________ |
|
569 | Cap 0 | Cap n | Cap n chomped | Cap n+1 | |
|
570 | - n-1 | | data | - end | |
|
571 |___________|___________|_______________|_______________| |
|
572 index > ^ ^ < index + ptr.Length |
|
573 <---------> |
|
574 ptr.Length |
|
575 <-------------------------> |
|
576 ptr.MaxLength |
|
577 |
|
578 We need to delete the chomped data, which has a start position of |
|
579 index + ptr.Length, and a length of ptr.MaxLength - ptr.Length |
|
580 */ |
|
581 |
|
582 TUint chompedLength = iCapabilityPtr.MaxLength() - iCapabilityPtr.Length(); |
|
583 |
|
584 aCapabilityPDUDomain.Delete(index + iCapabilityPtr.Length(), chompedLength); |
|
585 index+=iCapabilityPtr.Length(); |
|
586 capsLen -= chompedLength; |
|
587 } |
|
588 } |
|
589 else |
|
590 { |
|
591 // abandon remainder |
|
592 break; |
|
593 } |
|
594 } |
|
595 } |
|
596 |
|
597 EXPORT_C const TDesC8& CCapabilityVisitor::CapabilityPayload() |
|
598 { |
|
599 return iCapabilityPayload; |
|
600 } |
|
601 |
|
602 EXPORT_C TDes8& CCapabilityVisitor::CapabilityDes() |
|
603 { |
|
604 return iCapabilityPtr; |
|
605 } |
|
606 |
|
607 /** |
|
608 Converts an enumeration value corresponding to an AVDTP Signalling error |
|
609 into a system-wide error code. |
|
610 |
|
611 The AVDTP Signalling error range: -18172 to -18045 (inclusive) |
|
612 @publishedPartner |
|
613 @released |
|
614 @param aAvdtpError The locally defined error value. |
|
615 @return System-wide error code within the AVDTP Signalling error space; -18172 to -18045 (inclusive). |
|
616 */ |
|
617 EXPORT_C /*static*/ TInt SymbianBluetoothAV::ConvertToSymbianError::AvdtpError(SymbianBluetoothAV::TAvdtpSignallingErrorCode aAvdtpError) |
|
618 { |
|
619 return DoConvertError(aAvdtpError); |
|
620 } |
|
621 |
|
622 /** |
|
623 Converts an enumeration value corresponding to a GAVDP Signalling error |
|
624 into a system-wide error code. |
|
625 |
|
626 The GAVDP Signalling error range: -18236 to -18173 (inclusive) |
|
627 @publishedPartner |
|
628 @released |
|
629 @param aGavdpError The locally defined error value. |
|
630 @return System-wide error code within the GAVDP Signalling error space; -18236 to -18173 (inclusive). |
|
631 */ |
|
632 EXPORT_C /*static*/ TInt SymbianBluetoothAV::ConvertToSymbianError::GavdpError(TGavdpSignallingErrorCode aGavdpError) |
|
633 { |
|
634 return DoConvertError(aGavdpError); |
|
635 } |
|
636 |
|
637 /** |
|
638 Converts an enumeration value corresponding to an A2DP Signalling error |
|
639 into a system-wide error code. The A2DP Signalling error codes are mapped |
|
640 into the concrete profile error code range which is shared with other profiles that sit on top of the GAVDP, such as VDP. |
|
641 |
|
642 Mappings into this range of values are done locally by each profile and will typically cover |
|
643 the same subsets of the error code space. |
|
644 These error codes are therefore not globally unique and any value within this range |
|
645 requires the context of the profile it originated from in order for it to be fully defined. |
|
646 |
|
647 The concrete profile signalling error range: -18300 to -18237 (inclusive) |
|
648 @publishedPartner |
|
649 @released |
|
650 @param aA2dpError The locally defined error value. |
|
651 @return System-wide error code within the concrete profile error space; -18300 to -18237 (inclusive). |
|
652 */ |
|
653 EXPORT_C /*static*/ TInt SymbianBluetoothAV::ConvertToSymbianError::A2dpError(TA2dpSignallingErrorCode aA2dpError) |
|
654 { |
|
655 return DoConvertError(aA2dpError); |
|
656 } |
|
657 |
|
658 /** |
|
659 Converts an enumeration value corresponding to a VDP Signalling error |
|
660 into a system-wide error code. The VDP Signalling error codes are mapped |
|
661 into the concrete profile error code range which is shared with other profiles that sit on top of the GAVDP, such as A2DP. |
|
662 |
|
663 Mappings into this range of values are done locally by each profile and will typically cover |
|
664 the same subsets of the error code space. |
|
665 These error codes are therefore not globally unique and any value within this range |
|
666 requires the context of the profile it originated from in order for it to be fully defined. |
|
667 |
|
668 The concrete profile signalling error range: -18300 to -18237 (inclusive) |
|
669 @publishedPartner |
|
670 @released |
|
671 @param aVdpError The locally defined error value. |
|
672 @return System-wide error code within the concrete profile error space; -18300 to -18237 (inclusive) . |
|
673 */ |
|
674 EXPORT_C /*static*/ TInt SymbianBluetoothAV::ConvertToSymbianError::VdpError(TVdpSignallingErrorCode aVdpError) |
|
675 { |
|
676 return DoConvertError(aVdpError); |
|
677 } |
|
678 |
|
679 /** |
|
680 Takes the local signalling error code (which is a relative offset from the Bluetooth Audio/Visual base signalling |
|
681 error code) of any A/V profile type and calculates the corresponding system-wide error code. This function is called by |
|
682 a profile specific error conversion function. For full documentation of what the error code corresponds to |
|
683 refer to the relevant profile's conversion function. |
|
684 |
|
685 A Bluetooth A/V Signalling error code will exist within the range -18045 to -18300 (inclusive). |
|
686 @publishedPartner |
|
687 @released |
|
688 @param aError The value of the error enumeration object. |
|
689 @return A standard Symbian system-wide error code; -18045 to -18300 (inclusive). |
|
690 |
|
691 */ |
|
692 /*static*/ TInt SymbianBluetoothAV::ConvertToSymbianError::DoConvertError(TBluetoothAvDistributionError aAVError) |
|
693 { |
|
694 // check not already in correct range |
|
695 return KErrAvdtpSignallingErrorBase-static_cast<TInt>(aAVError); |
|
696 } |
|
697 |