bluetoothapitest/bluetoothsvs/T_BTSockAddrAPI/src/T_SockAddrData.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_SockAddrData.h"
       
    20 
       
    21 
       
    22 //Constant Literals used.
       
    23 
       
    24 //TSockAddr
       
    25 _LIT(KCmdConstruct, 							"Construct");
       
    26 _LIT(KCmdDistructor,							"~");
       
    27 
       
    28 /*@}*/
       
    29 
       
    30 CT_SockAddrData* CT_SockAddrData::NewL()
       
    31 	{
       
    32 	CT_SockAddrData*	ret=new (ELeave) CT_SockAddrData();
       
    33 	return ret;
       
    34 	}
       
    35 
       
    36 CT_SockAddrData::CT_SockAddrData()
       
    37 :   iTSockAddr(NULL)
       
    38 	{
       
    39 	}
       
    40 
       
    41 CT_SockAddrData::~CT_SockAddrData()
       
    42 	{
       
    43 	Cleanup();
       
    44 	}
       
    45 void CT_SockAddrData::Cleanup()
       
    46 	{
       
    47 	delete iTSockAddr;	
       
    48 	iTSockAddr=NULL;
       
    49 	}
       
    50 
       
    51 TBool CT_SockAddrData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& /*aSection*/, const TInt /*aAsyncErrorIndex*/)
       
    52 	{
       
    53 	TBool								retVal=ETrue;
       
    54 	
       
    55 	//-------------------------------------------------------------------------
       
    56 	// TSockAddr (Currently only used for other classes Copy constructor(s))
       
    57 	//-------------------------------------------------------------------------		
       
    58 
       
    59 	if ( aCommand==KCmdConstruct )
       
    60 		{
       
    61 		INFO_PRINTF1(_L("TSockAddr Constructor Call"));
       
    62 		delete iTSockAddr;
       
    63 		iTSockAddr=NULL;
       
    64 		TRAPD( err, iTSockAddr = new (ELeave) TSockAddr() );
       
    65 		SetError(err);
       
    66 		}
       
    67 	else if ( aCommand==KCmdDistructor )
       
    68 		{				
       
    69 		Cleanup();
       
    70 		}
       
    71 	else
       
    72 		{
       
    73 		retVal=EFalse;
       
    74 		}
       
    75 
       
    76 	return retVal;
       
    77 	}
       
    78 	
       
    79 TAny* CT_SockAddrData::GetObject()
       
    80 	{
       
    81 	return iTSockAddr;
       
    82 	}