os/boardsupport/haitest/bspsvs/suite/e32/src/T_TCommCapsV03Data.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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_TCommCapsV03Data.h"
    19 
    20 /*@{*/
    21 _LIT(KCmdConstructor,						"new");
    22 _LIT(KCmdDestructor,						"~");
    23 _LIT(KCmdiBreakSupported,					"iBreakSupported");
    24 
    25 _LIT(KFldExpected,							"expected");
    26 
    27 _LIT(KLogError,								"Error=%d");
    28 /*@}*/
    29 
    30 //////////////////////////////////////////////////////////////////////
    31 // Construction/Destruction
    32 //////////////////////////////////////////////////////////////////////
    33 
    34 CT_TCommCapsV03Data::CT_TCommCapsV03Data()
    35 :	CT_TCommCapsV02Data()
    36 ,	iCommCaps3(NULL)
    37 	{
    38 	}
    39 
    40 CT_TCommCapsV03Data::~CT_TCommCapsV03Data()
    41 /**
    42  * Public destructor
    43  */
    44 	{
    45 	DestroyData();
    46 	}
    47 
    48 void CT_TCommCapsV03Data::DestroyData()
    49 	{
    50 	delete iCommCaps3;
    51 	iCommCaps3=NULL;
    52 	}
    53 
    54 TDes8* CT_TCommCapsV03Data::Descriptor()
    55 /**
    56  * Return a pointer to the buffer
    57  *
    58  * @return	pointer to the buffer
    59  */
    60 	{
    61 	return iCommCaps3;
    62 	}
    63 
    64 TAny* CT_TCommCapsV03Data::GetObject()
    65 /**
    66  * Return a pointer to the object that the data wraps
    67  *
    68  * @return	pointer to the object that the data wraps
    69  */
    70 	{
    71 	return iCommCaps3;
    72 	}
    73 
    74 TBool CT_TCommCapsV03Data::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
    75 /**
    76  * Process a command read from the ini file
    77  *
    78  * @param aCommand			The command to process
    79  * @param aSection			The section in the ini containing data for the command
    80  * @param aAsyncErrorIndex	Command index for async calls to return errors to
    81  *
    82  * @return					ETrue if the command is processed
    83  *
    84  * @leave					System wide error
    85  */
    86 	{
    87 	TBool	ret=ETrue;
    88 	TInt	err=KErrNone;
    89 
    90 	if ( aCommand==KCmdConstructor )
    91 		{
    92 		err=DoCmdConstructor();
    93 		}
    94 	else if ( aCommand==KCmdDestructor )
    95 		{
    96 		DoCmdDestructor();
    97 		}
    98 	else if ( aCommand==KCmdiBreakSupported )
    99 		{
   100 		DoCmdiBreakSupported(aSection);
   101 		}
   102 	else
   103 		{
   104 		ret=CT_TCommCapsV02Data::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
   105 		}
   106 
   107 	if ( err!=KErrNone )
   108 		{
   109 		ERR_PRINTF2(KLogError, err);
   110 		SetError(err);
   111 		}
   112 
   113 	return ret;
   114 	}
   115 
   116 TCommCapsV01& CT_TCommCapsV03Data::GetCommCapsV01()
   117 	{
   118 	return (*iCommCaps3)();
   119 	}
   120 
   121 TCommCapsV02& CT_TCommCapsV03Data::GetCommCapsV02()
   122 	{
   123 	return (*iCommCaps3)();
   124 	}
   125 
   126 TCommCapsV03& CT_TCommCapsV03Data::GetCommCapsV03()
   127 	{
   128 	return (*iCommCaps3)();
   129 	}
   130 
   131 TInt CT_TCommCapsV03Data::DoCmdConstructor()
   132 	{
   133 	DestroyData();
   134 	TRAPD(err, iCommCaps3=new (ELeave) TCommCaps3());
   135 	iCommCaps3->FillZ();
   136 	return err;
   137 	}
   138 
   139 void CT_TCommCapsV03Data::DoCmdDestructor()
   140 	{
   141 	DestroyData();
   142 	}
   143 
   144 void CT_TCommCapsV03Data::DoCmdiBreakSupported(const TDesC& aSection)
   145 	{
   146 	TBool	actual=GetCommCapsV03().iBreakSupported;
   147 	INFO_PRINTF2(_L("iBreakSupported : 0x%X"), actual);
   148 
   149 	TBool	expected;
   150 	if ( GetBoolFromConfig(aSection, KFldExpected(), expected) )
   151 		{
   152 		if ( expected!=actual )
   153 			{
   154 			ERR_PRINTF1(_L("Expected Value does not match actual"));
   155 			SetBlockResult(EFail);
   156 			}
   157 		}
   158 	}