Thank you Dirk.
Still being stuck in the days of drvascii/drvserial we just went to
reading devices that returned a few values by format, like skip until
you get to here, read that, and skip the rest. That may work with asyn
as well if you're not expecting too many values or at too fast a rate.
For us it was/is mostly the weather station.
I'm glad things have moved forward from that even if I am unlikely to
get to that here.
Aloha,
Maren
On Tue, Apr 16, 2024 at 7:26 PM Zimoch Dirk via Tech-talk
<tech-talk at aps.anl.gov> wrote:
>
> 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
> >
- References:
- streamdevice and input strings Pierrick M Hanlet via Tech-talk
- Re: streamdevice and input strings Zimoch Dirk via Tech-talk
- Navigate by Date:
- Prev:
Re: streamdevice and input strings Zimoch Dirk via Tech-talk
- Next:
Re: streamdevice and input strings Pierrick M Hanlet 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>
2025
- Navigate by Thread:
- Prev:
Re: streamdevice and input strings Zimoch Dirk via Tech-talk
- Next:
Re: streamdevice and input strings Pierrick M Hanlet 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>
2025
|