basebandadaptationplugins/basebandchanneladaptorforc32/te_c32bca/src/te_C32BcaUnitSteps.cpp
changeset 31 8ab6687fb94c
parent 0 3553901f7fa8
child 42 3adadc800673
equal deleted inserted replaced
26:8767c6acf334 31:8ab6687fb94c
  1538 Tests C32 BCA Ioctl option: Getting COMM Config
  1538 Tests C32 BCA Ioctl option: Getting COMM Config
  1539 */	
  1539 */	
  1540 TVerdict CIoctlSerialPort1::RunTestStepL()
  1540 TVerdict CIoctlSerialPort1::RunTestStepL()
  1541 	{
  1541 	{
  1542 	LoadC32SettingsFromConfigFileL();
  1542 	LoadC32SettingsFromConfigFileL();
  1543 	
  1543     
  1544 	LoadCsyNameFromConfigFileL();
  1544 	LoadCsyNameFromConfigFileL();
  1545 	OpenRealCommPortL(iCommPort, iC32CsyName, iC32PortName);
  1545 	OpenRealCommPortL(iCommPort, iC32CsyName, iC32PortName);
  1546 	
  1546     
  1547 	LoadUutL();
  1547 	LoadUutL();
  1548 	SetProxyCsyL(*iUut, iC32CsyName);
  1548 	SetProxyCsyL(*iUut, iC32CsyName);
  1549 	
  1549     
  1550 	iUut->Open(iC32PortName);
  1550 	iUut->Open(iC32PortName);
  1551 	iUut->WaitForOpenL(KErrNone);
  1551 	iUut->WaitForOpenL(KErrNone);
  1552 	
  1552     
  1553 	TCommConfig actualCommConfig;
  1553 	TCommConfig actualCommConfig;
  1554 	iCommPort.Config(actualCommConfig);
  1554 	iCommPort.Config(actualCommConfig);
  1555 	actualCommConfig().iTerminatorCount = 1;
  1555 	actualCommConfig().iTerminatorCount = 1;
  1556 	actualCommConfig().iTerminator[0] = 0x7E;
  1556 	actualCommConfig().iTerminator[0] = 0x7E;
  1557 	LogAndLeaveIfErrorL(iCommPort.SetConfig(actualCommConfig), _L("Setting COMM Config on RComm"));
  1557 
  1558 	
  1558 	LogAndLeaveIfErrorL(iCommPort.SetConfig(actualCommConfig), _L("Setting COMM Config on RComm"));    
       
  1559     
  1559 	TCommConfig balCommConfig;
  1560 	TCommConfig balCommConfig;
  1560 	// sanity check
  1561 	// sanity check
  1561 	TRAPD(err, CheckBuffersEqualL(balCommConfig, actualCommConfig));
  1562 	TRAPD(err, CheckBuffersEqualL(balCommConfig, actualCommConfig));
  1562 	if(KErrNone == err)
  1563 	if(KErrNone == err)
  1563 		{
  1564 	{
  1564 		INFO_PRINTF1(_L("Santify Check Failure: buffers were equal before TCommConfig was retrieved from BCA."));
  1565 	INFO_PRINTF1(_L("Santify Check Failure: buffers were equal before TCommConfig was retrieved from BCA."));
  1565 		return EInconclusive;
  1566 	return EInconclusive;
  1566 		}
  1567 	}
  1567 
  1568 
  1568 	TPckgBuf<TCommConfig> argPckg(balCommConfig);
  1569 	TPckgBuf<TCommConfig> argPckg(balCommConfig);
  1569 	iUut->Ioctl(KBcaOptLevelExtSerial, KSerialConfig, argPckg);
  1570 	iUut->Ioctl(KBcaOptLevelExtSerial, KSerialConfig, argPckg);
  1570 	iUut->WaitForIoctlL(KErrNone);
  1571 	iUut->WaitForIoctlL(KErrNone);
  1571 	balCommConfig = argPckg();
  1572 	balCommConfig = argPckg();
  1572 
  1573 
  1573 	CheckBuffersEqualL(balCommConfig, actualCommConfig);
  1574 	CheckBuffersEqualL(balCommConfig, actualCommConfig);
  1574 	
  1575 
       
  1576 	// Now check that we can accept a V2 structure, although only the V1 attributes are configured for use.
       
  1577 	TCommConfig2 actualCommConfig2;
       
  1578 	actualCommConfig2.FillZ();
       
  1579 	actualCommConfig2().iTerminatorCount = 2;
       
  1580 	actualCommConfig2().iTerminator[0] = 0x7E;    
       
  1581 	LogAndLeaveIfErrorL(iCommPort.SetConfig(actualCommConfig2), _L("Setting COMM Config using V2 on RComm"));
       
  1582 
       
  1583 	// Now check that we can retrieve a V1 structure correctly.
       
  1584 	TCommConfig balCommConfig1;
       
  1585 	balCommConfig1.FillZ();
       
  1586 	TPckgBuf<TCommConfig> argPckg1(balCommConfig1);
       
  1587 	iUut->Ioctl(KBcaOptLevelExtSerial, KSerialConfig, argPckg1);
       
  1588 	iUut->WaitForIoctlL(KErrNone);
       
  1589 	balCommConfig1 = argPckg1();
       
  1590 
       
  1591 	actualCommConfig().iTerminatorCount = 2;    //Modify Comparison Structure to be aligned to balCommConfig1          
       
  1592 	CheckBuffersEqualL(balCommConfig1, actualCommConfig);
       
  1593     
  1575 	iCommPort.Close();
  1594 	iCommPort.Close();
  1576 	
  1595     
  1577 	iUut->Shutdown();
  1596 	iUut->Shutdown();
  1578 	iUut->WaitForShutdownL(KErrNone);
  1597 	iUut->WaitForShutdownL(KErrNone);
  1579 	
  1598     
  1580 	UnloadUut();
  1599 	UnloadUut();
  1581 	
  1600     
  1582 	return EPass;
  1601 	return EPass;    
  1583 	}
  1602 	}
  1584 
  1603 
  1585 /**
  1604 /**
  1586 Tests C32 BCA Ioctl option: Setting COMM Config
  1605 Tests C32 BCA Ioctl option: Setting COMM Config
  1587 */
  1606 */
  1775 	}
  1794 	}
  1776 	
  1795 	
  1777 /** Test C32 BCA open functionality with the different combinations of ChannelId*/
  1796 /** Test C32 BCA open functionality with the different combinations of ChannelId*/
  1778 TVerdict CValidChannelId::RunTestStepL()
  1797 TVerdict CValidChannelId::RunTestStepL()
  1779 	{
  1798 	{
  1780 	TPtrC channelId;
  1799     TPtrC channelId;
  1781 		
  1800 		
  1782 	if(!GetStringFromConfig(ConfigSection(), _L("Port_Name1"), channelId))
  1801 	if(!GetStringFromConfig(ConfigSection(), _L("Port_Name1"), channelId))
  1783 		{
  1802 		{
  1784 		INFO_PRINTF1(_L("Failed to read Port Name Config. Test is Aborted."));
  1803 		INFO_PRINTF1(_L("Failed to read Port Name Config. Test is Aborted."));
  1785 		return EAbort;
  1804 		return EAbort;
  1786 		}
  1805 		}
  1787 		
  1806 		
  1788 	// Pass channelId in the form of csyname::portname (ECUART::COMM::0) to the BCA
  1807 	// Pass channelId in the form of:
  1789 	
  1808 	// csyname::portname (ECUART::COMM::0) to the BCA
       
  1809 	// where csyname  = ECUART
       
  1810 	//       portname = COMM::0
       
  1811 	// OR alternatively
       
  1812 	// csyname::portname (PKTLOOPBACK::PKTLOOPBACK::501) 
       
  1813 	// where csyname   = PKTLOOPBACK
       
  1814 	//       portname  = PKTLOOPBACK::501
       
  1815 	//       (PKTLOOPBACK port names contain a seemingly redundant PKTLOOPBACK in their specification).
  1790 	LoadUutL();
  1816 	LoadUutL();
  1791 			
  1817 
       
  1818 	// Scenario 1 - the CSY name is specified in the descriptor argument passed to the Open()
       
  1819 	
  1792 	iUut->Open(channelId);
  1820 	iUut->Open(channelId);
  1793 	iUut->WaitForOpenL(KErrNone);
  1821 	iUut->WaitForOpenL(KErrNone);
  1794 	
  1822 	
  1795 	UnloadUut();
  1823 	UnloadUut();
  1796 	
  1824 	
  1798 		{
  1826 		{
  1799 		INFO_PRINTF1(_L("Failed to read Port Name Config. Test is Aborted."));
  1827 		INFO_PRINTF1(_L("Failed to read Port Name Config. Test is Aborted."));
  1800 		return EAbort;
  1828 		return EAbort;
  1801 		}
  1829 		}
  1802 		
  1830 		
  1803 	// Pass channelId in the form of portname (COMM::0) to the BCA	
  1831 	// Pass channelId in the form of portname (COMM::0) to the BCA
  1804 		
  1832 	//     OR
       
  1833 	//                                         (PKTLOOPBACK::501) 
       
  1834 
       
  1835 	// Scenario 2 - the CSY name is not specified in the descriptor argument passed to the Open()
       
  1836 	// In this case, the CSY name is retrieved from CommsDat, based on the IAP.
       
  1837 	// The client specifies the IAP by call SetProxyIapIdL();
       
  1838 	
  1805 	LoadUutL();
  1839 	LoadUutL();
  1806 	
  1840 
  1807 	SetProxyIapIdL(*iUut, iUutIapId);
  1841 	SetProxyIapIdL(*iUut, iUutIapId);
  1808 	
  1842 	
  1809 	iUut->Open(channelId);
  1843 	iUut->Open(channelId);
  1810 	iUut->WaitForOpenL(KErrNone);
  1844 	iUut->WaitForOpenL(KErrNone);
  1811 	
  1845