libvisiontransfer
10.6.0
|
Allows a configuration of device parameters over the network.
A TCP connection is established to a parameter server. The protocol allows writing and reading of individual parameters, which are identified by a unique ID. There are three supported types of parameters: integers, double precision floating point values, and booleans.
This class is only used internally. Users should use the class DeviceParameters instead.
Definition at line 70 of file parametertransfer.h.
#include <visiontransfer/parametertransfer.h>
Public Member Functions | |
ParameterTransfer (const char *address, const char *service="7683") | |
Creates an object and connects to the given server. More... | |
int | readIntParameter (const char *id) |
Reads an integer value from the parameter server. More... | |
double | readDoubleParameter (const char *id) |
Reads a double precision floating point value from the parameter server. More... | |
bool | readBoolParameter (const char *id) |
Reads a boolean value from the parameter server. More... | |
void | writeIntParameter (const char *id, int value) |
Writes an integer value to a parameter of the parameter server. More... | |
void | writeDoubleParameter (const char *id, double value) |
Writes a double precision floating point value to a parameter of the parameter server. More... | |
void | writeBoolParameter (const char *id, bool value) |
Writes a boolean value to a parameter of the parameter server. More... | |
template<typename T > | |
void | writeParameter (const char *id, const T &value, bool synchronous=true) |
Writes a scalar value to a parameter of the parameter server. More... | |
template<typename T > | |
void | writeParameterTransactionGuarded (const char *id, const T &value) |
Writes a scalar value to a parameter of the parameter server, transparently deferring for a batch update if a transaction has been started. More... | |
template<typename T > | |
void | writeParameterTransactionUnguarded (const char *id, const T &value) |
Writes a scalar value to a parameter of the parameter server, using 'fire-and-forget' for real-time commands (no replies expected). More... | |
std::map< std::string, ParameterInfo > | getAllParameters () |
Enumerates all parameters as reported by the device. More... | |
param::ParameterSet & | getParameterSet () |
Returns a reference to the internal parameter set (once the network handshake is complete) More... | |
param::ParameterSet const & | getParameterSet () const |
Returns a reference to the internal parameter set (once the network handshake is complete) More... | |
void | setParameterUpdateCallback (std::function< void(const std::string &uid)> callback) |
void | transactionStartQueue () |
Start batch parameter transaction. More... | |
void | transactionCommitQueue () |
Complete the started parameter transaction. More... | |
template<> | |
void | writeParameter (const char *id, const std::string &value, bool synchronous) |
template<> | |
void | writeParameterTransactionGuarded (const char *id, const std::string &value) |
template<> | |
void | writeParameterTransactionGuarded (const char *id, const double &value) |
template<> | |
void | writeParameterTransactionGuarded (const char *id, const int &value) |
template<> | |
void | writeParameterTransactionGuarded (const char *id, const bool &value) |
template<> | |
void | writeParameterTransactionUnguarded (const char *id, const bool &value) |
visiontransfer::internal::ParameterTransfer::ParameterTransfer | ( | const char * | address, |
const char * | service = "7683" |
||
) |
Creates an object and connects to the given server.
address | IP address or host name of the server. |
service | The port number that should be used as string or as textual service name. |
Definition at line 42 of file parametertransfer.cpp.
std::map< std::string, ParameterInfo > visiontransfer::internal::ParameterTransfer::getAllParameters | ( | ) |
Enumerates all parameters as reported by the device.
Definition at line 298 of file parametertransfer.cpp.
ParameterSet const & visiontransfer::internal::ParameterTransfer::getParameterSet | ( | ) |
Returns a reference to the internal parameter set (once the network handshake is complete)
Definition at line 578 of file parametertransfer.cpp.
param::ParameterSet const& visiontransfer::internal::ParameterTransfer::getParameterSet | ( | ) | const |
Returns a reference to the internal parameter set (once the network handshake is complete)
bool visiontransfer::internal::ParameterTransfer::readBoolParameter | ( | const char * | id | ) |
Reads a boolean value from the parameter server.
id | Unique ID of the parameter to be read. |
If reading the parameter fails, then an exception of type TransferException or ParameterException is thrown.
Definition at line 274 of file parametertransfer.cpp.
double visiontransfer::internal::ParameterTransfer::readDoubleParameter | ( | const char * | id | ) |
Reads a double precision floating point value from the parameter server.
id | Unique ID of the parameter to be read. |
If reading the parameter fails, then an exception of type TransferException or ParameterException is thrown.
Definition at line 262 of file parametertransfer.cpp.
int visiontransfer::internal::ParameterTransfer::readIntParameter | ( | const char * | id | ) |
Reads an integer value from the parameter server.
id | Unique ID of the parameter to be read. |
If reading the parameter fails, then an exception of type TransferException or ParameterException is thrown.
Definition at line 250 of file parametertransfer.cpp.
void visiontransfer::internal::ParameterTransfer::transactionCommitQueue | ( | ) |
Complete the started parameter transaction.
Bundles all queued writes into a single locked request and sends them.
Definition at line 611 of file parametertransfer.cpp.
void visiontransfer::internal::ParameterTransfer::transactionStartQueue | ( | ) |
Start batch parameter transaction.
Queues all remote set operations for writing in one batch; used for robust dependent parameter recalculation.
Definition at line 600 of file parametertransfer.cpp.
void visiontransfer::internal::ParameterTransfer::writeBoolParameter | ( | const char * | id, |
bool | value | ||
) |
Writes a boolean value to a parameter of the parameter server.
id | Unique ID of the parameter to be written. |
value | Value that should be written to the parameter. |
If writing the parameter fails, then an exception of type TransferException or ParameterException is thrown.
Definition at line 294 of file parametertransfer.cpp.
void visiontransfer::internal::ParameterTransfer::writeDoubleParameter | ( | const char * | id, |
double | value | ||
) |
Writes a double precision floating point value to a parameter of the parameter server.
id | Unique ID of the parameter to be written. |
value | Value that should be written to the parameter. |
If writing the parameter fails, then an exception of type TransferException or ParameterException is thrown.
Definition at line 290 of file parametertransfer.cpp.
void visiontransfer::internal::ParameterTransfer::writeIntParameter | ( | const char * | id, |
int | value | ||
) |
Writes an integer value to a parameter of the parameter server.
id | Unique ID of the parameter to be written. |
value | Value that should be written to the parameter. |
If writing the parameter fails, then an exception of type TransferException or ParameterException is thrown.
Definition at line 286 of file parametertransfer.cpp.
void visiontransfer::internal::ParameterTransfer::writeParameter | ( | const char * | id, |
const T & | value, | ||
bool | synchronous = true |
||
) |
Writes a scalar value to a parameter of the parameter server.
id | Unique ID of the parameter to be written. |
value | Value that should be written to the parameter. |
If writing the parameter fails, then an exception of type TransferException or ParameterException is thrown.
Definition at line 123 of file parametertransfer.cpp.
void visiontransfer::internal::ParameterTransfer::writeParameterTransactionGuarded | ( | const char * | id, |
const T & | value | ||
) |
Writes a scalar value to a parameter of the parameter server, transparently deferring for a batch update if a transaction has been started.
id | Unique ID of the parameter to be written. |
value | Value that should be written to the parameter. |
If writing the parameter fails, then an exception of type TransferException or ParameterException is thrown.
void visiontransfer::internal::ParameterTransfer::writeParameterTransactionUnguarded | ( | const char * | id, |
const T & | value | ||
) |
Writes a scalar value to a parameter of the parameter server, using 'fire-and-forget' for real-time commands (no replies expected).
id | Unique ID of the parameter to be written. |
value | Value that should be written to the parameter. |
If writing the parameter fails immediately, an exception of type TransferException is thrown.