EPICS Base  7.0.8.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 
365  long (*doLocked)(struct link *plink, dbLinkUserCallback rtn, void *priv);
366 
378  long (*getAlarmMsg)(const struct link *plink, epicsEnum16 *status,
379  epicsEnum16 *severity, char *msgbuf, size_t msgbuflen);
380 
388  long (*getTimeStampTag)(const struct link *plink, epicsTimeStamp *pstamp, epicsUTag *ptag);
389 } lset;
390 
391 #define dbGetSevr(link, sevr) \
392  dbGetAlarm(link, NULL, sevr)
393 
394 DBCORE_API const char * dbLinkFieldName(const struct link *plink);
395 
396 DBCORE_API void dbInitLink(struct link *plink, short dbfType);
397 DBCORE_API void dbAddLink(struct dbLocker *locker, struct link *plink,
398  short dbfType, dbChannel *ptarget);
399 
400 DBCORE_API void dbLinkOpen(struct link *plink);
401 DBCORE_API void dbRemoveLink(struct dbLocker *locker, struct link *plink);
402 
403 DBCORE_API int dbLinkIsDefined(const struct link *plink); /* 0 or 1 */
404 DBCORE_API int dbLinkIsConstant(const struct link *plink); /* 0 or 1 */
405 DBCORE_API int dbLinkIsVolatile(const struct link *plink); /* 0 or 1 */
406 
407 DBCORE_API long dbLoadLink(struct link *plink, short dbrType,
408  void *pbuffer);
409 DBCORE_API long dbLoadLinkArray(struct link *, short dbrType, void *pbuffer,
410  long *pnRequest);
411 
412 DBCORE_API long dbGetNelements(const struct link *plink, long *pnElements);
413 DBCORE_API int dbIsLinkConnected(const struct link *plink); /* 0 or 1 */
414 DBCORE_API int dbGetLinkDBFtype(const struct link *plink);
427 DBCORE_API long dbTryGetLink(struct link *, short dbrType, void *pbuffer,
428  long *nRequest);
430 DBCORE_API long dbGetLink(struct link *, short dbrType, void *pbuffer,
431  long *options, long *nRequest);
432 DBCORE_API long dbGetControlLimits(const struct link *plink, double *low,
433  double *high);
434 DBCORE_API long dbGetGraphicLimits(const struct link *plink, double *low,
435  double *high);
436 DBCORE_API long dbGetAlarmLimits(const struct link *plink, double *lolo,
437  double *low, double *high, double *hihi);
438 DBCORE_API long dbGetPrecision(const struct link *plink, short *precision);
439 DBCORE_API long dbGetUnits(const struct link *plink, char *units,
440  int unitsSize);
441 DBCORE_API long dbGetAlarm(const struct link *plink, epicsEnum16 *status,
442  epicsEnum16 *severity);
448 DBCORE_API long dbGetAlarmMsg(const struct link *plink, epicsEnum16 *status,
449  epicsEnum16 *severity, char *msgbuf, size_t msgbuflen);
450 #define dbGetAlarmMsg(LINK, STAT, SEVR, BUF, BUFLEN) dbGetAlarmMsg(LINK, STAT, SEVR, BUF, BUFLEN)
451 DBCORE_API long dbGetTimeStamp(const struct link *plink,
452  epicsTimeStamp *pstamp);
454 DBCORE_API long dbGetTimeStampTag(const struct link *plink,
455  epicsTimeStamp *pstamp, epicsUTag *ptag);
456 #define dbGetTimeStampTag(LINK, STAMP, TAG) dbGetTimeStampTag(LINK, STAMP, TAG)
457 DBCORE_API long dbPutLink(struct link *plink, short dbrType,
458  const void *pbuffer, long nRequest);
459 DBCORE_API void dbLinkAsyncComplete(struct link *plink);
460 DBCORE_API long dbPutLinkAsync(struct link *plink, short dbrType,
461  const void *pbuffer, long nRequest);
462 DBCORE_API void dbScanFwdLink(struct link *plink);
463 
464 DBCORE_API long dbLinkDoLocked(struct link *plink, dbLinkUserCallback rtn,
465  void *priv);
466 
467 DBCORE_API long dbLoadLinkLS(struct link *plink, char *pbuffer,
468  epicsUInt32 size, epicsUInt32 *plen);
469 DBCORE_API long dbGetLinkLS(struct link *plink, char *pbuffer,
470  epicsUInt32 buffer_size, epicsUInt32 *plen);
471 DBCORE_API long dbPutLinkLS(struct link *plink, char *pbuffer,
472  epicsUInt32 len);
473 
474 #ifdef __cplusplus
475 }
476 #endif
477 
478 #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
A Database Channel object.
Definition: dbChannel.h:84
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:388
long(* getAlarmMsg)(const struct link *plink, epicsEnum16 *status, epicsEnum16 *severity, char *msgbuf, size_t msgbuflen)
Extended version of getAlarm.
Definition: dbLink.h:378
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:365
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
The dbChannel API gives access to record fields.