45 int main(
int argc,
char *argv[])
51 if (argc >= 2 && std::string(argv[1]) !=
"-h")
53 if (std::string(argv[1]) ==
"-l")
59 for (
size_t i=0; i<system.size(); i++)
63 std::cout <<
"Transport Layer " << system[i]->getID() << std::endl;
64 std::cout <<
"Vendor: " << system[i]->getVendor() << std::endl;
65 std::cout <<
"Model: " << system[i]->getModel() << std::endl;
66 std::cout <<
"Vendor version: " << system[i]->getVersion() << std::endl;
67 std::cout <<
"TL type: " << system[i]->getTLType() << std::endl;
68 std::cout <<
"Name: " << system[i]->getName() << std::endl;
69 std::cout <<
"Pathname: " << system[i]->getPathname() << std::endl;
70 std::cout <<
"Display name: " << system[i]->getDisplayName() << std::endl;
71 std::cout <<
"GenTL version " << system[i]->getMajorVersion() <<
"." 72 << system[i]->getMinorVersion() << std::endl;
73 std::cout << std::endl;
75 std::vector<std::shared_ptr<rcg::Interface> > interf=system[i]->getInterfaces();
77 for (
size_t k=0; k<interf.size(); k++)
81 std::cout <<
" Interface " << interf[k]->getID() << std::endl;
82 std::cout <<
" Display name: " << interf[k]->getDisplayName() << std::endl;
83 std::cout <<
" TL type: " << interf[k]->getTLType() << std::endl;
84 std::cout << std::endl;
86 std::vector<std::shared_ptr<rcg::Device> > device=interf[k]->getDevices();
88 for (
size_t j=0; j<device.size(); j++)
90 std::cout <<
" Device " << device[j]->getID() << std::endl;
91 std::cout <<
" Vendor: " << device[j]->getVendor() << std::endl;
92 std::cout <<
" Model: " << device[j]->getModel() << std::endl;
93 std::cout <<
" TL type: " << device[j]->getTLType() << std::endl;
94 std::cout <<
" Display name: " << device[j]->getDisplayName() << std::endl;
95 std::cout <<
" User defined name: " << device[j]->getUserDefinedName() << std::endl;
96 std::cout <<
" Access status: " << device[j]->getAccessStatus() << std::endl;
97 std::cout <<
" Serial number: " << device[j]->getSerialNumber() << std::endl;
98 std::cout <<
" Version: " << device[j]->getVersion() << std::endl;
99 std::cout <<
" TS Frequency: " << device[j]->getTimestampFrequency() << std::endl;
100 std::cout << std::endl;
109 else if (std::string(argv[1]) ==
"-s")
115 std::cout <<
"Interface\tSerial Number\tVendor\tModel\tName" << std::endl;
117 for (
size_t i=0; i<system.size(); i++)
121 std::vector<std::shared_ptr<rcg::Interface> > interf=system[i]->getInterfaces();
123 for (
size_t k=0; k<interf.size(); k++)
127 std::vector<std::shared_ptr<rcg::Device> > device=interf[k]->getDevices();
129 for (
size_t j=0; j<device.size(); j++)
131 std::cout << interf[k]->getID() <<
'\t' 132 << device[j]->getSerialNumber() <<
'\t' 133 << device[j]->getVendor() <<
'\t' 134 << device[j]->getModel() <<
'\t' 135 << device[j]->getDisplayName() << std::endl;
151 if (k+1 < argc && std::string(argv[k]) ==
"-o")
156 if (std::string(xml) ==
".")
163 if (k < argc && std::string(argv[k]) ==
"-e")
173 std::string devid=argv[k++];
174 std::string node=
"Root";
178 size_t j=devid.find(
'?');
180 if (j != std::string::npos)
182 node=devid.substr(j+1);
183 devid=devid.substr(0, j);
186 if (node.size() == 0)
201 if (k < argc || edit)
210 std::shared_ptr<GenApi::CNodeMapRef> nodemap=dev->getRemoteNodeMap(xml);
216 std::string p=argv[k++];
218 if (p.find(
'=') != std::string::npos)
222 size_t j=p.find(
'=');
223 std::string value=p.substr(j+1);
224 std::string key=p.substr(0, j);
241 std::cerr <<
"Unknown node: " << node << std::endl;
249 std::cout <<
"Device: " << dev->getID() << std::endl;
250 std::cout <<
"Vendor: " << dev->getVendor() << std::endl;
251 std::cout <<
"Model: " << dev->getModel() << std::endl;
252 std::cout <<
"TL type: " << dev->getTLType() << std::endl;
253 std::cout <<
"Display name: " << dev->getDisplayName() << std::endl;
254 std::cout <<
"User defined name: " << dev->getUserDefinedName() << std::endl;
255 std::cout <<
"Serial number: " << dev->getSerialNumber() << std::endl;
256 std::cout <<
"Version: " << dev->getVersion() << std::endl;
257 std::cout <<
"TS Frequency: " << dev->getTimestampFrequency() << std::endl;
258 std::cout << std::endl;
260 std::vector<std::shared_ptr<rcg::Stream> > stream=dev->getStreams();
262 std::cout <<
"Available streams:" << std::endl;
263 for (
size_t i=0; i<stream.size(); i++)
265 std::cout <<
" Stream ID: " << stream[i]->getID() << std::endl;
268 std::cout << std::endl;
270 std::cout <<
"Available features:" << std::endl;
279 std::cerr <<
"Unknown node: " << node << std::endl;
286 std::cerr <<
"Nodemap not available!" << std::endl;
293 std::cerr <<
"Device '" << devid <<
"' not found!" << std::endl;
299 std::cerr <<
"Device name not given!" << std::endl;
306 std::cout << argv[0] <<
" -h | -l | -s | ([-o <xml-output-file>|.] [-e] [<interface-id>:]<device-id>[?<node>] [<key>=<value>] ...)" << std::endl;
307 std::cout << std::endl;
308 std::cout <<
"Provides information about GenICam transport layers, interfaces and devices." << std::endl;
309 std::cout << std::endl;
310 std::cout <<
"Options: " << std::endl;
311 std::cout <<
"-h Prints help information and exits" << std::endl;
312 std::cout <<
"-l List all all available devices on all interfaces" << std::endl;
313 std::cout <<
"-s List all all available devices on all interfaces (short format)" << std::endl;
314 std::cout <<
"-o Store XML description from specified device" << std::endl;
315 std::cout <<
"-e Open nodemap editor instead of printing nodemap" << std::endl;
316 std::cout << std::endl;
317 std::cout <<
"Parameters:" << std::endl;
318 std::cout <<
"<interface-id> Optional GenICam ID of interface for connecting to the device" << std::endl;
319 std::cout <<
"<device-id> GenICam device ID, serial number or user defined name of device" << std::endl;
320 std::cout <<
"<node> Optional name of category or parameter to be reported" << std::endl;
321 std::cout <<
"<key>=<value> Optional GenICam parameters to be changed in the given order before reporting" << std::endl;
325 catch (
const std::exception &ex)
327 std::cerr << ex.what() << std::endl;
std::shared_ptr< Device > getDevice(const char *id)
Searches across all transport layers and interfaces for a device.
static std::vector< std::shared_ptr< System > > getSystems()
This function creates systems for all producers that can be found.
static void clearSystems()
Clears the internal list of systems.
bool editNodemap(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char root[])
Shows nodemap in a curses gui in the terminal and allows editing of parameters.
int main(int argc, char *argv[])
bool setString(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, const char *value, bool exception)
Set the value of a feature of the given nodemap.
bool callCommand(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool exception)
Calls the given command.
bool printNodemap(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char root[], int depth, bool show_enum_list)
Printing of nodemap, starting at given root node.