Hi Tim,
Quick search “%%” on
https://paulscherrerinstitute.github.io/StreamDevice/formats.html , “%%” or “\%” should have worked.
Nonetheless, give a try on this (basically use \? for enum value 2):
get_units { out "REMOTE; CHAN \$1; UNITS?"; in "%{cm|in|\?}"; }
Cheers,
Yong
From:
Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Reply-To: "Mooney, Tim M." <mooney at anl.gov>
Date: Thursday, April 8, 2021 at 11:52 AM
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Subject: StreamDevice mbbi format-converter problem
I have an mbbi record with streamDevice support, and the following protocol:
get_units { out "REMOTE; CHAN \$1; UNITS?"; in "%{cm|in|%%}"; }
Here is the record definition:
record(mbbi, "$(device):UNITS")
field(INP, "@cryomagLM510.proto get_units($(chan)) $(port)")
When the device response is "cm" or "in" it is handled correctly, but when the response is "%" the record value doesn't change, even though the asyn trace output shows that the character received
actually was "%"
2021/04/08 10:03:28.517 164.54.115.98:4266 write 23
2021/04/08 10:03:28.617 164.54.115.98:4266 read 3
(Three characters are received because the input terminator is "interminator = CR LF;")
Originally, I had the protocol wrong because I didn't realize the "%" would be treated as a format converter:
get_units { out "REMOTE; CHAN \$1; UNITS?"; in "%{cm|in|%}"; }
But then I tried changing the protocol file to this:
get_units { out "REMOTE; CHAN \$1; UNITS?"; in "%{cm|in|\%}"; }
followed by streamReload(), which didn't work, and finally to this:
get_units { out "REMOTE; CHAN \$1; UNITS?"; in "%{cm|in|%%}"; }
followed by streamReload(), which also didn't work.
I'm using StreamDevice-2-8-9. I can't figure out what I'm doing wrong.
Tim Mooney (mooney at anl.gov) (630)252-5417
Beamline Controls Group (www.aps.anl.gov)
Advanced Photon Source, Argonne National Lab