56 switch (node->GetAccessMode())
74 return "(undefined access mode)";
77 return "(cycle detection)";
97 switch (node->GetRepresentation())
100 out <<
"0x" << std::hex << value;
104 out << ((value>>24)&0xff) <<
'.' << ((value>>16)&0xff) <<
'.' 105 << ((value>>8)&0xff) <<
'.' << (value&0xff);
109 out << std::hex << ((value>>32)&0xff) <<
':' << ((value>>30)&0xff) <<
':' 110 << ((value>>24)&0xff) <<
':' << ((value>>16)&0xff) <<
':' 111 << ((value>>8)&0xff) <<
':' << (value&0xff);
132 void printNode(
const std::string &prefix,
GenApi::INode *node,
int depth)
134 if (node != 0 && node->GetAccessMode() !=
GenApi::NI)
136 switch (node->GetPrincipalInterfaceType())
139 std::cout << prefix <<
"Value: " << node->GetName() <<
" " << getAccessMode(node)
144 std::cout << prefix <<
"Base: " << node->GetName() <<
" " << getAccessMode(node)
150 std::cout << prefix <<
"Integer: " << node->GetName() <<
" " 151 << getAccessMode(node) <<
" ";
157 std::cout <<
"[" << formatValue(p, p->GetMin()) <<
", " 158 << formatValue(p, p->GetMax()) <<
"]: ";
159 std::cout << formatValue(p, p->GetValue()) <<
" " << p->GetUnit();
162 std::cout << std::endl;
168 std::cout << prefix <<
"Boolean: " << node->GetName() <<
" " << getAccessMode(node);
174 std::cout <<
": " << p->GetValue();
177 std::cout << std::endl;
182 std::cout << prefix <<
"Command: " << node->GetName() <<
" " << getAccessMode(node)
188 std::cout << prefix <<
"Float: " << node->GetName() <<
" " << getAccessMode(node)
195 std::cout <<
"[" << p->GetMin() <<
", " 196 << p->GetMax() <<
"]: " 197 << p->GetValue() <<
" " << p->GetUnit();
200 std::cout << std::endl;
206 std::cout << prefix <<
"String: " << node->GetName() <<
" " << getAccessMode(node)
213 std::cout << p->GetValue();
216 std::cout << std::endl;
221 std::cout << prefix <<
"Register: " << node->GetName() <<
" " << getAccessMode(node)
227 std::cout << prefix <<
"Category: " << node->GetName() <<
" " 228 << getAccessMode(node) << std::endl;
236 GenApi::FeatureList_t feature;
237 root->GetFeatures(feature);
239 for (
size_t i=0; i<feature.size(); i++)
241 printNode(prefix+
" ", feature[i]->
GetNode(), depth-1);
250 std::cout << prefix <<
"Enumeration: " << node->GetName() <<
" " << getAccessMode(node)
260 p->GetSymbolics(list);
262 for (
size_t i=0; i<list.size(); i++)
269 std::cout << list[i];
274 if (p->GetCurrentEntry() != 0)
276 std::cout << p->GetCurrentEntry()->GetSymbolic();
280 std::cout << std::endl;
285 std::cout << prefix <<
"EnumEntry: " << node->GetName() <<
" " << getAccessMode(node)
290 std::cout << prefix <<
"Port: " << node->GetName() <<
" " << getAccessMode(node)
300 int main(
int argc,
char *argv[])
306 if (argc >= 2 && std::string(argv[1]) !=
"-h")
308 if (std::string(argv[1]) ==
"-l")
314 for (
size_t i=0; i<system.size(); i++)
318 std::cout <<
"Transport Layer " << system[i]->getID() << std::endl;
319 std::cout <<
"Vendor: " << system[i]->getVendor() << std::endl;
320 std::cout <<
"Model: " << system[i]->getModel() << std::endl;
321 std::cout <<
"Vendor version: " << system[i]->getVersion() << std::endl;
322 std::cout <<
"TL type: " << system[i]->getTLType() << std::endl;
323 std::cout <<
"Name: " << system[i]->getName() << std::endl;
324 std::cout <<
"Pathname: " << system[i]->getPathname() << std::endl;
325 std::cout <<
"Display name: " << system[i]->getDisplayName() << std::endl;
326 std::cout <<
"GenTL version " << system[i]->getMajorVersion() <<
"." 327 << system[i]->getMinorVersion() << std::endl;
328 std::cout << std::endl;
330 std::vector<std::shared_ptr<rcg::Interface> > interf=system[i]->getInterfaces();
332 for (
size_t k=0; k<interf.size(); k++)
336 std::cout <<
" Interface " << interf[k]->getID() << std::endl;
337 std::cout <<
" Display name: " << interf[k]->getDisplayName() << std::endl;
338 std::cout <<
" TL type: " << interf[k]->getTLType() << std::endl;
339 std::cout << std::endl;
341 std::vector<std::shared_ptr<rcg::Device> > device=interf[k]->getDevices();
343 for (
size_t j=0; j<device.size(); j++)
345 std::cout <<
" Device " << device[j]->getID() << std::endl;
346 std::cout <<
" Vendor: " << device[j]->getVendor() << std::endl;
347 std::cout <<
" Model: " << device[j]->getModel() << std::endl;
348 std::cout <<
" TL type: " << device[j]->getTLType() << std::endl;
349 std::cout <<
" Display name: " << device[j]->getDisplayName() << std::endl;
350 std::cout <<
" User defined name: " << device[j]->getUserDefinedName() << std::endl;
351 std::cout <<
" Access status: " << device[j]->getAccessStatus() << std::endl;
352 std::cout <<
" Serial number: " << device[j]->getSerialNumber() << std::endl;
353 std::cout <<
" Version: " << device[j]->getVersion() << std::endl;
354 std::cout <<
" TS Frequency: " << device[j]->getTimestampFrequency() << std::endl;
355 std::cout << std::endl;
371 if (k+1 < argc && std::string(argv[k]) ==
"-o")
381 std::string devid=argv[k++];
382 std::string node=
"Root";
386 size_t j=devid.find(
'?');
388 if (j != std::string::npos)
390 node=devid.substr(j+1);
391 devid=devid.substr(0, j);
394 if (node.size() == 0)
419 std::shared_ptr<GenApi::CNodeMapRef> nodemap=dev->getRemoteNodeMap(xml);
425 std::string p=argv[k++];
427 if (p.find(
'=') != std::string::npos)
431 size_t j=p.find(
'=');
432 std::string value=p.substr(j+1);
433 std::string key=p.substr(0, j);
450 std::cout <<
"Device: " << dev->getID() << std::endl;
451 std::cout <<
"Vendor: " << dev->getVendor() << std::endl;
452 std::cout <<
"Model: " << dev->getModel() << std::endl;
453 std::cout <<
"TL type: " << dev->getTLType() << std::endl;
454 std::cout <<
"Display name: " << dev->getDisplayName() << std::endl;
455 std::cout <<
"User defined name: " << dev->getUserDefinedName() << std::endl;
456 std::cout <<
"Serial number: " << dev->getSerialNumber() << std::endl;
457 std::cout <<
"Version: " << dev->getVersion() << std::endl;
458 std::cout <<
"TS Frequency: " << dev->getTimestampFrequency() << std::endl;
459 std::cout << std::endl;
461 std::vector<std::shared_ptr<rcg::Stream> > stream=dev->getStreams();
463 std::cout <<
"Available streams:" << std::endl;
464 for (
size_t i=0; i<stream.size(); i++)
466 std::cout <<
" Stream ID: " << stream[i]->getID() << std::endl;
469 std::cout << std::endl;
471 std::cout <<
"Available features:" << std::endl;
472 printNode(std::string(
" "), nodemap->_GetNode(node.c_str()), depth);
482 printNode(std::string(), p, depth);
486 std::cerr <<
"Unknown node: " << node << std::endl;
493 std::cerr <<
"Nodemap not available!" << std::endl;
500 std::cerr <<
"Device '" << devid <<
"' not found!" << std::endl;
506 std::cerr <<
"Device name not given!" << std::endl;
513 std::cout << argv[0] <<
" -h | -l | ([-o <xml-output-file>] [<interface-id>:]<device-id>[?<node>] [<key>=<value>] ...)" << std::endl;
514 std::cout << std::endl;
515 std::cout <<
"Provides information about GenICam transport layers, interfaces and devices." << std::endl;
516 std::cout << std::endl;
517 std::cout <<
"Options: " << std::endl;
518 std::cout <<
"-h Prints help information and exits" << std::endl;
519 std::cout <<
"-l List all all available devices on all interfaces" << std::endl;
520 std::cout <<
"-o Filename to store XML description from specified device" << std::endl;
521 std::cout << std::endl;
522 std::cout <<
"Parameters:" << std::endl;
523 std::cout <<
"<interface-id> Optional GenICam ID of interface for connecting to the device" << std::endl;
524 std::cout <<
"<device-id> GenICam device ID, serial number or user defined name of device" << std::endl;
525 std::cout <<
"<node> Optional name of category or parameter to be reported" << std::endl;
526 std::cout <<
"<key>=<value> Optional GenICam parameters to be changed in the given order before reporting" << std::endl;
530 catch (
const std::exception &ex)
532 std::cerr << ex.what() << std::endl;
std::shared_ptr< Device > getDevice(const char *id)
Searches across all transport layers and interfaces for a device.
Hex number in an edit control.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IBoolean
Interface for Boolean properties.
GENICAM_INTERFACE IInteger
Interface for integer properties.
static std::vector< std::shared_ptr< System > > getSystems()
Returns a list of systems (i.e.
virtual INode * GetNode(const GENICAM_NAMESPACE::gcstring &Name) const =0
Retrieves the node from the central map by Name.
used internally for AccessMode cycle detection
bool IsReadable(EAccessMode AccessMode)
Tests if readable.
static void clearSystems()
Clears the internal list of systems.
int main(int argc, char *argv[])
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IEnumeration
Interface for enumeration properties.
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.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT ICategory
Gives access to a category node.
bool callCommand(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool exception)
Calls the given command.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IString
Interface for string properties.
Object is not yet initialized.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IFloat
Interface for float properties.
GENICAM_INTERFACE INode
Interface common to all nodes.
GENICAM_NAMESPACE::gcstring_vector StringList_t
A list of strings.