15 #include <visiontransfer/deviceenumeration.h> 16 #include <visiontransfer/imagetransfer.h> 17 #include <visiontransfer/imageset.h> 18 #include <visiontransfer/deviceparameters.h> 28 int main(
int argc,
const char** argv) {
34 if(devices.size() == 0) {
35 std::cout <<
"No devices discovered!" << std::endl;
40 std::cout <<
"Discovered devices:" << std::endl;
41 for(
unsigned int i = 0; i< devices.size(); i++) {
42 std::cout << devices[i].toString() << std::endl;
44 std::cout << std::endl;
54 std::cout << std::boolalpha << std::left;
55 std::cout <<
"Server-side Parameter Enumeration" << std::endl;
56 std::cout <<
"=================================" << std::endl << std::endl;
58 std::cout <<
"All " << allParams.size() <<
" parameters reported by server:" << std::endl;
59 for (ParameterSet::iterator it = allParams.begin(); it != allParams.end(); ++it) {
62 case ParameterValue::TYPE_INT: {
63 std::cout << std::setw(colW) << (param.
getUid()+
" (int)") <<
" = " << std::setw(valueW) << param.
getCurrent<
int>();
65 std::cout <<
" range " << param.
getMin<
int>() <<
"-" << param.
getMax<
int>();
70 std::cout << std::endl;
73 case ParameterValue::TYPE_BOOL: {
74 std::cout << std::setw(colW) << (param.
getUid() +
" (bool)") <<
" = " << (param.
getCurrent<
bool>()?
"true":
"false") << std::endl;
77 case ParameterValue::TYPE_DOUBLE: {
78 std::cout << std::setw(colW) << (param.
getUid()+
" (double)") <<
" = " << std::setw(valueW) << param.
getCurrent<
double>();
80 std::cout <<
" range " << param.
getMin<
double>() <<
"-" << param.
getMax<
double>();
83 std::cout <<
" increment " << param.
getIncrement<
double>();
85 std::cout << std::endl;
88 case ParameterValue::TYPE_STRING: {
89 std::cout << std::setw(colW) << (param.
getUid() +
" (string)") <<
" = \"" << param.
getCurrent<std::string>() <<
"\"" << std::endl;
92 case ParameterValue::TYPE_SAFESTRING: {
93 std::cout << std::setw(colW) << (param.
getUid() +
" (safestring)") <<
" = \"" << param.
getCurrent<std::string>() <<
"\"" << std::endl;
96 case ParameterValue::TYPE_TENSOR: {
97 std::cout << std::setw(colW) << (param.
getUid() +
" (tensor) - shape: ");
99 if (i) std::cout <<
"x";
102 std::cout << std::endl;
105 std::cout << std::setw(colW) << (
" ");
106 std::cout <<
" - data: ";
109 std::cout << data[i] <<
" ";
110 if (((i+1)%perline)==0) {
111 std::cout << std::endl << std::setw(colW) << (
" ") <<
" ";
114 std::cout << std::endl;
117 case ParameterValue::TYPE_COMMAND: {
118 std::cout << std::setw(colW) << (param.
getUid() +
" (-> command trigger)") << std::endl;
132 std::cout << std::endl;
136 std::string argname(argv[1]);
138 std::string val(argv[2]);
139 std::cout <<
"Sending request to set " << argname <<
" to " << val << std::endl;
140 parameters.setParameter(argname, val);
142 std::cout <<
"Requesting single parameter " << argname << std::endl;
143 std::cout <<
"-> cast as a string: " << parameters.getParameter(argname).getCurrent<std::string>() << std::endl;
146 std::cout <<
"You can launch this with a parameter name to get (and a value to set it)" << std::endl;
147 std::cout <<
" e.g. " << argv[0] <<
" operation_mode [2]" << std::endl;
151 }
catch(
const std::exception& ex) {
152 std::cerr <<
"Exception occurred: " << ex.what() << std::endl;
DeviceList discoverDevices()
Discovers new devices and returns the list of all devices that have been found.
unsigned int getTensorDimension() const
bool hasIncrement() const
std::string getUid() const
Allows for configuration of the parameters of a Nerian stereo device through a network connection...
std::vector< unsigned int > getTensorShape() const
ParameterValue::ParameterType getType() const
Allows for the discovery of devices in the network.
unsigned int getTensorNumElements() const
std::vector< double > getTensorData() const