usbmgmt/usbmgrtest/t_termusb2/src/t_termusb2.cpp
branchRCL_3
changeset 15 f92a4f87e424
parent 0 c9bc50fca66e
child 16 012cc2ee6408
equal deleted inserted replaced
14:d3e8e7d462dd 15:f92a4f87e424
   201 		aBuf.Append(_L("CTS/RTS "));
   201 		aBuf.Append(_L("CTS/RTS "));
   202 	if (aConfig.iHandshake&KConfigObeyDSR)
   202 	if (aConfig.iHandshake&KConfigObeyDSR)
   203 		aBuf.Append(_L("DSR/DTR "));
   203 		aBuf.Append(_L("DSR/DTR "));
   204 	if (aConfig.iHandshake&KConfigWriteBufferedComplete)
   204 	if (aConfig.iHandshake&KConfigWriteBufferedComplete)
   205 		aBuf.Append(_L("Early "));
   205 		aBuf.Append(_L("Early "));
   206 	//|KConfigObeyDCD|KConfigFailDCD|))
       
   207 
       
   208 
       
   209 //	if (aConfig.iBreak==TEiger::EBreakOn)
       
   210 //		aBuf.Append(_L("Brk "));
       
   211 	if (aConfig.iFifo==EFifoEnable)
   206 	if (aConfig.iFifo==EFifoEnable)
   212 		aBuf.Append(_L("Fifo "));
   207 		aBuf.Append(_L("Fifo "));
   213 	
   208 	
   214 	// Settings
   209 	// Settings
   215 	if (aSettings.iLocalEcho)
   210 	if (aSettings.iLocalEcho)
   219 	// rx mode
   214 	// rx mode
   220 	if ((aSettings.iRxMode&~ECapture)==ELoopBack)
   215 	if ((aSettings.iRxMode&~ECapture)==ELoopBack)
   221 		aBuf.Append(_L("LpBk"));
   216 		aBuf.Append(_L("LpBk"));
   222 	else if ((aSettings.iRxMode&~ECapture)==ECountChars)
   217 	else if ((aSettings.iRxMode&~ECapture)==ECountChars)
   223 		aBuf.Append(_L("CtCh"));
   218 		aBuf.Append(_L("CtCh"));
   224 	//else if (aSettings.iRxMode==ERxOff)
       
   225 		//{
       
   226 		//aBuf.Append(_L("NoRx"));
       
   227 		//}
       
   228 	aBuf.Append(_L(" "));
   219 	aBuf.Append(_L(" "));
   229 	aBuf.AppendNum((TInt)(RThread().Priority()));
   220 	aBuf.AppendNum((TInt)(RThread().Priority()));
   230 	if (aSettings.iInfraRed==1)
   221 	if (aSettings.iInfraRed==1)
   231 		aBuf.Append(_L("IR1"));
   222 		aBuf.Append(_L("IR1"));
   232 	else if (aSettings.iInfraRed==2)
   223 	else if (aSettings.iInfraRed==2)
   353 		aWait=EFalse;
   344 		aWait=EFalse;
   354 	else if (aDes.FindF(_L("1"))>=0)
   345 	else if (aDes.FindF(_L("1"))>=0)
   355 		aWait=ETrue;
   346 		aWait=ETrue;
   356 	}
   347 	}
   357 
   348 
   358 /*LOCAL_C void GetBreak(const TDesC &aDes)
       
   359 	{
       
   360 
       
   361 	if (aDes==_L(""))
       
   362 		{
       
   363 		if (data.iBreak==TEiger::EBreakOn)
       
   364 			data.iBreak=TEiger::EBreakOff;
       
   365 		else
       
   366 			data.iBreak=TEiger::EBreakOn;
       
   367 		}
       
   368 	if (aDes.FindF(_L("N"))>=0)
       
   369 		data.iBreak=TEiger::EBreakOn;
       
   370 	if (aDes.FindF(_L("F"))>=0)
       
   371 		data.iBreak=TEiger::EBreakOff;
       
   372 	SetConfig();
       
   373 	}
       
   374 */
       
   375 LOCAL_C void GetFifo(TUint& aFifo, const TDesC &aDes)
   349 LOCAL_C void GetFifo(TUint& aFifo, const TDesC &aDes)
   376 	{
   350 	{
   377 
   351 
   378 	if (aDes==_L(""))
   352 	if (aDes==_L(""))
   379 		{
   353 		{
   464 			break;
   438 			break;
   465 		TText a=(TText)k.Code();
   439 		TText a=(TText)k.Code();
   466 		TPtrC s(&a,1);
   440 		TPtrC s(&a,1);
   467 		dialog.Write(s);
   441 		dialog.Write(s);
   468 		aSettings.iDumpData.Append(k.Code());
   442 		aSettings.iDumpData.Append(k.Code());
   469 		//if (a=='\r')
       
   470 		//	dialog.Write(_L("\n"));
       
   471 		} while (aSettings.iDumpData.Length()<KMaxDumpLength);
   443 		} while (aSettings.iDumpData.Length()<KMaxDumpLength);
   472 
   444 
   473 	dialog.Destroy();
   445 	dialog.Destroy();
   474 	dialog.Close();
   446 	dialog.Close();
   475 	}
   447 	}
   524 			GetParity(aConfig.iParity, right);
   496 			GetParity(aConfig.iParity, right);
   525 		if (des[0]=='S')
   497 		if (des[0]=='S')
   526 			GetStopBit(aConfig.iStopBits, right);
   498 			GetStopBit(aConfig.iStopBits, right);
   527 		if (des[0]=='L')
   499 		if (des[0]=='L')
   528 			GetLength(aConfig.iDataBits, right);
   500 			GetLength(aConfig.iDataBits, right);
   529 //		if (des[0]=='K')
       
   530 //			GetBreak(aSettings.iBreak, right);
       
   531 		if (des[0]=='F')
   501 		if (des[0]=='F')
   532 			GetFifo(aConfig.iFifo, right);
   502 			GetFifo(aConfig.iFifo, right);
   533 		if (des[0]=='I')
   503 		if (des[0]=='I')
   534 			GetInfraRedMode(aSettings.iInfraRed, right);
   504 			GetInfraRedMode(aSettings.iInfraRed, right);
   535 		if (aSettings.iInfraRed==1)
   505 		if (aSettings.iInfraRed==1)
   650 
   620 
   651 	RDebug::Print(_L("E32Main: Initialised Window!"));
   621 	RDebug::Print(_L("E32Main: Initialised Window!"));
   652 
   622 
   653 	// Initialisation
   623 	// Initialisation
   654 
   624 
   655 /*	
       
   656 	// I don't belive this section of code is being used anymore and
       
   657 	// has been replaced with PORT_NAME.
       
   658 	// I'm not sure so I've left it here ...
       
   659 	
       
   660 	TBuf <0x100> cmd;
       
   661 	User::CommandLine(cmd);
       
   662 	TInt port=0;
       
   663 	if ((cmd.Length()>0) && (cmd[0]>='1' && cmd[0]<='4'))
       
   664 		port=(TInt)(cmd[0]-'0');
       
   665 */
       
   666 	// Load Device Drivers
   625 	// Load Device Drivers
   667 	TInt r;
   626 	TInt r;
   668 
   627 
   669 #if defined (VERBOSE)
   628 #if defined (VERBOSE)
   670 	TheWindow.Write(_L("Load LDD "));
   629 	TheWindow.Write(_L("Load LDD "));
   759 		}
   718 		}
   760 
   719 
   761 	RDebug::Print(_L("E32Main: Open USB Comm Port"));
   720 	RDebug::Print(_L("E32Main: Open USB Comm Port"));
   762 
   721 
   763 	TheCommPort.Config(TheConfigBuf);	// get config
   722 	TheCommPort.Config(TheConfigBuf);	// get config
   764 	TheConfig.iHandshake=0; //KConfigObeyXoff|KConfigSendXoff;
   723 	TheConfig.iHandshake=0; 
   765 	TheConfig.iTerminator[0] = 'Z';
   724 	TheConfig.iTerminator[0] = 'Z';
   766 	TheConfig.iTerminatorCount = 1;
   725 	TheConfig.iTerminatorCount = 1;
   767 	TheCommPort.SetConfig(TheConfigBuf);
   726 	TheCommPort.SetConfig(TheConfigBuf);
   768 	TheCommPort.SetReceiveBufferLength(8192);
   727 	TheCommPort.SetReceiveBufferLength(8192);
   769 
   728