Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017 Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
<== Date ==> <== Thread ==>

Subject: Data types in monitor function
From: Jeong Han Lee <citadel.lee@gmail.com>
To: tech-talk@aps.anl.gov
Date: Mon, 24 Apr 2017 14:27:22 +0200
Hi,

I am wondering the mixed data types in monitor function in most_of_Record.c. For example, static void monitor(aiRecord *prec).

recGblResetAlarms function returns epicsUint16 (unsigned int) and the returned value is used in different way according to its record, and pass it as argument of db_post_events function with mixed data type.

All of them mixed data types are larger than its epicsUnit16, so no problems I saw.

Is it just due to "history of Data types evolution" in many difference records? If so, do we have any intention to keep the same data type in entire (at least monitor function) EPICS layer? If any help is needed, I can work on them.


  Thanks,
  Han
```
in recGbl.c / recGbl.h

unsigned short recGblResetAlarms
>> epicsUInt16 recGblResetAlarms


std/rec/longoutRecord.c:static void monitor(longoutRecord *prec);
std/rec/longoutRecord.c:static void monitor(longoutRecord *prec)


/* DELTA calculates the absolute difference between its arguments
 * expressed as an unsigned 32-bit integer */
#define DELTA(last, val) \
    ((epicsUInt32) ((last) > (val) ? (last) - (val) : (val) - (last)))

static void monitor(longoutRecord *prec)
{
    unsigned short monitor_mask = recGblResetAlarms(prec);
    >> epicsUInt16 monitor_mask = recGblResetAlarms(prec);
    
    if (prec->mdel < 0 ||
        DELTA(prec->mlst, prec->val) > (epicsUInt32) prec->mdel) {
        /* post events for value change */
        monitor_mask |= DBE_VALUE;
        /* update last value monitored */
        prec->mlst = prec->val;
    }

    if (prec->adel < 0 ||
        DELTA(prec->alst, prec->val) > (epicsUInt32) prec->adel) {
        /* post events for archive value change */
        monitor_mask |= DBE_LOG;
        /* update last archive value monitored */
        prec->alst = prec->val;
    }

    /* send out monitors connected to the value field */
    if (monitor_mask)
        db_post_events(prec, &prec->val, monitor_mask);
} 


db_post_events in ioc/db/dbEvent.c  (void, void, unsigned int)

unsigned int > epicsUInit32



std/rec/mbboDirectRecord.c:static void monitor(mbboDirectRecord *);
std/rec/mbboDirectRecord.c:static void monitor(mbboDirectRecord *prec)

static void monitor(mbboDirectRecord *prec)
{
    epicsUInt16 events = recGblResetAlarms(prec);

    if (prec->mlst != prec->val) {
        events |= DBE_VALUE | DBE_LOG;
        prec->mlst = prec->val;
    }
    if (events)
        db_post_events(prec, &prec->val, events);

    events |= DBE_VALUE | DBE_LOG;
    if (prec->oraw != prec->rval) {
        db_post_events(prec, &prec->rval, events);
        prec->oraw = prec->rval;
    }
    if (prec->orbv != prec->rbv) {
        db_post_events(prec, &prec->rbv, events);
        prec->orbv = prec->rbv;
    }
}



std/rec/longinRecord.c:static void monitor(longinRecord *prec);
std/rec/longinRecord.c:static void monitor(longinRecord *prec)

/* DELTA calculates the absolute difference between its arguments
 * expressed as an unsigned 32-bit integer */
#define DELTA(last, val) \
    ((epicsUInt32) ((last) > (val) ? (last) - (val) : (val) - (last)))

static void monitor(longinRecord *prec)
{
    unsigned short monitor_mask = recGblResetAlarms(prec);

    if (prec->mdel < 0 ||
        DELTA(prec->mlst, prec->val) > (epicsUInt32) prec->mdel) {
        /* post events for value change */
        monitor_mask |= DBE_VALUE;
        /* update last value monitored */
        prec->mlst = prec->val;
    }

    if (prec->adel < 0 ||
        DELTA(prec->alst, prec->val) > (epicsUInt32) prec->adel) {
        /* post events for archive value change */
        monitor_mask |= DBE_LOG;
        /* update last archive value monitored */
        prec->alst = prec->val;
    }

    /* send out monitors connected to the value field */
    if (monitor_mask)
        db_post_events(prec, &prec->val, monitor_mask);
}



std/rec/aoRecord.c:static void monitor(aoRecord *);
std/rec/aoRecord.c:static void monitor(aoRecord *prec)

static void monitor(aoRecord *prec)
{
    unsigned monitor_mask = recGblResetAlarms(prec);

    /* check for value change */
    recGblCheckDeadband(&prec->mlst, prec->val, prec->mdel, &monitor_mask, DBE_VALUE);

    /* check for archive change */
    recGblCheckDeadband(&prec->alst, prec->val, prec->adel, &monitor_mask, DBE_ARCHIVE);

    /* send out monitors connected to the value field */
    if (monitor_mask){
        db_post_events(prec,&prec->val,monitor_mask);
    }

        if(prec->omod) monitor_mask |= (DBE_VALUE|DBE_LOG);
        if(monitor_mask) {
                prec->omod = FALSE;
                db_post_events(prec,&prec->oval,monitor_mask);
                if(prec->oraw != prec->rval) {
                        db_post_events(prec,&prec->rval,
                            monitor_mask|DBE_VALUE|DBE_LOG);
                        prec->oraw = prec->rval;
                }
                if(prec->orbv != prec->rbv) {
                        db_post_events(prec,&prec->rbv,
                            monitor_mask|DBE_VALUE|DBE_LOG);
                        prec->orbv = prec->rbv;
                }
        }
        return;
}


std/rec/permissiveRecord.c:static void monitor(permissiveRecord *);
std/rec/permissiveRecord.c:static void monitor(permissiveRecord *prec)

static void monitor(permissiveRecord *prec)
{
    unsigned short  monitor_mask;
   //epicsUint16
   
    unsigned short  val,oval,wflg,oflg;

    monitor_mask = recGblResetAlarms(prec);
    /* get val,oval,wflg,oflg*/
    val=prec->val;
    oval=prec->oval;
    wflg=prec->wflg;
    oflg=prec->oflg;
    /*set  oval and oflg*/
    prec->oval = val;
    prec->oflg = wflg;
    if(oval != val) {
        db_post_events(prec,&prec->val,
            monitor_mask|DBE_VALUE|DBE_LOG);
    }
    if(oflg != wflg) {
        db_post_events(prec,&prec->wflg,
            monitor_mask|DBE_VALUE|DBE_LOG);
    }
    return;
}


std/rec/boRecord.c:static void monitor(boRecord *);
std/rec/boRecord.c:static void monitor(boRecord *prec)

static void monitor(boRecord *prec)
{
        unsigned short  monitor_mask;
   //epicsUint16
        monitor_mask = recGblResetAlarms(prec);
        /* check for value change */
        if (prec->mlst != prec->val){
                /* post events for value change and archive change */
                monitor_mask |= (DBE_VALUE | DBE_LOG);
                /* update last value monitored */
                prec->mlst = prec->val;
        }

        /* send out monitors connected to the value field */
        if (monitor_mask){
                db_post_events(prec,&prec->val,monitor_mask);
        }
        if(prec->oraw!=prec->rval) {
                db_post_events(prec,&prec->rval,
                    monitor_mask|DBE_VALUE|DBE_LOG);
                prec->oraw = prec->rval;
        }
        if(prec->orbv!=prec->rbv) {
                db_post_events(prec,&prec->rbv,
                    monitor_mask|DBE_VALUE|DBE_LOG);
                prec->orbv = prec->rbv;
        }
        return;
}




std/rec/calcoutRecord.c:static void monitor(calcoutRecord *prec);
std/rec/calcoutRecord.c:static void monitor(calcoutRecord *prec)

static void monitor(calcoutRecord *prec)
{
    unsigned        monitor_mask;
	/epicsUint32
    double          *pnew;
    double          *pprev;
    int             i;

    monitor_mask = recGblResetAlarms(prec);

    /* check for value change */
    recGblCheckDeadband(&prec->mlst, prec->val, prec->mdel, &monitor_mask, DBE_VALUE);

    /* check for archive change */
    recGblCheckDeadband(&prec->alst, prec->val, prec->adel, &monitor_mask, DBE_ARCHIVE);

    /* send out monitors connected to the value field */
    if (monitor_mask){
        db_post_events(prec, &prec->val, monitor_mask);
    }

    /* check all input fields for changes*/
    for (i = 0, pnew = &prec->a, pprev = &prec->la; i<CALCPERFORM_NARGS;
         i++, pnew++, pprev++) {
        if ((*pnew != *pprev) || (monitor_mask&DBE_ALARM)) {
            db_post_events(prec, pnew, monitor_mask|DBE_VALUE|DBE_LOG);
            *pprev = *pnew;
        }
    }
    /* Check OVAL field */
    if (prec->povl != prec->oval) {
        db_post_events(prec, &prec->oval, monitor_mask|DBE_VALUE|DBE_LOG);
        prec->povl = prec->oval;
    }
    return;
}


std/rec/dfanoutRecord.c:static void monitor(dfanoutRecord *);
std/rec/dfanoutRecord.c:static void monitor(dfanoutRecord *prec)

static void monitor(dfanoutRecord *prec)
{
    unsigned monitor_mask = recGblResetAlarms(prec);
   //epicsUint32
   
    /* check for value change */
    recGblCheckDeadband(&prec->mlst, prec->val, prec->mdel, &monitor_mask, DBE_VALUE);

    /* check for archive change */
    recGblCheckDeadband(&prec->alst, prec->val, prec->adel, &monitor_mask, DBE_ARCHIVE);

    /* send out monitors connected to the value field */
    if (monitor_mask){
        db_post_events(prec,&prec->val,monitor_mask);
    }

    return;
}



std/rec/mbbiRecord.c:static void monitor(mbbiRecord *);
std/rec/mbbiRecord.c:static void monitor(mbbiRecord *prec)

static void monitor(mbbiRecord *prec)
{
    epicsUInt16 events = recGblResetAlarms(prec);

    if (prec->mlst != prec->val) {
        events |= DBE_VALUE | DBE_LOG;
        prec->mlst = prec->val;
    }

    if (events)
        db_post_events(prec, &prec->val, events);

    if (prec->oraw != prec->rval) {
        db_post_events(prec, &prec->rval, events | DBE_VALUE | DBE_LOG);
        prec->oraw = prec->rval;
    }
}


std/rec/compressRecord.c:static void monitor(compressRecord *prec)

static void monitor(compressRecord *prec)
{
    unsigned short alarm_mask = recGblResetAlarms(prec);
    //epicsUint16
    unsigned short monitor_mask = alarm_mask | DBE_LOG | DBE_VALUE;
    //epicsUint16
    if (alarm_mask || prec->nuse != prec->ouse) {
        db_post_events(prec, &prec->nuse, monitor_mask);
        prec->ouse = prec->nuse;
    }
    db_post_events(prec, prec->bptr, monitor_mask);
}



std/rec/subArrayRecord.c:static void monitor(subArrayRecord *prec);
std/rec/subArrayRecord.c:static void monitor(subArrayRecord *prec)

static void monitor(subArrayRecord *prec)
{
    unsigned short monitor_mask;
   //epicsUint16
   
    monitor_mask = recGblResetAlarms(prec);
    monitor_mask |= (DBE_LOG|DBE_VALUE);

    db_post_events(prec, prec->bptr, monitor_mask);

    return;
}



std/rec/aiRecord.c:static void monitor(aiRecord *prec);
std/rec/aiRecord.c:static void monitor(aiRecord *prec)


static void monitor(aiRecord *prec)
{
    unsigned monitor_mask = recGblResetAlarms(prec);
   //epicsUint32

    /* check for value change */
    recGblCheckDeadband(&prec->mlst, prec->val, prec->mdel, &monitor_mask, DBE_VALUE);

    /* check for archive change */
    recGblCheckDeadband(&prec->alst, prec->val, prec->adel, &monitor_mask, DBE_ARCHIVE);

        /* send out monitors connected to the value field */
        if (monitor_mask){
                db_post_events(prec,&prec->val,monitor_mask);
                if(prec->oraw != prec->rval) {
                        db_post_events(prec,&prec->rval,monitor_mask);
                        prec->oraw = prec->rval;
                }
        }
        return;
}



std/rec/aaiRecord.c:static void monitor(aaiRecord *);
std/rec/aaiRecord.c:static void monitor(aaiRecord *prec)

static void monitor(aaiRecord *prec)
{
    unsigned short monitor_mask;
    //epicsUint16
    unsigned int hash = 0;

    monitor_mask = recGblResetAlarms(prec);

    if (prec->mpst == aaiPOST_Always)
        monitor_mask |= DBE_VALUE;
    if (prec->apst == aaiPOST_Always)
        monitor_mask |= DBE_LOG;

    /* Calculate hash if we are interested in OnChange events. */
    if ((prec->mpst == aaiPOST_OnChange) ||
        (prec->apst == aaiPOST_OnChange)) {
        hash = epicsMemHash(prec->bptr,
            prec->nord * dbValueSize(prec->ftvl), 0);

        /* Only post OnChange values if the hash is different. */
        if (hash != prec->hash) {
            if (prec->mpst == aaiPOST_OnChange)
                monitor_mask |= DBE_VALUE;
            if (prec->apst == aaiPOST_OnChange)
                monitor_mask |= DBE_LOG;

            /* Store hash for next process. */
            prec->hash = hash;
            /* Post HASH. */
            db_post_events(prec, &prec->hash, DBE_VALUE);
        }
    }

    if (monitor_mask)
        db_post_events(prec, &prec->val, monitor_mask);
}


std/rec/waveformRecord.c:static void monitor(waveformRecord *);
std/rec/waveformRecord.c:static void monitor(waveformRecord *prec)

static void monitor(waveformRecord *prec)
{
    unsigned short monitor_mask = 0;
    unsigned int hash = 0;

    monitor_mask = recGblResetAlarms(prec);

    if (prec->mpst == waveformPOST_Always)
        monitor_mask |= DBE_VALUE;
    if (prec->apst == waveformPOST_Always)
        monitor_mask |= DBE_LOG;

    /* Calculate hash if we are interested in OnChange events. */
    if ((prec->mpst == waveformPOST_OnChange) ||
        (prec->apst == waveformPOST_OnChange)) {
        hash = epicsMemHash((char *)prec->bptr,
            prec->nord * dbValueSize(prec->ftvl), 0);

        /* Only post OnChange values if the hash is different. */
        if (hash != prec->hash) {
            if (prec->mpst == waveformPOST_OnChange)
                monitor_mask |= DBE_VALUE;
            if (prec->apst == waveformPOST_OnChange)
                monitor_mask |= DBE_LOG;

            /* Store hash for next process. */
            prec->hash = hash;
            /* Post HASH. */
            db_post_events(prec, &prec->hash, DBE_VALUE);
        }
    }

    if (monitor_mask) {
        db_post_events(prec, &prec->val, monitor_mask);
    }
}


std/rec/aaoRecord.c:static void monitor(aaoRecord *);
std/rec/aaoRecord.c:static void monitor(aaoRecord *prec)

static void monitor(aaoRecord *prec)
{
    unsigned short monitor_mask;
    unsigned int hash = 0;

    monitor_mask = recGblResetAlarms(prec);

    if (prec->mpst == aaoPOST_Always)
        monitor_mask |= DBE_VALUE;
    if (prec->apst == aaoPOST_Always)
        monitor_mask |= DBE_LOG;

    /* Calculate hash if we are interested in OnChange events. */
    if ((prec->mpst == aaoPOST_OnChange) ||
        (prec->apst == aaoPOST_OnChange)) {
        hash = epicsMemHash(prec->bptr,
            prec->nord * dbValueSize(prec->ftvl), 0);

        /* Only post OnChange values if the hash is different. */
        if (hash != prec->hash) {
            if (prec->mpst == aaoPOST_OnChange)
                monitor_mask |= DBE_VALUE;
            if (prec->apst == aaoPOST_OnChange)
                monitor_mask |= DBE_LOG;

            /* Store hash for next process. */
            prec->hash = hash;
            /* Post HASH. */
            db_post_events(prec, &prec->hash, DBE_VALUE);
        }
    }

    if (monitor_mask)
        db_post_events(prec, &prec->val, monitor_mask);
}


std/rec/stringinRecord.c:static void monitor(stringinRecord *);
std/rec/stringinRecord.c:static void monitor(stringinRecord *prec)


static void monitor(stringinRecord *prec)
{
    int monitor_mask = recGblResetAlarms(prec);
   //epicsUint16
   
    if (strncmp(prec->oval, prec->val, sizeof(prec->val))) {
        monitor_mask |= DBE_VALUE | DBE_LOG;
        strncpy(prec->oval, prec->val, sizeof(prec->val));
    }

    if (prec->mpst == stringinPOST_Always)
        monitor_mask |= DBE_VALUE;
    if (prec->apst == stringinPOST_Always)
        monitor_mask |= DBE_LOG;

    if (monitor_mask)
        db_post_events(prec, prec->val, monitor_mask);
}


std/rec/eventRecord.c:static void monitor(eventRecord *);
std/rec/eventRecord.c:static void monitor(eventRecord *prec)

static void monitor(eventRecord *prec)
{
    unsigned short  monitor_mask;
   //epicsUint16
    /* get previous stat and sevr  and new stat and sevr*/
    monitor_mask = recGblResetAlarms(prec);
    db_post_events(prec,&prec->val,monitor_mask|DBE_VALUE);
    return;
}



std/rec/stateRecord.c:static void monitor(stateRecord *);
std/rec/stateRecord.c:static void monitor(stateRecord *prec)

static void monitor(stateRecord *prec)
{
    unsigned short  monitor_mask;
  //epicsUint16
    /* get previous stat and sevr  and new stat and sevr*/
    monitor_mask = recGblResetAlarms(prec);
    if(strncmp(prec->oval,prec->val,sizeof(prec->val))) {
        db_post_events(prec,&(prec->val[0]),monitor_mask|DBE_VALUE|DBE_LOG);
        strncpy(prec->oval,prec->val,sizeof(prec->val));
    }
    return;
}

std/rec/selRecord.c:static void monitor(selRecord *);
std/rec/selRecord.c:static void monitor(selRecord *prec)

static void monitor(selRecord *prec)
{
    unsigned    monitor_mask;
    double              *pnew;
    double              *pprev;
    int                 i;

    monitor_mask = recGblResetAlarms(prec);

    /* check for value change */
    recGblCheckDeadband(&prec->mlst, prec->val, prec->mdel, &monitor_mask, DBE_VALUE);

    /* check for archive change */
    recGblCheckDeadband(&prec->alst, prec->val, prec->adel, &monitor_mask, DBE_ARCHIVE);

    /* send out monitors connected to the value field */
    if (monitor_mask)
        db_post_events(prec, &prec->val, monitor_mask);

    monitor_mask |= DBE_VALUE|DBE_LOG;

    /* trigger monitors of the SELN field */
    if (prec->nlst != prec->seln) {
        prec->nlst = prec->seln;
        db_post_events(prec, &prec->seln, monitor_mask);
    }

    /* check all input fields for changes, even if VAL hasn't changed */
    for(i=0, pnew=&prec->a, pprev=&prec->la; i<SEL_MAX; i++, pnew++, pprev++) {
        if(*pnew != *pprev) {
            db_post_events(prec, pnew, monitor_mask);
            *pprev = *pnew;
        }
    }
    return;
}


std/rec/aSubRecord.c:static void monitor(aSubRecord *);
std/rec/aSubRecord.c:static void monitor(aSubRecord *prec)

static void monitor(aSubRecord *prec)
{
    int            i;
    unsigned short monitor_mask;

    monitor_mask = recGblResetAlarms(prec) | DBE_VALUE | DBE_LOG;

    /* Post events for VAL field */
    if (prec->val != prec->oval) {
        db_post_events(prec, &prec->val, monitor_mask);
        prec->oval = prec->val;
    }

    /* Event posting on VAL arrays depends on the setting of prec->eflg */
    switch (prec->eflg) {
    case aSubEFLG_NEVER:
        break;
    case aSubEFLG_ON_CHANGE:
        for (i = 0; i < NUM_ARGS; i++) {
            void *povl = (&prec->ovla)[i];
            void *pval = (&prec->vala)[i];
            epicsUInt32 *ponv = &(&prec->onva)[i];
            epicsUInt32 *pnev = &(&prec->neva)[i];
            epicsUInt32 onv = *ponv;    /* Num Elements in OVLx */
            epicsUInt32 nev = *pnev;    /* Num Elements in VALx */
            epicsUInt32 alen = dbValueSize((&prec->ftva)[i]) * nev;

            if (nev != onv || memcmp(povl, pval, alen)) {
                memcpy(povl, pval, alen);
                db_post_events(prec, pval, monitor_mask);
                if (nev != onv) {
                    *ponv = nev;
                    db_post_events(prec, pnev, monitor_mask);
                }
            }
        }
        break;
    case aSubEFLG_ALWAYS:
        for (i = 0; i < NUM_ARGS; i++) {
            db_post_events(prec, (&prec->vala)[i], monitor_mask);
            db_post_events(prec, &(&prec->neva)[i], monitor_mask);
        }
        break;
    }
    return;
}



std/rec/mbbiDirectRecord.c:static void monitor(mbbiDirectRecord *);
std/rec/mbbiDirectRecord.c:static void monitor(mbbiDirectRecord *prec)

static void monitor(mbbiDirectRecord *prec)
{
    epicsUInt16 events = recGblResetAlarms(prec);
    epicsUInt16 vl_events = events | DBE_VALUE | DBE_LOG;
    epicsUInt16 val = prec->val;
    epicsUInt8 *pBn = &prec->b0;
    int i;

    /* Update B0 - BF from VAL and post monitors */
    for (i = 0; i < NUM_BITS; i++, pBn++, val >>= 1) {
        epicsUInt8 oBn = *pBn;

        *pBn = !! (val & 1);
        if (oBn != *pBn)
            db_post_events(prec, pBn, vl_events);
        else if (events)
            db_post_events(prec, pBn, events);
    }

    if (prec->mlst != prec->val) {
        events = vl_events;
        prec->mlst = prec->val;
    }
    if (events)
        db_post_events(prec, &prec->val, events);

    if (prec->oraw != prec->rval) {
        db_post_events(prec, &prec->rval, vl_events);
        prec->oraw = prec->rval;
    }
}



std/rec/lsiRecord.c:static void monitor(lsiRecord *);
std/rec/lsiRecord.c:static void monitor(lsiRecord *prec)

static void monitor(lsiRecord *prec)
{
    epicsUInt16 events = recGblResetAlarms(prec);

    if (prec->len != prec->olen ||
        memcmp(prec->oval, prec->val, prec->len)) {
        events |= DBE_VALUE | DBE_LOG;
        memcpy(prec->oval, prec->val, prec->len);
    }

    if (prec->len != prec->olen) {
        prec->olen = prec->len;
        db_post_events(prec, &prec->len, DBE_VALUE | DBE_LOG);
    }

    if (prec->mpst == menuPost_Always)
        events |= DBE_VALUE;
    if (prec->apst == menuPost_Always)
        events |= DBE_LOG;

    if (events)
        db_post_events(prec, prec->val, events);
}


std/rec/stringoutRecord.c:static void monitor(stringoutRecord *);
std/rec/stringoutRecord.c:static void monitor(stringoutRecord *prec)

static void monitor(stringoutRecord *prec)
{
    int monitor_mask = recGblResetAlarms(prec);

    if (strncmp(prec->oval, prec->val, sizeof(prec->val))) {
        monitor_mask |= DBE_VALUE | DBE_LOG;
        strncpy(prec->oval, prec->val, sizeof(prec->val));
    }

    if (prec->mpst == stringoutPOST_Always)
        monitor_mask |= DBE_VALUE;
    if (prec->apst == stringoutPOST_Always)
        monitor_mask |= DBE_LOG;

    if (monitor_mask)
        db_post_events(prec, prec->val, monitor_mask);
}



std/rec/histogramRecord.c:static void monitor(histogramRecord *);
std/rec/histogramRecord.c:static void monitor(histogramRecord *prec)

static void monitor(histogramRecord *prec)
{
    unsigned short monitor_mask = recGblResetAlarms(prec);

    /* post events for count change */
    if (prec->mcnt > prec->mdel){
        monitor_mask |= DBE_VALUE | DBE_LOG;
        /* reset counts since monitor */
        prec->mcnt = 0;
    }
    /* send out monitors connected to the value field */
    if (monitor_mask)
        db_post_events(prec, prec->bptr, monitor_mask);

    return;
}



std/rec/mbboRecord.c:static void monitor(mbboRecord *);
std/rec/mbboRecord.c:static void monitor(mbboRecord *prec)


static void monitor(mbboRecord *prec)
{
    epicsUInt16 events = recGblResetAlarms(prec);

    if (prec->mlst != prec->val) {
        events |= DBE_VALUE | DBE_LOG;
        prec->mlst = prec->val;
    }
    if (events)
        db_post_events(prec, &prec->val, events);

    events |= DBE_VALUE | DBE_LOG;
    if (prec->oraw != prec->rval) {
        db_post_events(prec, &prec->rval, events);
        prec->oraw = prec->rval;
    }
    if (prec->orbv != prec->rbv) {
        db_post_events(prec, &prec->rbv, events);
        prec->orbv = prec->rbv;
    }
}


std/rec/biRecord.c:static void monitor(biRecord *);
std/rec/biRecord.c:static void monitor(biRecord *prec)

static void monitor(biRecord *prec)
{
        unsigned short  monitor_mask;

        monitor_mask = recGblResetAlarms(prec);
        /* check for value change */
        if (prec->mlst != prec->val){
                /* post events for value change and archive change */
                monitor_mask |= (DBE_VALUE | DBE_LOG);
                /* update last value monitored */
                prec->mlst = prec->val;
        }

        /* send out monitors connected to the value field */
        if (monitor_mask){
                db_post_events(prec,&prec->val,monitor_mask);
        }
        if(prec->oraw!=prec->rval) {
                db_post_events(prec,&prec->rval,
                    monitor_mask|DBE_VALUE|DBE_LOG);
                prec->oraw = prec->rval;
        }
        return;
}



std/rec/lsoRecord.c:static void monitor(lsoRecord *);
std/rec/lsoRecord.c:static void monitor(lsoRecord *prec)

static void monitor(lsoRecord *prec)
{
    epicsUInt16 events = recGblResetAlarms(prec);

    if (prec->len != prec->olen ||
        memcmp(prec->oval, prec->val, prec->len)) {
        events |= DBE_VALUE | DBE_LOG;
        memcpy(prec->oval, prec->val, prec->len);
    }

    if (prec->len != prec->olen) {
        prec->olen = prec->len;
        db_post_events(prec, &prec->len, DBE_VALUE | DBE_LOG);
    }

    if (prec->mpst == menuPost_Always)
        events |= DBE_VALUE;
    if (prec->apst == menuPost_Always)
        events |= DBE_LOG;

    if (events)
        db_post_events(prec, prec->val, events);
}

std/rec/subRecord.c:static void monitor(subRecord *);
std/rec/subRecord.c:static void monitor(subRecord *prec)

static void monitor(subRecord *prec)
{
    unsigned monitor_mask;
    double *pnew;
    double *pold;
    int i;

    /* get alarm mask */
    monitor_mask = recGblResetAlarms(prec);

    /* check for value change */
    recGblCheckDeadband(&prec->mlst, prec->val, prec->mdel, &monitor_mask, DBE_VALUE);

    /* check for archive change */
    recGblCheckDeadband(&prec->alst, prec->val, prec->adel, &monitor_mask, DBE_ARCHIVE);

    /* send out monitors connected to the value field */
    if (monitor_mask) {
        db_post_events(prec, &prec->val, monitor_mask);
    }

    /* check all input fields for changes */
    for (i = 0, pnew = &prec->a, pold = &prec->la;
         i < INP_ARG_MAX; i++, pnew++, pold++) {
        if (*pnew != *pold) {
            db_post_events(prec, pnew, monitor_mask | DBE_VALUE | DBE_LOG);
            *pold = *pnew;
        }
    }
    return;
}



std/rec/calcRecord.c:static void monitor(calcRecord *prec);
std/rec/calcRecord.c:static void monitor(calcRecord *prec)


static void monitor(calcRecord *prec)
{
    unsigned monitor_mask;
    double *pnew, *pprev;
    int i;

    monitor_mask = recGblResetAlarms(prec);

    /* check for value change */
    recGblCheckDeadband(&prec->mlst, prec->val, prec->mdel, &monitor_mask, DBE_VALUE);

    /* check for archive change */
    recGblCheckDeadband(&prec->alst, prec->val, prec->adel, &monitor_mask, DBE_ARCHIVE);

    /* send out monitors connected to the value field */
    if (monitor_mask){
        db_post_events(prec, &prec->val, monitor_mask);
    }

    /* check all input fields for changes*/
    pnew = &prec->a;
    pprev = &prec->la;
    for (i = 0; i < CALCPERFORM_NARGS; i++, pnew++, pprev++) {
        if (*pnew != *pprev ||
            monitor_mask & DBE_ALARM) {
            db_post_events(prec, pnew, monitor_mask | DBE_VALUE | DBE_LOG);
            *pprev = *pnew;
        }
    }
    return;
}


template/base/top/exampleApp/src/xxxRecord.c:static void monitor(xxxRecord *prec);
template/base/top/exampleApp/src/xxxRecord.c:static void monitor(xxxRecord *prec)



static void monitor(xxxRecord *prec)
{
        unsigned short  monitor_mask;
        double          delta;

        monitor_mask = recGblResetAlarms(prec);
        /* check for value change */
        delta = prec->mlst - prec->val;
        if(delta<0.0) delta = -delta;
        if (delta > prec->mdel) {
                /* post events for value change */
                monitor_mask |= DBE_VALUE;
                /* update last value monitored */
                prec->mlst = prec->val;
        }

        /* check for archive change */
        delta = prec->alst - prec->val;
        if(delta<0.0) delta = -delta;
        if (delta > prec->adel) {
                /* post events on value field for archive change */
                monitor_mask |= DBE_LOG;
                /* update last archive value monitored */
                prec->alst = prec->val;
        }

        /* send out monitors connected to the value field */
        if (monitor_mask){
                db_post_events(prec,&prec->val,monitor_mask);
        }
        return;
}
```



Replies:
Re: Data types in monitor function Jeong Han Lee
Re: Data types in monitor function Andrew Johnson

Navigate by Date:
Prev: Control System Job Opening at PSI, Switzerland Simon Rees
Next: CSS Service Panel gennaro.tortone@na.infn.it
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
Navigate by Thread:
Prev: Control System Job Opening at PSI, Switzerland Simon Rees
Next: Re: Data types in monitor function Jeong Han Lee
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
ANJ, 24 Apr 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·