Go to the documentation of this file.
43 int main(
int argc,
char *argv[])
49 if (argc > 1 && std::string(argv[1]) !=
"-h")
53 if (std::string(argv[1]) ==
"-l")
55 std::cout <<
"Available GigE Vision devices:" << std::endl;
59 for (
size_t i=0; i<system.size(); i++)
63 std::vector<std::shared_ptr<rcg::Interface> > interf=system[i]->getInterfaces();
65 for (
size_t k=0; k<interf.size(); k++)
69 std::vector<std::shared_ptr<rcg::Device> > device=interf[k]->getDevices();
71 for (
size_t j=0; j<device.size(); j++)
73 if (device[j]->getTLType() ==
"GEV")
75 std::cout <<
" " << interf[k]->getID() <<
":" << device[j]->getSerialNumber() <<
" (";
77 std::string uname=device[j]->getDisplayName();
81 std::cout << uname <<
", ";
84 std::cout << device[j]->getID() <<
")" << std::endl;
103 bool showsummary=
false;
110 if (i == argc || (i+1 == argc && std::string(argv[i]) ==
"--iponly"))
118 catch (
const std::exception &)
135 std::shared_ptr<GenApi::CNodeMapRef> nodemap=dev->getRemoteNodeMap();
142 std::string p=argv[i++];
148 else if (p[0] ==
'-' && i < argc)
162 rcg::setString(nodemap,
"GevCurrentIPConfigurationDHCP", argv[i++],
true);
166 rcg::setString(nodemap,
"GevCurrentIPConfigurationPersistentIP", argv[i++],
true);
186 std::cerr <<
"Unknown parameter: " << p << std::endl;
190 else if (p.size() > 0 && p[0] ==
'@')
198 catch (
const std::exception &ex)
200 std::cerr <<
"Warning: Loading of parameters from file '" << p.substr(1) <<
201 "' failed at least partially" << std::endl;
202 std::cerr << ex.what() << std::endl;
205 else if (p.find(
'=') != std::string::npos)
209 size_t k=p.find(
'=');
210 std::string value=p.substr(k+1);
211 std::string key=p.substr(0, k);
228 std::cout <<
rcg::getString(nodemap,
"GevCurrentIPAddress") << std::endl;
230 else if (showsummary)
232 std::cout <<
"ID: " << dev->getParent()->getID() <<
":"
234 std::cout <<
"GenTL ID: " << dev->getID() << std::endl;
235 std::cout <<
"Serial number: " <<
rcg::getString(nodemap,
"DeviceID") << std::endl;
236 std::cout <<
"User defined ID: " <<
rcg::getString(nodemap,
"DeviceUserID") << std::endl;
237 std::cout << std::endl;
251 std::cout <<
"Interface " << i <<
":" << std::endl;
253 std::cout <<
" MAC Address: " <<
rcg::getString(nodemap,
"GevMACAddress") << std::endl;
254 std::cout << std::endl;
256 std::cout <<
" Current IP: " <<
rcg::getString(nodemap,
"GevCurrentIPAddress") << std::endl;
257 std::cout <<
" Current subnet mask: " <<
rcg::getString(nodemap,
"GevCurrentSubnetMask") << std::endl;
258 std::cout <<
" Current gateway: " <<
rcg::getString(nodemap,
"GevCurrentDefaultGateway") << std::endl;
259 std::cout << std::endl;
261 std::cout <<
" Persistent IP on/off: " <<
rcg::getString(nodemap,
"GevCurrentIPConfigurationPersistentIP") << std::endl;
262 std::cout <<
" Persistent IP: " <<
rcg::getString(nodemap,
"GevPersistentIPAddress") << std::endl;
263 std::cout <<
" Persistent subnet mask: " <<
rcg::getString(nodemap,
"GevPersistentSubnetMask") << std::endl;
264 std::cout <<
" Persistent gateway: " <<
rcg::getString(nodemap,
"GevPersistentDefaultGateway") << std::endl;
265 std::cout <<
" DHCP on/off: " <<
rcg::getString(nodemap,
"GevCurrentIPConfigurationDHCP") << std::endl;
266 std::cout <<
" Link local on/off: " <<
rcg::getString(nodemap,
"GevCurrentIPConfigurationLLA") << std::endl;
267 std::cout << std::endl;
270 catch (
const std::exception &)
272 std::cout <<
"Gev interface parameters are not available" << std::endl;
273 std::cout << std::endl;
285 std::cout <<
"PTP: " <<
rcg::getString(nodemap,
"PtpEnable") << std::endl;
286 std::cout <<
"PTP status: " <<
rcg::getString(nodemap,
"PtpStatus") << std::endl;
287 std::cout <<
"PTP offset: " <<
rcg::getInteger(nodemap,
"PtpOffsetFromMaster") <<
" ns" << std::endl;
291 std::cout <<
"Ptp cannot be shown due to another application with control access." << std::endl;
292 std::cout << std::endl;
295 catch (
const std::exception &)
297 std::cout <<
"Ptp parameters are not available" << std::endl;
298 std::cout << std::endl;
306 std::cerr <<
"Cannot find device: " << argv[1] << std::endl;
313 std::cout << argv[0] <<
" -h | -l | ([<interface-id>:]<device-id> <options> ...)" << std::endl;
314 std::cout << std::endl;
315 std::cout <<
"Configuration of a GigE Vision device via GenICam." << std::endl;
316 std::cout << std::endl;
317 std::cout <<
"-h Prints help information and exits" << std::endl;
318 std::cout <<
"-l Lists all available GigE Vision devices" << std::endl;
319 std::cout << std::endl;
320 std::cout <<
"Parameters:" << std::endl;
321 std::cout <<
"<interface-id> Optional GenICam ID of interface for connecting to the device" << std::endl;
322 std::cout <<
"<device-id> GenICam device ID, serial number or user defined name of device" << std::endl;
323 std::cout << std::endl;
324 std::cout <<
"Options:" << std::endl;
325 std::cout <<
"-n <id> Set user defined id" << std::endl;
326 std::cout <<
"-f <n> Apply all further IP settings to interface with specified number. Default: 0" << std::endl;
327 std::cout <<
"-d 1|0 Switch DHCP on or off" << std::endl;
328 std::cout <<
"-p 1|0 Switch persistent IP on or off" << std::endl;
329 std::cout <<
"-t 1|0 Switch precision time protocol (ptp) on or off" << std::endl;
330 std::cout <<
"-i <ip> Set persistent IP address" << std::endl;
331 std::cout <<
"-s <ip> Set subnet mask for persistent IP address" << std::endl;
332 std::cout <<
"-g <ip> Set default gateway for persistent IP address" << std::endl;
333 std::cout <<
"--iponly Show current IP of device instead of full summary" << std::endl;
334 std::cout <<
"@<file> Optional file with parameters as store with parameter 'gc_info -p ...'" << std::endl;
335 std::cout <<
"<key>=<value> Optional GenICam parameters to be changed in the given order" << std::endl;
339 catch (
const std::exception &ex)
341 std::cerr << ex.what() << std::endl;
bool setIPV4Address(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, const char *value, bool exception)
Set the value of an integer feature of the given nodemap from an IP address.
std::shared_ptr< Device > getDevice(const char *id, uint64_t timeout)
Searches across all transport layers and interfaces for a device.
int main(int argc, char *argv[])
bool callCommand(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool exception)
Calls the given command.
static void clearSystems()
Clears the internal list of systems.
bool loadStreamableParameters(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool exception)
Load all streamable parameters from file into the nodemap.
bool setInteger(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, int64_t value, bool exception)
Set the value of an integer feature of the given nodemap.
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.
int64_t getInteger(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, int64_t *vmin, int64_t *vmax, bool exception, bool igncache)
Get the value of an integer feature of the given nodemap.
std::string getString(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool exception, bool igncache)
Get the value of a feature of the given nodemap.
static std::vector< std::shared_ptr< System > > getSystems()
This function creates systems for all producers that can be found.
rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Dec 4 2024 03:10:11