os/boardsupport/haitest/bspsvs/suite/e32/src/T_RHandleBaseData.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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 "T_RHandleBaseData.h"
    19 
    20 /*@{*/
    21 _LIT(KCmdClose,								"Close");
    22 _LIT(KCmdFullName,							"FullName");
    23 _LIT(KCmdName,								"Name");
    24 
    25 _LIT(KFldExpected,							"expected");
    26 _LIT(KFldNameParameter,						"nameParameter");
    27 
    28 _LIT(KLogErrorExpectedValue,				"Expected Value does not match actual");
    29 /*@}*/
    30 
    31 //////////////////////////////////////////////////////////////////////
    32 // Construction/Destruction
    33 //////////////////////////////////////////////////////////////////////
    34 
    35 CT_RHandleBaseData::CT_RHandleBaseData()
    36 :	CDataWrapperBase()
    37 	{
    38 	}
    39 
    40 CT_RHandleBaseData::~CT_RHandleBaseData()
    41 /**
    42  * Public destructor
    43  */
    44 	{
    45 	}
    46 
    47 TBool CT_RHandleBaseData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
    48 /**
    49  * Process a command read from the ini file
    50  *
    51  * @param aCommand			The command to process
    52  * @param aSection			The section in the ini containing data for the command
    53  * @param aAsyncErrorIndex	Command index for async calls to return errors to
    54  *
    55  * @return					ETrue if the command is processed
    56  *
    57  * @leave					System wide error
    58  */
    59 	{
    60 	TBool	ret=ETrue;
    61 
    62 	if ( aCommand==KCmdClose )
    63 		{
    64 		DoCmdClose();
    65 		}
    66 	else if ( aCommand==KCmdFullName )
    67 		{
    68 		DoCmdFullName(aSection);
    69 		}
    70 	else if ( aCommand==KCmdName )
    71 		{
    72 		DoCmdName(aSection);
    73 		}
    74 	else
    75 		{
    76 		ret=CDataWrapperBase::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
    77 		}
    78 
    79 	return ret;
    80 	}
    81 
    82 void CT_RHandleBaseData::DoCmdClose()
    83 	{
    84 	GetHandleBase()->Close();
    85 	}
    86 
    87 void CT_RHandleBaseData::DoCmdFullName(const TDesC& aSection)
    88 	{
    89 	TFullName	actual;
    90 
    91 	TBool	nameParameter=ETrue;
    92 	GetBoolFromConfig(aSection, KFldNameParameter(), nameParameter);
    93 
    94 	if ( nameParameter )
    95 		{
    96 		GetHandleBase()->FullName(actual);
    97 		}
    98 	else
    99 		{
   100 		actual=GetHandleBase()->FullName();
   101 		}
   102 	INFO_PRINTF2(_L("FullName: (%S)" ), &actual);
   103 
   104 	TPtrC	expected;
   105 	if ( GetStringFromConfig(aSection, KFldExpected, expected) )
   106 		{
   107 		if ( expected!=actual )
   108 			{
   109 			ERR_PRINTF1(KLogErrorExpectedValue);
   110 			SetBlockResult(EFail);
   111 			}
   112 		}
   113 	}
   114 
   115 void CT_RHandleBaseData::DoCmdName(const TDesC& aSection)
   116 	{
   117 	TName	actual=GetHandleBase()->Name();
   118 	INFO_PRINTF2(_L("Name: (%S)" ), &actual);
   119 
   120 	TPtrC	expected;
   121 	if ( GetStringFromConfig(aSection, KFldExpected, expected) )
   122 		{
   123 		if ( expected!=actual )
   124 			{
   125 			ERR_PRINTF1(KLogErrorExpectedValue);
   126 			SetBlockResult(EFail);
   127 			}
   128 		}
   129 	}