os/boardsupport/haitest/bspsvs/suite/e32/src/T_RHandleBaseData.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_RHandleBaseData.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,129 @@
     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_RHandleBaseData.h"
    1.22 +
    1.23 +/*@{*/
    1.24 +_LIT(KCmdClose,								"Close");
    1.25 +_LIT(KCmdFullName,							"FullName");
    1.26 +_LIT(KCmdName,								"Name");
    1.27 +
    1.28 +_LIT(KFldExpected,							"expected");
    1.29 +_LIT(KFldNameParameter,						"nameParameter");
    1.30 +
    1.31 +_LIT(KLogErrorExpectedValue,				"Expected Value does not match actual");
    1.32 +/*@}*/
    1.33 +
    1.34 +//////////////////////////////////////////////////////////////////////
    1.35 +// Construction/Destruction
    1.36 +//////////////////////////////////////////////////////////////////////
    1.37 +
    1.38 +CT_RHandleBaseData::CT_RHandleBaseData()
    1.39 +:	CDataWrapperBase()
    1.40 +	{
    1.41 +	}
    1.42 +
    1.43 +CT_RHandleBaseData::~CT_RHandleBaseData()
    1.44 +/**
    1.45 + * Public destructor
    1.46 + */
    1.47 +	{
    1.48 +	}
    1.49 +
    1.50 +TBool CT_RHandleBaseData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
    1.51 +/**
    1.52 + * Process a command read from the ini file
    1.53 + *
    1.54 + * @param aCommand			The command to process
    1.55 + * @param aSection			The section in the ini containing data for the command
    1.56 + * @param aAsyncErrorIndex	Command index for async calls to return errors to
    1.57 + *
    1.58 + * @return					ETrue if the command is processed
    1.59 + *
    1.60 + * @leave					System wide error
    1.61 + */
    1.62 +	{
    1.63 +	TBool	ret=ETrue;
    1.64 +
    1.65 +	if ( aCommand==KCmdClose )
    1.66 +		{
    1.67 +		DoCmdClose();
    1.68 +		}
    1.69 +	else if ( aCommand==KCmdFullName )
    1.70 +		{
    1.71 +		DoCmdFullName(aSection);
    1.72 +		}
    1.73 +	else if ( aCommand==KCmdName )
    1.74 +		{
    1.75 +		DoCmdName(aSection);
    1.76 +		}
    1.77 +	else
    1.78 +		{
    1.79 +		ret=CDataWrapperBase::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
    1.80 +		}
    1.81 +
    1.82 +	return ret;
    1.83 +	}
    1.84 +
    1.85 +void CT_RHandleBaseData::DoCmdClose()
    1.86 +	{
    1.87 +	GetHandleBase()->Close();
    1.88 +	}
    1.89 +
    1.90 +void CT_RHandleBaseData::DoCmdFullName(const TDesC& aSection)
    1.91 +	{
    1.92 +	TFullName	actual;
    1.93 +
    1.94 +	TBool	nameParameter=ETrue;
    1.95 +	GetBoolFromConfig(aSection, KFldNameParameter(), nameParameter);
    1.96 +
    1.97 +	if ( nameParameter )
    1.98 +		{
    1.99 +		GetHandleBase()->FullName(actual);
   1.100 +		}
   1.101 +	else
   1.102 +		{
   1.103 +		actual=GetHandleBase()->FullName();
   1.104 +		}
   1.105 +	INFO_PRINTF2(_L("FullName: (%S)" ), &actual);
   1.106 +
   1.107 +	TPtrC	expected;
   1.108 +	if ( GetStringFromConfig(aSection, KFldExpected, expected) )
   1.109 +		{
   1.110 +		if ( expected!=actual )
   1.111 +			{
   1.112 +			ERR_PRINTF1(KLogErrorExpectedValue);
   1.113 +			SetBlockResult(EFail);
   1.114 +			}
   1.115 +		}
   1.116 +	}
   1.117 +
   1.118 +void CT_RHandleBaseData::DoCmdName(const TDesC& aSection)
   1.119 +	{
   1.120 +	TName	actual=GetHandleBase()->Name();
   1.121 +	INFO_PRINTF2(_L("Name: (%S)" ), &actual);
   1.122 +
   1.123 +	TPtrC	expected;
   1.124 +	if ( GetStringFromConfig(aSection, KFldExpected, expected) )
   1.125 +		{
   1.126 +		if ( expected!=actual )
   1.127 +			{
   1.128 +			ERR_PRINTF1(KLogErrorExpectedValue);
   1.129 +			SetBlockResult(EFail);
   1.130 +			}
   1.131 +		}
   1.132 +	}