bluetoothmgmt/bluetoothclientlib/avlib/avdtpRecoveryCapability.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 <bluetooth/logger.h>
       
    22 #include <bluetoothav.h>
       
    23 #include "gavdpinterface.h"
       
    24 
       
    25 #ifdef __FLOG_ACTIVE
       
    26 _LIT8(KLogComponent, LOG_COMPONENT_AVLIB);
       
    27 #endif
       
    28 
       
    29 #ifdef _DEBUG
       
    30 PANICCATEGORY("recovcap");
       
    31 #endif
       
    32 
       
    33 EXPORT_C TAvdtpRecoveryCapabilities::TAvdtpRecoveryCapabilities()
       
    34 : TAvdtpServiceCapability(EServiceCategoryRecovery, KServiceCatLOSCRecovery)
       
    35 	{
       
    36 	}
       
    37 
       
    38 EXPORT_C /*virtual*/ TInt inline TAvdtpRecoveryCapabilities::AsProtocol(RBuf8& aBuffer) const
       
    39 	{
       
    40 	TInt ret = AddHeader(aBuffer);
       
    41 	
       
    42 	if (ret==KErrNone)
       
    43 		{
       
    44 		aBuffer.Append(static_cast<TUint8>(iRecoveryType));
       
    45 		aBuffer.Append(static_cast<TUint8>(iMaximumRecoveryWindowSize));
       
    46 		aBuffer.Append(static_cast<TUint8>(iMinimumRecoveryWindowSize));
       
    47 		}
       
    48 	return ret;	
       
    49 	}
       
    50 	
       
    51 /*virtual*/ void TAvdtpRecoveryCapabilities::Parse(const TDesC8& aPtr)
       
    52 	{
       
    53 	ASSERT_DEBUG(aPtr.Length()>=3);	// the parse broke if this is not true
       
    54 	iRecoveryType = static_cast<SymbianBluetoothAV::TAvdtpRecoveryType>(aPtr[0]);
       
    55 	iMaximumRecoveryWindowSize = static_cast<TAvdtpRecoveryWindowSize>(aPtr[1]);
       
    56 	iMinimumRecoveryWindowSize = static_cast<TAvdtpRecoveryWindowSize>(aPtr[2]);
       
    57 	}
       
    58 
       
    59 EXPORT_C SymbianBluetoothAV::TAvdtpRecoveryType TAvdtpRecoveryCapabilities::RecoveryType() const
       
    60 	{
       
    61 	return iRecoveryType;	
       
    62 	}
       
    63 	
       
    64 EXPORT_C void TAvdtpRecoveryCapabilities::SetRecoveryType(SymbianBluetoothAV::TAvdtpRecoveryType aType)
       
    65 	{
       
    66 	iRecoveryType = aType;
       
    67 	}
       
    68 	
       
    69 EXPORT_C TAvdtpRecoveryWindowSize TAvdtpRecoveryCapabilities::MaxWindowSize() const
       
    70 	{
       
    71 	return iMaximumRecoveryWindowSize;
       
    72 	}
       
    73 	
       
    74 //This runs client-side - panic bad values, no return error needed
       
    75 EXPORT_C void TAvdtpRecoveryCapabilities::SetMaxWindowSize(TAvdtpRecoveryWindowSize aSize)
       
    76 	{
       
    77 	iMaximumRecoveryWindowSize = aSize;
       
    78 	}
       
    79 	
       
    80 	
       
    81 EXPORT_C TAvdtpRecoveryWindowSize TAvdtpRecoveryCapabilities::MinWindowSize() const
       
    82 	{
       
    83 	return iMinimumRecoveryWindowSize;
       
    84 	}
       
    85 	
       
    86 	
       
    87 EXPORT_C void TAvdtpRecoveryCapabilities::SetMinWindowSize(TAvdtpRecoveryWindowSize aSize)
       
    88 	{
       
    89 	iMinimumRecoveryWindowSize=aSize;
       
    90 	}
       
    91