serialserver/packetloopbackcsy/src/loopback.cpp
branchRCL_3
changeset 21 07656293a99c
parent 4 928ed51ddc43
--- a/serialserver/packetloopbackcsy/src/loopback.cpp	Wed Jun 09 11:00:38 2010 +0300
+++ b/serialserver/packetloopbackcsy/src/loopback.cpp	Mon Jun 21 17:02:22 2010 +0300
@@ -489,15 +489,26 @@
 	LOGTEXT2(_L8("PKTLOOPBACK:BreakCancel is not supported:  Unit %d..."), iPortName);
 	}
 
-TInt CHWPort::GetConfig(TDes8& /*aDes*/) const
+TInt CHWPort::GetConfig(TDes8& aDes) const
 /**
  * This gets the current configuration from the loopback driver.
  * 
- * @return KErrNotSupported
+ * @return KErrNone if the size of the output descriptor is valid
  */
 	{
-	LOGTEXT2(_L8("PKTLOOPBACK:GetConfig is not supported:  Unit %d..."), iPortName);
+	LOGTEXT2(_L8("PKTLOOPBACK:GetConfig: Unit %d..."), iPortName);
+
+	TInt length = aDes.Length();
+	__ASSERT_DEBUG( ((length==sizeof(TCommConfigV01)) ||
+	                 (length==sizeof(TCommConfigV02)) ),
+	                 User::Panic(KPortLoopBackCsyPanic, EPLBArgument));
 
+	if (length == sizeof(TCommConfigV01))
+	    {
+            aDes.Copy(iConfig);
+            return KErrNone;
+	    }
+        
 	return KErrNotSupported;
 	}
 
@@ -506,12 +517,28 @@
  * This sets the current configuration for the loopback driver.  Note that
  * no error checking is done when setting the configuration.
  *
- * @return KErrNotSupported
+ * @return KErrNone if the size of the output descriptor is valid
  */
 	{
-	LOGTEXT2(_L8("PKTLOOPBACK:SetConfig is not supported:  Unit %d..."), iPortName);
+    
+	LOGTEXT2(_L8("PKTLOOPBACK:SetConfig:  Unit %d..."), iPortName);
+
+	TInt length = aDes.Length();
 	
-	iConfig.Copy(aDes);
+	__ASSERT_DEBUG( ((length==sizeof(TCommConfigV01)) ||
+	                  (length==sizeof(TCommConfigV02))),
+	                  User::Panic(KPortLoopBackCsyPanic, EPLBArgument));
+
+	if (length==sizeof(TCommConfigV01))
+	    {
+            iConfig.Copy(aDes);
+	    }
+	else if (length==sizeof(TCommConfigV02))
+	    {
+            TBuf8<sizeof(TCommConfigV02)> buff(aDes);
+            buff.SetLength(sizeof(TCommConfigV01));        
+            iConfig.Copy(buff);	
+	    }
 
 	return KErrNone;
 	}