mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julien Vermillard <jvermill...@archean.fr>
Subject Re: Mina serial communication - filter not used?
Date Wed, 06 Feb 2008 17:15:26 GMT
On Wed, 6 Feb 2008 17:36:57 +0100
Julien Vermillard <jvermillard@archean.fr> wrote:

> On Wed, 6 Feb 2008 06:56:06 -0800 (PST)
> Konrad Bösche <bika200x@web.de> wrote:
> 
> > 
> > 
> > Hello,
> > 
> > I'm developing a connection tool that supports UDP and serial(RS232)
> > connections. 
> > There's an IConnector instance that can be either a
> > NioDatagramConnector or a SerialConnector. In both cases I'm adding
> > a ProtocolCodecFilter. The corresponding encoder/decoder instances
> > are working fine (tested with NioDatagramConnector), but when
> > writing/receiving a message over a serial session, it seems as the
> > encoder/decoder is not used. The encode() or doDecode() method is
> > never called. Even the getEncoder() and getDecoder() methods from
> > ProtocolCodecFactory are not called. Is it possible that there’s a
> > bug in SerialSessionImpl that prevents the usage of my filter?
> > Here’s the code for my SerialConnector initialization:
> > 
> > connector = new SerialConnector();            
> > address = new SerialAddress("COM1", 115200, DataBits.DATABITS_8,
> > StopBits.BITS_1, Parity.NONE, FlowControl.NONE);
> > connector.getSessionConfig().setReadBufferSize(120000);                        
> > connector.getFilterChain().addLast( "protocol-codec", new
> > ProtocolCodecFilter(new CommProtocolCodecFactory()) );
> > connector.setHandler(new InternalIoHandler());
> > ConnectFuture cf = connector.connect(address);
> > try {
> > cf.await();
> > session = cf.getSession();
> > } catch (Exception e) {
> > e.printStackTrace();
> > }   
> > WriteFuture wf = session.write(object);
> > 
> > I'm using Mina core and serial bundle from the ASF Maven 2 snapshot
> > repository (mina-core-2.0.0-M1-20080117.051022-115.jar and
> > mina-transport-serial-2.0.0-M1-20080124.103130-71.jar)
> > 
> > I would be grateful for any answers.
> > 
> > Kind regards from Berlin,
> > Konrad
> > 
> 
> Hi Konrad,
> 
> It's sounding pretty weird, I'm sure to have tested it against a codec
> filter. I'm going to check that.
> 
> Julien

Yes there is a bug,
The filterchain from the SerialConnector is not copied, you could use
the IoHandler.sessionCreated(..) for adding your codec filter in the
session filterchain. 
I'll try to fix that ASAP.

Julien

Mime
View raw message