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  2023  <2024 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  2023  <2024
<== Date ==> <== Thread ==>

Subject: Re: streamdevice and input strings
From: Zimoch Dirk via Tech-talk <tech-talk at aps.anl.gov>
To: Pierrick M Hanlet <hanlet at fnal.gov>
Cc: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Wed, 17 Apr 2024 05:26:21 +0000
Hello Pierrick,

StreamDevice uses Separator only for array records (waveform, aai, aao). There, it reads alternating the format and the separator. But the format %s only stops at a space, not at your separator. Thus, the first %s gets the complete string and there is no separator left to read. Here, with redirections to multiple scalar records, the Separator is not used at all. Still the %s consumes as much as it can, that is everything.
What you need is %[^,] instead of %s (that reads strings up to comma) and explicit commas in between:
in  "%(\$1:G1Name)[^,],%(\$1:G2Name)[^,], %(\$1:G3Name)[^,],%(\$1:G4Name)[^,]";

Also, one of the formats (I suggest the last) can be without redirection if the corresponding G*Name record (G4 in this case) is the one which calls this protocol.

Best regards,
Dirk

> Am 17.04.2024 um 01:24 schrieb Pierrick M Hanlet via Tech-talk <tech-talk at aps.anl.gov>:
> 
> Hi all,
> I'm on a linux box with AL9.3, base 7.07, and StreamDevice 2.8.24.
> I have a string input, which the controller gives as: A1,A2,B1,B2.
> I want to read them individually as separate names, i.e. separate records.
> 
> My protocol is:
> get_names {
>     separator=",";
>     out "CID";
>     in  "%(\$1:G1Name)s%(\$1:G2Name)s%(\$1:G3Name)s%(\$1:G4Name)s";
> }
> 
> although, I've also tried as:
> get_names {
>     separator=",";
>     out "CID";
>     in "%(\$1:G1Name)s,%(\$1:G2Name)s,%(\$1:G3Name)s,%(\$1:G4Name)s";
> }
> 
> or as:
> get_names {
>     out "CID";
>     in "%(\$1:G1Name)s,%(\$1:G2Name)s,%(\$1:G3Name)s,%(\$1:G4Name)s";
> }
> 
> Of course, it works perfectly if I have:
> get_names {
>     out "CID";
>     in "%(\$1:G1Name)2c,%(\$1:G2Name)2c,%(\$1:G3Name)2c,%(\$1:G4Name)2c";
> }
> However, the name can be up to 8 characters long.
> 
> I don't understand why separator doesn't work as I'm using it.
> Thank you,
> Pierrick
> 
> 
> -- 
> Pierrick Hanlet
> Fermi National Accelerator
> Accelerator Front End Controls
> +1-630-840-5555 -- lab
> +1-312-687-4980 -- mobile
> 
> "Whether you think you can or think you can't, you're right" -- Henry Ford
> 

Replies:
Re: streamdevice and input strings Maren Purves via Tech-talk
Re: streamdevice and input strings Pierrick M Hanlet via Tech-talk
References:
streamdevice and input strings Pierrick M Hanlet via Tech-talk

Navigate by Date:
Prev: streamdevice and input strings Pierrick M Hanlet via Tech-talk
Next: Re: streamdevice and input strings Maren Purves 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  2023  <2024
Navigate by Thread:
Prev: streamdevice and input strings Pierrick M Hanlet via Tech-talk
Next: Re: streamdevice and input strings Maren Purves 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  2023  <2024
ANJ, 17 Apr 2024 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·