mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yigal Rachman <yi...@uvic.ca>
Subject Re: How to deal with dynamically changing line terminators?
Date Mon, 13 Aug 2007 17:48:33 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<body bgcolor="#ffffff" text="#000000">
Hi, Adam:<br>
I actually have to code drivers for several different instruments, all
with the same basic challenges, so I agree that the state machine
solution is the better way to go.&nbsp; This is particularly so because the
message terminators are themselves stateful, so are not easily handled
simply by tweaking the TextLineDecoder.<br>
Again, thank you for your very helpful suggestions.<br>
- Yigal<br>
Adam Fisk wrote:
  <pre wrap="">There's likely an easier way, though, to, like taking the TextLineCodec
and just tweaking it to also look for "&gt;".  My last suggestion is an elegant
way to do it, but it would require much more work.


On 8/12/07, Adam Fisk <a class="moz-txt-link-rfc2396E" href="mailto:a@lastbamboo.org">&lt;a@lastbamboo.org&gt;</a>
  <blockquote type="cite">
    <pre wrap="">I'd give the state machine in AsyncWeb a look, as well as some of the
helper classes.  The state machine approach takes awhile to wrap your head
around if you're not used to it, but it works well.  The
"ConsumeToDynamicTerminatorDecodingState" helper class will do exactly what
you want.  You would need to write a fair bit of custom state machine code
for your protocol going this route, but I think it's worth it.

<a class="moz-txt-link-freetext" href="http://docs.safehaus.org/display/ASYNCWEB/Home">http://docs.safehaus.org/display/ASYNCWEB/Home</a>


On 8/9/07, Yigal Rachman <a class="moz-txt-link-rfc2396E" href="mailto:yigal@uvic.ca">&lt;yigal@uvic.ca&gt;</a>
    <blockquote type="cite">
      <pre wrap="">Hi, Folks:

I have a MINA client that acts as a driver for a scientific instrument.
The communication is via a serial link using ASCII.  The messages from
the instrument are usually terminated with a line feed, but are
sometimes terminated with a "&gt;" instead (when it is prompting for

Could you please suggest a design pattern that would do this elegantly
in MINA?  I expect it will use the TextLineCodec and possibly some other
filters, but I am fuzzy on the details.

Best regards,
Yigal Rachman

DMAS Data Acquisition Developer
University of Victoria,
Victoria, BC, Canada
<a class="moz-txt-link-abbreviated" href="http://www.neptunecanada.ca">www.neptunecanada.ca</a>

    <pre wrap="">
  <pre wrap=""><!---->

View raw message