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 <<
" Access status: " << device[j]->getAccessStatus() << std::endl;
351 std::cout <<
" Serial number: " << device[j]->getSerialNumber() << std::endl;
352 std::cout <<
" Version: " << device[j]->getVersion() << std::endl;
353 std::cout <<
" TS Frequency: " << device[j]->getTimestampFrequency() << std::endl;
354 std::cout << std::endl;
370 if (k+1 < argc && std::string(argv[k]) ==
"-o")
380 std::string devid=argv[k++];
381 std::string node=
"Root";
385 size_t j=devid.find(
'?');
387 if (j != std::string::npos)
389 node=devid.substr(j+1);
390 devid=devid.substr(0, j);
393 if (node.size() == 0)
418 std::shared_ptr<GenApi::CNodeMapRef> nodemap=dev->getRemoteNodeMap(xml);
422 std::string p=argv[k++];
424 if (p.find(
'=') != std::string::npos)
428 size_t j=p.find(
'=');
429 std::string value=p.substr(j+1);
430 std::string key=p.substr(0, j);
447 std::cout <<
"Device: " << dev->getID() << std::endl;
448 std::cout <<
"Vendor: " << dev->getVendor() << std::endl;
449 std::cout <<
"Model: " << dev->getModel() << std::endl;
450 std::cout <<
"TL type: " << dev->getTLType() << std::endl;
451 std::cout <<
"Display name: " << dev->getDisplayName() << std::endl;
452 std::cout <<
"User name: " << dev->getUserDefinedName() << std::endl;
453 std::cout <<
"Serial number: " << dev->getSerialNumber() << std::endl;
454 std::cout <<
"Version: " << dev->getVersion() << std::endl;
455 std::cout <<
"TS Frequency: " << dev->getTimestampFrequency() << std::endl;
456 std::cout << std::endl;
458 std::vector<std::shared_ptr<rcg::Stream> > stream=dev->getStreams();
460 std::cout <<
"Available streams:" << std::endl;
461 for (
size_t i=0; i<stream.size(); i++)
463 std::cout <<
" Stream ID: " << stream[i]->getID() << std::endl;
466 std::cout << std::endl;
468 std::cout <<
"Available features:" << std::endl;
469 printNode(std::string(
" "), nodemap->_GetNode(node.c_str()), depth);
479 printNode(std::string(), p, depth);
483 std::cerr <<
"Unknown node: " << node << std::endl;
492 std::cerr <<
"Device '" << devid <<
"' not found!" << std::endl;
498 std::cerr <<
"Device name not given!" << std::endl;
505 std::cout << argv[0] <<
" -h | -l | ([-o <xml-output-file>] [<interface-id>:]<device-id>[?<node>] [<key>=<value>] ...)" << std::endl;
506 std::cout << std::endl;
507 std::cout <<
"Provides information about GenICam transport layers, interfaces and devices." << std::endl;
508 std::cout << std::endl;
509 std::cout <<
"Options: " << std::endl;
510 std::cout <<
"-h Prints help information and exits" << std::endl;
511 std::cout <<
"-l List all all available devices on all interfaces" << std::endl;
512 std::cout <<
"-o Filename to store XML description from specified device" << std::endl;
513 std::cout << std::endl;
514 std::cout <<
"Parameters:" << std::endl;
515 std::cout <<
"<interface-id> Optional GenICam ID of interface for connecting to the device" << std::endl;
516 std::cout <<
"<device-id> GenICam device ID, serial number or user defined name of device" << std::endl;
517 std::cout <<
"<node> Optional name of category or parameter to be reported" << std::endl;
518 std::cout <<
"<key>=<value> Optional GenICam parameters to be changed in the given order before reporting" << std::endl;
522 catch (
const std::exception &ex)
524 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.
interface GENAPI_DECL_ABSTRACT IBoolean
Interface for Boolean 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
interface GENAPI_DECL_ABSTRACT IEnumeration
Interface for enumeration properties.
bool IsReadable(EAccessMode AccessMode)
Tests if readable.
interface GENAPI_DECL_ABSTRACT IInteger
Interface for integer properties.
interface GENAPI_DECL_ABSTRACT IFloat
Interface for float properties.
static void clearSystems()
Clears the internal list of systems.
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.
interface GENAPI_DECL_ABSTRACT IString
Interface for string properties.
Object is not yet initialized.
interface GENAPI_DECL_ABSTRACT INode
Interface common to all nodes.
GENICAM_NAMESPACE::gcstring_vector StringList_t
A list of strings.
interface GENAPI_DECL_ABSTRACT ICategory
Gives access to a category node.