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  <2025 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
<== Date ==> <== Thread ==>

Subject: Re: StreamDevice and AMSG field
From: Michael Davidsaver via Tech-talk <tech-talk at aps.anl.gov>
To: Zimoch Dirk <dirk.zimoch at psi.ch>, "Neidherr, Dennis Dr." <D.Neidherr at gsi.de>
Cc: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Tue, 20 May 2025 10:36:05 -0700
On 5/20/25 01:00, Zimoch Dirk via Tech-talk wrote:
Hi Dennis

Yes, that field is new and not yet supported by StreamDevice.
The idea of that field is to store clear text error messages together with the alarm status/severity for easier debugging. StreamDevice could use it to store messages like "Parse Error", "Connection lost", "Reply timeout" etc.
The field is not modifiable by dbPutField and thus neither by caput nor by redirection from a StreamDevice protocol.
As storing something into AMSG uses a totally different method, it would be difficult to make it writable by redirections.

AMSG is intended to provide context for STAT and SEVR, about the active record alarm.

As device support should not write directly to STAT and SEVR, neither should it write AMSG.

The interface for writing to all three fields is the "recGblSetSevrMsg()" function,
which is an extension of "recGblSetSevr()".  These functions implement the Maximize
Severity algorithm to ensure that all three fields are consistent.

DBCORE_API int recGblSetSevrMsg(void *precord, epicsEnum16 new_stat,
                                epicsEnum16 new_sevr,
                                EPICS_PRINTF_FMT(const char *msg), ...) EPICS_PRINTF_STYLE(4,5);

So Stream could be updated to call recGblSetSevrMsg() here:

$ git grep recGblSetSevr
src/StreamEpics.cc:        (void) recGblSetSevr(record, UDF_ALARM, INVALID_ALARM);
src/StreamEpics.cc:            (void) recGblSetSevr(record, status, INVALID_ALARM);
src/StreamEpics.cc:        (void) recGblSetSevr(record, UDF_ALARM, INVALID_ALARM);
src/StreamEpics.cc:        (void) recGblSetSevr(record, status ? status : UDF_ALARM, INVALID_ALARM);
src/StreamEpics.cc:                (void) recGblSetSevr(pdbaddr->precord,
src/devmbboStream.c:        recGblSetSevr(record, STATE_ALARM, mbbo->unsv);
src/devmbboStream.c:        recGblSetSevr(record, STATE_ALARM, (&(mbbo->zrsv))[mbbo->val]);
src/devmbboStream.c:        if (!recGblSetSevr(record, COS_ALARM, mbbo->cosv)) mbbo->lalm = mbbo->val;

There is a feature test macro also defined in recGbl.h

/** Feature test macro for alarm message (AMSG) field and support
 *
 * Covers addition of dbCommon::amsg, recGblSetSevrMsg(), lset::getAlarmMsg()
 *
 * @since 7.0.6
 */
#define HAS_ALARM_MESSAGE 1




Dirk

-----Original Message-----
From: Tech-talk <tech-talk-bounces at aps.anl.gov> On Behalf Of Neidherr, Dennis
Dr. via Tech-talk
Sent: Dienstag, 20. Mai 2025 08:57
To: tech-talk at aps.anl.gov
Subject: StreamDevice and AMSG field

Dear all,

and again a small question:
According to the documentation there is a (new?) field called AMSG to store
alarm (or error) messages. Is this somehow also useable with StreamDevice?
Because this field is marked as "non-writable", I can not simply redirect errors
into it like I tried here:

setAmplitude0 {
     out ":SOUR1:VOLT %f;:SYST:ERR?";
	in "+%(myAgilent:ErrorCode)i,\"No error\"";
	# @mismatch { in
"%(myAgilent:ErrorCode)i,\"%(myAgilent:ErrorMsg)#s\"" }
	@mismatch { in "%(myAgilent:ErrorCode)i,\"%(AMSG)#s\"" }
	@writetimeout { disconnect; }
	@readtimeout { disconnect; }
	@replyTimeout { disconnect; }
}

I can certainly use another record to store errors but with the AMSG-field this
would be a more elegant way. So, is there some workaround or have I maybe
missed something?

Thanks and
Greetings Dennis


References:
StreamDevice and AMSG field Neidherr, Dennis Dr. via Tech-talk
RE: StreamDevice and AMSG field Zimoch Dirk via Tech-talk

Navigate by Date:
Prev: RE: StreamDevice and AMSG field Neidherr, Dennis Dr. via Tech-talk
Next: Suggestions wanted on IOC hardware James P. Withrow 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 AMSG field Neidherr, Dennis Dr. via Tech-talk
Next: Suggestions wanted on IOC hardware James P. Withrow 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
ANJ, 21 May 2025 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions ·
· Download · Search · IRMIS · Talk · Documents · Links · Licensing ·