serialserver/packetloopbackcsy/src/loopback.cpp
branchRCL_3
changeset 21 07656293a99c
parent 4 928ed51ddc43
equal deleted inserted replaced
19:35c06c1d4fa6 21:07656293a99c
   487  */
   487  */
   488 	{
   488 	{
   489 	LOGTEXT2(_L8("PKTLOOPBACK:BreakCancel is not supported:  Unit %d..."), iPortName);
   489 	LOGTEXT2(_L8("PKTLOOPBACK:BreakCancel is not supported:  Unit %d..."), iPortName);
   490 	}
   490 	}
   491 
   491 
   492 TInt CHWPort::GetConfig(TDes8& /*aDes*/) const
   492 TInt CHWPort::GetConfig(TDes8& aDes) const
   493 /**
   493 /**
   494  * This gets the current configuration from the loopback driver.
   494  * This gets the current configuration from the loopback driver.
   495  * 
   495  * 
   496  * @return KErrNotSupported
   496  * @return KErrNone if the size of the output descriptor is valid
   497  */
   497  */
   498 	{
   498 	{
   499 	LOGTEXT2(_L8("PKTLOOPBACK:GetConfig is not supported:  Unit %d..."), iPortName);
   499 	LOGTEXT2(_L8("PKTLOOPBACK:GetConfig: Unit %d..."), iPortName);
   500 
   500 
       
   501 	TInt length = aDes.Length();
       
   502 	__ASSERT_DEBUG( ((length==sizeof(TCommConfigV01)) ||
       
   503 	                 (length==sizeof(TCommConfigV02)) ),
       
   504 	                 User::Panic(KPortLoopBackCsyPanic, EPLBArgument));
       
   505 
       
   506 	if (length == sizeof(TCommConfigV01))
       
   507 	    {
       
   508             aDes.Copy(iConfig);
       
   509             return KErrNone;
       
   510 	    }
       
   511         
   501 	return KErrNotSupported;
   512 	return KErrNotSupported;
   502 	}
   513 	}
   503 
   514 
   504 TInt CHWPort::SetConfig(const TDesC8& aDes)
   515 TInt CHWPort::SetConfig(const TDesC8& aDes)
   505 /**
   516 /**
   506  * This sets the current configuration for the loopback driver.  Note that
   517  * This sets the current configuration for the loopback driver.  Note that
   507  * no error checking is done when setting the configuration.
   518  * no error checking is done when setting the configuration.
   508  *
   519  *
   509  * @return KErrNotSupported
   520  * @return KErrNone if the size of the output descriptor is valid
   510  */
   521  */
   511 	{
   522 	{
   512 	LOGTEXT2(_L8("PKTLOOPBACK:SetConfig is not supported:  Unit %d..."), iPortName);
   523     
   513 	
   524 	LOGTEXT2(_L8("PKTLOOPBACK:SetConfig:  Unit %d..."), iPortName);
   514 	iConfig.Copy(aDes);
   525 
       
   526 	TInt length = aDes.Length();
       
   527 	
       
   528 	__ASSERT_DEBUG( ((length==sizeof(TCommConfigV01)) ||
       
   529 	                  (length==sizeof(TCommConfigV02))),
       
   530 	                  User::Panic(KPortLoopBackCsyPanic, EPLBArgument));
       
   531 
       
   532 	if (length==sizeof(TCommConfigV01))
       
   533 	    {
       
   534             iConfig.Copy(aDes);
       
   535 	    }
       
   536 	else if (length==sizeof(TCommConfigV02))
       
   537 	    {
       
   538             TBuf8<sizeof(TCommConfigV02)> buff(aDes);
       
   539             buff.SetLength(sizeof(TCommConfigV01));        
       
   540             iConfig.Copy(buff);	
       
   541 	    }
   515 
   542 
   516 	return KErrNone;
   543 	return KErrNone;
   517 	}
   544 	}
   518 
   545 
   519 TInt CHWPort::GetCaps(TDes8& aDes)
   546 TInt CHWPort::GetCaps(TDes8& aDes)