[Enhancement] Support optional alarm message in Record.setSevr() - #48
Conversation
|
Hi @aqshafei , this looks good to me. The python tests for 3.15.9 are failing. I think we could skip if _dbapi.EPICS_VERSION >= 7:
self.assertEqual(rec.NAMSG, "Meaningful alarm message") |
|
Hi @tynanford, @aqshafei, This seems to be a duplication of work that is already included in my pull request 33 'win32_merge' (and should be separate from it). |
|
Hi @pheest , Thanks for pointing that out. Your addition also has an update for ptable so it can set stat/amsg as well. I think that is worth adding to this PR: https://github.com/epics-modules/pyDevSup/pull/33/changes#diff-2c53d4e276a2b54b70ce9f2aaf0d4e7469847367228710d03146dc041da78111 . One thing on the default values in ptable.py. self.stat = COMM_ALARM
self.amsg = NoneAlso @aqshafei I am thinking we should use |
|
The field is named 'amsg' in EPICS base.
I take note of your point about the defaults, but I would have to revisit to verify. |
|
@tynanford I could change it to @pheest the |
|
Hi @aqshafei, It is OK to pass NULL as the msg parameter to the recGblSetSevrMsg function, it is just treated as being synonymous with the empty string. There is however a need to call the recGblSetSevr (rather than recGblSetSevrMsg) function if the base version is < 7.0.6 because the latter function was not implemented until that version. This is dependant on a compile-time constant. |
|
I believe there are 3 use-cases for accessing the error number and string:
|
zhangt58
left a comment
There was a problem hiding this comment.
That's a good enhancement, please also update the documentaton about setSevr() with the new message parameter support, at PyMethodDef.
|
Hi @tynanford,
This is the default value of the function call if the parameter is not provided - which it was not, so the STAT field was always (and in my view inappropriately) set to COMM_ALARM. I believe the value should default to the expected value of the field after IOC start-up.
|
|
I vote for @pheest thanks, how about you or I make a separate PR for your ptable amsg/stat enhancements and make that separate from this PR. I agree with you on the |
|
I'd vote for |
|
|
I have change the parameter |
|
I agree. This should work just fine. |
Summary
add an optional parameter called
messagetoRecord.setSevr()while preserving all existing functionalityExisting calls without a message continue to behave as before.
Details
messageargument toRecord.setSevr().recGblSetSevrMsg()when EPICS Base provides alarm message support.recGblSetSevr()path on older EPICS Base versions.message=Nonethe same as omitting the message.