/* * Copyright information and license terms for this software can be * found in the file LICENSE that is included with the distribution */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "pvutils.h" namespace pvd = epics::pvData; namespace pva = epics::pvAccess; namespace { void usage (void) { fprintf (stderr, "\nUsage: pvinfo [options] ...\n\n" "\noptions:\n" " -h: Help: Print this message\n" " -V: Print version and exit\n" " -w : Wait time, specifies timeout, default is %f second(s)\n" " -p : Set default provider name, default is '%s'\n" " -d: Enable debug output\n" " -c: Wait for clean shutdown and report used instance count (for expert users)" "\nExample: pvinfo double01\n\n" , timeout, defaultProvider.c_str()); } int haderror; struct GetInfo : public pvac::ClientChannel::InfoCallback, public Tracker { pvac::Operation op; virtual void infoDone(const pvac::InfoEvent& evt) { switch(evt.event) { case pvac::InfoEvent::Cancel: break; case pvac::InfoEvent::Fail: std::cerr< > infos; pva::ca::CAClientFactory::start(); { pvac::ClientProvider prov(defaultProvider); for(int i = optind; i info(new GetInfo); info->op = prov.connect(argv[i]).info(info.get()); infos.push_back(info); } Tracker::prepare(); // install signal handler { Guard G(Tracker::doneLock); while(Tracker::inprog.size() && !Tracker::abort) { UnGuard U(G); if(timeout<=0) Tracker::doneEvt.wait(); else if(!Tracker::doneEvt.wait(timeout)) { haderror = 1; std::cerr<<"Timeout\n"; break; } } } } return haderror ? 1 : 0; }