1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/boardsupport/haitest/bspsvs/suite/e32/src/T_TCommCapsV03Data.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,158 @@
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_TCommCapsV03Data.h"
1.22 +
1.23 +/*@{*/
1.24 +_LIT(KCmdConstructor, "new");
1.25 +_LIT(KCmdDestructor, "~");
1.26 +_LIT(KCmdiBreakSupported, "iBreakSupported");
1.27 +
1.28 +_LIT(KFldExpected, "expected");
1.29 +
1.30 +_LIT(KLogError, "Error=%d");
1.31 +/*@}*/
1.32 +
1.33 +//////////////////////////////////////////////////////////////////////
1.34 +// Construction/Destruction
1.35 +//////////////////////////////////////////////////////////////////////
1.36 +
1.37 +CT_TCommCapsV03Data::CT_TCommCapsV03Data()
1.38 +: CT_TCommCapsV02Data()
1.39 +, iCommCaps3(NULL)
1.40 + {
1.41 + }
1.42 +
1.43 +CT_TCommCapsV03Data::~CT_TCommCapsV03Data()
1.44 +/**
1.45 + * Public destructor
1.46 + */
1.47 + {
1.48 + DestroyData();
1.49 + }
1.50 +
1.51 +void CT_TCommCapsV03Data::DestroyData()
1.52 + {
1.53 + delete iCommCaps3;
1.54 + iCommCaps3=NULL;
1.55 + }
1.56 +
1.57 +TDes8* CT_TCommCapsV03Data::Descriptor()
1.58 +/**
1.59 + * Return a pointer to the buffer
1.60 + *
1.61 + * @return pointer to the buffer
1.62 + */
1.63 + {
1.64 + return iCommCaps3;
1.65 + }
1.66 +
1.67 +TAny* CT_TCommCapsV03Data::GetObject()
1.68 +/**
1.69 + * Return a pointer to the object that the data wraps
1.70 + *
1.71 + * @return pointer to the object that the data wraps
1.72 + */
1.73 + {
1.74 + return iCommCaps3;
1.75 + }
1.76 +
1.77 +TBool CT_TCommCapsV03Data::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
1.78 +/**
1.79 + * Process a command read from the ini file
1.80 + *
1.81 + * @param aCommand The command to process
1.82 + * @param aSection The section in the ini containing data for the command
1.83 + * @param aAsyncErrorIndex Command index for async calls to return errors to
1.84 + *
1.85 + * @return ETrue if the command is processed
1.86 + *
1.87 + * @leave System wide error
1.88 + */
1.89 + {
1.90 + TBool ret=ETrue;
1.91 + TInt err=KErrNone;
1.92 +
1.93 + if ( aCommand==KCmdConstructor )
1.94 + {
1.95 + err=DoCmdConstructor();
1.96 + }
1.97 + else if ( aCommand==KCmdDestructor )
1.98 + {
1.99 + DoCmdDestructor();
1.100 + }
1.101 + else if ( aCommand==KCmdiBreakSupported )
1.102 + {
1.103 + DoCmdiBreakSupported(aSection);
1.104 + }
1.105 + else
1.106 + {
1.107 + ret=CT_TCommCapsV02Data::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
1.108 + }
1.109 +
1.110 + if ( err!=KErrNone )
1.111 + {
1.112 + ERR_PRINTF2(KLogError, err);
1.113 + SetError(err);
1.114 + }
1.115 +
1.116 + return ret;
1.117 + }
1.118 +
1.119 +TCommCapsV01& CT_TCommCapsV03Data::GetCommCapsV01()
1.120 + {
1.121 + return (*iCommCaps3)();
1.122 + }
1.123 +
1.124 +TCommCapsV02& CT_TCommCapsV03Data::GetCommCapsV02()
1.125 + {
1.126 + return (*iCommCaps3)();
1.127 + }
1.128 +
1.129 +TCommCapsV03& CT_TCommCapsV03Data::GetCommCapsV03()
1.130 + {
1.131 + return (*iCommCaps3)();
1.132 + }
1.133 +
1.134 +TInt CT_TCommCapsV03Data::DoCmdConstructor()
1.135 + {
1.136 + DestroyData();
1.137 + TRAPD(err, iCommCaps3=new (ELeave) TCommCaps3());
1.138 + iCommCaps3->FillZ();
1.139 + return err;
1.140 + }
1.141 +
1.142 +void CT_TCommCapsV03Data::DoCmdDestructor()
1.143 + {
1.144 + DestroyData();
1.145 + }
1.146 +
1.147 +void CT_TCommCapsV03Data::DoCmdiBreakSupported(const TDesC& aSection)
1.148 + {
1.149 + TBool actual=GetCommCapsV03().iBreakSupported;
1.150 + INFO_PRINTF2(_L("iBreakSupported : 0x%X"), actual);
1.151 +
1.152 + TBool expected;
1.153 + if ( GetBoolFromConfig(aSection, KFldExpected(), expected) )
1.154 + {
1.155 + if ( expected!=actual )
1.156 + {
1.157 + ERR_PRINTF1(_L("Expected Value does not match actual"));
1.158 + SetBlockResult(EFail);
1.159 + }
1.160 + }
1.161 + }