EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: streamdevice to find the last match
From: Dirk Zimoch <[email protected]>
To: "Zhang, Dehong" <[email protected]>
Cc: [email protected]
Date: Fri, 23 Aug 2013 16:11:25 +0200
Dehong,

I am not sure if the payload data is the first number or the P= number or both.

In any case with a %*/.*BOS*/ you should be able to find the last BOS in your input. After that start reading your data. If P= is your data it would look like this:

in "%*/.*BOS/*d,P=%dEOS\r\n";

BTW: ExtraInput = Ignore is almost always a bad idea. Use it only if absolutely necessary.

Dirk


On 23.08.2013 09:55, Dirk Zimoch wrote:
Hello Dehong,

Is your record "I/O Intr"? I assume so because your STATUS protocol does
not have any out command.

In that case and if you set InTerminator = CR LF, you should actually
get 2 messages and the record should be processed twice. Thus at the
end, your record will have the correct value.

Skipping intermediate results is tricky on the protocol level, because
how should StreamDevice know that no more input is about to come? What
if the gap between the messages is sometimes so big, that you actually
get 2 messages?

But In case you really always get a double message as below and want to
read the second value only you can skip the first one:

in "BOS%*d,P=%*dEOS\r\nBOS%d,P=%(otherrecord)dEOS\r\n"

In case you may have an arbitrary number of messages connected and
always want to skip all but the last, things become tricky. I have to
make up a PCRE. The idea is to do a greedy search for everything up to
"BOS" and then read the data. I will send you the PCRE later.

Dirk



On 22.08.2013 21:17, Zhang, Dehong wrote:
Hi Dirk and Friends,

(Sorry if you get this 2 times. I had a wrong address with my previous
send)

I run into 2 little problems: I wait for the hardware to send a
message like
"BOS123456,P=987654EOS\r\n".
Here BOS is my starting label and EOS the ending label.

Due to timing, which I cannot control, sometimes I would receive 2
messages
together, like:
"BOS123456,P=987654EOS\r\nBOS345,P=987649EOS\r\n".
Here the first one was sent when the state was still changing, the
second one
was sent when the state stablizes. But the time in between is so short
that the
2 messages just come out as one. How can I skip the first match, only
get the
second/last match?

My protocal is like:
InTerminator = CR;
OutTerminator = CR LF;
ReplyTimeout = 800;
ReadTimeout = 100;
WriteTimeout = 100;
ExtraInput = Ignore;

# Reports from the controller
STATUS { ReplyTimeout = 50; ReadTimeout = 10; InTerminator =; in
"%.1/BOS([0-9,P=]*EOS)/"; }

I tried to use the "$" anchor, but cannot get it to work -- maybe
because "$" is a special
character in streamdevice.

Related to this, sometimes the time in between is not so short that
the 2 messages
do come out separately, but the time in between is short enough so
that my stringin
record misses the second message. How can I avoid this? Tune the
ReplyTimeout,
ReadTimeout and InTerminator?

Thank you for your advice. Best regards,
Dehong





Replies:
Re: streamdevice to find the last match Dirk Zimoch
RE: streamdevice to find the last match Zhang, Dehong
References:
streamdevice to find the last match Zhang, Dehong
Re: streamdevice to find the last match Dirk Zimoch

Navigate by Date:
Prev: RE: Problems compiling Nexus library as DLL on Windows Mark Rivers
Next: Re: streamdevice to find the last match Dirk Zimoch
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: streamdevice to find the last match Wesley Moore
Next: Re: streamdevice to find the last match Dirk Zimoch
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·