usbmgmt/usbmgrtest/t_termusb2/src/t_termusb2.cpp
branchRCL_3
changeset 16 012cc2ee6408
parent 15 f92a4f87e424
equal deleted inserted replaced
15:f92a4f87e424 16:012cc2ee6408
   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 "));
   206 	if (aConfig.iFifo==EFifoEnable)
   211 	if (aConfig.iFifo==EFifoEnable)
   207 		aBuf.Append(_L("Fifo "));
   212 		aBuf.Append(_L("Fifo "));
   208 	
   213 	
   209 	// Settings
   214 	// Settings
   210 	if (aSettings.iLocalEcho)
   215 	if (aSettings.iLocalEcho)
   214 	// rx mode
   219 	// rx mode
   215 	if ((aSettings.iRxMode&~ECapture)==ELoopBack)
   220 	if ((aSettings.iRxMode&~ECapture)==ELoopBack)
   216 		aBuf.Append(_L("LpBk"));
   221 		aBuf.Append(_L("LpBk"));
   217 	else if ((aSettings.iRxMode&~ECapture)==ECountChars)
   222 	else if ((aSettings.iRxMode&~ECapture)==ECountChars)
   218 		aBuf.Append(_L("CtCh"));
   223 		aBuf.Append(_L("CtCh"));
       
   224 	//else if (aSettings.iRxMode==ERxOff)
       
   225 		//{
       
   226 		//aBuf.Append(_L("NoRx"));
       
   227 		//}
   219 	aBuf.Append(_L(" "));
   228 	aBuf.Append(_L(" "));
   220 	aBuf.AppendNum((TInt)(RThread().Priority()));
   229 	aBuf.AppendNum((TInt)(RThread().Priority()));
   221 	if (aSettings.iInfraRed==1)
   230 	if (aSettings.iInfraRed==1)
   222 		aBuf.Append(_L("IR1"));
   231 		aBuf.Append(_L("IR1"));
   223 	else if (aSettings.iInfraRed==2)
   232 	else if (aSettings.iInfraRed==2)
   344 		aWait=EFalse;
   353 		aWait=EFalse;
   345 	else if (aDes.FindF(_L("1"))>=0)
   354 	else if (aDes.FindF(_L("1"))>=0)
   346 		aWait=ETrue;
   355 		aWait=ETrue;
   347 	}
   356 	}
   348 
   357 
       
   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 */
   349 LOCAL_C void GetFifo(TUint& aFifo, const TDesC &aDes)
   375 LOCAL_C void GetFifo(TUint& aFifo, const TDesC &aDes)
   350 	{
   376 	{
   351 
   377 
   352 	if (aDes==_L(""))
   378 	if (aDes==_L(""))
   353 		{
   379 		{
   438 			break;
   464 			break;
   439 		TText a=(TText)k.Code();
   465 		TText a=(TText)k.Code();
   440 		TPtrC s(&a,1);
   466 		TPtrC s(&a,1);
   441 		dialog.Write(s);
   467 		dialog.Write(s);
   442 		aSettings.iDumpData.Append(k.Code());
   468 		aSettings.iDumpData.Append(k.Code());
       
   469 		//if (a=='\r')
       
   470 		//	dialog.Write(_L("\n"));
   443 		} while (aSettings.iDumpData.Length()<KMaxDumpLength);
   471 		} while (aSettings.iDumpData.Length()<KMaxDumpLength);
   444 
   472 
   445 	dialog.Destroy();
   473 	dialog.Destroy();
   446 	dialog.Close();
   474 	dialog.Close();
   447 	}
   475 	}
   496 			GetParity(aConfig.iParity, right);
   524 			GetParity(aConfig.iParity, right);
   497 		if (des[0]=='S')
   525 		if (des[0]=='S')
   498 			GetStopBit(aConfig.iStopBits, right);
   526 			GetStopBit(aConfig.iStopBits, right);
   499 		if (des[0]=='L')
   527 		if (des[0]=='L')
   500 			GetLength(aConfig.iDataBits, right);
   528 			GetLength(aConfig.iDataBits, right);
       
   529 //		if (des[0]=='K')
       
   530 //			GetBreak(aSettings.iBreak, right);
   501 		if (des[0]=='F')
   531 		if (des[0]=='F')
   502 			GetFifo(aConfig.iFifo, right);
   532 			GetFifo(aConfig.iFifo, right);
   503 		if (des[0]=='I')
   533 		if (des[0]=='I')
   504 			GetInfraRedMode(aSettings.iInfraRed, right);
   534 			GetInfraRedMode(aSettings.iInfraRed, right);
   505 		if (aSettings.iInfraRed==1)
   535 		if (aSettings.iInfraRed==1)
   620 
   650 
   621 	RDebug::Print(_L("E32Main: Initialised Window!"));
   651 	RDebug::Print(_L("E32Main: Initialised Window!"));
   622 
   652 
   623 	// Initialisation
   653 	// Initialisation
   624 
   654 
       
   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 */
   625 	// Load Device Drivers
   666 	// Load Device Drivers
   626 	TInt r;
   667 	TInt r;
   627 
   668 
   628 #if defined (VERBOSE)
   669 #if defined (VERBOSE)
   629 	TheWindow.Write(_L("Load LDD "));
   670 	TheWindow.Write(_L("Load LDD "));
   718 		}
   759 		}
   719 
   760 
   720 	RDebug::Print(_L("E32Main: Open USB Comm Port"));
   761 	RDebug::Print(_L("E32Main: Open USB Comm Port"));
   721 
   762 
   722 	TheCommPort.Config(TheConfigBuf);	// get config
   763 	TheCommPort.Config(TheConfigBuf);	// get config
   723 	TheConfig.iHandshake=0; 
   764 	TheConfig.iHandshake=0; //KConfigObeyXoff|KConfigSendXoff;
   724 	TheConfig.iTerminator[0] = 'Z';
   765 	TheConfig.iTerminator[0] = 'Z';
   725 	TheConfig.iTerminatorCount = 1;
   766 	TheConfig.iTerminatorCount = 1;
   726 	TheCommPort.SetConfig(TheConfigBuf);
   767 	TheCommPort.SetConfig(TheConfigBuf);
   727 	TheCommPort.SetReceiveBufferLength(8192);
   768 	TheCommPort.SetReceiveBufferLength(8192);
   728 
   769