Go to the documentation of this file.
52 int main(
int argc,
char *argv[])
58 if (argc >= 2 && std::string(argv[1]) !=
"-h")
65 std::string devid=argv[k++];
81 std::shared_ptr<GenApi::CNodeMapRef> nodemap=dev->getRemoteNodeMap();
87 std::string devfile=argv[k++];
91 std::vector<std::string> list;
94 for (
size_t i=0; i<list.size(); i++)
96 std::cout << list[i] << std::endl;
112 std::ifstream in(file);
116 throw std::invalid_argument(
"Cannot open file: "+file);
120 buffer << in.rdbuf();
121 std::string data=buffer.
str();
123 std::cout <<
"Input file length: " << data.size() << std::endl;
127 else if (op ==
"-r" || op ==
"")
129 std::string data=
rcg::loadFile(nodemap, devfile.c_str(),
true);
133 std::ofstream out(file);
144 std::cerr <<
"Error: Expected parameter '-r' or '-w'!" << std::endl;
151 std::cerr <<
"Error: More parameters expected!" << std::endl;
159 std::cerr <<
"Error: Device '" << devid <<
"' not found!" << std::endl;
165 std::cerr <<
"Error: Device name not given!" << std::endl;
171 std::cout << argv[0] <<
" -h | [<interface-id>:]<device-id> -f | (<device-file> [-w|-r <file>])" << std::endl;
172 std::cout << std::endl;
173 std::cout <<
"Downloading or uploading a file via GenICam." << std::endl;
174 std::cout << std::endl;
175 std::cout <<
"-h Prints help information and exits" << std::endl;
176 std::cout <<
"-f Lists names of files on the device" << std::endl;
177 std::cout <<
"-w <file> Writes the given local file into the selected file on the device" << std::endl;
178 std::cout <<
"-r <file> Reads the selected file on the device and stores it as local file" << std::endl;
179 std::cout << std::endl;
180 std::cout <<
"The selected file is printed on std out if none of -f, -w and -r are given." << std::endl;
184 catch (
const std::exception &ex)
186 std::cerr << ex.what() << std::endl;
191 std::cerr << ex.
what() << std::endl;
std::shared_ptr< Device > getDevice(const char *id, uint64_t timeout)
Searches across all transport layers and interfaces for a device.
std::string loadFile(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool exception)
Loads the contents of a file via the GenICam FileAccessControl interface.
static void clearSystems()
Clears the internal list of systems.
std::string getEnum(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool exception)
Get the value of an enumeration of the given nodemap.
int main(int argc, char *argv[])
bool saveFile(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, const std::string &data, bool exception)
Loads the contents of the given string as a file via the GenICam FileAccessControl interface.
virtual const char * what() const
Get error description (overwrite from std:exception)
Definition of ODevFileStream and IDevFileStream.
GenICam's exception class.
rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Dec 4 2024 03:10:11