bluetoothapitest/bluetoothsvs/T_BTUserAPI/src/T_AvdtpReportingCapabilitiesData.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 #include <bluetoothav.h>
       
    19 
       
    20 //	User Includes
       
    21 #include "T_AvdtpServiceCapabilityData.h"
       
    22 #include "T_AvdtpReportingCapabilitiesData.h"
       
    23 
       
    24 
       
    25 /*@{*/
       
    26 //Commands
       
    27 _LIT(KCmdnew,											"new");
       
    28 _LIT(KCmdDestructor,									"~"); 
       
    29 
       
    30 //Log
       
    31 _LIT(KLogError,											"Error=%d");
       
    32 /*@}*/
       
    33 
       
    34 //////////////////////////////////////////////////////////////////////
       
    35 // Construction/Destruction
       
    36 //////////////////////////////////////////////////////////////////////
       
    37 
       
    38 CT_AvdtpReportingCapabilitiesData* CT_AvdtpReportingCapabilitiesData::NewL()
       
    39 	{
       
    40 	CT_AvdtpReportingCapabilitiesData*	ret=new (ELeave) CT_AvdtpReportingCapabilitiesData();
       
    41 	CleanupStack::PushL(ret);
       
    42 	ret->ConstructL();
       
    43 	CleanupStack::Pop(ret);
       
    44 	return ret;
       
    45 	}
       
    46 
       
    47 CT_AvdtpReportingCapabilitiesData::CT_AvdtpReportingCapabilitiesData()
       
    48 :iAvdtpReportingCapabilities(NULL)
       
    49 	{
       
    50 	}
       
    51 
       
    52 void CT_AvdtpReportingCapabilitiesData::ConstructL()
       
    53 	{
       
    54 	}
       
    55 
       
    56 TAvdtpServiceCapability* CT_AvdtpReportingCapabilitiesData::GetAvdtpServiceCapability() const
       
    57 	{
       
    58 	return iAvdtpReportingCapabilities;
       
    59 	}
       
    60 
       
    61 CT_AvdtpReportingCapabilitiesData::~CT_AvdtpReportingCapabilitiesData()
       
    62 	{
       
    63 	DestroyData();
       
    64 	}
       
    65 
       
    66 void CT_AvdtpReportingCapabilitiesData::SetObjectL(TAny* aAny)
       
    67 	{
       
    68 	DestroyData();
       
    69 	iAvdtpReportingCapabilities = static_cast<TAvdtpReportingCapabilities*> (aAny);
       
    70 	}
       
    71 
       
    72 void CT_AvdtpReportingCapabilitiesData::DisownObjectL()
       
    73 	{
       
    74 	iAvdtpReportingCapabilities = NULL;
       
    75 	}
       
    76 
       
    77 void CT_AvdtpReportingCapabilitiesData::DestroyData()
       
    78 	{
       
    79 	delete iAvdtpReportingCapabilities;
       
    80 	iAvdtpReportingCapabilities=NULL;	
       
    81 	}
       
    82 
       
    83 TBool CT_AvdtpReportingCapabilitiesData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
       
    84 	{
       
    85 	TBool	ret = ETrue;
       
    86 	
       
    87 	if ( aCommand==KCmdnew )
       
    88 		{
       
    89 		DoCmdnewL();
       
    90 		}
       
    91 	else if ( aCommand==KCmdDestructor )
       
    92 		{
       
    93 		DestroyData();
       
    94 		}
       
    95 	else
       
    96 		{
       
    97 		ret=CT_AvdtpServiceCapabilityData::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
       
    98 		}
       
    99 
       
   100 	return ret;
       
   101 	}
       
   102 
       
   103 
       
   104 /**
       
   105 Test TAvdtpReportingCapabilities()
       
   106 */
       
   107 void CT_AvdtpReportingCapabilitiesData::DoCmdnewL()
       
   108 	{
       
   109 	INFO_PRINTF1(_L("TAvdtpReportingCapabilities Constructor Call"));
       
   110 	DestroyData();
       
   111 	TRAPD( err, iAvdtpReportingCapabilities = new (ELeave) TAvdtpReportingCapabilities());
       
   112 	
       
   113 	if ( err!=KErrNone )
       
   114 		{
       
   115 		ERR_PRINTF2(KLogError, err);
       
   116 		SetError(err);
       
   117 		}
       
   118 	}
       
   119