On 9/29/22 7:49 AM, Jörn Dreyer via
Tech-talk wrote:
i guess I have a misunderstanding how to use the user callback functions
together with a subscription to a PV variable.
In my userfunc the value of arg.status is always 1 which evaluates to a
ca_message of "Normal successful completion". But the documentation say's to
check against ECA_NORMAL witch is 0.
What am I doing wrong here.
Actually the macro ECA_NORMAL
expands to the value 1, so arg.status == ECA_NORMAL will evaluate to true
in your userfunc as described above. The status macros defined in
caerr.h are somewhat confusing as they are actually a bitmask — the
bottom 3 bits are a severity code, and the severity code CA_K_SUCCESS has the
value 1. I suspect this may have been done to avoid using a status
value of 0 which could then be used to detect the absence of a
status value, although I doubt if anyone uses it like that now.
HTH,
- Andrew
--
Complexity comes for free, Simplicity you have to work for.