EPICS Base  7.0.6.1
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dbLink.h
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2010 The UChicago Argonne LLC, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * SPDX-License-Identifier: EPICS
7 * EPICS BASE is distributed subject to a Software License Agreement found
8 * in file LICENSE that is included with this distribution.
9 \*************************************************************************/
10 /* dbLink.h
11  *
12  * Created on: Mar 21, 2010
13  * Author: Andrew Johnson
14  */
15 
16 #ifndef INC_dbLink_H
17 #define INC_dbLink_H
18 
19 #include "link.h"
20 #include "dbCoreAPI.h"
21 #include "epicsTypes.h"
22 #include "epicsTime.h"
23 #include "dbAddr.h"
24 #include "dbChannel.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 struct dbLocker;
31 
49 typedef long (*dbLinkUserCallback)(struct link *plink, void *priv);
50 
59 typedef struct lset {
60  /* Characteristics of the link type */
61 
68  const unsigned isConstant:1;
69 
74  const unsigned isVolatile:1;
75 
82  void (*openLink)(struct link *plink);
83 
92  void (*removeLink)(struct dbLocker *locker, struct link *plink);
93 
94  /* Constant link initialization and data type hinting */
95 
109  long (*loadScalar)(struct link *plink, short dbrType, void *pbuffer);
110 
125  long (*loadLS)(struct link *plink, char *pbuffer, epicsUInt32 size,
126  epicsUInt32 *plen);
127 
143  long (*loadArray)(struct link *plink, short dbrType, void *pbuffer,
144  long *pnRequest);
145 
146  /* Metadata */
147 
157  int (*isConnected)(const struct link *plink);
158 
170  int (*getDBFtype)(const struct link *plink);
171 
172  /* Get data */
173 
184  long (*getElements)(const struct link *plink, long *pnElements);
185 
201  long (*getValue)(struct link *plink, short dbrType, void *pbuffer,
202  long *pnRequest);
203 
216  long (*getControlLimits)(const struct link *plink, double *lo, double *hi);
217 
230  long (*getGraphicLimits)(const struct link *plink, double *lo, double *hi);
231 
246  long (*getAlarmLimits)(const struct link *plink, double *lolo, double *lo,
247  double *hi, double *hihi);
248 
259  long (*getPrecision)(const struct link *plink, short *precision);
260 
272  long (*getUnits)(const struct link *plink, char *units, int unitsSize);
273 
286  long (*getAlarm)(const struct link *plink, epicsEnum16 *status,
287  epicsEnum16 *severity);
288 
299  long (*getTimeStamp)(const struct link *plink, epicsTimeStamp *pstamp);
300 
301  /* Put data */
302 
314  long (*putValue)(struct link *plink, short dbrType,
315  const void *pbuffer, long nRequest);
316 
331  long (*putAsync)(struct link *plink, short dbrType,
332  const void *pbuffer, long nRequest);
333 
334  /* Process */
335 
346  void (*scanForward)(struct link *plink);
347 
348  /* Atomicity */
349 
363  long (*doLocked)(struct link *plink, dbLinkUserCallback rtn, void *priv);
364 
376  long (*getAlarmMsg)(const struct link *plink, epicsEnum16 *status,
377  epicsEnum16 *severity, char *msgbuf, size_t msgbuflen);
378 
386  long (*getTimeStampTag)(const struct link *plink, epicsTimeStamp *pstamp, epicsUTag *ptag);
387 } lset;
388 
389 #define dbGetSevr(link, sevr) \
390  dbGetAlarm(link, NULL, sevr)
391 
392 DBCORE_API const char * dbLinkFieldName(const struct link *plink);
393 
394 DBCORE_API void dbInitLink(struct link *plink, short dbfType);
395 DBCORE_API void dbAddLink(struct dbLocker *locker, struct link *plink,
396  short dbfType, dbChannel *ptarget);
397 
398 DBCORE_API void dbLinkOpen(struct link *plink);
399 DBCORE_API void dbRemoveLink(struct dbLocker *locker, struct link *plink);
400 
401 DBCORE_API int dbLinkIsDefined(const struct link *plink); /* 0 or 1 */
402 DBCORE_API int dbLinkIsConstant(const struct link *plink); /* 0 or 1 */
403 DBCORE_API int dbLinkIsVolatile(const struct link *plink); /* 0 or 1 */
404 
405 DBCORE_API long dbLoadLink(struct link *plink, short dbrType,
406  void *pbuffer);
407 DBCORE_API long dbLoadLinkArray(struct link *, short dbrType, void *pbuffer,
408  long *pnRequest);
409 
410 DBCORE_API long dbGetNelements(const struct link *plink, long *pnElements);
411 DBCORE_API int dbIsLinkConnected(const struct link *plink); /* 0 or 1 */
412 DBCORE_API int dbGetLinkDBFtype(const struct link *plink);
413 DBCORE_API long dbTryGetLink(struct link *, short dbrType, void *pbuffer,
414  long *nRequest);
415 DBCORE_API long dbGetLink(struct link *, short dbrType, void *pbuffer,
416  long *options, long *nRequest);
417 DBCORE_API long dbGetControlLimits(const struct link *plink, double *low,
418  double *high);
419 DBCORE_API long dbGetGraphicLimits(const struct link *plink, double *low,
420  double *high);
421 DBCORE_API long dbGetAlarmLimits(const struct link *plink, double *lolo,
422  double *low, double *high, double *hihi);
423 DBCORE_API long dbGetPrecision(const struct link *plink, short *precision);
424 DBCORE_API long dbGetUnits(const struct link *plink, char *units,
425  int unitsSize);
426 DBCORE_API long dbGetAlarm(const struct link *plink, epicsEnum16 *status,
427  epicsEnum16 *severity);
433 DBCORE_API long dbGetAlarmMsg(const struct link *plink, epicsEnum16 *status,
434  epicsEnum16 *severity, char *msgbuf, size_t msgbuflen);
435 #define dbGetAlarmMsg(LINK, STAT, SEVR, BUF, BUFLEN) dbGetAlarmMsg(LINK, STAT, SEVR, BUF, BUFLEN)
436 DBCORE_API long dbGetTimeStamp(const struct link *plink,
437  epicsTimeStamp *pstamp);
439 DBCORE_API long dbGetTimeStampTag(const struct link *plink,
440  epicsTimeStamp *pstamp, epicsUTag *ptag);
441 #define dbGetTimeStampTag(LINK, STAMP, TAG) dbGetTimeStampTag(LINK, STAMP, TAG)
442 DBCORE_API long dbPutLink(struct link *plink, short dbrType,
443  const void *pbuffer, long nRequest);
444 DBCORE_API void dbLinkAsyncComplete(struct link *plink);
445 DBCORE_API long dbPutLinkAsync(struct link *plink, short dbrType,
446  const void *pbuffer, long nRequest);
447 DBCORE_API void dbScanFwdLink(struct link *plink);
448 
449 DBCORE_API long dbLinkDoLocked(struct link *plink, dbLinkUserCallback rtn,
450  void *priv);
451 
452 DBCORE_API long dbLoadLinkLS(struct link *plink, char *pbuffer,
453  epicsUInt32 size, epicsUInt32 *plen);
454 DBCORE_API long dbGetLinkLS(struct link *plink, char *pbuffer,
455  epicsUInt32 buffer_size, epicsUInt32 *plen);
456 DBCORE_API long dbPutLinkLS(struct link *plink, char *pbuffer,
457  epicsUInt32 len);
458 
459 #ifdef __cplusplus
460 }
461 #endif
462 
463 #endif /* INC_dbLink_H */
long(* getUnits)(const struct link *plink, char *units, int unitsSize)
get the units string from an input link
Definition: dbLink.h:272
epicsUInt64 epicsUTag
Type of UTAG field (dbCommon::utag)
Definition: epicsTime.h:49
long(* getControlLimits)(const struct link *plink, double *lo, double *hi)
get the control range for an output link
Definition: dbLink.h:216
long(* getAlarmLimits)(const struct link *plink, double *lolo, double *lo, double *hi, double *hihi)
get the alarm limits from an input link
Definition: dbLink.h:246
long(* getGraphicLimits)(const struct link *plink, double *lo, double *hi)
get the display range from an input link
Definition: dbLink.h:230
long(* getElements)(const struct link *plink, long *pnElements)
get array size of an input link
Definition: dbLink.h:184
void(* removeLink)(struct dbLocker *locker, struct link *plink)
deactivate link
Definition: dbLink.h:92
The core data types used by epics.
long(* putValue)(struct link *plink, short dbrType, const void *pbuffer, long nRequest)
put a value to an output link
Definition: dbLink.h:314
const unsigned isVolatile
link volatility
Definition: dbLink.h:74
long(* loadScalar)(struct link *plink, short dbrType, void *pbuffer)
load constant scalar from link type
Definition: dbLink.h:109
long(* getTimeStampTag)(const struct link *plink, epicsTimeStamp *pstamp, epicsUTag *ptag)
Extended version of getTimeStamp.
Definition: dbLink.h:386
long(* getAlarmMsg)(const struct link *plink, epicsEnum16 *status, epicsEnum16 *severity, char *msgbuf, size_t msgbuflen)
Extended version of getAlarm.
Definition: dbLink.h:376
int(* getDBFtype)(const struct link *plink)
get data type of link destination
Definition: dbLink.h:170
long(* getAlarm)(const struct link *plink, epicsEnum16 *status, epicsEnum16 *severity)
get the alarm condition from an input link
Definition: dbLink.h:286
long(* loadLS)(struct link *plink, char *pbuffer, epicsUInt32 size, epicsUInt32 *plen)
load constant long string from link type
Definition: dbLink.h:125
long(* getTimeStamp)(const struct link *plink, epicsTimeStamp *pstamp)
get the time-stamp from an input link
Definition: dbLink.h:299
EPICS time stamp, for use from C code.
Definition: epicsTime.h:42
long(* getValue)(struct link *plink, short dbrType, void *pbuffer, long *pnRequest)
get value from an input link
Definition: dbLink.h:201
long(* loadArray)(struct link *plink, short dbrType, void *pbuffer, long *pnRequest)
load constant array from link type
Definition: dbLink.h:143
void(* scanForward)(struct link *plink)
trigger processing of a forward link
Definition: dbLink.h:346
int(* isConnected)(const struct link *plink)
return link connection status
Definition: dbLink.h:157
long(* getPrecision)(const struct link *plink, short *precision)
get the precision from an input link
Definition: dbLink.h:259
Link Support Entry Table.
Definition: dbLink.h:59
EPICS time-stamps (epicsTimeStamp), epicsTime C++ class and C functions for handling wall-clock times...
const unsigned isConstant
link constancy
Definition: dbLink.h:68
void(* openLink)(struct link *plink)
activate link
Definition: dbLink.h:82
long(* doLocked)(struct link *plink, dbLinkUserCallback rtn, void *priv)
execute a callback routine with link locked
Definition: dbLink.h:363
long(* putAsync)(struct link *plink, short dbrType, const void *pbuffer, long nRequest)
put a value to an output link with asynchronous completion
Definition: dbLink.h:331