fix aai and waveform soft device support to support reading empty arrays

This commit is contained in:
2020-06-05 16:01:14 +02:00
parent 8cc20393f1
commit 19c50d4c3d
2 changed files with 13 additions and 5 deletions

View File

@@ -60,9 +60,10 @@ static long init_record(dbCommon *pcommon)
}
status = dbLoadLinkArray(plink, prec->ftvl, prec->bptr, &nRequest);
if (!status && nRequest > 0) {
if (!status) {
prec->nord = nRequest;
prec->udf = FALSE;
return status;
}
}
return 0;
@@ -74,7 +75,7 @@ static long readLocked(struct link *pinp, void *dummy)
long nRequest = prec->nelm;
long status = dbGetLink(pinp, prec->ftvl, prec->bptr, 0, &nRequest);
if (!status && nRequest > 0) {
if (!status) {
prec->nord = nRequest;
prec->udf = FALSE;
@@ -89,8 +90,12 @@ static long read_aai(aaiRecord *prec)
{
epicsUInt32 nord = prec->nord;
struct link *pinp = prec->simm == menuYesNoYES ? &prec->siol : &prec->inp;
long status = dbLinkDoLocked(pinp, readLocked, NULL);
long status;
if (dbLinkIsConstant(pinp))
return 0;
status = dbLinkDoLocked(pinp, readLocked, NULL);
if (status == S_db_noLSET)
status = readLocked(pinp, NULL);

View File

@@ -41,7 +41,7 @@ static long init_record(dbCommon *pcommon)
long nelm = prec->nelm;
long status = dbLoadLinkArray(&prec->inp, prec->ftvl, prec->bptr, &nelm);
if (!status && nelm > 0) {
if (!status) {
prec->nord = nelm;
prec->udf = FALSE;
}
@@ -77,11 +77,14 @@ static long read_wf(waveformRecord *prec)
rt.ptime = (dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime) ? &prec->time : NULL;
if (dbLinkIsConstant(&prec->inp))
return 0;
status = dbLinkDoLocked(&prec->inp, readLocked, &rt);
if (status == S_db_noLSET)
status = readLocked(&prec->inp, &rt);
if (!status && rt.nRequest > 0) {
if (!status) {
prec->nord = rt.nRequest;
prec->udf = FALSE;
if (nord != prec->nord)