37 #include "menuYesNo.h" 39 #define GEN_SIZE_OFFSET 40 #include "stringoutRecord.h" 41 #undef GEN_SIZE_OFFSET 46 #define initialize NULL 48 static long process(
struct dbCommon *);
49 static long special(DBADDR *,
int);
50 #define get_value NULL 51 #define cvt_dbaddr NULL 52 #define get_array_info NULL 53 #define put_array_info NULL 54 #define get_units NULL 55 #define get_precision NULL 56 #define get_enum_str NULL 57 #define get_enum_strs NULL 58 #define put_enum_str NULL 59 #define get_graphic_double NULL 60 #define get_control_double NULL 61 #define get_alarm_double NULL 85 static void monitor(stringoutRecord *);
86 static long writeValue(stringoutRecord *);
89 static long init_record(
struct dbCommon *pcommon,
int pass)
91 struct stringoutRecord *
prec = (
struct stringoutRecord *)pcommon;
94 stringoutdset *pdset = (stringoutdset *) prec->dset;
96 if (pass == 0)
return 0;
98 recGblInitSimm(pcommon, &prec->sscn, &prec->oldsimm, &prec->simm, &prec->siml);
101 recGblRecordError(
S_dev_noDSET, prec,
"stringout: init_record");
106 if ((pdset->common.number < 5) || (pdset->write_stringout ==
NULL)) {
112 if (recGblInitConstantLink(&prec->dol,
DBF_STRING, prec->val))
115 if (pdset->common.init_record) {
116 long status = pdset->common.init_record(pcommon);
121 strncpy(prec->oval, prec->val,
sizeof(prec->oval));
125 static long process(
struct dbCommon *pcommon)
127 struct stringoutRecord *
prec = (
struct stringoutRecord *)pcommon;
128 stringoutdset *pdset = (stringoutdset *)(prec->dset);
130 unsigned char pact=prec->pact;
132 if( (pdset==
NULL) || (pdset->write_stringout==
NULL) ) {
138 !dbLinkIsConstant(&prec->dol) &&
139 prec->omsl == menuOmslclosed_loop) {
140 status = dbGetLink(&prec->dol,
DBR_STRING, prec->val, 0, 0);
141 if (!dbLinkIsConstant(&prec->dol) && !status)
145 if(prec->udf ==
TRUE ){
146 recGblSetSevr(prec,
UDF_ALARM,prec->udfs);
150 status=writeValue(prec);
152 switch (prec->ivoa) {
153 case (menuIvoaContinue_normally) :
154 status=writeValue(prec);
156 case (menuIvoaDon_t_drive_outputs) :
158 case (menuIvoaSet_output_to_IVOV) :
159 if(prec->pact ==
FALSE){
160 strncpy(prec->val, prec->ivov,
sizeof(prec->val));
162 status=writeValue(prec);
166 recGblRecordError(S_db_badField,(
void *)prec,
167 "stringout:process Illegal IVOA field");
172 if ( !pact && prec->pact )
return(0);
175 recGblGetTimeStampSimm(prec, prec->simm,
NULL);
183 static long special(DBADDR *paddr,
int after)
185 stringoutRecord *
prec = (stringoutRecord *)(paddr->precord);
186 int special_type = paddr->special;
188 switch(special_type) {
190 if (dbGetFieldIndex(paddr) == stringoutRecordSIMM) {
192 recGblSaveSimm(prec->sscn, &prec->oldsimm, prec->simm);
194 recGblCheckSimm((dbCommon *)prec, &prec->sscn, prec->oldsimm, prec->simm);
198 recGblDbaddrError(S_db_badChoice, paddr,
"stringout: special");
199 return(S_db_badChoice);
203 static void monitor(stringoutRecord *
prec)
205 int monitor_mask = recGblResetAlarms(prec);
207 if (strncmp(prec->oval, prec->val,
sizeof(prec->val))) {
209 strncpy(prec->oval, prec->val,
sizeof(prec->oval));
212 if (prec->mpst == stringoutPOST_Always)
214 if (prec->apst == stringoutPOST_Always)
218 db_post_events(prec, prec->val, monitor_mask);
221 static long writeValue(stringoutRecord *
prec)
223 stringoutdset *pdset = (stringoutdset *) prec->dset;
227 status = recGblGetSimm((dbCommon *)prec, &prec->sscn, &prec->oldsimm, &prec->simm, &prec->siml);
231 switch (prec->simm) {
233 status = pdset->write_stringout(prec);
238 if (prec->pact || (prec->sdly < 0.)) {
242 epicsCallback *pvt = prec->simpvt;
244 pvt = calloc(1,
sizeof(epicsCallback));
247 if (pvt) callbackRequestProcessCallbackDelayed(pvt, prec->prio, prec, prec->sdly);
Miscellaneous macro definitions.
#define get_graphic_double
#define STATIC_ASSERT(expr)
Declare a condition that should be true at compile-time.
epicsExportAddress(rset, stringoutRSET)
#define get_control_double