|
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 /** |
|
17 @file |
|
18 @publishedPartner |
|
19 */ |
|
20 |
|
21 #include <bluetoothav.h> |
|
22 #include "gavdpinterface.h" |
|
23 |
|
24 EXPORT_C TAvdtpContentProtectionCapabilities::TAvdtpContentProtectionCapabilities() |
|
25 : TAvdtpServiceCapability(EServiceCategoryContentProtection), |
|
26 KMinContentProtectionLOSC(2) |
|
27 { |
|
28 } |
|
29 |
|
30 EXPORT_C TUint16 TAvdtpContentProtectionCapabilities::ContentProtectionType() const |
|
31 { |
|
32 return iCPType; |
|
33 } |
|
34 |
|
35 EXPORT_C void TAvdtpContentProtectionCapabilities::SetContentProtectionType(TUint16 aCPType) |
|
36 { |
|
37 iCPType = aCPType; |
|
38 } |
|
39 |
|
40 EXPORT_C const TDesC8& TAvdtpContentProtectionCapabilities::ContentProtectionData() const |
|
41 { |
|
42 return iCPData; |
|
43 } |
|
44 |
|
45 EXPORT_C void TAvdtpContentProtectionCapabilities::SetContentProtectionData(const TDesC8& aCPData) |
|
46 { |
|
47 iCPData.Copy(aCPData); |
|
48 } |
|
49 |
|
50 EXPORT_C /*virtual*/ TInt TAvdtpContentProtectionCapabilities::AsProtocol(RBuf8& aBuffer) const |
|
51 { |
|
52 // must set LOSC before adding header |
|
53 iLOSC = KMinContentProtectionLOSC + iCPData.Length(); // length of CPType+CPData |
|
54 |
|
55 TInt ret = AddHeader(aBuffer); |
|
56 if (ret == KErrNone) |
|
57 { |
|
58 aBuffer.Append(reinterpret_cast<const TUint8*>(&iCPType), KMinContentProtectionLOSC); |
|
59 aBuffer.Append(iCPData); |
|
60 } |
|
61 return ret; |
|
62 } |
|
63 |
|
64 EXPORT_C void TAvdtpContentProtectionCapabilities::Parse(const TDesC8& aConfig) |
|
65 { |
|
66 iCPType = LittleEndian::Get16(aConfig.Ptr()); |
|
67 iCPData = aConfig.Right(aConfig.Length()-2); |
|
68 } |
|
69 |