Merged Dirk Zimoch's named-soft-events branch
Added the iocsh command postEvent Marked a couple of char * args as const
This commit is contained in:
@@ -51,7 +51,7 @@ static long init_record(eventRecord *prec)
|
||||
/* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/
|
||||
switch (prec->inp.type) {
|
||||
case CONSTANT:
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_USHORT, &prec->val))
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_STRING, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
break;
|
||||
case PV_LINK:
|
||||
@@ -69,13 +69,20 @@ static long init_record(eventRecord *prec)
|
||||
static long read_event(eventRecord *prec)
|
||||
{
|
||||
long status;
|
||||
char newEvent[MAX_STRING_SIZE];
|
||||
|
||||
status = dbGetLink(&prec->inp, DBR_USHORT, &prec->val, 0, 0);
|
||||
if (!status) {
|
||||
prec->udf = FALSE;
|
||||
if (prec->tsel.type == CONSTANT &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
if (prec->inp.type != CONSTANT)
|
||||
{
|
||||
status = dbGetLinkValue(&prec->inp, DBR_STRING, newEvent, 0, 0);
|
||||
if (status) return status;
|
||||
if (strcmp(newEvent, prec->val) != 0) {
|
||||
strcpy(prec->val, newEvent);
|
||||
prec->epvt = eventNameToHandle(prec->val);
|
||||
}
|
||||
}
|
||||
return status;
|
||||
prec->udf = FALSE;
|
||||
if (prec->tsel.type == CONSTANT &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -197,6 +197,8 @@ static long init_record(calcoutRecord *prec, int pass)
|
||||
callbackSetUser(prec, &prpvt->checkLinkCb);
|
||||
prpvt->cbScheduled = 0;
|
||||
|
||||
prec->epvt = eventNameToHandle(prec->oevt);
|
||||
|
||||
if (pcalcoutDSET->init_record) pcalcoutDSET->init_record(prec);
|
||||
prec->pval = prec->val;
|
||||
prec->mlst = prec->val;
|
||||
@@ -360,6 +362,9 @@ static long special(DBADDR *paddr, int after)
|
||||
}
|
||||
db_post_events(prec, plinkValid, DBE_VALUE);
|
||||
return 0;
|
||||
case(calcoutRecordOEVT):
|
||||
prec->epvt = eventNameToHandle(prec->oevt);
|
||||
return 0;
|
||||
default:
|
||||
recGblDbaddrError(S_db_badChoice, paddr, "calc: special");
|
||||
return(S_db_badChoice);
|
||||
@@ -543,27 +548,21 @@ static void execOutput(calcoutRecord *prec)
|
||||
if (prec->nsev < INVALID_ALARM ) {
|
||||
/* Output the value */
|
||||
status = writeValue(prec);
|
||||
/* post event if output event != 0 */
|
||||
if (prec->oevt > 0) {
|
||||
post_event((int)prec->oevt);
|
||||
}
|
||||
/* post output event if set */
|
||||
if (prec->epvt) postEvent(prec->epvt);
|
||||
} else switch (prec->ivoa) {
|
||||
case menuIvoaContinue_normally:
|
||||
status = writeValue(prec);
|
||||
/* post event if output event != 0 */
|
||||
if (prec->oevt > 0) {
|
||||
post_event((int)prec->oevt);
|
||||
}
|
||||
/* post output event if set */
|
||||
if (prec->epvt) postEvent(prec->epvt);
|
||||
break;
|
||||
case menuIvoaDon_t_drive_outputs:
|
||||
break;
|
||||
case menuIvoaSet_output_to_IVOV:
|
||||
prec->oval = prec->ivov;
|
||||
status = writeValue(prec);
|
||||
/* post event if output event != 0 */
|
||||
if (prec->oevt > 0) {
|
||||
post_event((int)prec->oevt);
|
||||
}
|
||||
/* post output event if set */
|
||||
if (prec->epvt) postEvent(prec->epvt);
|
||||
break;
|
||||
default:
|
||||
status = -1;
|
||||
|
||||
@@ -255,10 +255,19 @@ recordtype(calcout) {
|
||||
prompt("OCAL Valid")
|
||||
interest(1)
|
||||
}
|
||||
field(OEVT,DBF_USHORT) {
|
||||
field(OEVT,DBF_STRING) {
|
||||
prompt("Event To Issue")
|
||||
promptgroup(GUI_CLOCK)
|
||||
special(SPC_MOD)
|
||||
asl(ASL0)
|
||||
size(40)
|
||||
}
|
||||
%#include "dbScan.h"
|
||||
field(EPVT, DBF_NOACCESS) {
|
||||
prompt("Event private")
|
||||
special(SPC_NOMOD)
|
||||
interest(4)
|
||||
extra("EVENTPVT epvt")
|
||||
}
|
||||
field(IVOA,DBF_MENU) {
|
||||
prompt("INVALID output action")
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "errMdef.h"
|
||||
#include "recSup.h"
|
||||
#include "recGbl.h"
|
||||
#include "special.h"
|
||||
#include "menuYesNo.h"
|
||||
#define GEN_SIZE_OFFSET
|
||||
#include "eventRecord.h"
|
||||
@@ -43,7 +44,7 @@
|
||||
#define initialize NULL
|
||||
static long init_record(eventRecord *, int);
|
||||
static long process(eventRecord *);
|
||||
#define special NULL
|
||||
static long special(DBADDR *, int);
|
||||
static long get_value(eventRecord *, struct valueDes *);
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
@@ -103,9 +104,11 @@ static long init_record(eventRecord *prec, int pass)
|
||||
}
|
||||
|
||||
if (prec->siol.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->siol,DBF_USHORT,&prec->sval);
|
||||
recGblInitConstantLink(&prec->siol,DBF_STRING,&prec->sval);
|
||||
}
|
||||
|
||||
prec->epvt = eventNameToHandle(prec->val);
|
||||
|
||||
if( (pdset=(struct eventdset *)(prec->dset)) && (pdset->init_record) )
|
||||
status=(*pdset->init_record)(prec);
|
||||
return(status);
|
||||
@@ -123,7 +126,7 @@ static long process(eventRecord *prec)
|
||||
if ( !pact && prec->pact ) return(0);
|
||||
prec->pact = TRUE;
|
||||
|
||||
if(prec->val>0) post_event((int)prec->val);
|
||||
postEvent(prec->epvt);
|
||||
|
||||
recGblGetTimeStamp(prec);
|
||||
|
||||
@@ -137,10 +140,22 @@ static long process(eventRecord *prec)
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
static long special(DBADDR *paddr, int after)
|
||||
{
|
||||
eventRecord *prec = (eventRecord *)paddr->precord;
|
||||
|
||||
if (!after) return 0;
|
||||
if (dbGetFieldIndex(paddr) == eventRecordVAL) {
|
||||
prec->epvt = eventNameToHandle(prec->val);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static long get_value(eventRecord *prec, struct valueDes *pvdes)
|
||||
{
|
||||
pvdes->field_type = DBF_USHORT;
|
||||
pvdes->field_type = DBF_STRING;
|
||||
pvdes->no_elements=1;
|
||||
pvdes->pvalue = (void *)(&prec->val);
|
||||
return(0);
|
||||
@@ -177,10 +192,13 @@ static long readValue(eventRecord *prec)
|
||||
return(status);
|
||||
}
|
||||
if (prec->simm == menuYesNoYES){
|
||||
status=dbGetLink(&(prec->siol),DBR_USHORT,
|
||||
status=dbGetLink(&(prec->siol),DBR_STRING,
|
||||
&(prec->sval),0,0);
|
||||
if (status==0) {
|
||||
prec->val=prec->sval;
|
||||
if (strcmp(prec->sval, prec->val) != 0) {
|
||||
strcpy(prec->val, prec->sval);
|
||||
prec->epvt = eventNameToHandle(prec->val);
|
||||
}
|
||||
prec->udf=FALSE;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -9,10 +9,19 @@
|
||||
#*************************************************************************
|
||||
recordtype(event) {
|
||||
include "dbCommon.dbd"
|
||||
field(VAL,DBF_USHORT) {
|
||||
prompt("Event Number To Post")
|
||||
field(VAL,DBF_STRING) {
|
||||
prompt("Event Name To Post")
|
||||
promptgroup(GUI_INPUTS)
|
||||
special(SPC_MOD)
|
||||
asl(ASL0)
|
||||
size(40)
|
||||
}
|
||||
%#include "dbScan.h"
|
||||
field(EPVT, DBF_NOACCESS) {
|
||||
prompt("Event private")
|
||||
special(SPC_NOMOD)
|
||||
interest(4)
|
||||
extra("EVENTPVT epvt")
|
||||
}
|
||||
field(INP,DBF_INLINK) {
|
||||
prompt("Input Specification")
|
||||
@@ -24,8 +33,9 @@ recordtype(event) {
|
||||
promptgroup(GUI_INPUTS)
|
||||
interest(1)
|
||||
}
|
||||
field(SVAL,DBF_USHORT) {
|
||||
field(SVAL,DBF_STRING) {
|
||||
prompt("Simulation Value")
|
||||
size(40)
|
||||
}
|
||||
field(SIML,DBF_INLINK) {
|
||||
prompt("Sim Mode Location")
|
||||
|
||||
Reference in New Issue
Block a user