libvisiontransfer  10.6.0
Public Member Functions | List of all members
visiontransfer::internal::ParameterTransfer Class Reference

Detailed Description

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, ParameterInfogetAllParameters ()
 Enumerates all parameters as reported by the device. More...
 
param::ParameterSetgetParameterSet ()
 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)
 

Constructor & Destructor Documentation

◆ ParameterTransfer()

visiontransfer::internal::ParameterTransfer::ParameterTransfer ( const char *  address,
const char *  service = "7683" 
)

Creates an object and connects to the given server.

Parameters
addressIP address or host name of the server.
serviceThe port number that should be used as string or as textual service name.

Definition at line 42 of file parametertransfer.cpp.

Member Function Documentation

◆ getAllParameters()

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.

◆ getParameterSet() [1/2]

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.

◆ getParameterSet() [2/2]

param::ParameterSet const& visiontransfer::internal::ParameterTransfer::getParameterSet ( ) const

Returns a reference to the internal parameter set (once the network handshake is complete)

◆ readBoolParameter()

bool visiontransfer::internal::ParameterTransfer::readBoolParameter ( const char *  id)

Reads a boolean value from the parameter server.

Parameters
idUnique ID of the parameter to be read.
Returns
If successful, the value of the parameter that has been read

If reading the parameter fails, then an exception of type TransferException or ParameterException is thrown.

Definition at line 274 of file parametertransfer.cpp.

◆ readDoubleParameter()

double visiontransfer::internal::ParameterTransfer::readDoubleParameter ( const char *  id)

Reads a double precision floating point value from the parameter server.

Parameters
idUnique ID of the parameter to be read.
Returns
If successful, the value of the parameter that has been read

If reading the parameter fails, then an exception of type TransferException or ParameterException is thrown.

Definition at line 262 of file parametertransfer.cpp.

◆ readIntParameter()

int visiontransfer::internal::ParameterTransfer::readIntParameter ( const char *  id)

Reads an integer value from the parameter server.

Parameters
idUnique ID of the parameter to be read.
Returns
If successful, the value of the parameter that has been read

If reading the parameter fails, then an exception of type TransferException or ParameterException is thrown.

Definition at line 250 of file parametertransfer.cpp.

◆ transactionCommitQueue()

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.

◆ transactionStartQueue()

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.

◆ writeBoolParameter()

void visiontransfer::internal::ParameterTransfer::writeBoolParameter ( const char *  id,
bool  value 
)

Writes a boolean value to a parameter of the parameter server.

Parameters
idUnique ID of the parameter to be written.
valueValue 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.

◆ writeDoubleParameter()

void visiontransfer::internal::ParameterTransfer::writeDoubleParameter ( const char *  id,
double  value 
)

Writes a double precision floating point value to a parameter of the parameter server.

Parameters
idUnique ID of the parameter to be written.
valueValue 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.

◆ writeIntParameter()

void visiontransfer::internal::ParameterTransfer::writeIntParameter ( const char *  id,
int  value 
)

Writes an integer value to a parameter of the parameter server.

Parameters
idUnique ID of the parameter to be written.
valueValue 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.

◆ writeParameter()

template<typename T >
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.

Parameters
idUnique ID of the parameter to be written.
valueValue 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.

◆ writeParameterTransactionGuarded()

template<typename T >
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.

Parameters
idUnique ID of the parameter to be written.
valueValue that should be written to the parameter.

If writing the parameter fails, then an exception of type TransferException or ParameterException is thrown.

◆ writeParameterTransactionUnguarded()

template<typename T >
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).

Parameters
idUnique ID of the parameter to be written.
valueValue that should be written to the parameter.

If writing the parameter fails immediately, an exception of type TransferException is thrown.


The documentation for this class was generated from the following files:
Allied Vision