45 int main(
int argc,
char *argv[])
51 if (argc >= 2 && std::string(argv[1]) !=
"-h")
53 if (std::string(argv[1]) ==
"-L" || std::string(argv[1]) ==
"-l")
55 bool extended=(std::string(argv[1]) ==
"-L");
61 for (
size_t i=0; i<system.size(); i++)
65 std::cout <<
"Transport Layer " << system[i]->getID() << std::endl;
66 std::cout <<
"Vendor: " << system[i]->getVendor() << std::endl;
67 std::cout <<
"Model: " << system[i]->getModel() << std::endl;
68 std::cout <<
"Vendor version: " << system[i]->getVersion() << std::endl;
69 std::cout <<
"TL type: " << system[i]->getTLType() << std::endl;
70 std::cout <<
"Name: " << system[i]->getName() << std::endl;
71 std::cout <<
"Pathname: " << system[i]->getPathname() << std::endl;
72 std::cout <<
"Display name: " << system[i]->getDisplayName() << std::endl;
73 std::cout <<
"GenTL version " << system[i]->getMajorVersion() <<
"."
74 << system[i]->getMinorVersion() << std::endl;
75 std::cout << std::endl;
77 std::vector<std::shared_ptr<rcg::Interface> > interf=system[i]->getInterfaces();
82 std::cout << std::endl;
85 for (
size_t k=0; k<interf.size(); k++)
89 std::cout <<
" Interface " << interf[k]->getID() << std::endl;
90 std::cout <<
" Display name: " << interf[k]->getDisplayName() << std::endl;
91 std::cout <<
" TL type: " << interf[k]->getTLType() << std::endl;
92 std::cout << std::endl;
94 std::vector<std::shared_ptr<rcg::Device> > device=interf[k]->getDevices();
99 std::cout << std::endl;
102 for (
size_t j=0; j<device.size(); j++)
104 std::cout <<
" Device " << device[j]->getID() << std::endl;
105 std::cout <<
" Vendor: " << device[j]->getVendor() << std::endl;
106 std::cout <<
" Model: " << device[j]->getModel() << std::endl;
107 std::cout <<
" TL type: " << device[j]->getTLType() << std::endl;
108 std::cout <<
" Display name: " << device[j]->getDisplayName() << std::endl;
109 std::cout <<
" User defined name: " << device[j]->getUserDefinedName() << std::endl;
110 std::cout <<
" Access status: " << device[j]->getAccessStatus() << std::endl;
111 std::cout <<
" Serial number: " << device[j]->getSerialNumber() << std::endl;
112 std::cout <<
" Version: " << device[j]->getVersion() << std::endl;
113 std::cout <<
" TS Frequency: " << device[j]->getTimestampFrequency() << std::endl;
114 std::cout << std::endl;
123 else if (std::string(argv[1]) ==
"-s")
129 std::cout <<
"Interface\tSerial Number\tVendor\tModel\tName" << std::endl;
131 for (
size_t i=0; i<system.size(); i++)
135 std::vector<std::shared_ptr<rcg::Interface> > interf=system[i]->getInterfaces();
137 for (
size_t k=0; k<interf.size(); k++)
141 std::vector<std::shared_ptr<rcg::Device> > device=interf[k]->getDevices();
143 for (
size_t j=0; j<device.size(); j++)
145 std::cout << interf[k]->getID() <<
'\t'
146 << device[j]->getSerialNumber() <<
'\t'
147 << device[j]->getVendor() <<
'\t'
148 << device[j]->getModel() <<
'\t'
149 << device[j]->getDisplayName() << std::endl;
164 int module_event_timeout=-1;
166 const char *paramfile=0;
167 bool local_nodemap=
false;
170 while (k+1 < argc && argv[k][0] ==
'-')
172 if (std::string(argv[k]) ==
"-o")
177 if (std::string(xml) ==
".")
182 else if (std::string(argv[k]) ==
"-m")
185 module_event_timeout=std::stoi(std::string(argv[k++]));
187 else if (std::string(argv[k]) ==
"-p")
192 else if (std::string(argv[k]) ==
"-d")
197 else if (std::string(argv[k]) ==
"-e")
204 std::cerr <<
"Unknown parameter: " << argv[k] << std::endl;
216 std::string devid=argv[k++];
217 std::string node=
"Root";
221 size_t j=devid.find(
'?');
223 if (j != std::string::npos)
225 if (devid.substr(j+1) !=
"-")
227 node=devid.substr(j+1);
228 devid=devid.substr(0, j);
231 if (node.size() == 0)
239 devid=devid.substr(0, j);
252 if (k < argc || edit || paramfile)
263 std::shared_ptr<GenApi::CNodeMapRef> nodemap;
266 nodemap=dev->getNodeMap(xml);
270 nodemap=dev->getRemoteNodeMap(xml);
275 if (module_event_timeout >= 0)
277 dev->enableModuleEvents();
279 std::shared_ptr<GenApi::CNodeMapRef> lnodemap;
280 lnodemap=dev->getNodeMap();
282 std::vector<std::string> list;
285 for (
size_t i=0; i<list.size(); i++)
287 rcg::setEnum(lnodemap,
"EventSelector", list[i].c_str(),
true);
288 rcg::setEnum(lnodemap,
"EventNotification",
"On",
false);
298 std::string p=argv[k++];
300 if (p.size() > 0 && p[0] ==
'@')
306 else if (p.find(
'=') != std::string::npos)
310 size_t j=p.find(
'=');
311 std::string value=p.substr(j+1);
312 std::string key=p.substr(0, j);
325 if (module_event_timeout >= 0)
327 std::cout <<
"Waiting for events" << std::endl;
329 int64_t eventid=dev->getModuleEvent(1000*module_event_timeout);
333 std::cout <<
"Received no module events" << std::endl;
338 std::cout <<
"Received module event with ID: " << eventid << std::endl;
339 eventid=dev->getModuleEvent(0);
342 std::cout << std::endl;
349 std::cerr <<
"Unknown node: " << node << std::endl;
353 else if (node.size() > 0)
359 std::cout <<
"Device: " << dev->getID() << std::endl;
360 std::cout <<
"Vendor: " << dev->getVendor() << std::endl;
361 std::cout <<
"Model: " << dev->getModel() << std::endl;
362 std::cout <<
"TL type: " << dev->getTLType() << std::endl;
363 std::cout <<
"Display name: " << dev->getDisplayName() << std::endl;
364 std::cout <<
"User defined name: " << dev->getUserDefinedName() << std::endl;
365 std::cout <<
"Serial number: " << dev->getSerialNumber() << std::endl;
366 std::cout <<
"Version: " << dev->getVersion() << std::endl;
367 std::cout <<
"TS Frequency: " << dev->getTimestampFrequency() << std::endl;
368 std::cout << std::endl;
370 std::vector<std::shared_ptr<rcg::Stream> > stream=dev->getStreams();
372 std::cout <<
"Available streams:" << std::endl;
373 for (
size_t i=0; i<stream.size(); i++)
375 std::cout <<
" Stream ID: " << stream[i]->getID() << std::endl;
378 std::cout << std::endl;
382 std::cout <<
"Local device nodemap:" << std::endl;
386 std::cout <<
"Remote device nodemap:" << std::endl;
397 std::cerr <<
"Unknown node: " << node << std::endl;
410 std::cerr <<
"Nodemap not available!" << std::endl;
417 std::cerr <<
"Device '" << devid <<
"' not found!" << std::endl;
423 std::cerr <<
"Device name not given!" << std::endl;
431 std::cout << argv[0] <<
" -h | -L | -l | -s | ([-o <xml-output-file>|.] [-m <timeout>] [-p <file>] [-d] [-e] [<interface-id>:]<device-id>[?<node>] [@<file>] [<key>=<value>] ...)" << std::endl;
432 std::cout << std::endl;
433 std::cout <<
"Provides information about GenICam transport layers, interfaces and devices." << std::endl;
434 std::cout << std::endl;
435 std::cout <<
"Options: " << std::endl;
436 std::cout <<
"-h Prints help information and exits" << std::endl;
437 std::cout <<
"-L List all available devices on all interfaces (extended format)" << std::endl;
438 std::cout <<
"-l List all available devices on all interfaces" << std::endl;
439 std::cout <<
"-s List all available devices on all interfaces (short format)" << std::endl;
440 std::cout <<
"-o Store XML description from specified device" << std::endl;
441 std::cout <<
"-m Registers for module events and waits for the given number of seconds for such events" << std::endl;
442 std::cout <<
"-d Use local device nodemap, instead of remote nodemap" << std::endl;
443 std::cout <<
"-e Open nodemap editor instead of printing nodemap" << std::endl;
444 std::cout <<
"-p Store all streamable parameters to the given file, after applying all parameters" << std::endl;
445 std::cout << std::endl;
446 std::cout <<
"Parameters:" << std::endl;
447 std::cout <<
"<interface-id> Optional GenICam ID of interface for connecting to the device" << std::endl;
448 std::cout <<
"<device-id> GenICam device ID, serial number or user defined name of device" << std::endl;
449 std::cout <<
"<node> Optional name of category or parameter to be reported. '-' for none. Default is 'Root'." << std::endl;
450 std::cout <<
"@<file> Optional file with parameters as store with parameter '-p'" << std::endl;
451 std::cout <<
"<key>=<value> Optional GenICam parameters to be changed in the given order before reporting" << std::endl;
455 catch (
const std::exception &ex)
457 std::cerr << ex.what() << std::endl;