本文整理汇总了C++中recGblSetSevr函数的典型用法代码示例。如果您正苦于以下问题:C++ recGblSetSevr函数的具体用法?C++ recGblSetSevr怎么用?C++ recGblSetSevr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了recGblSetSevr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: processAiAverage
static long processAiAverage(aiRecord *pr)
{
devInt32Pvt *pPvt = (devInt32Pvt *)pr->dpvt;
double rval;
epicsMutexLock(pPvt->ringBufferLock);
if (pPvt->numAverage == 0) {
(void)recGblSetSevr(pr, UDF_ALARM, INVALID_ALARM);
pr->udf = 1;
epicsMutexUnlock(pPvt->ringBufferLock);
return -2;
}
rval = pPvt->sum/pPvt->numAverage;
/*round result*/
rval += (pPvt->sum>0.0) ? 0.5 : -0.5;
pr->rval = (epicsInt32) rval;
pPvt->numAverage = 0;
pPvt->sum = 0.;
asynPrint(pPvt->pasynUser, ASYN_TRACEIO_DEVICE,
"%s devAsynInt32::processAiInt32Average rval=%d, status=%d\n",pr->name, pr->rval, pPvt->result.status);
if (pPvt->result.status == asynSuccess) {
pr->udf = 0;
}
else {
pasynEpicsUtils->asynStatusToEpicsAlarm(pPvt->result.status, READ_ALARM, &pPvt->alarmStat,
INVALID_ALARM, &pPvt->alarmSevr);
(void)recGblSetSevr(pr, pPvt->alarmStat, pPvt->alarmSevr);
pPvt->result.status = 0;
}
epicsMutexUnlock(pPvt->ringBufferLock);
return 0;
}
开发者ID:arvinderpalaha,项目名称:asyn,代码行数:32,代码来源:devAsynInt32.c
示例2: alarm
static long alarm(rfmRecord *precord)
{
long status = OK;
if(precord->udf == TRUE) {
recGblSetSevr(precord, UDF_ALARM, INVALID_ALARM);
return status;
}
if(precord->val != rfmSuccess) {
recGblSetSevr(precord, DISABLE_ALARM, MAJOR_ALARM);
return status;
}
if(precord->rfe < 50) {
recGblSetSevr(precord,SOFT_ALARM, MAJOR_ALARM);
return status;
}
if(precord->rfe < 100) {
recGblSetSevr(precord, SOFT_ALARM, MINOR_ALARM);
return status;
}
precord->val = rfmSuccess;
return status;
}
开发者ID:Sangil-Lee,项目名称:RefCode,代码行数:27,代码来源:rfmRecord.c
示例3: readValue
static long readValue(stringinRecord *prec)
{
long status;
struct stringindset *pdset = (struct stringindset *) (prec->dset);
if (prec->pact == TRUE){
status=(*pdset->read_stringin)(prec);
return(status);
}
status=dbGetLink(&(prec->siml),DBR_USHORT, &(prec->simm),0,0);
if (status)
return(status);
if (prec->simm == menuYesNoNO){
status=(*pdset->read_stringin)(prec);
return(status);
}
if (prec->simm == menuYesNoYES){
status=dbGetLink(&(prec->siol),DBR_STRING,
prec->sval,0,0);
if (status==0) {
strcpy(prec->val,prec->sval);
prec->udf=FALSE;
}
} else {
status=-1;
recGblSetSevr(prec,SOFT_ALARM,INVALID_ALARM);
return(status);
}
recGblSetSevr(prec,SIMM_ALARM,prec->sims);
return(status);
}
开发者ID:ISISComputingGroup,项目名称:EPICS-base,代码行数:34,代码来源:stringinRecord.c
示例4: writeString
static int writeString(gpibDpvt *pgpibDpvt,int P1, int P2, char **P3)
{
asynUser *pasynUser = pgpibDpvt->pasynUser;
stringoutRecord *precord = (stringoutRecord*)pgpibDpvt->precord;
int nchars;
gpibCmd *pgpibCmd = gpibCmdGet(pgpibDpvt);
char *format = (pgpibCmd->format) ? pgpibCmd->format : "%s";
if(!pgpibDpvt->msg) {
asynPrint(pasynUser,ASYN_TRACE_ERROR,
"%s no msg buffer. Must define gpibCmd.msgLen > 0.\n",
precord->name);
recGblSetSevr(precord,WRITE_ALARM, INVALID_ALARM);
return -1;
}
nchars = epicsSnprintf(pgpibDpvt->msg,pgpibCmd->msgLen,format,precord->val);
if(nchars>pgpibCmd->msgLen) {
asynPrint(pasynUser,ASYN_TRACE_ERROR,
"%s msg buffer too small. msgLen %d message length %d\n",
precord->name,pgpibCmd->msgLen,nchars);
recGblSetSevr(precord,WRITE_ALARM, INVALID_ALARM);
return -1;
}
asynPrint(pasynUser,ASYN_TRACE_FLOW,"%s writeMsgString\n",precord->name);
return nchars;
}
开发者ID:A2-Collaboration,项目名称:epics,代码行数:26,代码来源:devGpibConvertExample.c
示例5: processAiAverage
static long processAiAverage(aiRecord *pai)
{
devPvt *pPvt = (devPvt *)pai->dpvt;
double dval;
epicsMutexLock(pPvt->ringBufferLock);
if (pPvt->numAverage == 0) {
recGblSetSevr(pai, UDF_ALARM, INVALID_ALARM);
pai->udf = 1;
epicsMutexUnlock(pPvt->ringBufferLock);
return -2;
}
dval = pPvt->sum/pPvt->numAverage;
pPvt->numAverage = 0;
pPvt->sum = 0.;
epicsMutexUnlock(pPvt->ringBufferLock);
pasynEpicsUtils->asynStatusToEpicsAlarm(pPvt->result.status,
READ_ALARM, &pPvt->result.alarmStatus,
INVALID_ALARM, &pPvt->result.alarmSeverity);
recGblSetSevr(pai, pPvt->result.alarmStatus, pPvt->result.alarmSeverity);
if (pPvt->result.status == asynSuccess) {
pai->val = dval;
pai->udf = 0;
asynPrint(pPvt->pasynUser, ASYN_TRACEIO_DEVICE,
"%s devAsynFloat64::callbackAiAverage val=%f\n",
pai->name, pai->val);
return 2;
}
else {
pPvt->result.status = asynSuccess;
return -1;
}
}
开发者ID:FreddieAkeroyd,项目名称:asyn,代码行数:33,代码来源:devAsynFloat64.c
示例6: writeIt
static asynStatus writeIt(asynUser *pasynUser,const char *message,size_t nbytes)
{
devPvt *pdevPvt = (devPvt *)pasynUser->userPvt;
dbCommon *precord = pdevPvt->precord;
asynOctet *poctet = pdevPvt->poctet;
void *octetPvt = pdevPvt->octetPvt;
asynStatus status;
size_t nbytesTransfered;
status = poctet->write(octetPvt,pasynUser,message,nbytes,&nbytesTransfered);
if(status!=asynSuccess) {
asynPrint(pasynUser,ASYN_TRACE_ERROR,
"%s devTestBlock: writeIt failed %s\n",
precord->name,pasynUser->errorMessage);
recGblSetSevr(precord, WRITE_ALARM, INVALID_ALARM);
return status;
}
if(nbytes != nbytesTransfered) {
asynPrint(pasynUser,ASYN_TRACE_ERROR,
"%s devTestBlock: writeIt requested %lu but sent %lu bytes\n",
precord->name,(unsigned long)nbytes,(unsigned long)nbytesTransfered);
recGblSetSevr(precord, WRITE_ALARM, MINOR_ALARM);
return asynError;
}
asynPrintIO(pasynUser,ASYN_TRACEIO_DEVICE,message,nbytes,
"%s devTestBlock: writeIt\n",precord->name);
return status;
}
开发者ID:A2-Collaboration,项目名称:epics,代码行数:28,代码来源:devTestBlock.c
示例7: writeValue
static long writeValue(stringoutRecord *prec)
{
long status;
struct stringoutdset *pdset = (struct stringoutdset *) (prec->dset);
if (prec->pact == TRUE){
status=(*pdset->write_stringout)(prec);
return(status);
}
status=dbGetLink(&(prec->siml),DBR_USHORT,
&(prec->simm),0,0);
if (status)
return(status);
if (prec->simm == menuYesNoNO){
status=(*pdset->write_stringout)(prec);
return(status);
}
if (prec->simm == menuYesNoYES){
status=dbPutLink(&prec->siol,DBR_STRING,
prec->val,1);
} else {
status=-1;
recGblSetSevr(prec,SOFT_ALARM,INVALID_ALARM);
return(status);
}
recGblSetSevr(prec,SIMM_ALARM,prec->sims);
return(status);
}
开发者ID:zlxmsu,项目名称:TestEpics,代码行数:31,代码来源:stringoutRecord.c
示例8: process
static long process(epidRecord *pepid)
{
struct epidDSET *pdset = (struct epidDSET *)(pepid->dset);
long status;
int pact=pepid->pact;
if (!pact) { /* If this is not a callback from device support */
/* fetch the setpoint */
if(pepid->smsl == menuOmslclosed_loop) {
status = dbGetLink(&(pepid->stpl),DBR_DOUBLE, &(pepid->val),0,0);
if (RTN_SUCCESS(status)) pepid->udf=FALSE;
}
if (pepid->udf == TRUE ) {
#if LT_EPICSBASE(3,15,0,2)
recGblSetSevr(pepid,UDF_ALARM,INVALID_ALARM);
#else
recGblSetSevr(pepid,UDF_ALARM,pepid->udfs);
#endif
return(0);
}
}
status = (*pdset->do_pid)(pepid);
/* See if device support set pact=true, meaning it will call us back */
if (!pact && pepid->pact) return(0);
pepid->pact = TRUE;
recGblGetTimeStamp(pepid);
checkAlarms(pepid);
monitor(pepid);
recGblFwdLink(pepid);
pepid->pact=FALSE;
return(status);
}
开发者ID:epics-modules,项目名称:std,代码行数:33,代码来源:epidRecord.c
示例9: writeValue
static long writeValue(lsoRecord *prec)
{
long status;
lsodset *pdset = (lsodset *) prec->dset;
if (prec->pact)
goto write;
status = dbGetLink(&prec->siml, DBR_USHORT, &prec->simm, 0, 0);
if (status)
return(status);
switch (prec->simm) {
case menuYesNoNO:
write:
status = pdset->write_string(prec);
break;
case menuYesNoYES:
recGblSetSevr(prec, SIMM_ALARM, prec->sims);
status = dbPutLink(&prec->siol,DBR_STRING, prec->val,1);
break;
default:
recGblSetSevr(prec, SOFT_ALARM, INVALID_ALARM);
status = -1;
}
return status;
}
开发者ID:A2-Collaboration,项目名称:epics,代码行数:30,代码来源:lsoRecord.c
示例10: readValue
static long readValue(waveformRecord *prec)
{
long status;
struct wfdset *pdset = (struct wfdset *) prec->dset;
if (prec->pact == TRUE) {
return (*pdset->read_wf)(prec);
}
status = dbGetLink(&(prec->siml), DBR_ENUM, &(prec->simm),0,0);
if (status)
return status;
if (prec->simm == menuYesNoNO) {
return (*pdset->read_wf)(prec);
}
if (prec->simm == menuYesNoYES) {
long nRequest = prec->nelm;
status = dbGetLink(&(prec->siol), prec->ftvl, prec->bptr, 0, &nRequest);
/* nord set only for db links: needed for old db_access */
if (prec->siol.type != CONSTANT) {
prec->nord = nRequest;
if (status == 0)
prec->udf=FALSE;
}
} else {
recGblSetSevr(prec, SOFT_ALARM, INVALID_ALARM);
return -1;
}
recGblSetSevr(prec, SIMM_ALARM, prec->sims);
return status;
}
开发者ID:zlxmsu,项目名称:epics,代码行数:34,代码来源:waveformRecord.c
示例11: process
static long process(fanoutRecord *prec)
{
struct link *plink;
unsigned short state;
short i;
unsigned short monitor_mask;
prec->pact = TRUE;
/* fetch link selection */
dbGetLink(&(prec->sell),DBR_USHORT,&(prec->seln),0,0);
switch (prec->selm){
case (fanoutSELM_All):
plink=&(prec->lnk1);
state=prec->seln;
for ( i=0; i<6; i++, state>>=1, plink++) {
if(plink->type!=CONSTANT) dbScanFwdLink(plink);
}
break;
case (fanoutSELM_Specified):
if(prec->seln>6) {
recGblSetSevr(prec,SOFT_ALARM,INVALID_ALARM);
break;
}
if(prec->seln==0) {
break;
}
plink=&(prec->lnk1);
plink += (prec->seln-1); dbScanFwdLink(plink);
break;
case (fanoutSELM_Mask):
if(prec->seln==0) {
break;
}
if(prec->seln>63 ) {
recGblSetSevr(prec,SOFT_ALARM,INVALID_ALARM);
break;
}
plink=&(prec->lnk1);
state=prec->seln;
for ( i=0; i<6; i++, state>>=1, plink++) {
if(state & 1 && plink->type!=CONSTANT) dbScanFwdLink(plink);
}
break;
default:
recGblSetSevr(prec,SOFT_ALARM,INVALID_ALARM);
}
prec->udf=FALSE;
recGblGetTimeStamp(prec);
/* check monitors*/
/* get previous stat and sevr and new stat and sevr*/
monitor_mask = recGblResetAlarms(prec);
/* process the forward scan link record */
recGblFwdLink(prec);
prec->pact=FALSE;
return(0);
}
开发者ID:ISISComputingGroup,项目名称:EPICS-base,代码行数:57,代码来源:fanoutRecord.c
示例12: inherit_severity
static void inherit_severity(const struct pv_link *ppv_link,
dbCommon *pdest, epicsEnum16 stat, epicsEnum16 sevr)
{
switch(ppv_link->pvlMask&pvlOptMsMode) {
case pvlOptNMS: break;
case pvlOptMSI: if (sevr < INVALID_ALARM) break;
case pvlOptMS: recGblSetSevr(pdest,LINK_ALARM,sevr); break;
case pvlOptMSS: recGblSetSevr(pdest,stat,sevr); break;
}
}
开发者ID:T-A-R-L-A,项目名称:EPICS-Base,代码行数:10,代码来源:dbAccess.c
示例13: checkAlarms
static void checkAlarms(selRecord *prec)
{
double val, hyst, lalm;
double alev;
epicsEnum16 asev;
if (prec->udf) {
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
return;
}
val = prec->val;
hyst = prec->hyst;
lalm = prec->lalm;
/* alarm condition hihi */
asev = prec->hhsv;
alev = prec->hihi;
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
if (recGblSetSevr(prec, HIHI_ALARM, asev))
prec->lalm = alev;
return;
}
/* alarm condition lolo */
asev = prec->llsv;
alev = prec->lolo;
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
if (recGblSetSevr(prec, LOLO_ALARM, asev))
prec->lalm = alev;
return;
}
/* alarm condition high */
asev = prec->hsv;
alev = prec->high;
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
if (recGblSetSevr(prec, HIGH_ALARM, asev))
prec->lalm = alev;
return;
}
/* alarm condition low */
asev = prec->lsv;
alev = prec->low;
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
if (recGblSetSevr(prec, LOW_ALARM, asev))
prec->lalm = alev;
return;
}
/* we get here only if val is out of alarm by at least hyst */
prec->lalm = val;
return;
}
开发者ID:ukaea,项目名称:epics,代码行数:55,代码来源:selRecord.c
示例14: checkAlarms
static void checkAlarms(aliveRecord *prec)
{
if (prec->udf == TRUE)
{
#if LT_EPICSBASE(3,15,0,2)
recGblSetSevr(prec,UDF_ALARM,INVALID_ALARM);
#else
recGblSetSevr(prec,UDF_ALARM,prec->udfs);
#endif
return;
}
return;
}
开发者ID:epics-modules,项目名称:alive,代码行数:13,代码来源:aliveRecord.c
示例15: processAo
static long processAo(aoRecord *pr)
{
devInt32Pvt *pPvt = (devInt32Pvt *)pr->dpvt;
asynStatus status;
double value;
if (getCallbackValue(pPvt)) {
/* We got a callback from the driver */
if (pPvt->result.status == asynSuccess) {
pr->rval = pPvt->result.value;
pr->udf = 0;
value = (double)pr->rval + (double)pr->roff;
if(pr->aslo!=0.0) value *= pr->aslo;
value += pr->aoff;
if (pr->linr == menuConvertNO_CONVERSION){
; /*do nothing*/
} else if ((pr->linr == menuConvertLINEAR) ||
(pr->linr == menuConvertSLOPE)) {
value = value*pr->eslo + pr->eoff;
} else {
if(cvtRawToEngBpt(&value,pr->linr,pr->init,
(void *)&pr->pbrk,&pr->lbrk)!=0) {
asynPrint(pPvt->pasynUser, ASYN_TRACE_ERROR,
"%s devAsynInt32 cvtRawToEngBpt failed\n",
pr->name);
(void)recGblSetSevr(pr, WRITE_ALARM, INVALID_ALARM);
return -1;
}
}
pr->val = value;
pr->udf = isnan(value);
}
} else if(pr->pact == 0) {
pPvt->result.value = pr->rval;
if(pPvt->canBlock) pr->pact = 1;
status = pasynManager->queueRequest(pPvt->pasynUser, 0, 0);
if((status==asynSuccess) && pPvt->canBlock) return 0;
if(pPvt->canBlock) pr->pact = 0;
reportQueueRequestStatus(pPvt, status);
}
if(pPvt->result.status == asynSuccess) {
return 0;
}
else {
pasynEpicsUtils->asynStatusToEpicsAlarm(pPvt->result.status, WRITE_ALARM, &pPvt->alarmStat,
INVALID_ALARM, &pPvt->alarmSevr);
(void)recGblSetSevr(pr, pPvt->alarmStat, pPvt->alarmSevr);
pPvt->result.status = asynSuccess;
return -1;
}
}
开发者ID:ffeldbauer,项目名称:asyn,代码行数:51,代码来源:devAsynInt32.c
示例16: checkAlarms
static void checkAlarms(epidRecord *pepid)
{
double val;
double hyst, lalm, hihi, high, low, lolo;
unsigned short hhsv, llsv, hsv, lsv;
if(pepid->udf == TRUE ) {
recGblSetSevr(pepid,UDF_ALARM,INVALID_ALARM);
return;
}
hihi = pepid->hihi;
lolo = pepid->lolo;
high = pepid->high;
low = pepid->low;
hhsv = pepid->hhsv;
llsv = pepid->llsv;
hsv = pepid->hsv;
lsv = pepid->lsv;
val = pepid->val;
hyst = pepid->hyst;
lalm = pepid->lalm;
/* alarm condition hihi */
if (hhsv && (val >= hihi || ((lalm==hihi) && (val >= hihi-hyst)))) {
if (recGblSetSevr(pepid,HIHI_ALARM,pepid->hhsv)) pepid->lalm = hihi;
return;
}
/* alarm condition lolo */
if (llsv && (val <= lolo || ((lalm==lolo) && (val <= lolo+hyst)))) {
if (recGblSetSevr(pepid,LOLO_ALARM,pepid->llsv)) pepid->lalm = lolo;
return;
}
/* alarm condition high */
if (hsv && (val >= high || ((lalm==high) && (val >= high-hyst)))) {
if (recGblSetSevr(pepid,HIGH_ALARM,pepid->hsv)) pepid->lalm = high;
return;
}
/* alarm condition low */
if (lsv && (val <= low || ((lalm==low) && (val <= low+hyst)))) {
if (recGblSetSevr(pepid,LOW_ALARM,pepid->lsv)) pepid->lalm = low;
return;
}
/* we get here only if val is out of alarm by at least hyst */
pepid->lalm = val;
return;
}
开发者ID:epics-modules,项目名称:std,代码行数:50,代码来源:epidRecord.c
示例17: read_ai
static long read_ai(aiRecord *prec)
{
devPvt *pdevPvt = (devPvt *)prec->dpvt;
if (!prec->dpvt)
return 2;
if (!prec->pact) {
dbProcessNotify(&pdevPvt->pn);
prec->pact = TRUE;
return 0;
}
if (pdevPvt->status) {
recGblSetSevr(prec, READ_ALARM, INVALID_ALARM);
pdevPvt->smooth = FALSE;
return 2;
}
/* Apply smoothing algorithm */
if (prec->smoo != 0.0 && pdevPvt->smooth && finite(prec->val))
prec->val = prec->val * prec->smoo +
pdevPvt->buffer.value * (1.0 - prec->smoo);
else
prec->val = pdevPvt->buffer.value;
prec->udf = FALSE;
pdevPvt->smooth = TRUE;
switch (prec->inp.value.pv_link.pvlMask & pvlOptMsMode) {
case pvlOptNMS:
break;
case pvlOptMSI:
if (pdevPvt->buffer.severity < INVALID_ALARM)
break;
/* else fall through */
case pvlOptMS:
recGblSetSevr(prec, LINK_ALARM, pdevPvt->buffer.severity);
break;
case pvlOptMSS:
recGblSetSevr(prec, pdevPvt->buffer.status,
pdevPvt->buffer.severity);
break;
}
if (prec->tsel.type == CONSTANT &&
prec->tse == epicsTimeEventDeviceTime)
prec->time = pdevPvt->buffer.time;
return 2;
}
开发者ID:epicsdeb,项目名称:epics-base,代码行数:49,代码来源:devAiSoftCallback.c
示例18: processAo
static long processAo(aoRecord *pr)
{
devInt32Pvt *pPvt = (devInt32Pvt *)pr->dpvt;
asynStatus status;
double value;
getCallbackValue(pPvt);
if(pPvt->gotValue) {
/* This code is for I/O Intr scanned output records, which are not tested yet. */
pr->rval = pPvt->value;
pr->udf = 0;
value = (double)pr->rval + (double)pr->roff;
if(pr->aslo!=0.0) value *= pr->aslo;
value += pr->aoff;
if (pr->linr == menuConvertNO_CONVERSION){
; /*do nothing*/
} else if ((pr->linr == menuConvertLINEAR) ||
(pr->linr == menuConvertSLOPE)) {
value = value*pr->eslo + pr->eoff;
}else{
if(cvtRawToEngBpt(&value,pr->linr,pr->init,
(void *)&pr->pbrk,&pr->lbrk)!=0) {
asynPrint(pPvt->pasynUser, ASYN_TRACE_ERROR,
"%s devAsynInt32 cvtRawToEngBpt failed\n",
pr->name);
recGblSetSevr(pr, READ_ALARM, INVALID_ALARM);
goto done;
}
}
pr->val = value;
pr->udf = isnan(value);
} else if(pr->pact == 0) {
pPvt->value = pr->rval;
if(pPvt->canBlock) pr->pact = 1;
status = pasynManager->queueRequest(pPvt->pasynUser, 0, 0);
if((status==asynSuccess) && pPvt->canBlock) return 0;
if(pPvt->canBlock) pr->pact = 0;
if(status != asynSuccess) {
asynPrint(pPvt->pasynUser, ASYN_TRACE_ERROR,
"%s devAsynInt32 queueRequest %s\n",
pr->name,pPvt->pasynUser->errorMessage);
recGblSetSevr(pr, WRITE_ALARM, INVALID_ALARM);
}
}
done:
pPvt->gotValue = 0;
return 0;
}
开发者ID:A2-Collaboration,项目名称:epics,代码行数:48,代码来源:devAsynInt32.c
示例19: process
static long process(compressRecord *prec)
{
long status=0;
long nelements = 0;
int alg = prec->alg;
prec->pact = TRUE;
if(!dbIsLinkConnected(&prec->inp)
|| dbGetNelements(&prec->inp,&nelements)
|| nelements<=0) {
recGblSetSevr(prec,LINK_ALARM,INVALID_ALARM);
} else {
if(!prec->wptr || nelements!=prec->inpn) {
if(prec->wptr) {
free(prec->wptr);
reset(prec);
}
prec->wptr = (double *)dbCalloc(nelements,sizeof(double));
prec->inpn = nelements;
}
status = dbGetLink(&prec->inp,DBF_DOUBLE,prec->wptr,0,&nelements);
if(status || nelements<=0) {
recGblSetSevr(prec,LINK_ALARM,INVALID_ALARM);
status = 0;
} else {
if(alg==compressALG_Average) {
status = array_average(prec,prec->wptr,nelements);
} else if(alg==compressALG_Circular_Buffer) {
(void)put_value(prec,prec->wptr,nelements);
status = 0;
} else if(nelements>1) {
status = compress_array(prec,prec->wptr,nelements);
}else if(nelements==1){
status = compress_scalar(prec,prec->wptr);
}else status=1;
}
}
/* check event list */
if(status!=1) {
prec->udf=FALSE;
recGblGetTimeStamp(prec);
monitor(prec);
/* process the forward scan link record */
recGblFwdLink(prec);
}
prec->pact=FALSE;
return(0);
}
开发者ID:zlxmsu,项目名称:TestEpics,代码行数:48,代码来源:compressRecord.c
示例20: processAiAverage
static long processAiAverage(aiRecord *pai)
{
devPvt *pPvt = (devPvt *)pai->dpvt;
double dval;
static const char *functionName="processAiAverage";
epicsMutexLock(pPvt->devPvtLock);
if (getCallbackValue(pPvt)) {
/* Record is I/O Intr scanned and the average has been put in the ring buffer */
dval = pPvt->result.value;
pai->time = pPvt->result.time;
} else {
if (pPvt->numAverage == 0) {
recGblSetSevr(pai, UDF_ALARM, INVALID_ALARM);
pai->udf = 1;
epicsMutexUnlock(pPvt->devPvtLock);
return -2;
}
dval = pPvt->sum/pPvt->numAverage;
pPvt->numAverage = 0;
pPvt->sum = 0.;
}
epicsMutexUnlock(pPvt->devPvtLock);
pasynEpicsUtils->asynStatusToEpicsAlarm(pPvt->result.status,
READ_ALARM, &pPvt->result.alarmStatus,
INVALID_ALARM, &pPvt->result.alarmSeverity);
recGblSetSevr(pai, pPvt->result.alarmStatus, pPvt->result.alarmSeverity);
if (pPvt->result.status == asynSuccess) {
/* ASLO/AOFF conversion */
if (pai->aslo != 0.0) dval *= pai->aslo;
dval += pai->aoff;
/* Smoothing */
if (pai->smoo == 0.0 || pai->udf || !finite(pai->val))
pai->val = dval;
else
pai->val = pai->val * pai->smoo + dval * (1.0 - pai->smoo);
pai->udf = 0;
asynPrint(pPvt->pasynUser, ASYN_TRACEIO_DEVICE,
"%s %s::%s val=%f\n",
pai->name, driverName, functionName,pai->val);
return 2;
}
else {
pPvt->result.status = asynSuccess;
return -1;
}
}
开发者ID:epics-modules,项目名称:asyn,代码行数:48,代码来源:devAsynFloat64.c
注:本文中的recGblSetSevr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论