static void createAndOpen(const char *name, dbChannel**pch) { testOk(!!(*pch = dbChannelCreate(name)), "dbChannel %s created", name); testOk(!(dbChannelOpen(*pch)), "dbChannel opened"); testOk((ellCount(&(*pch)->pre_chain) == 0), "no filters in pre chain"); testOk((ellCount(&(*pch)->post_chain) == 0), "no filters in post chain"); }
long dbtpn(char *pname, char *pvalue) { struct dbChannel *chan; tpnInfo *ptpnInfo; processNotify *ppn=NULL; chan = dbChannelCreate(pname); if (!chan) { printf("dbtpn: No such channel"); return -1; } ppn = dbCalloc(1, sizeof(processNotify)); ppn->requestType = pvalue ? putProcessRequest : processGetRequest; ppn->chan = chan; ppn->putCallback = putCallback; ppn->getCallback = getCallback; ppn->doneCallback = doneCallback; ptpnInfo = dbCalloc(1, sizeof(tpnInfo)); ptpnInfo->ppn = ppn; ptpnInfo->callbackDone = epicsEventCreate(epicsEventEmpty); strncpy(ptpnInfo->buffer, pvalue, 80); ptpnInfo->buffer[79] = 0; ppn->usrPvt = ptpnInfo; epicsThreadCreate("dbtpn", epicsThreadPriorityHigh, epicsThreadGetStackSize(epicsThreadStackMedium), tpnThread, ptpnInfo); return 0; }
static long add_record(dbCommon *pcommon) { aiRecord *prec = (aiRecord *)pcommon; DBLINK *plink = &prec->inp; dbChannel *chan; devPvt *pdevPvt; processNotify *ppn; if (plink->type == CONSTANT) return 0; if (plink->type != PV_LINK) { long status = S_db_badField; recGblRecordError(status, (void *)prec, "devAiSoftCallback (add_record) Illegal INP field"); return status; } chan = dbChannelCreate(plink->value.pv_link.pvname); if (!chan) { long status = S_db_notFound; recGblRecordError(status, (void *)prec, "devAiSoftCallback (add_record) link target not found"); return status; } pdevPvt = calloc(1, sizeof(*pdevPvt)); if (!pdevPvt) { long status = S_db_noMemory; recGblRecordError(status, (void *)prec, "devAiSoftCallback (add_record) out of memory, calloc() failed"); return status; } ppn = &pdevPvt->pn; plink->type = PN_LINK; plink->value.pv_link.precord = pcommon; plink->value.pv_link.pvlMask &= pvlOptMsMode; /* Severity flags only */ ppn->usrPvt = prec; ppn->chan = chan; ppn->getCallback = getCallback; ppn->doneCallback = doneCallback; ppn->requestType = processGetRequest; pdevPvt->options = GET_OPTIONS; prec->dpvt = pdevPvt; return 0; }
struct dbChannel * dbChannel_create(const char *pname) { dbChannel *chan = dbChannelCreate(pname); if (!chan) return NULL; if (INVALID_DB_REQ(dbChannelExportType(chan)) || dbChannelOpen(chan)) { dbChannelDelete(chan); return NULL; } return chan; }
static void createAndOpen(const char *chan, const char *json, const char *type, dbChannel**pch, short no) { ELLNODE *node; char name[80]; strncpy(name, chan, sizeof(name)-1); strncat(name, json, sizeof(name)-strlen(name)-1); testOk(!!(*pch = dbChannelCreate(name)), "dbChannel with plugin arr %s created", type); testOk((ellCount(&(*pch)->filters) == no), "channel has %d filter(s) in filter list", no); testOk(!(dbChannelOpen(*pch)), "dbChannel with plugin arr opened"); node = ellFirst(&(*pch)->pre_chain); (void) CONTAINER(node, chFilter, pre_node); testOk((ellCount(&(*pch)->pre_chain) == 0), "arr has no filter in pre chain"); node = ellFirst(&(*pch)->post_chain); (void) CONTAINER(node, chFilter, post_node); testOk((ellCount(&(*pch)->post_chain) == no), "arr has %d filter(s) in post chain", no); }