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  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
<== Date ==> <== Thread ==>

Subject: Re: process multiple lines with streamdevice
From: Zimoch Dirk via Tech-talk <tech-talk at aps.anl.gov>
To: "gerrit.kuehn at aei.mpg.de" <gerrit.kuehn at aei.mpg.de>
Cc: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Fri, 13 Oct 2023 13:29:17 +0000
Two things to keep in mind:
1. Once %/regex/ has skipped something, there is no way back. Thus if you have
multiple of those in one protocol, the order must stay fixed.
2. Any unread line after the one used will cause an error unless you set
ExtraInput=ignore in this protocol. (Normally I discourage people to use that.)

Dirk


On Fri, 2023-10-13 at 15:10 +0200, Gerrit Kühn wrote:
> Am Fri, 13 Oct 2023 12:53:43 +0000
> schrieb Zimoch Dirk <dirk.zimoch at psi.ch>:
> 
> Hello Dirk,
> 
> > If you do not set your InTerminator to the normal line terminator for
> > this protocol (i.e. inside the { } ), then the 'in' command will read
> > all the lines (terminated by readTimeout).
> 
> Great suggestion, I'll try that.
> 
> > If there is a "special"
> > terminator after reply (e.g. 2 newlines) even better: Set InTerminator
> > accordingly.
> 
> Unfortunately not, I will have to wait for the timeout. But that would be
> ok, this is supposed to be done only once during IOC initilisation.
> 
> > in "%/unique identifier[^\n]*/";
> > in "%.1/unique identifier/([\n]*)";
> > in "%*/unique identifier/%f)";
> > in "%*/unique identifier/%(\$1:rec1)f,%(\$1:rec1)f,%f";
> 
> I will have to parse tag=value stuff further down the road (see below), so
> what I have come up with so far looks like this (searching for a given uid
> and parsing for the identifier afterwards):
> 
> in "%.1/uid=\$1.*?device-identifier=([-a-z0-9]+)/";
> 
> > Give example data for more details (so that I do not have to guess).
> 
> The answers for a full bus look like this (Tinkerforge stuff via a text
> proxy, extra newlines between the blocks added manually for posting):
> 
> ---
> uid=62C6Tx\tconnected-uid=0\tposition=0\thardware-version=3,1,0\tfirmware-version=2,5,2\tdevice-identifier=master-brick\tenumeration-type=available\n
> 
> uid=Tm6\tconnected-uid=62C6Tx\tposition=a\thardware-version=1,0,0\tfirmware-version=2,0,2\tdevice-identifier=industrial-digital-out-4-v2-bricklet\tenumeration-type=available\n
> 
> uid=YmR\tconnected-uid=62C6Tx\tposition=b\thardware-version=1,0,0\tfirmware-version=2,0,2\tdevice-identifier=isolator-bricklet\tenumeration-type=available\n
> 
> uid=XKM\tconnected-uid=62C6Tx\tposition=c\thardware-version=1,0,0\tfirmware-version=2,0,2\tdevice-identifier=industrial-digital-in-4-v2-bricklet\tenumeration-type=available\n
> 
> uid=Ymq\tconnected-uid=62C6Tx\tposition=d\thardware-version=1,0,0\tfirmware-version=2,0,2\tdevice-identifier=isolator-bricklet\tenumeration-type=available\n
> 
> uid=P7w\tconnected-uid=YmR\tposition=Z\thardware-version=1,0,0\tfirmware-version=2,0,1\tdevice-identifier=analog-out-v3-bricklet\tenumeration-type=available\n
> 
> uid=23Uu\tconnected-uid=Ymq\tposition=Z\thardware-version=1,0,0\tfirmware-version=2,0,7\tdevice-identifier=industrial-dual-analog-in-v2-bricklet\tenumeration-type=available\n
> ---
> 
> 
> 
> Thanks for the already very usefuls hints!
> 
> 
> cu
>   Gerrit

Replies:
Re: process multiple lines with streamdevice Gerrit Kühn via Tech-talk
References:
process multiple lines with streamdevice Gerrit Kühn via Tech-talk
Re: process multiple lines with streamdevice Zimoch Dirk via Tech-talk
Re: process multiple lines with streamdevice Gerrit Kühn via Tech-talk

Navigate by Date:
Prev: Re: process multiple lines with streamdevice Gerrit Kühn via Tech-talk
Next: Re: process multiple lines with streamdevice Gerrit Kühn via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
Navigate by Thread:
Prev: Re: process multiple lines with streamdevice Gerrit Kühn via Tech-talk
Next: Re: process multiple lines with streamdevice Gerrit Kühn via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
ANJ, 13 Oct 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·