Add test of jlinkz::putValue() to dbPutLinkTest

Add OUTP link field to xRecord
xRecord::process() puts VAL to the OUTP link
jlinkz writes the output value to the record's own PHAS field
Correct the dbFastPutConvertRoutine lookup
Test sets OUTP link, processes record and confirms that PHAS was set
This commit is contained in:
Andrew Johnson
2024-07-10 23:06:53 -05:00
parent 916b17ef3f
commit 31b22fd253
4 changed files with 11 additions and 2 deletions

View File

@ -597,8 +597,12 @@ void testJLink(void)
testNumZ(6);
testdbPutFieldOk("j1.INP", DBF_STRING, "{\"z\":{\"good\":4}}");
testdbPutFieldOk("j1.PHAS", DBF_LONG, 0);
testdbPutFieldOk("j1.OUTP", DBF_STRING, "{z:{good:99}}");
testdbPutFieldOk("j1.PROC", DBF_LONG, 1);
testdbGetFieldEqual("j1.VAL", DBF_LONG, 4);
testdbGetFieldEqual("j1.PHAS", DBF_LONG, 4);
testdbPutFieldOk("j1.OUTP", DBF_STRING, "");
testdbPutFieldOk("j2.TSEL", DBF_STRING, "{'z':{good:0}}");
testdbPutFieldOk("j2.PROC", DBF_LONG, 1);
@ -701,7 +705,7 @@ void testTSEL(void)
MAIN(dbPutLinkTest)
{
testPlan(348);
testPlan(352);
testLinkParse();
testLinkFailParse();
testCADBSet();

View File

@ -124,13 +124,14 @@ long z_putval(struct link *plink, short dbrType,
if(INVALID_DB_REQ(dbrType))
return S_db_badDbrtype;
pconv = dbFastPutConvertRoutine[DBF_LONG][dbrType];
pconv = dbFastPutConvertRoutine[dbrType][DBF_LONG];
if(nRequest==0) return 0;
epicsMutexLock(priv->lock);
ret = pconv(pbuffer, &priv->value, NULL);
epicsMutexUnlock(priv->lock);
plink->precord->phas = priv->value;
return ret;
}

View File

@ -71,6 +71,7 @@ static long process(struct dbCommon *pcommon)
ret = (*xset->process)(prec);
monitor(prec);
recGblGetTimeStamp(prec);
dbPutLink(&prec->outp, DBR_LONG, &prec->val, 1);
recGblFwdLink(prec);
prec->pact = FALSE;
return ret;

View File

@ -49,6 +49,9 @@ recordtype(x) {
prompt("Input Link")
special(SPC_MOD)
}
field(OUTP, DBF_OUTLINK) {
prompt("Output Link")
}
field(CLBK, DBF_NOACCESS) {
prompt("Processing callback")
special(SPC_NOMOD)