I am messing around with some ideas, and I am trying to get notified of alarm states changing on PV’s without link fields or user events – basically without putting any requirements on PV’s or DB records.
I tried some code that intends to set a callback for the DBE_ALARM event, but I don’t seem to get called. The code looks like this:
void
my_event_func(void
*user_arg,
struct
dbChannel
*chan,
int
eventsRemaining,
struct
db_field_log
*pfl)
{
errlogPrintf("my_event_func\n");
}
int
main(int
argc,char
*argv[])
{
if(argc>=2)
{
iocsh(argv[1]);
epicsThreadSleep(.2);
}
auto
pctx =
db_init_events();
errlogPrintf("pctx
%p\n",
pctx);
auto
pchn =
dbChannelCreate("SOME_");
errlogPrintf("pchn
%p
%s\n",
pchn,
pchn ?
pchn->name
: "");
auto
psub =
db_add_event(pctx,
pchn,
my_event_func,
0, DBE_ALARM);
errlogPrintf("psub
%p\n",
psub);
db_event_enable(psub);
iocsh(NULL);
epicsExit(0);
return(0);
}
Does this seem feasible at all?