Revision: 201019
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 14 May 2010 17:04:36 +0300
changeset 27 cd9717388750
parent 25 e53adc4c49de
child 34 6646e488a904
Revision: 201019 Kit: 201019
serialserver/packetloopbackcsy/inc/Loopback.h
serialserver/packetloopbackcsy/src/loopback.cpp
--- a/serialserver/packetloopbackcsy/inc/Loopback.h	Mon May 03 13:39:24 2010 +0300
+++ b/serialserver/packetloopbackcsy/inc/Loopback.h	Fri May 14 17:04:36 2010 +0300
@@ -40,6 +40,15 @@
 
 _LIT(KSerialDescription, "Packet Loopback CSY");
 _LIT(KSerialName, "PKTLOOPBACK");
+_LIT(KPortLoopBackCsyPanic, "PortLoopBack.csy");
+
+enum TPortLoopBackCsyPanic
+    {       
+    /** Input / Output Argument Invalid */
+    EPLBArgument
+    };
+
+
 
 class CHWPort;
 
--- a/serialserver/packetloopbackcsy/src/loopback.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/serialserver/packetloopbackcsy/src/loopback.cpp	Fri May 14 17:04:36 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;
 	}