bluetoothapitest/bluetoothsvs/T_BTUserAPI/src/T_AvdtpMediaCodecCapabilitiesData.cpp
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "T_AvdtpServiceCapabilityData.h"
       
    20 #include "T_AvdtpMediaCodecCapabilitiesData.h"
       
    21 #include "T_BTUtil.h"
       
    22 
       
    23 /*@{*/
       
    24 //Parameters
       
    25 _LIT(KExpected,									"expected");
       
    26 
       
    27 
       
    28 //Commands
       
    29 _LIT(KCmdMediaType,								"MediaType");
       
    30 _LIT(KCmdMediaCodecType,						"MediaCodecType");
       
    31 _LIT(KCmdMinWindowSize,							"MinWindowSize");
       
    32 _LIT(KCmdSetMinWindowSize,						"SetMinWindowSize");
       
    33 _LIT(KCmdAllocCodecFromPDUL,					"AllocCodecFromPDUL");
       
    34 
       
    35 //Log
       
    36 _LIT(KLogMissingExpected,								"Missing expected '%S'");
       
    37 
       
    38 
       
    39 /*@}*/
       
    40 
       
    41 //////////////////////////////////////////////////////////////////////
       
    42 // Construction/Destruction
       
    43 //////////////////////////////////////////////////////////////////////
       
    44 
       
    45 CT_AvdtpMediaCodecCapabilitiesData::CT_AvdtpMediaCodecCapabilitiesData()
       
    46 	{
       
    47 	}
       
    48 
       
    49 
       
    50 TBool CT_AvdtpMediaCodecCapabilitiesData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
       
    51 	{
       
    52 	TBool	ret = ETrue;
       
    53 
       
    54 	if ( aCommand==KCmdMediaType )
       
    55 		{
       
    56 		DoCmdMediaType(aSection);
       
    57 		}
       
    58 	else if(aCommand == KCmdMediaCodecType)
       
    59 		{
       
    60 		DoCmdMediaCodecType(aSection);
       
    61 		}
       
    62 	else if(aCommand == KCmdMinWindowSize)
       
    63 		{
       
    64 		DoCmdMinWindowSize(aSection);
       
    65 		}
       
    66 	else if(aCommand == KCmdSetMinWindowSize)
       
    67 		{
       
    68 		DoCmdSetMinWindowSize(aSection);
       
    69 		}
       
    70 	else if(aCommand == KCmdAllocCodecFromPDUL)
       
    71 		{
       
    72 		AllocCodecFromPDUL(aSection);
       
    73 		}
       
    74 	else
       
    75 		{
       
    76 		ret = CT_AvdtpServiceCapabilityData::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
       
    77 		}
       
    78 
       
    79 	return ret;
       
    80 	}
       
    81 
       
    82 /**
       
    83 Test MediaType() 
       
    84 */
       
    85 void CT_AvdtpMediaCodecCapabilitiesData::DoCmdMediaType(const TDesC& aSection)
       
    86 	{
       
    87 	INFO_PRINTF1(_L("TAvdtpMediaCodecCapabilities MediaType() Call"));	
       
    88 	SymbianBluetoothAV::TBluetoothMediaType actualValue = ((TAvdtpMediaCodecCapabilities*)GetAvdtpServiceCapability())->MediaType();
       
    89 	INFO_PRINTF2(_L("MediaType result (%d)"), actualValue);	
       
    90 
       
    91 	SymbianBluetoothAV::TBluetoothMediaType expected;
       
    92 	if ( CT_BTUtil::ReadBluetoothMediaType(*this, aSection, KExpected, expected) )
       
    93 		{
       
    94 		if ( actualValue != expected )
       
    95 			{
       
    96 			ERR_PRINTF3(_L("Result (%d) is not as expected (%d)"), actualValue, expected);
       
    97 			SetBlockResult(EFail);	
       
    98 			}			
       
    99 		}
       
   100 	else
       
   101 		{
       
   102 		ERR_PRINTF2(KLogMissingExpected, &KExpected);
       
   103 		SetBlockResult(EFail);		
       
   104 		}	
       
   105 	}
       
   106 
       
   107 /**
       
   108 Test MediaCodecType() 
       
   109 */
       
   110 void CT_AvdtpMediaCodecCapabilitiesData::DoCmdMediaCodecType(const TDesC& aSection)
       
   111 	{
       
   112 	INFO_PRINTF1(_L("TAvdtpMediaCodecCapabilities MediaCodecType() Call"));	
       
   113 	TBluetoothMediaCodecType actualValue = ((TAvdtpMediaCodecCapabilities*)GetAvdtpServiceCapability())->MediaCodecType();
       
   114 	INFO_PRINTF2(_L("MediaCodecType result (%d)"), actualValue);	
       
   115 
       
   116 	TInt expected;
       
   117 	if ( GetIntFromConfig(aSection, KExpected, expected) )
       
   118 		{
       
   119 		if ( actualValue != (TBluetoothMediaCodecType)expected )
       
   120 			{
       
   121 			ERR_PRINTF3(_L("Result (%d) is not as expected (%d)"), actualValue, expected);
       
   122 			SetBlockResult(EFail);	
       
   123 			}			
       
   124 		}
       
   125 	else
       
   126 		{
       
   127 		ERR_PRINTF2(KLogMissingExpected, &KExpected);
       
   128 		SetBlockResult(EFail);		
       
   129 		}
       
   130 	}
       
   131 
       
   132 /**
       
   133 Test MinWindowSize() 
       
   134 */
       
   135 void CT_AvdtpMediaCodecCapabilitiesData::DoCmdMinWindowSize(const TDesC& /*aSection*/)
       
   136 	{
       
   137 //	INFO_PRINTF1(_L("TAvdtpMediaCodecCapabilities MinWindowSize() Call"));	
       
   138 //	TAvdtpRecoveryWindowSize actualValue = ((TAvdtpMediaCodecCapabilities*)GetAvdtpServiceCapability())->MinWindowSize();
       
   139 //	INFO_PRINTF2(_L("MinWindowSize result (%d)"), actualValue);	
       
   140 //
       
   141 //	TInt expected;
       
   142 //	if ( GetIntFromConfig(aSection, KExpected, expected) )
       
   143 //		{
       
   144 //		if ( actualValue != (TAvdtpRecoveryWindowSize)expected )
       
   145 //			{
       
   146 //			ERR_PRINTF3(_L("Result (%d) is not as expected (%d)"), actualValue, expected);
       
   147 //			SetBlockResult(EFail);	
       
   148 //			}			
       
   149 //		}
       
   150 //	else
       
   151 //		{
       
   152 //		ERR_PRINTF2(KLogMissingExpected, &KExpected);
       
   153 //		SetBlockResult(EFail);		
       
   154 //		}	
       
   155 	}
       
   156 
       
   157 /**
       
   158 Test SetMinWindowSize() 
       
   159 */
       
   160 void CT_AvdtpMediaCodecCapabilitiesData::DoCmdSetMinWindowSize(const TDesC& /*aSection*/)
       
   161 	{
       
   162 //	INFO_PRINTF1(_L("TAvdtpMediaCodecCapabilities SetMinWindowSize() Call"));
       
   163 //
       
   164 //	TInt size = 0;
       
   165 //	if ( GetIntFromConfig(aSection, KSize, size) )
       
   166 //		{
       
   167 //		((TAvdtpMediaCodecCapabilities*)GetAvdtpServiceCapability())->SetMinWindowSize((TAvdtpRecoveryWindowSize)size);
       
   168 //		}
       
   169 //	else
       
   170 //		{
       
   171 //		ERR_PRINTF2(KLogMissingParameter, &KSize);
       
   172 //		SetBlockResult(EFail);
       
   173 //		}
       
   174 	}
       
   175 
       
   176 /**
       
   177 Test CodecFromPDUL() 
       
   178 */
       
   179 void CT_AvdtpMediaCodecCapabilitiesData::AllocCodecFromPDUL(const TDesC& /*aSection*/)
       
   180 	{
       
   181 	
       
   182 	}