# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1273845876 -10800 # Node ID cd971738875056861be089a375596c507e9c2d67 # Parent e53adc4c49de71717623e94119d5da024696f165 Revision: 201019 Kit: 201019 diff -r e53adc4c49de -r cd9717388750 serialserver/packetloopbackcsy/inc/Loopback.h --- 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; diff -r e53adc4c49de -r cd9717388750 serialserver/packetloopbackcsy/src/loopback.cpp --- 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 buff(aDes); + buff.SetLength(sizeof(TCommConfigV01)); + iConfig.Copy(buff); + } return KErrNone; }