This is Unofficial EPICS BASE Doxygen Site
caget.c
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2009 Helmholtz-Zentrum Berlin fuer Materialien und Energie.
3 * Copyright (c) 2006 Diamond Light Source Ltd.
4 * Copyright (c) 2002 The University of Chicago, as Operator of Argonne
5 * National Laboratory.
6 * Copyright (c) 2002 The Regents of the University of California, as
7 * Operator of Los Alamos National Laboratory.
8 * Copyright (c) 2002 Berliner Elektronenspeicherringgesellschaft fuer
9 * Synchrotronstrahlung.
10 * EPICS BASE is distributed subject to a Software License Agreement found
11 * in file LICENSE that is included with this distribution.
12 \*************************************************************************/
13 
14 /*
15  * Author: Ralph Lange (BESSY)
16  *
17  * Modification History
18  * 2006/01/17 Malcolm Walters (Tessella/Diamond Light Source)
19  * Fixed problem with "-c -w 0" hanging forever
20  * 2008/04/16 Ralph Lange (BESSY)
21  * Updated usage info
22  * 2009/03/31 Larry Hoff (BNL)
23  * Added field separators
24  * 2009/04/01 Ralph Lange (HZB/BESSY)
25  * Added support for long strings (array of char) and quoting of nonprintable characters
26  *
27  */
28 
29 #include <stdio.h>
30 #include <string.h>
31 #include <epicsStdlib.h>
32 #include <epicsString.h>
33 
34 #include <alarm.h>
35 #include <cadef.h>
36 #include <epicsGetopt.h>
37 #include "epicsVersion.h"
38 
39 #include "tool_lib.h"
40 
41 #define VALID_DOUBLE_DIGITS 18 /* Max usable precision for a double */
42 #define PEND_EVENT_SLICES 5 /* No. of pend_event slices for callback requests */
43 
44 /* Different output formats */
45 typedef enum { plain, terse, all, specifiedDbr } OutputT;
46 
47 /* Different request types */
48 typedef enum { get, callback } RequestT;
49 
50 static int nConn = 0; /* Number of connected PVs */
51 static int nRead = 0; /* Number of channels that were read */
52 static int floatAsString = 0; /* Flag: fetch floats as string */
53 
54 
55 static void usage (void)
56 {
57  fprintf (stderr, "\nUsage: caget [options] <PV name> ...\n\n"
58  " -h: Help: Print this message\n"
59  " -V: Version: Show EPICS and CA versions\n"
60  "Channel Access options:\n"
61  " -w <sec>: Wait time, specifies CA timeout, default is %f second(s)\n"
62  " -c: Asynchronous get (use ca_get_callback and wait for completion)\n"
63  " -p <prio>: CA priority (0-%u, default 0=lowest)\n"
64  "Format options:\n"
65  " Default output format is \"name value\"\n"
66  " -t: Terse mode - print only value, without name\n"
67  " -a: Wide mode \"name timestamp value stat sevr\" (read PVs as DBR_TIME_xxx)\n"
68  " -d <type>: Request specific dbr type; use string (DBR_ prefix may be omitted)\n"
69  " or number of one of the following types:\n"
70  " DBR_STRING 0 DBR_STS_FLOAT 9 DBR_TIME_LONG 19 DBR_CTRL_SHORT 29\n"
71  " DBR_INT 1 DBR_STS_ENUM 10 DBR_TIME_DOUBLE 20 DBR_CTRL_INT 29\n"
72  " DBR_SHORT 1 DBR_STS_CHAR 11 DBR_GR_STRING 21 DBR_CTRL_FLOAT 30\n"
73  " DBR_FLOAT 2 DBR_STS_LONG 12 DBR_GR_SHORT 22 DBR_CTRL_ENUM 31\n"
74  " DBR_ENUM 3 DBR_STS_DOUBLE 13 DBR_GR_INT 22 DBR_CTRL_CHAR 32\n"
75  " DBR_CHAR 4 DBR_TIME_STRING 14 DBR_GR_FLOAT 23 DBR_CTRL_LONG 33\n"
76  " DBR_LONG 5 DBR_TIME_INT 15 DBR_GR_ENUM 24 DBR_CTRL_DOUBLE 34\n"
77  " DBR_DOUBLE 6 DBR_TIME_SHORT 15 DBR_GR_CHAR 25 DBR_STSACK_STRING 37\n"
78  " DBR_STS_STRING 7 DBR_TIME_FLOAT 16 DBR_GR_LONG 26 DBR_CLASS_NAME 38\n"
79  " DBR_STS_SHORT 8 DBR_TIME_ENUM 17 DBR_GR_DOUBLE 27\n"
80  " DBR_STS_INT 8 DBR_TIME_CHAR 18 DBR_CTRL_STRING 28\n"
81  "Enum format:\n"
82  " -n: Print DBF_ENUM value as number (default is enum string)\n"
83  "Arrays: Value format: print number of requested values, then list of values\n"
84  " Default: Print all values\n"
85  " -# <count>: Print first <count> elements of an array\n"
86  " -S: Print array of char as a string (long string)\n"
87  "Floating point type format:\n"
88  " Default: Use %%g format\n"
89  " -e <nr>: Use %%e format, with a precision of <nr> digits\n"
90  " -f <nr>: Use %%f format, with a precision of <nr> digits\n"
91  " -g <nr>: Use %%g format, with a precision of <nr> digits\n"
92  " -s: Get value as string (honors server-side precision)\n"
93  " -lx: Round to long integer and print as hex number\n"
94  " -lo: Round to long integer and print as octal number\n"
95  " -lb: Round to long integer and print as binary number\n"
96  "Integer number format:\n"
97  " Default: Print as decimal number\n"
98  " -0x: Print as hex number\n"
99  " -0o: Print as octal number\n"
100  " -0b: Print as binary number\n"
101  "Alternate output field separator:\n"
102  " -F <ofs>: Use <ofs> as an alternate output field separator\n"
103  "\nExample: caget -a -f8 my_channel another_channel\n"
104  " (uses wide output format, doubles are printed as %%f with precision of 8)\n\n"
106 }
107 
108 
109 
110 /*+**************************************************************************
111  *
112  * Function: event_handler
113  *
114  * Description: CA event_handler for request type callback
115  * Allocates the dbr structure and copies the data
116  *
117  * Arg(s) In: args - event handler args (see CA manual)
118  *
119  **************************************************************************-*/
120 
121 static void event_handler (evargs args)
122 {
123  pv* ppv = args.usr;
124 
125  ppv->status = args.status;
126  if (args.status == ECA_NORMAL)
127  {
128  ppv->dbrType = args.type;
129  ppv->value = calloc(1, dbr_size_n(args.type, args.count));
130  memcpy(ppv->value, args.dbr, dbr_size_n(args.type, args.count));
131  ppv->nElems = args.count;
132  nRead++;
133  }
134 }
135 
136 
137 
138 /*+**************************************************************************
139  *
140  * Function: caget
141  *
142  * Description: Issue read requests, wait for incoming data
143  * and print the data according to the selected format
144  *
145  * Arg(s) In: pvs - Pointer to an array of pv structures
146  * nPvs - Number of elements in the pvs array
147  * request - Request type
148  * format - Output format
149  * dbrType - Requested dbr type
150  * reqElems - Requested number of (array) elements
151  *
152  * Return(s): Error code: 0 = OK, 1 = Error
153  *
154  **************************************************************************-*/
155 
156 static int caget (pv *pvs, int nPvs, RequestT request, OutputT format,
157  chtype dbrType, unsigned long reqElems)
158 {
159  unsigned int i;
160  int n, result;
161 
162  for (n = 0; n < nPvs; n++) {
163  unsigned long nElems;
164 
165  /* Set up pvs structure */
166  /* -------------------- */
167 
168  /* Get natural type and array count */
169  nElems = ca_element_count(pvs[n].chid);
170  pvs[n].dbfType = ca_field_type(pvs[n].chid);
171  pvs[n].dbrType = dbrType;
172 
173  /* Set up value structures */
174  if (format != specifiedDbr)
175  {
176  pvs[n].dbrType = dbf_type_to_DBR_TIME(pvs[n].dbfType); /* Use native type */
177  if (dbr_type_is_ENUM(pvs[n].dbrType)) /* Enums honour -n option */
178  {
179  if (enumAsNr) pvs[n].dbrType = DBR_TIME_INT;
180  else pvs[n].dbrType = DBR_TIME_STRING;
181  }
182  else if (floatAsString &&
183  (dbr_type_is_FLOAT(pvs[n].dbrType) || dbr_type_is_DOUBLE(pvs[n].dbrType)))
184  {
185  pvs[n].dbrType = DBR_TIME_STRING;
186  }
187  }
188 
189  /* Issue CA request */
190  /* ---------------- */
191 
192  if (ca_state(pvs[n].chid) == cs_conn)
193  {
194  nConn++;
195  pvs[n].onceConnected = 1;
196  if (request == callback)
197  {
198  /* Event handler will allocate value and set nElems */
199  pvs[n].reqElems = reqElems > nElems ? nElems : reqElems;
200  result = ca_array_get_callback(pvs[n].dbrType,
201  pvs[n].reqElems,
202  pvs[n].chid,
204  (void*)&pvs[n]);
205  } else {
206  /* We allocate value structure and set nElems */
207  pvs[n].nElems = reqElems && reqElems < nElems ? reqElems : nElems;
208  pvs[n].value = calloc(1, dbr_size_n(pvs[n].dbrType, pvs[n].nElems));
209  if (!pvs[n].value) {
210  fprintf(stderr,"Memory allocation failed\n");
211  return 1;
212  }
213  result = ca_array_get(pvs[n].dbrType,
214  pvs[n].nElems,
215  pvs[n].chid,
216  pvs[n].value);
217  }
218  pvs[n].status = result;
219  } else {
220  pvs[n].status = ECA_DISCONN;
221  }
222  }
223  if (!nConn) return 1; /* No connection? We're done. */
224 
225  /* Wait for completion */
226  /* ------------------- */
227 
228  result = ca_pend_io(caTimeout);
229  if (result == ECA_TIMEOUT)
230  fprintf(stderr, "Read operation timed out: some PV data was not read.\n");
231 
232  if (request == callback) /* Also wait for callbacks */
233  {
234  if (caTimeout != 0)
235  {
236  double slice = caTimeout / PEND_EVENT_SLICES;
237  for (n = 0; n < PEND_EVENT_SLICES; n++)
238  {
239  ca_pend_event(slice);
240  if (nRead >= nConn) break;
241  }
242  if (nRead < nConn)
243  fprintf(stderr, "Read operation timed out: some PV data was not read.\n");
244  } else {
245  /* For 0 timeout keep waiting until all are done */
246  while (nRead < nConn) {
247  ca_pend_event(1.0);
248  }
249  }
250  }
251 
252  /* Print the data */
253  /* -------------- */
254 
255  for (n = 0; n < nPvs; n++) {
256 
257  switch (format) {
258  case plain: /* Emulate old caget behaviour */
259  if (pvs[n].nElems <= 1 && fieldSeparator == ' ') printf("%-30s", pvs[n].name);
260  else printf("%s", pvs[n].name);
261  printf("%c", fieldSeparator);
262  case terse:
263  if (pvs[n].status == ECA_DISCONN)
264  printf("*** not connected\n");
265  else if (pvs[n].status == ECA_NORDACCESS)
266  printf("*** no read access\n");
267  else if (pvs[n].status != ECA_NORMAL)
268  printf("*** CA error %s\n", ca_message(pvs[n].status));
269  else if (pvs[n].value == 0)
270  printf("*** no data available (timeout)\n");
271  else
272  {
273  if (charArrAsStr && dbr_type_is_CHAR(pvs[n].dbrType) && (reqElems || pvs[n].nElems > 1)) {
274  dbr_char_t *s = (dbr_char_t*) dbr_value_ptr(pvs[n].value, pvs[n].dbrType);
275  int dlen = epicsStrnEscapedFromRawSize((char*)s, strlen((char*)s));
276  char *d = calloc(dlen+1, sizeof(char));
277  if(d) {
278  epicsStrnEscapedFromRaw(d, dlen+1, (char*)s, strlen((char*)s));
279  printf("%s", d);
280  free(d);
281  } else {
282  fprintf(stderr,"Failed to allocate space for escaped string\n");
283  }
284  } else {
285  if (reqElems || pvs[n].nElems > 1) printf("%lu%c", pvs[n].nElems, fieldSeparator);
286  for (i=0; i<pvs[n].nElems; ++i) {
287  if (i) printf ("%c", fieldSeparator);
288  printf("%s", val2str(pvs[n].value, pvs[n].dbrType, i));
289  }
290  }
291  printf("\n");
292  }
293  break;
294  case all:
295  print_time_val_sts(&pvs[n], reqElems);
296  break;
297  case specifiedDbr:
298  printf("%s\n", pvs[n].name);
299  if (pvs[n].status == ECA_DISCONN)
300  printf(" *** not connected\n");
301  else if (pvs[n].status == ECA_NORDACCESS)
302  printf(" *** no read access\n");
303  else if (pvs[n].status != ECA_NORMAL)
304  printf(" *** CA error %s\n", ca_message(pvs[n].status));
305  else
306  {
307  printf(" Native data type: %s\n",
308  dbf_type_to_text(pvs[n].dbfType));
309  printf(" Request type: %s\n",
310  dbr_type_to_text(pvs[n].dbrType));
311  if (pvs[n].dbrType == DBR_CLASS_NAME)
312  printf(" Class Name: %s\n",
313  *((dbr_string_t*)dbr_value_ptr(pvs[n].value,
314  pvs[n].dbrType)));
315  else {
316  printf(" Element count: %lu\n"
317  " Value: ",
318  pvs[n].nElems);
319  if (charArrAsStr && dbr_type_is_CHAR(pvs[n].dbrType) && (reqElems || pvs[n].nElems > 1)) {
320  dbr_char_t *s = (dbr_char_t*) dbr_value_ptr(pvs[n].value, pvs[n].dbrType);
321  int dlen = epicsStrnEscapedFromRawSize((char*)s, strlen((char*)s));
322  char *d = calloc(dlen+1, sizeof(char));
323  if(d) {
324  epicsStrnEscapedFromRaw(d, dlen+1, (char*)s, strlen((char*)s));
325  printf("%s", d);
326  free(d);
327  } else {
328  fprintf(stderr,"Failed to allocate space for escaped string\n");
329  }
330  } else {
331  for (i=0; i<pvs[n].nElems; ++i) {
332  if (i) printf ("%c", fieldSeparator);
333  printf("%s", val2str(pvs[n].value, pvs[n].dbrType, i));
334  }
335  }
336  printf("\n");
337  if (pvs[n].dbrType > DBR_DOUBLE) /* Extended type extra info */
338  printf("%s\n", dbr2str(pvs[n].value, pvs[n].dbrType));
339  }
340  }
341  break;
342  default :
343  break;
344  }
345  }
346  return 0;
347 }
348 
349 
350 
351 /*+**************************************************************************
352  *
353  * Function: main
354  *
355  * Description: caget main()
356  * Evaluate command line options, set up CA, connect the
357  * channels, collect and print the data as requested
358  *
359  * Arg(s) In: [options] <pv-name> ...
360  *
361  * Arg(s) Out: none
362  *
363  * Return(s): Standard return code (0=success, 1=error)
364  *
365  **************************************************************************-*/
366 
367 static void complainIfNotPlainAndSet (OutputT *current, const OutputT requested)
368 {
369  if (*current != plain)
370  fprintf(stderr,
371  "Options t,d,a are mutually exclusive. "
372  "('caget -h' for help.)\n");
373  *current = requested;
374 }
375 
376 int main (int argc, char *argv[])
377 {
378  int n;
379  int result; /* CA result */
380  OutputT format = plain; /* User specified format */
381  RequestT request = get; /* User specified request type */
382  IntFormatT outType; /* Output type */
383 
384  int count = 0; /* 0 = not specified by -# option */
385  int opt; /* getopt() current option */
386  int type = -1; /* getopt() data type argument */
387  int digits = 0; /* getopt() no. of float digits */
388 
389  int nPvs; /* Number of PVs */
390  pv* pvs; /* Array of PV structures */
391 
392  LINE_BUFFER(stdout); /* Configure stdout buffering */
393 
394  while ((opt = getopt(argc, argv, ":taicnhsSVe:f:g:l:#:d:0:w:p:F:")) != -1) {
395  switch (opt) {
396  case 'h': /* Print usage */
397  usage();
398  return 0;
399  case 'V':
400  printf( "\nEPICS Version %s, CA Protocol version %s\n", EPICS_VERSION_STRING, ca_version() );
401  return 0;
402  case 't': /* Terse output mode */
403  complainIfNotPlainAndSet(&format, terse);
404  break;
405  case 'a': /* Wide output mode */
406  complainIfNotPlainAndSet(&format, all);
407  break;
408  case 'c': /* Callback mode */
409  request = callback;
410  break;
411  case 'd': /* Data type specification */
412  complainIfNotPlainAndSet(&format, specifiedDbr);
413  /* Argument (type) may be text or number */
414  if (sscanf(optarg, "%d", &type) != 1)
415  {
416  dbr_text_to_type(optarg, type);
417  if (type == -1) /* Invalid? Try prefix DBR_ */
418  {
419  char str[30] = "DBR_";
420  strncat(str, optarg, 25);
421  dbr_text_to_type(str, type);
422  }
423  }
424  if (type < DBR_STRING || type > DBR_CLASS_NAME
425  || type == DBR_PUT_ACKT || type == DBR_PUT_ACKS)
426  {
427  fprintf(stderr, "Requested dbr type out of range "
428  "or invalid - ignored. ('caget -h' for help.)\n");
429  format = plain;
430  }
431  break;
432  case 'n': /* Print ENUM as index numbers */
433  enumAsNr = 1;
434  break;
435  case 'w': /* Set CA timeout value */
436  if(epicsScanDouble(optarg, &caTimeout) != 1)
437  {
438  fprintf(stderr, "'%s' is not a valid timeout value "
439  "- ignored. ('caget -h' for help.)\n", optarg);
441  }
442  break;
443  case '#': /* Array count */
444  if (sscanf(optarg,"%d", &count) != 1)
445  {
446  fprintf(stderr, "'%s' is not a valid array element count "
447  "- ignored. ('caget -h' for help.)\n", optarg);
448  count = 0;
449  }
450  break;
451  case 'p': /* CA priority */
452  if (sscanf(optarg,"%u", &caPriority) != 1)
453  {
454  fprintf(stderr, "'%s' is not a valid CA priority "
455  "- ignored. ('caget -h' for help.)\n", optarg);
457  }
459  break;
460  case 's': /* Select string dbr for floating type data */
461  floatAsString = 1;
462  break;
463  case 'S': /* Treat char array as (long) string */
464  charArrAsStr = 1;
465  break;
466  case 'e': /* Select %e/%f/%g format, using <arg> digits */
467  case 'f':
468  case 'g':
469  if (sscanf(optarg, "%d", &digits) != 1)
470  fprintf(stderr,
471  "Invalid precision argument '%s' "
472  "for option '-%c' - ignored.\n", optarg, opt);
473  else
474  {
475  if (digits>=0 && digits<=VALID_DOUBLE_DIGITS)
476  sprintf(dblFormatStr, "%%-.%d%c", digits, opt);
477  else
478  fprintf(stderr, "Precision %d for option '-%c' "
479  "out of range - ignored.\n", digits, opt);
480  }
481  break;
482  case 'l': /* Convert to long and use integer format */
483  case '0': /* Select integer format */
484  switch ((char) *optarg) {
485  case 'x': outType = hex; break; /* x print Hex */
486  case 'b': outType = bin; break; /* b print Binary */
487  case 'o': outType = oct; break; /* o print Octal */
488  default :
489  outType = dec;
490  fprintf(stderr, "Invalid argument '%s' "
491  "for option '-%c' - ignored.\n", optarg, opt);
492  }
493  if (outType != dec) {
494  if (opt == '0') {
495  type = DBR_LONG;
496  outTypeI = outType;
497  } else {
498  outTypeF = outType;
499  }
500  }
501  break;
502  case 'F': /* Store this for output and tool_lib formatting */
503  fieldSeparator = (char) *optarg;
504  break;
505  case '?':
506  fprintf(stderr,
507  "Unrecognized option: '-%c'. ('caget -h' for help.)\n",
508  optopt);
509  return 1;
510  case ':':
511  fprintf(stderr,
512  "Option '-%c' requires an argument. ('caget -h' for help.)\n",
513  optopt);
514  return 1;
515  default :
516  usage();
517  return 1;
518  }
519  }
520 
521  nPvs = argc - optind; /* Remaining arg list are PV names */
522 
523  if (nPvs < 1)
524  {
525  fprintf(stderr, "No pv name specified. ('caget -h' for help.)\n");
526  return 1;
527  }
528  /* Start up Channel Access */
529 
531  if (result != ECA_NORMAL) {
532  fprintf(stderr, "CA error %s occurred while trying "
533  "to start channel access.\n", ca_message(result));
534  return 1;
535  }
536  /* Allocate PV structure array */
537 
538  pvs = calloc (nPvs, sizeof(pv));
539  if (!pvs)
540  {
541  fprintf(stderr, "Memory allocation for channel structures failed.\n");
542  return 1;
543  }
544  /* Connect channels */
545 
546  for (n = 0; optind < argc; n++, optind++)
547  pvs[n].name = argv[optind] ; /* Copy PV names from command line */
548 
549  result = connect_pvs(pvs, nPvs);
550 
551  /* Read and print data */
552  if (!result)
553  result = caget(pvs, nPvs, request, format, type, count);
554 
555  /* Shut down Channel Access */
557 
558  return result;
559 }
IntFormatT
Definition: tool_lib.h:64
RequestT
Definition: caget.c:48
int getopt(int nargc, char *const *nargv, const char *ostr)
Definition: epicsGetopt.c:65
void print_time_val_sts(pv *pv, unsigned long reqElems)
Definition: tool_lib.c:503
#define dbr_type_is_ENUM(type)
Definition: db_access.h:664
Definition: link.h:174
LIBCA_API int epicsStdCall ca_array_get_callback(chtype type, unsigned long count, chid chanId, caEventCallBackFunc *pFunc, void *pArg)
char * dbr2str(const void *value, unsigned type)
Definition: tool_lib.c:333
pvac::PutEvent result
Definition: clientSync.cpp:117
std::string request
Definition: caget.c:45
IntFormatT outTypeI
Definition: tool_lib.c:46
capri caPriority
Definition: tool_lib.c:56
const void * dbr
Definition: cadef.h:89
long dbfType
Definition: tool_lib.h:71
#define dbf_type_to_text(type)
Definition: db_access.h:677
char dblFormatStr[30]
Definition: tool_lib.c:49
pvd::Status status
char fieldSeparator
Definition: tool_lib.c:51
size_t epicsStrnEscapedFromRawSize(const char *src, size_t srclen)
Definition: epicsString.c:170
int i
Definition: scan.c:967
#define DEFAULT_TIMEOUT
Definition: tool_lib.h:50
int optind
Definition: epicsGetopt.c:50
LIBCA_API unsigned long epicsStdCall ca_element_count(chid chan)
LIBCA_API enum channel_state epicsStdCall ca_state(chid chan)
#define CA_PRIORITY_MAX
Definition: cadef.h:190
Definition: tool_lib.h:67
int epicsStdCall ca_pend_io(ca_real timeout)
Definition: access.cpp:484
#define printf
Definition: epicsStdio.h:41
pvd::StructureConstPtr type
void * value
Definition: tool_lib.h:76
#define DBR_PUT_ACKS
Definition: db_access.h:110
#define str(v)
Definition: cadef.h:166
#define PEND_EVENT_SLICES
Definition: caget.c:42
#define DBR_TIME_INT
Definition: db_access.h:86
dbfType
Definition: dbFldTypes.h:24
int status
Definition: tool_lib.h:75
int charArrAsStr
Definition: tool_lib.c:54
OutputT
Definition: caget.c:45
#define LINE_BUFFER(stream)
Definition: tool_lib.h:53
#define epicsScanDouble(str, to)
Definition: epicsStdlib.h:78
LIBCA_API short epicsStdCall ca_field_type(chid chan)
Definition: caget.c:45
#define ECA_DISCONN
Definition: caerr.h:101
#define dbr_type_is_CHAR(type)
Definition: db_access.h:667
#define dbr_type_to_text(type)
Definition: db_access.h:687
int optopt
Definition: epicsGetopt.c:50
#define dbr_value_ptr(PDBR, DBR_TYPE)
Definition: db_access.h:540
int epicsStdCall ca_context_create(ca_preemptive_callback_select premptiveCallbackSelect)
Definition: access.cpp:172
int epicsStdCall ca_pend_event(ca_real timeout)
Definition: access.cpp:457
int main(int argc, char *argv[])
Definition: caget.c:376
#define dbr_text_to_type(text, type)
Definition: db_access.h:691
#define ECA_NORMAL
Definition: caerr.h:77
#define DEFAULT_CA_PRIORITY
Definition: tool_lib.h:49
int caget(pv *pvs, int nPvs, OutputT format, chtype dbrType, unsigned long reqElems)
Definition: caput.c:128
#define DBR_TIME_STRING
Definition: db_access.h:85
long dbrType
Definition: tool_lib.h:72
Definition: caget.c:48
#define DBR_DOUBLE
Definition: db_access.h:76
LIBCA_API int epicsStdCall ca_array_get(chtype type, unsigned long count, chid chanId, void *pValue)
char onceConnected
Definition: tool_lib.h:80
void event_handler(struct event_handler_args args)
Definition: evtime.c:73
char * val2str(const void *v, unsigned type, int index)
Definition: tool_lib.c:109
epicsOldString dbr_string_t
Definition: db_access.h:38
#define stdout
Definition: epicsStdio.h:30
unsigned long nElems
Definition: tool_lib.h:73
int connect_pvs(pv *pvs, int nPvs)
Definition: tool_lib.c:621
epicsUInt8 dbr_char_t
Definition: db_access.h:39
const char *epicsStdCall ca_message(long ca_status)
Definition: access.cpp:561
const char *epicsStdCall ca_version()
Definition: access.cpp:641
long chtype
Definition: cadef.h:47
#define DBR_CLASS_NAME
Definition: db_access.h:112
Definition: caget.c:45
#define DBR_LONG
Definition: db_access.h:75
#define VALID_DOUBLE_DIGITS
Definition: caget.c:41
Definition: tool_lib.h:64
#define dbr_size_n(TYPE, COUNT)
Definition: db_access.h:518
unsigned long reqElems
Definition: tool_lib.h:74
#define ECA_NORDACCESS
Definition: caerr.h:123
#define dbr_type_is_FLOAT(type)
Definition: db_access.h:661
Definition: tool_lib.h:64
Definition: tool_lib.h:64
#define ECA_TIMEOUT
Definition: caerr.h:87
#define DBR_PUT_ACKT
Definition: db_access.h:109
#define stderr
Definition: epicsStdio.h:32
#define dbr_type_is_DOUBLE(type)
Definition: db_access.h:673
Definition: tool_lib.h:64
void epicsStdCall ca_context_destroy()
Definition: access.cpp:232
int enumAsNr
Definition: tool_lib.c:53
IntFormatT outTypeF
Definition: tool_lib.c:47
char * optarg
Definition: epicsGetopt.c:55
void * usr
Definition: cadef.h:85
double caTimeout
Definition: tool_lib.c:55
int epicsStrnEscapedFromRaw(char *dst, size_t dstlen, const char *src, size_t srclen)
Definition: epicsString.c:129
#define dbf_type_to_DBR_TIME(type)
Definition: db_access.h:705