This is Unofficial EPICS BASE Doxygen Site
tool_lib.c
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2009 Helmholtz-Zentrum Berlin fuer Materialien und Energie.
3 * Copyright (c) 2002 The University of Chicago, as Operator of Argonne
4 * National Laboratory.
5 * Copyright (c) 2002 The Regents of the University of California, as
6 * Operator of Los Alamos National Laboratory.
7 * Copyright (c) 2002 Berliner Elektronenspeicherringgesellschaft fuer
8 * Synchrotronstrahlung.
9 * EPICS BASE is distributed subject to a Software License Agreement found
10 * in file LICENSE that is included with this distribution.
11 \*************************************************************************/
12 
13 /*
14  * Author: Ralph Lange (BESSY)
15  *
16  * Modification History
17  * 2009/03/31 Larry Hoff (BNL)
18  * Added field separators
19  * 2009/04/01 Ralph Lange (HZB/BESSY)
20  * Added support for long strings (array of char) and quoting of nonprintable characters
21  *
22  */
23 
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <string.h>
27 
28 #include <alarm.h>
29 #include <epicsTime.h>
30 #include <epicsString.h>
31 #include <cadef.h>
32 
33 #include "tool_lib.h"
34 
35 /* Time stamps for program start, first incoming monitor,
36  previous value (client and server stamp):
37  used for relative resp. incremental timestamps with monitors */
38 static epicsTimeStamp tsStart, tsFirst, tsPreviousC, tsPreviousS;
39 
40 static int tsInitS = 0; /* Flag: Server timestamps init'd */
41 static int tsInitC = 0; /* Flag: Client timestamps init'd */
42 
43 TimeT tsType = absolute; /* Timestamp type flag (-t option) */
44 int tsSrcServer = 1; /* Timestamp source flag (-t option) */
45 int tsSrcClient = 0; /* Timestamp source flag (-t option) */
46 IntFormatT outTypeI = dec; /* For -0.. output format option */
47 IntFormatT outTypeF = dec; /* For -l.. output format option */
48 
49 char dblFormatStr[30] = "%g"; /* Format string to print doubles (-efg options) */
50 char timeFormatStr[30] = "%Y-%m-%d %H:%M:%S.%06f"; /* Time format string */
51 char fieldSeparator = ' '; /* OFS default is whitespace */
52 
53 int enumAsNr = 0; /* used for -n option - get DBF_ENUM as number */
54 int charArrAsStr = 0; /* used for -S option - treat char array as (long) string */
55 double caTimeout = 1.0; /* wait time default (see -w option) */
56 capri caPriority = DEFAULT_CA_PRIORITY; /* CA Priority */
57 
58 #define TIMETEXTLEN 28 /* Length of timestamp text buffer */
59 
60 
61 
62 static void sprint_long (char *ret, dbr_long_t val, IntFormatT outType)
63 {
64  if (outType == bin && val != 0) {
65  /* sprintf doesn't do binary; this code doesn't handle 0 */
66  int i, skip = -1;
67 
68  for (i = 31; i >= 0; i--) {
69  int bit = (val >> i) & 1;
70 
71  if (skip < 0 && bit) {
72  skip = 31 - i; /* skip leading 0's */
73  ret[i+1] = '\0';
74  }
75  if (skip >= 0) {
76  ret[31-i-skip] = '0' + bit;
77  }
78  }
79  }
80  else {
81  const char *fmt[4] = { /* Order must match the enum IntFormatT */
82  "%d" /* dec */,
83  "0" /* bin and val is 0 */,
84  "0o%o" /* oct */,
85  "0x%X" /* hex */
86  };
87 
88  /* dbr_long_t is actually an int on all supported platforms */
89  sprintf(ret, fmt[outType], (int) val);
90  }
91 }
92 
93 
94 
95 /*+**************************************************************************
96  *
97  * Function: val2str
98  *
99  * Description: Print (convert) value to a string
100  *
101  * Arg(s) In: v - Pointer to dbr_... structure
102  * type - Numeric dbr type
103  * index - Index of element to print (for arrays)
104  *
105  * Return(s): Pointer to static output string
106  *
107  **************************************************************************-*/
108 
109 char *val2str (const void *v, unsigned type, int index)
110 {
111 #define STR 500
112  static char str[STR];
113  char ch;
114  void *val_ptr;
115  unsigned base_type;
116  dbr_long_t val_long;
117 
118  if (!dbr_type_is_valid(type)) {
119  strcpy (str, "*** invalid type");
120  return str;
121  }
122  strcpy (str, "!!!");
123 
124  base_type = type % (LAST_TYPE+1);
125 
126  if (type == DBR_STSACK_STRING || type == DBR_CLASS_NAME)
127  base_type = DBR_STRING;
128 
129  val_ptr = dbr_value_ptr(v, type);
130 
131  switch (base_type) {
132  case DBR_STRING:
133  epicsStrnEscapedFromRaw(str, STR, ((dbr_string_t*) val_ptr)[index], strlen(((dbr_string_t*) val_ptr)[index]));
134  break;
135  case DBR_FLOAT:
136  if (outTypeF == dec) {
137  sprintf(str, dblFormatStr, ((dbr_float_t*) val_ptr)[index]);
138  } else {
139  if (((dbr_float_t*) val_ptr)[index] > 0.0)
140  val_long = ((dbr_float_t*) val_ptr)[index] + 0.5;
141  else
142  val_long = ((dbr_float_t*) val_ptr)[index] - 0.5;
143  sprint_long(str, val_long, outTypeF);
144  }
145  break;
146  case DBR_DOUBLE:
147  if (outTypeF == dec) {
148  sprintf(str, dblFormatStr, ((dbr_double_t*) val_ptr)[index]);
149  } else {
150  if (((dbr_double_t*) val_ptr)[index] > 0.0)
151  val_long = ((dbr_double_t*) val_ptr)[index] + 0.5;
152  else
153  val_long = ((dbr_double_t*) val_ptr)[index] - 0.5;
154  sprint_long(str, val_long, outTypeF);
155  }
156  break;
157  case DBR_CHAR:
158  ch = ((dbr_char_t*) val_ptr)[index];
159  sprintf(str, "%d", ch);
160  break;
161  case DBR_INT:
162  sprint_long(str, ((dbr_int_t*) val_ptr)[index], outTypeI);
163  break;
164  case DBR_LONG:
165  sprint_long(str, ((dbr_long_t*) val_ptr)[index], outTypeI);
166  break;
167  case DBR_ENUM:
168  {
169  dbr_enum_t *val = (dbr_enum_t *)val_ptr;
170  if (dbr_type_is_GR(type) && !enumAsNr) {
171  if (val[index] >= MAX_ENUM_STATES)
172  sprintf(str, "Illegal Value (%d)", val[index]);
173  else if (val[index] >= ((struct dbr_gr_enum *)v)->no_str)
174  sprintf(str, "Enum Index Overflow (%d)", val[index]);
175  else
176  sprintf(str, "%s", ((struct dbr_gr_enum *)v)->strs[val[index]]);
177  } else if (dbr_type_is_CTRL(type) && !enumAsNr) {
178  if (val[index] >= MAX_ENUM_STATES)
179  sprintf(str, "Illegal Value (%d)", val[index]);
180  else if (val[index] >= ((struct dbr_ctrl_enum *)v)->no_str)
181  sprintf(str, "Enum Index Overflow (%d)", val[index]);
182  else
183  sprintf(str, "%s", ((struct dbr_ctrl_enum *)v)->strs[val[index]]);
184  } else
185  sprintf(str, "%d", val[index]);
186  }
187  }
188  return str;
189 }
190 
191 
192 
193 /*+**************************************************************************
194  *
195  * Function: dbr2str
196  *
197  * Description: Print (convert) additional information contained in dbr_...
198  *
199  * Arg(s) In: value - Pointer to dbr_... structure
200  * type - Numeric dbr type
201  *
202  * Return(s): Pointer to static output string
203  *
204  **************************************************************************-*/
205 
206 /* Definitions for sprintf format strings and matching argument lists */
207 
208 #define FMT_TIME \
209  " Timestamp: %s"
210 
211 #define ARGS_TIME(T) \
212  timeText
213 
214 #define FMT_STS \
215  " Status: %s\n" \
216  " Severity: %s"
217 
218 #define ARGS_STS(T) \
219  stat_to_str(((struct T *)value)->status), \
220  sevr_to_str(((struct T *)value)->severity)
221 
222 #define ARGS_STS_UNSIGNED(T) \
223  stat_to_str_unsigned(((struct T *)value)->status), \
224  sevr_to_str_unsigned(((struct T *)value)->severity)
225 
226 #define FMT_ACK \
227  " Ack transient?: %s\n" \
228  " Ack severity: %s"
229 
230 #define ARGS_ACK(T) \
231  ((struct T *)value)->ackt ? "YES" : "NO", \
232  sevr_to_str_unsigned(((struct T *)value)->acks)
233 
234 #define FMT_UNITS \
235  " Units: %s"
236 
237 #define ARGS_UNITS(T) \
238  ((struct T *)value)->units
239 
240 #define FMT_PREC \
241  " Precision: %d"
242 
243 #define ARGS_PREC(T) \
244  ((struct T *)value)->precision
245 
246 #define FMT_GR(FMT) \
247  " Lo disp limit: " #FMT "\n" \
248  " Hi disp limit: " #FMT "\n" \
249  " Lo alarm limit: " #FMT "\n" \
250  " Lo warn limit: " #FMT "\n" \
251  " Hi warn limit: " #FMT "\n" \
252  " Hi alarm limit: " #FMT
253 
254 #define ARGS_GR(T,F) \
255  (F)((struct T *)value)->lower_disp_limit, \
256  (F)((struct T *)value)->upper_disp_limit, \
257  (F)((struct T *)value)->lower_alarm_limit, \
258  (F)((struct T *)value)->lower_warning_limit, \
259  (F)((struct T *)value)->upper_warning_limit, \
260  (F)((struct T *)value)->upper_alarm_limit
261 
262 #define FMT_CTRL(FMT) \
263  " Lo ctrl limit: " #FMT "\n" \
264  " Hi ctrl limit: " #FMT
265 
266 #define ARGS_CTRL(T,F) \
267  (F)((struct T *)value)->lower_ctrl_limit, \
268  (F)((struct T *)value)->upper_ctrl_limit
269 
270 
271 /* Definitions for the actual sprintf calls */
272 
273 #define PRN_DBR_STS(T) \
274  sprintf(str, \
275  FMT_STS, \
276  ARGS_STS(T))
277 
278 #define PRN_DBR_TIME(T) \
279  epicsTimeToStrftime(timeText, TIMETEXTLEN, timeFormatStr, \
280  &(((struct T *)value)->stamp)); \
281  sprintf(str, \
282  FMT_TIME "\n" FMT_STS, \
283  ARGS_TIME(T), ARGS_STS(T))
284 
285 #define PRN_DBR_GR(T,F,FMT) \
286  sprintf(str, \
287  FMT_STS "\n" FMT_UNITS "\n" FMT_GR(FMT), \
288  ARGS_STS(T), ARGS_UNITS(T), ARGS_GR(T,F))
289 
290 #define PRN_DBR_GR_PREC(T,F,FMT) \
291  sprintf(str, \
292  FMT_STS "\n" FMT_UNITS "\n" FMT_PREC "\n" FMT_GR(FMT), \
293  ARGS_STS(T), ARGS_UNITS(T), ARGS_PREC(T), ARGS_GR(T,F))
294 
295 #define PRN_DBR_CTRL(T,F,FMT) \
296  sprintf(str, \
297  FMT_STS "\n" FMT_UNITS "\n" FMT_GR(FMT) "\n" FMT_CTRL(FMT), \
298  ARGS_STS(T), ARGS_UNITS(T), ARGS_GR(T,F), ARGS_CTRL(T,F))
299 
300 #define PRN_DBR_CTRL_PREC(T,F,FMT) \
301  sprintf(str, \
302  FMT_STS "\n" FMT_UNITS "\n" FMT_PREC "\n" FMT_GR(FMT) "\n" FMT_CTRL(FMT), \
303  ARGS_STS(T), ARGS_UNITS(T), ARGS_PREC(T), ARGS_GR(T,F), ARGS_CTRL(T,F))
304 
305 #define PRN_DBR_STSACK(T) \
306  sprintf(str, \
307  FMT_STS "\n" FMT_ACK, \
308  ARGS_STS_UNSIGNED(T), ARGS_ACK(T))
309 
310 #define PRN_DBR_X_ENUM(T) \
311  n = ((struct T *)value)->no_str; \
312  PRN_DBR_STS(T); \
313  sprintf(str+strlen(str), \
314  "\n Enums: (%2d)", n); \
315  for (i=0; i<n; i++) \
316  sprintf(str+strlen(str), \
317  "\n [%2d] %s", i, \
318  ((struct T *)value)->strs[i]);
319 
320 
321 /* Make a good guess how long the dbr_... stuff might get as worst case */
322 #define DBR_PRINT_BUFFER_SIZE \
323  50 /* timestamp */ \
324  + 2 * 30 /* status / Severity */ \
325  + 2 * 30 /* acks / ackt */ \
326  + 20 + MAX_UNITS_SIZE /* units */ \
327  + 30 /* precision */ \
328  + 6 * 45 /* graphic limits */ \
329  + 2 * 45 /* control limits */ \
330  + 30 + (MAX_ENUM_STATES * (20 + MAX_ENUM_STRING_SIZE)) /* enums */ \
331  + 50 /* just to be sure */
332 
333 char *dbr2str (const void *value, unsigned type)
334 {
335  static char str[DBR_PRINT_BUFFER_SIZE];
336  char timeText[TIMETEXTLEN];
337  int n, i;
338 
339  switch (type) {
340  case DBR_STRING: /* no additional information for basic data types */
341  case DBR_INT:
342  case DBR_FLOAT:
343  case DBR_ENUM:
344  case DBR_CHAR:
345  case DBR_LONG:
346  case DBR_DOUBLE: break;
347 
348  case DBR_CTRL_STRING: /* see db_access.h: not implemented */
349  case DBR_GR_STRING: /* see db_access.h: not implemented */
353  case DBR_STS_ENUM: PRN_DBR_STS(dbr_sts_enum); break;
354  case DBR_STS_CHAR: PRN_DBR_STS(dbr_sts_char); break;
355  case DBR_STS_LONG: PRN_DBR_STS(dbr_sts_long); break;
357 
365 
366  case DBR_GR_CHAR:
367  PRN_DBR_GR(dbr_gr_char, char, %8d); break;
368  case DBR_GR_INT:
369  PRN_DBR_GR(dbr_gr_int, int, %8d); break;
370  case DBR_GR_LONG:
371  PRN_DBR_GR(dbr_gr_long, long int, %8ld); break;
372  case DBR_GR_FLOAT:
373  PRN_DBR_GR_PREC(dbr_gr_float, float, %g); break;
374  case DBR_GR_DOUBLE:
375  PRN_DBR_GR_PREC(dbr_gr_double, double, %g); break;
376  case DBR_GR_ENUM:
377  PRN_DBR_X_ENUM(dbr_gr_enum); break;
378  case DBR_CTRL_CHAR:
379  PRN_DBR_CTRL(dbr_ctrl_char, char, %8d); break;
380  case DBR_CTRL_INT:
381  PRN_DBR_CTRL(dbr_ctrl_int, int, %8d); break;
382  case DBR_CTRL_LONG:
383  PRN_DBR_CTRL(dbr_ctrl_long, long int, %8ld); break;
384  case DBR_CTRL_FLOAT:
385  PRN_DBR_CTRL_PREC(dbr_ctrl_float, float, %g); break;
386  case DBR_CTRL_DOUBLE:
387  PRN_DBR_CTRL_PREC(dbr_ctrl_double, double, %g); break;
388  case DBR_CTRL_ENUM:
390  case DBR_STSACK_STRING:
392  default : strcpy (str, "can't print data type");
393  }
394  return str;
395 }
396 
397 
398 
399 /*+**************************************************************************
400  *
401  * Function: print_time_val_sts
402  *
403  * Description: Print (to stdout) one wide output line
404  * (name, timestamp, value, status, severity)
405  *
406  * Arg(s) In: pv - Pointer to pv structure
407  * nElems - Number of elements (array)
408  *
409  **************************************************************************-*/
410 
411 #define PRN_TIME_VAL_STS(TYPE,TYPE_ENUM) \
412  printAbs = !pv->firstStampPrinted; \
413  \
414  ptsNewS = &((struct TYPE *)value)->stamp; \
415  ptsNewC = &tsNow; \
416  \
417  if (!tsInitS) \
418  { \
419  tsFirst = *ptsNewS; \
420  tsInitS = 1; \
421  } \
422  \
423  switch (tsType) { \
424  case relative: \
425  ptsRefC = &tsStart; \
426  ptsRefS = &tsFirst; \
427  break; \
428  case incremental: \
429  ptsRefC = &tsPreviousC; \
430  ptsRefS = &tsPreviousS; \
431  break; \
432  case incrementalByChan: \
433  ptsRefC = &pv->tsPreviousC; \
434  ptsRefS = &pv->tsPreviousS; \
435  break; \
436  default : \
437  printAbs = 1; \
438  } \
439  \
440  if (printAbs) { \
441  if (tsSrcServer) { \
442  epicsTimeToStrftime(timeText, TIMETEXTLEN, timeFormatStr, ptsNewS); \
443  printf("%s", timeText); \
444  } \
445  if (tsSrcClient) { \
446  epicsTimeToStrftime(timeText, TIMETEXTLEN, timeFormatStr, ptsNewC); \
447  printf("(%s)", timeText); \
448  } \
449  pv->firstStampPrinted = 1; \
450  } else { \
451  if (tsSrcServer) { \
452  printf(" %+12.6f", epicsTimeDiffInSeconds(ptsNewS, ptsRefS) ); \
453  } \
454  if (tsSrcClient) { \
455  printf(" (%+12.6f)", epicsTimeDiffInSeconds(ptsNewC, ptsRefC) ); \
456  } \
457  } \
458  \
459  if (tsType == incrementalByChan) { \
460  pv->tsPreviousC = *ptsNewC; \
461  pv->tsPreviousS = *ptsNewS; \
462  } \
463  \
464  tsPreviousC = *ptsNewC; \
465  tsPreviousS = *ptsNewS; \
466  \
467  if (charArrAsStr && dbr_type_is_CHAR(TYPE_ENUM) && (reqElems || pv->nElems > 1)) { \
468  dbr_char_t *s = (dbr_char_t*) dbr_value_ptr(pv->value, pv->dbrType); \
469  size_t len = strlen((char*)s); \
470  unsigned long elems = reqElems && (reqElems < pv->nElems) ? reqElems : pv->nElems; \
471  int dlen; \
472  char *d; \
473  if (len < elems) elems = len; \
474  dlen = epicsStrnEscapedFromRawSize((char*)s, elems); \
475  d = calloc(dlen+1, sizeof(char)); \
476  if(d) { \
477  epicsStrnEscapedFromRaw(d, dlen+1, (char*)s, elems); \
478  printf("%c%s", fieldSeparator, d); \
479  free(d); \
480  } else { \
481  printf("Failed to allocate for print_time_val_sts\n"); \
482  } \
483  } else { \
484  if (reqElems || pv->nElems > 1) printf("%c%lu", fieldSeparator, pv->nElems); \
485  for (i=0; i<pv->nElems; ++i) { \
486  printf("%c%s", fieldSeparator, val2str(value, TYPE_ENUM, i)); \
487  } \
488  } \
489  /* Print Status, Severity - if not NO_ALARM */ \
490  if ( ((struct TYPE *)value)->status || ((struct TYPE *)value)->severity ) \
491  { \
492  printf("%c%s%c%s\n", \
493  fieldSeparator, \
494  stat_to_str(((struct TYPE *)value)->status), \
495  fieldSeparator, \
496  sevr_to_str(((struct TYPE *)value)->severity)); \
497  } else { \
498  printf("%c%c\n", \
499  fieldSeparator, fieldSeparator); \
500  }
501 
502 
503 void print_time_val_sts (pv* pv, unsigned long reqElems)
504 {
505  char timeText[2*TIMETEXTLEN+2];
506  int i, printAbs;
507  void* value = pv->value;
508  epicsTimeStamp *ptsRefC, *ptsRefS; /* Reference timestamps (client, server) */
509  epicsTimeStamp *ptsNewC, *ptsNewS; /* Update timestamps (client, server) */
510  epicsTimeStamp tsNow;
511 
512  epicsTimeGetCurrent(&tsNow);
513  epicsTimeToStrftime(timeText, TIMETEXTLEN, timeFormatStr, &tsNow);
514 
515  if (pv->nElems <= 1 && fieldSeparator == ' ') printf("%-30s", pv->name);
516  else printf("%s", pv->name);
517  printf("%c", fieldSeparator);
518  if (!pv->onceConnected)
519  printf("*** Not connected (PV not found)\n");
520  else if (pv->status == ECA_DISCONN)
521  printf("%s *** disconnected\n", timeText);
522  else if (pv->status == ECA_NORDACCESS)
523  printf("%s *** no read access\n", timeText);
524  else if (pv->status != ECA_NORMAL)
525  printf("%s *** CA error %s\n", timeText, ca_message(pv->status));
526  else if (pv->value == 0)
527  printf("%s *** no data available (timeout)\n", timeText);
528  else
529  switch (pv->dbrType) {
530  case DBR_TIME_STRING:
532  break;
533  case DBR_TIME_SHORT:
535  break;
536  case DBR_TIME_FLOAT:
538  break;
539  case DBR_TIME_ENUM:
541  break;
542  case DBR_TIME_CHAR:
544  break;
545  case DBR_TIME_LONG:
547  break;
548  case DBR_TIME_DOUBLE:
550  break;
551  default: printf("can't print data type\n");
552  }
553 }
554 
555 
556 /*+**************************************************************************
557  *
558  * Function: create_pvs
559  *
560  * Description: Creates an arbitrary number of PVs
561  *
562  * Arg(s) In: pvs - Pointer to an array of pv structures
563  * nPvs - Number of elements in the pvs array
564  * pCB - Connection state change callback
565  *
566  * Arg(s) Out: none
567  *
568  * Return(s): Error code:
569  * 0 - All PVs created
570  * 1 - Some PV(s) not created
571  *
572  **************************************************************************-*/
573 
574 int create_pvs (pv* pvs, int nPvs, caCh *pCB)
575 {
576  int n;
577  int result;
578  int returncode = 0;
579 
580  if (!tsInitC) /* Initialize start timestamp */
581  {
582  epicsTimeGetCurrent(&tsStart);
583  tsInitC = 1;
584  }
585  /* Issue channel connections */
586  for (n = 0; n < nPvs; n++) {
587  result = ca_create_channel (pvs[n].name,
588  pCB,
589  &pvs[n],
590  caPriority,
591  &pvs[n].chid);
592  if (result != ECA_NORMAL) {
593  fprintf(stderr, "CA error %s occurred while trying "
594  "to create channel '%s'.\n", ca_message(result), pvs[n].name);
595  pvs[n].status = result;
596  returncode = 1;
597  }
598  }
599 
600  return returncode;
601 }
602 
603 
604 /*+**************************************************************************
605  *
606  * Function: connect_pvs
607  *
608  * Description: Connects an arbitrary number of PVs
609  *
610  * Arg(s) In: pvs - Pointer to an array of pv structures
611  * nPvs - Number of elements in the pvs array
612  *
613  * Arg(s) Out: none
614  *
615  * Return(s): Error code:
616  * 0 - All PVs connected
617  * 1 - Some PV(s) not connected
618  *
619  **************************************************************************-*/
620 
621 int connect_pvs (pv* pvs, int nPvs)
622 {
623  int returncode = create_pvs ( pvs, nPvs, 0);
624  if ( returncode == 0 ) {
625  /* Wait for channels to connect */
626  int result = ca_pend_io (caTimeout);
627  if (result == ECA_TIMEOUT)
628  {
629  if (nPvs > 1)
630  {
631  fprintf(stderr, "Channel connect timed out: some PV(s) not found.\n");
632  } else {
633  fprintf(stderr, "Channel connect timed out: '%s' not found.\n",
634  pvs[0].name);
635  }
636  returncode = 1;
637  }
638  }
639  return returncode;
640 }
int tsSrcServer
Definition: tool_lib.c:44
#define PRN_DBR_GR_PREC(T, F, FMT)
Definition: tool_lib.c:290
IntFormatT
Definition: tool_lib.h:64
#define DBR_GR_INT
Definition: db_access.h:95
#define DBR_CHAR
Definition: db_access.h:74
#define DBR_STRING
Definition: db_access.h:69
#define DBR_GR_LONG
Definition: db_access.h:99
void print_time_val_sts(pv *pv, unsigned long reqElems)
Definition: tool_lib.c:503
Definition: link.h:174
void caCh(struct connection_handler_args args)
Definition: cadef.h:57
#define PRN_DBR_STS(T)
Definition: tool_lib.c:273
char * dbr2str(const void *value, unsigned type)
Definition: tool_lib.c:333
pvac::PutEvent result
Definition: clientSync.cpp:117
#define DBR_PRINT_BUFFER_SIZE
Definition: tool_lib.c:322
IntFormatT outTypeI
Definition: tool_lib.c:46
capri caPriority
Definition: tool_lib.c:56
#define PRN_DBR_CTRL(T, F, FMT)
Definition: tool_lib.c:295
char dblFormatStr[30]
Definition: tool_lib.c:49
char fieldSeparator
Definition: tool_lib.c:51
int i
Definition: scan.c:967
#define PRN_DBR_X_ENUM(T)
Definition: tool_lib.c:310
int epicsStdCall ca_create_channel(const char *name_str, caCh *conn_func, void *puser, capri priority, chid *chanptr)
Definition: access.cpp:288
#define DBR_GR_ENUM
Definition: db_access.h:97
Definition: tool_lib.h:67
char timeFormatStr[30]
Definition: tool_lib.c:50
epicsFloat32 dbr_float_t
Definition: db_access.h:46
#define DBR_CTRL_ENUM
Definition: db_access.h:105
#define PRN_DBR_STSACK(T)
Definition: tool_lib.c:305
#define DBR_STS_FLOAT
Definition: db_access.h:80
#define DBR_FLOAT
Definition: db_access.h:72
int epicsStdCall ca_pend_io(ca_real timeout)
Definition: access.cpp:484
#define printf
Definition: epicsStdio.h:41
pvd::StructureConstPtr type
#define DBR_INT
Definition: db_access.h:70
void * value
Definition: tool_lib.h:76
#define DBR_STS_CHAR
Definition: db_access.h:82
#define DBR_STS_STRING
Definition: db_access.h:77
#define str(v)
int status
Definition: tool_lib.h:75
int charArrAsStr
Definition: tool_lib.c:54
#define PRN_TIME_VAL_STS(TYPE, TYPE_ENUM)
Definition: tool_lib.c:411
#define dbr_type_is_valid(type)
Definition: db_access.h:644
#define ECA_DISCONN
Definition: caerr.h:101
#define DBR_CTRL_FLOAT
Definition: db_access.h:104
#define DBR_STS_SHORT
Definition: db_access.h:78
#define DBR_STSACK_STRING
Definition: db_access.h:111
int create_pvs(pv *pvs, int nPvs, caCh *pCB)
Definition: tool_lib.c:574
#define DBR_CTRL_STRING
Definition: db_access.h:101
#define dbr_value_ptr(PDBR, DBR_TYPE)
Definition: db_access.h:540
LIBCOM_API size_t epicsStdCall epicsTimeToStrftime(char *pBuff, size_t bufLength, const char *pFormat, const epicsTimeStamp *pTS)
Convert epicsTimeStamp to string. See epicsTime::strftime()
Definition: epicsTime.cpp:1120
#define ECA_NORMAL
Definition: caerr.h:77
#define dbr_type_is_CTRL(type)
Definition: db_access.h:653
#define DEFAULT_CA_PRIORITY
Definition: tool_lib.h:49
#define LAST_TYPE
Definition: db_access.h:64
#define DBR_TIME_STRING
Definition: db_access.h:85
long dbrType
Definition: tool_lib.h:72
#define DBR_TIME_ENUM
Definition: db_access.h:89
int epicsStdCall epicsTimeGetCurrent(epicsTimeStamp *pDest)
Get current time into *pDest.
#define DBR_DOUBLE
Definition: db_access.h:76
#define DBR_GR_DOUBLE
Definition: db_access.h:100
unsigned capri
Definition: cadef.h:189
#define DBR_TIME_LONG
Definition: db_access.h:91
#define DBR_CTRL_CHAR
Definition: db_access.h:106
TimeT tsType
Definition: tool_lib.c:43
char onceConnected
Definition: tool_lib.h:80
epicsFloat64 dbr_double_t
Definition: db_access.h:47
#define TIMETEXTLEN
Definition: tool_lib.c:58
char * val2str(const void *v, unsigned type, int index)
Definition: tool_lib.c:109
TimeT
Definition: tool_lib.h:61
epicsOldString dbr_string_t
Definition: db_access.h:38
dbr_short_t no_str
Definition: db_access.h:353
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
#define DBR_STS_DOUBLE
Definition: db_access.h:84
epicsInt16 dbr_int_t
Definition: db_access.h:42
int tsSrcClient
Definition: tool_lib.c:45
#define STR
#define DBR_TIME_SHORT
Definition: db_access.h:87
#define DBR_ENUM
Definition: db_access.h:73
epicsUInt16 dbr_enum_t
Definition: db_access.h:43
const char *epicsStdCall ca_message(long ca_status)
Definition: access.cpp:561
#define DBR_GR_CHAR
Definition: db_access.h:98
#define DBR_CTRL_LONG
Definition: db_access.h:107
#define DBR_GR_FLOAT
Definition: db_access.h:96
#define DBR_STS_ENUM
Definition: db_access.h:81
#define DBR_CLASS_NAME
Definition: db_access.h:112
#define DBR_LONG
Definition: db_access.h:75
EPICS time stamp, for use from C code.
Definition: epicsTime.h:33
#define PRN_DBR_TIME(T)
Definition: tool_lib.c:278
#define ECA_NORDACCESS
Definition: caerr.h:123
#define DBR_STS_LONG
Definition: db_access.h:83
#define DBR_TIME_CHAR
Definition: db_access.h:90
Definition: tool_lib.h:64
#define ECA_TIMEOUT
Definition: caerr.h:87
#define MAX_ENUM_STATES
Definition: db_access.h:31
#define DBR_TIME_DOUBLE
Definition: db_access.h:92
#define stderr
Definition: epicsStdio.h:32
char * name
Definition: tool_lib.h:69
EPICS time-stamps (epicsTimeStamp), epicsTime C++ class and C functions for handling wall-clock times...
#define PRN_DBR_GR(T, F, FMT)
Definition: tool_lib.c:285
Definition: tool_lib.h:64
epicsInt32 dbr_long_t
Definition: db_access.h:44
#define DBR_CTRL_INT
Definition: db_access.h:103
int enumAsNr
Definition: tool_lib.c:53
#define PRN_DBR_CTRL_PREC(T, F, FMT)
Definition: tool_lib.c:300
IntFormatT outTypeF
Definition: tool_lib.c:47
#define DBR_CTRL_DOUBLE
Definition: db_access.h:108
double caTimeout
Definition: tool_lib.c:55
#define dbr_type_is_GR(type)
Definition: db_access.h:651
#define DBR_GR_STRING
Definition: db_access.h:93
int epicsStrnEscapedFromRaw(char *dst, size_t dstlen, const char *src, size_t srclen)
Definition: epicsString.c:129
char strs[MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE]
Definition: db_access.h:354
#define DBR_TIME_FLOAT
Definition: db_access.h:88