os/boardsupport/haitest/bspsvs/suite/e32/src/T_TCommConfigV02Data.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/boardsupport/haitest/bspsvs/suite/e32/src/T_TCommConfigV02Data.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,160 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +#include "T_TCommConfigV02Data.h"
    1.22 +
    1.23 +/*@{*/
    1.24 +_LIT(KCmdConstructor,						"new");
    1.25 +_LIT(KCmdDestructor,						"~");
    1.26 +_LIT(KCmdiTxShutdownTimeout,				"iTxShutdownTimeout");
    1.27 +
    1.28 +_LIT(KFldExpected,							"expected");
    1.29 +_LIT(KFldValue,								"value");
    1.30 +
    1.31 +_LIT(KLogError,								"Error=%d");
    1.32 +/*@}*/
    1.33 +
    1.34 +//////////////////////////////////////////////////////////////////////
    1.35 +// Construction/Destruction
    1.36 +//////////////////////////////////////////////////////////////////////
    1.37 +
    1.38 +CT_TCommConfigV02Data::CT_TCommConfigV02Data()
    1.39 +:	CT_TCommConfigV01Data()
    1.40 +,	iCommConfig2(NULL)
    1.41 +	{
    1.42 +	}
    1.43 +
    1.44 +CT_TCommConfigV02Data::~CT_TCommConfigV02Data()
    1.45 +/**
    1.46 + * Public destructor
    1.47 + */
    1.48 +	{
    1.49 +	DestroyData();
    1.50 +	}
    1.51 +
    1.52 +void CT_TCommConfigV02Data::DestroyData()
    1.53 +	{
    1.54 +	delete iCommConfig2;
    1.55 +	iCommConfig2=NULL;
    1.56 +	}
    1.57 +
    1.58 +TDes8* CT_TCommConfigV02Data::Descriptor()
    1.59 +/**
    1.60 + * Return a pointer to the buffer
    1.61 + *
    1.62 + * @return	pointer to the buffer
    1.63 + */
    1.64 +	{
    1.65 +	return iCommConfig2;
    1.66 +	}
    1.67 +
    1.68 +TAny* CT_TCommConfigV02Data::GetObject()
    1.69 +/**
    1.70 + * Return a pointer to the object that the data wraps
    1.71 + *
    1.72 + * @return	pointer to the object that the data wraps
    1.73 + */
    1.74 +	{
    1.75 +	return iCommConfig2;
    1.76 +	}
    1.77 +
    1.78 +TBool CT_TCommConfigV02Data::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
    1.79 +/**
    1.80 + * Process a command read from the ini file
    1.81 + *
    1.82 + * @param aCommand			The command to process
    1.83 + * @param aSection			The section in the ini containing data for the command
    1.84 + * @param aAsyncErrorIndex	Command index for async calls to return errors to
    1.85 + *
    1.86 + * @return					ETrue if the command is processed
    1.87 + *
    1.88 + * @leave					System wide error
    1.89 + */
    1.90 +	{
    1.91 +	TBool	ret=ETrue;
    1.92 +	TInt	err=KErrNone;
    1.93 +
    1.94 +	if ( aCommand==KCmdConstructor )
    1.95 +		{
    1.96 +		err=DoCmdConstructor();
    1.97 +		}
    1.98 +	else if ( aCommand==KCmdDestructor )
    1.99 +		{
   1.100 +		DoCmdDestructor();
   1.101 +		}
   1.102 +	else if ( aCommand==KCmdiTxShutdownTimeout )
   1.103 +		{
   1.104 +		DoCmdiTxShutdownTimeout(aSection);
   1.105 +		}
   1.106 +	else
   1.107 +		{
   1.108 +		err=CT_TCommConfigV01Data::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
   1.109 +		}
   1.110 +
   1.111 +	if ( err!=KErrNone )
   1.112 +		{
   1.113 +		ERR_PRINTF2(KLogError, err);
   1.114 +		SetError(err);
   1.115 +		}
   1.116 +
   1.117 +	return ret;
   1.118 +	}
   1.119 +
   1.120 +TCommConfigV01& CT_TCommConfigV02Data::GetCommConfigV01()
   1.121 +	{
   1.122 +	return (*iCommConfig2)();
   1.123 +	}
   1.124 +
   1.125 +TCommConfigV02& CT_TCommConfigV02Data::GetCommConfigV02()
   1.126 +	{
   1.127 +	return (*iCommConfig2)();
   1.128 +	}
   1.129 +
   1.130 +TInt CT_TCommConfigV02Data::DoCmdConstructor()
   1.131 +	{
   1.132 +	DestroyData();
   1.133 +	TRAPD(err, iCommConfig2=new (ELeave) TCommConfig2());
   1.134 +	iCommConfig2->FillZ();
   1.135 +	return err;
   1.136 +	}
   1.137 +
   1.138 +void CT_TCommConfigV02Data::DoCmdDestructor()
   1.139 +	{
   1.140 +	DestroyData();
   1.141 +	}
   1.142 +
   1.143 +void CT_TCommConfigV02Data::DoCmdiTxShutdownTimeout(const TDesC& aSection)
   1.144 +	{
   1.145 +	TInt	actual=GetCommConfigV02().iTxShutdownTimeout;
   1.146 +	INFO_PRINTF2(_L("iTxShutdownTimeout : %d"), actual);
   1.147 +
   1.148 +	TInt	expected;
   1.149 +	if( GetIntFromConfig(aSection, KFldExpected(), expected) )
   1.150 +		{
   1.151 +		if ( expected!=actual )
   1.152 +			{
   1.153 +			ERR_PRINTF1(_L("Expected Value does not match actual"));
   1.154 +			SetBlockResult(EFail);
   1.155 +			}
   1.156 +		}
   1.157 +
   1.158 +	TInt	value;
   1.159 +	if( GetIntFromConfig(aSection, KFldValue(), value) )
   1.160 +		{
   1.161 +		GetCommConfigV02().iTxShutdownTimeout=value;
   1.162 +		}
   1.163 +	}