graphics/wserv/src/T_DataWsClientClass.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     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 the License "Symbian Foundation License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include "T_DataWsClientClass.h"
       
    19 
       
    20 /*@{*/
       
    21 //Commands
       
    22 _LIT(KCmdWsHandle,					"WsHandle");
       
    23 
       
    24 // Fields
       
    25 _LIT(KFldExpected,					"expected");
       
    26 _LIT(KFldExpectNot,					"expectnot");
       
    27 
       
    28 ///	Logging
       
    29 _LIT(KLogNotExpectedValueInt,		"'%S' is not as expected=%d, actual=%d");
       
    30 _LIT(KLogAsExpectedValueInt,		"actual value as '%S'=%d");
       
    31 /*@}*/
       
    32 
       
    33 
       
    34 /**
       
    35 * Process a command read from the ini file
       
    36 *
       
    37 * @param aCommand			the command to process
       
    38 * @param aSection			the entry in the ini file requiring the command to be processed
       
    39 * @param aAsyncErrorIndex	index of command. used for async calls
       
    40 *
       
    41 * @return ETrue if the command is processed
       
    42 */
       
    43 TBool CT_DataWsClientClass::DoCommandL(CDataWrapperBase& aDataWrapper, const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
       
    44 	{
       
    45 	TBool	ret = ETrue;
       
    46 
       
    47 	if ( aCommand==KCmdWsHandle )
       
    48 		{
       
    49 		DoCmdWsHandle(aDataWrapper, aSection);
       
    50 		}
       
    51 	else
       
    52 		{
       
    53 		ret=EFalse;
       
    54 		}
       
    55 
       
    56 	return ret;
       
    57 	}
       
    58 
       
    59 
       
    60 void CT_DataWsClientClass::DoCmdWsHandle(CDataWrapperBase& aDataWrapper, const TDesC& aSection)
       
    61 	{
       
    62 	// Execute command and log parameters
       
    63 	aDataWrapper.INFO_PRINTF1(_L("execute WsHandle()"));
       
    64 	TInt	actualResult = GetClientClass()->WsHandle();
       
    65 
       
    66 	// Diaplay command return value, check if it matches the expected value
       
    67 	TInt	expnotResult;
       
    68 	if ( aDataWrapper.GetIntFromConfig(aSection, KFldExpectNot, expnotResult) )
       
    69 		{
       
    70 		if ( actualResult==expnotResult )
       
    71 			{
       
    72 			aDataWrapper.ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpectNot, expnotResult, actualResult);
       
    73 			aDataWrapper.SetBlockResult(EFail);
       
    74 			}
       
    75 		else
       
    76 			{
       
    77 			aDataWrapper.INFO_PRINTF3(KLogAsExpectedValueInt, &KFldExpectNot, actualResult);
       
    78 			}
       
    79 		}
       
    80 
       
    81 	TInt	expectResult;
       
    82 	if ( aDataWrapper.GetIntFromConfig(aSection, KFldExpected, expectResult) )
       
    83 		{
       
    84 		if ( actualResult!=expectResult )
       
    85 			{
       
    86 			aDataWrapper.ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected, expectResult, actualResult);
       
    87 			aDataWrapper.SetBlockResult(EFail);
       
    88 			}
       
    89 		else
       
    90 			{
       
    91 			aDataWrapper.INFO_PRINTF3(KLogAsExpectedValueInt, &KFldExpected, actualResult);
       
    92 			}
       
    93 		}
       
    94 	}