add ca exception handler
This commit is contained in:
@@ -52,6 +52,19 @@ typedef struct {
|
||||
chid chid;
|
||||
} CAPVT;
|
||||
|
||||
static void exceptionCallback(struct exception_handler_args args)
|
||||
{
|
||||
chid chid = args.chid;
|
||||
long stat = args.stat; /* Channel access status code*/
|
||||
const char *channel;
|
||||
static char *noname = "unknown";
|
||||
|
||||
channel = (chid ? ca_name(chid) : noname);
|
||||
|
||||
errlogPrintf("asCa:exceptionCallback stat %s channel %s\n",
|
||||
ca_message(stat),channel);
|
||||
}
|
||||
|
||||
/*connectCallback only handles disconnects*/
|
||||
LOCAL void connectCallback(struct connection_handler_args arg)
|
||||
{
|
||||
@@ -135,6 +148,8 @@ LOCAL void asCaTask(void)
|
||||
|
||||
taskwdInsert(taskIdSelf(),NULL,NULL);
|
||||
SEVCHK(ca_task_initialize(),"ca_task_initialize");
|
||||
SEVCHK(ca_add_exception_event(exceptionCallback,NULL),
|
||||
"ca_add_exception_event");
|
||||
while(TRUE) {
|
||||
if(semTake(asCaTaskAddChannels,WAIT_FOREVER)!=OK) {
|
||||
epicsPrintf("asCa semTake error for asCaTaskClearChannels\n");
|
||||
|
||||
@@ -432,6 +432,20 @@ int dbCaGetLinkDBFtype(struct link *plink)
|
||||
}
|
||||
|
||||
|
||||
static void exceptionCallback(struct exception_handler_args args)
|
||||
{
|
||||
chid chid = args.chid;
|
||||
long stat = args.stat; /* Channel access status code*/
|
||||
const char *channel;
|
||||
static char *noname = "unknown";
|
||||
|
||||
channel = (chid ? ca_name(chid) : noname);
|
||||
|
||||
errlogPrintf("dbCa:exceptionCallback stat %s channel %s\n",
|
||||
ca_message(stat),channel);
|
||||
}
|
||||
|
||||
|
||||
static void eventCallback(struct event_handler_args arg)
|
||||
{
|
||||
caLink *pca = (caLink *)arg.usr;
|
||||
@@ -635,6 +649,8 @@ void dbCaTask()
|
||||
int status;
|
||||
|
||||
SEVCHK(ca_task_initialize(),NULL);
|
||||
SEVCHK(ca_add_exception_event(exceptionCallback,NULL),
|
||||
"ca_add_exception_event");
|
||||
/*Dont do anything until iocInit initializes database*/
|
||||
while(!interruptAccept) taskDelay(10);
|
||||
/* channel access event loop */
|
||||
|
||||
Reference in New Issue
Block a user