bluetoothmgmt/bluetoothclientlib/avlib/avdtpNonSBCCodecCapability.cpp
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     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 /**
       
    25 Constructor
       
    26 @param aMediaType The media type
       
    27 @param aCodecType The codec type
       
    28 */	
       
    29 EXPORT_C TNonSBCCodecCapabilities::TNonSBCCodecCapabilities(SymbianBluetoothAV::TBluetoothMediaType aMediaType,
       
    30 															TBluetoothMediaCodecType aCodecType)
       
    31 : TAvdtpMediaCodecCapabilities(aMediaType, aCodecType, KUnknownLOSC)
       
    32 	{
       
    33 	// LOSC set when SetCodecData called
       
    34 	}
       
    35 	
       
    36 /**
       
    37 @internalTechnology
       
    38 */	
       
    39 EXPORT_C /*virtual*/ TInt TNonSBCCodecCapabilities::AsProtocol(RBuf8& aBuffer) const
       
    40 	{
       
    41 	using namespace SymbianBluetoothAV;
       
    42 
       
    43 	TInt ret = AddHeader(aBuffer);
       
    44 	if (ret == KErrNone)
       
    45 		{		
       
    46 		aBuffer.Append(static_cast<TChar>(iMediaType));
       
    47 		aBuffer.Append(static_cast<TChar>(iMediaCodecType));
       
    48 
       
    49 		aBuffer.Append(iCodecData);
       
    50 		}
       
    51 		
       
    52 	return ret;
       
    53 
       
    54 	}
       
    55 
       
    56 /**
       
    57 @internalTechnology
       
    58 */	
       
    59 EXPORT_C /*virtual*/ void TNonSBCCodecCapabilities::Parse(const TDesC8& aPtr)
       
    60 	{
       
    61 	_LIT(KNonSBCCodecCapabilitiesPanic, "NonSBCConfigPanic");
       
    62 	__ASSERT_ALWAYS(aPtr.Length()>=2, User::Panic(KNonSBCCodecCapabilitiesPanic, 0));
       
    63 	
       
    64 	// parse the media type and codec type via base-class
       
    65 	TAvdtpMediaCodecCapabilities::Parse(aPtr);
       
    66 
       
    67 	iCodecData = aPtr.Right(aPtr.Length()-KServiceCatLOSCMediaCodecMinimum);
       
    68 	iLOSC = KServiceCatLOSCMediaCodecMinimum+iCodecData.Length();
       
    69 	}
       
    70 
       
    71 /**
       
    72 Set codec settings transparently - used for arbitrary nonSBC codec
       
    73 @param aCodecData descriptor containing arbitrary codec data
       
    74 */	
       
    75 EXPORT_C void TNonSBCCodecCapabilities::SetCodecData(const TDesC8& aCodecData)
       
    76 	{
       
    77 	iCodecData = aCodecData;
       
    78 	iLOSC = KServiceCatLOSCMediaCodecMinimum+aCodecData.Length();
       
    79 	}
       
    80 	
       
    81 /**
       
    82 Get codec settings transparently - used for arbitrary nonSBC codec
       
    83 @return descriptor containing arbitrary codec data
       
    84 */	
       
    85 EXPORT_C const TDesC8& TNonSBCCodecCapabilities::CodecData() const
       
    86 	{
       
    87 	return iCodecData;
       
    88 	}
       
    89