#include <stdio.h>
#include <epicsStdlib.h>
#include <string.h>
#include "epicsVersion.h"
#include <cadef.h>
#include <epicsGetopt.h>
#include "tool_lib.h"
Go to the source code of this file.
|
void | usage (void) |
|
int | main (int argc, char *argv[]) |
|
#define VALID_DOUBLE_DIGITS 18 /* Max usable precision for a double */ |
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 206 of file camonitor.c.
221 while ((opt =
getopt(argc, argv,
":nhVm:sSe:f:g:l:#:0:w:t:p:F:")) != -1) {
227 printf(
"\nEPICS Version %s, CA Protocol version %s\n", EPICS_VERSION_STRING,
ca_version() );
247 fprintf(
stderr,
"Invalid argument '%c' " 248 "for option '-t' - ignored.\n", c);
255 fprintf(
stderr,
"'%s' is not a valid timeout value " 256 "- ignored. ('camonitor -h' for help.)\n",
optarg);
261 if (sscanf(
optarg,
"%ld", &reqElems) != 1)
263 fprintf(
stderr,
"'%s' is not a valid array element count " 264 "- ignored. ('camonitor -h' for help.)\n",
optarg);
271 fprintf(
stderr,
"'%s' is not a valid CA priority " 272 "- ignored. ('camonitor -h' for help.)\n",
optarg);
282 while ((c =
optarg[i++]) && !err)
286 case 'l': eventMask |=
DBE_LOG;
break;
289 fprintf(
stderr,
"Invalid argument '%s' " 290 "for option '-m' - ignored.\n",
optarg);
305 if (sscanf(
optarg,
"%d", &digits) != 1)
307 "Invalid precision argument '%s' " 308 "for option '-%c' - ignored.\n",
optarg, opt);
314 fprintf(
stderr,
"Precision %d for option '-%c' " 315 "out of range - ignored.\n", digits, opt);
321 case 'x': outType =
hex;
break;
322 case 'b': outType =
bin;
break;
323 case 'o': outType =
oct;
break;
326 fprintf(
stderr,
"Invalid argument '%s' " 327 "for option '-%c' - ignored.\n", optarg, opt);
329 if (outType !=
dec) {
339 "Unrecognized option: '-%c'. ('camonitor -h' for help.)\n",
344 "Option '-%c' requires an argument. ('camonitor -h' for help.)\n",
357 fprintf(
stderr,
"No pv name specified. ('camonitor -h' for help.)\n");
364 fprintf(
stderr,
"CA error %s occurred while trying " 365 "to start channel access.\n",
ca_message(result));
370 pvs = calloc (nPvs,
sizeof(
pv));
373 fprintf(
stderr,
"Memory allocation for channel structures failed.\n");
379 for (n = 0; optind < argc; n++, optind++)
384 returncode =
create_pvs(pvs, nPvs, connection_handler);
390 for (n = 0; n < nPvs; n++)
392 if (!pvs[n].onceConnected)
int getopt(int nargc, char *const *nargv, const char *ostr)
#define VALID_DOUBLE_DIGITS
#define epicsScanDouble(str, to)
int epicsStdCall ca_context_create(ca_preemptive_callback_select premptiveCallbackSelect)
int epicsStdCall ca_pend_event(ca_real timeout)
const char *epicsStdCall ca_message(long ca_status)
const char *epicsStdCall ca_version()
void epicsStdCall ca_context_destroy()
Definition at line 44 of file camonitor.c.
46 fprintf (
stderr,
"\nUsage: camonitor [options] <PV name> ...\n" 48 " -h: Help: Print this message\n" 49 " -V: Version: Show EPICS and CA versions\n" 50 "Channel Access options:\n" 51 " -w <sec>: Wait time, specifies CA timeout, default is %f second(s)\n" 52 " -m <msk>: Specify CA event mask to use. <msk> is any combination of\n" 53 " 'v' (value), 'a' (alarm), 'l' (log/archive), 'p' (property).\n" 54 " Default event mask is 'va'\n" 55 " -p <pri>: CA priority (0-%u, default 0=lowest)\n" 57 " Default: Print absolute timestamps (as reported by CA server)\n" 58 " -t <key>: Specify timestamp source(s) and type, with <key> containing\n" 59 " 's' = CA server (remote) timestamps\n" 60 " 'c' = CA client (local) timestamps (shown in '()'s)\n" 61 " 'n' = no timestamps\n" 62 " 'r' = relative timestamps (time elapsed since start of program)\n" 63 " 'i' = incremental timestamps (time elapsed since last update)\n" 64 " 'I' = incremental timestamps (time since last update, by channel)\n" 65 " 'r', 'i' or 'I' require 's' or 'c' to select the time source\n" 67 " -n: Print DBF_ENUM values as number (default is enum string)\n" 68 "Array values: Print number of elements, then list of values\n" 69 " Default: Request and print all elements (dynamic arrays supported)\n" 70 " -# <num>: Request and print up to <num> elements\n" 71 " -S: Print arrays of char as a string (long string)\n" 72 "Floating point format:\n" 73 " Default: Use %%g format\n" 74 " -e <num>: Use %%e format, with a precision of <num> digits\n" 75 " -f <num>: Use %%f format, with a precision of <num> digits\n" 76 " -g <num>: Use %%g format, with a precision of <num> digits\n" 77 " -s: Get value as string (honors server-side precision)\n" 78 " -lx: Round to long integer and print as hex number\n" 79 " -lo: Round to long integer and print as octal number\n" 80 " -lb: Round to long integer and print as binary number\n" 81 "Integer number format:\n" 82 " Default: Print as decimal number\n" 83 " -0x: Print as hex number\n" 84 " -0o: Print as octal number\n" 85 " -0b: Print as binary number\n" 86 "Alternate output field separator:\n" 87 " -F <ofs>: Use <ofs> to separate fields in output\n" 89 "Example: camonitor -f8 my_channel another_channel\n" 90 " (doubles are printed as %%f with precision of 8)\n\n"