|
VRPN 06.04 |
The vrpn_Analog_Output_Remote class enables the client program to specify an analog value on a server object. It is the inverse of a vrpn_Analog_Remote (which tells what analog values on a server object). Servers that include analog output objects can also implement the vrpn_Analog interface. User code will control the object's value using the vrpn_Analog_Output_Remote interface and listen for reports of new positions on the vrpn_Analog_Remote interface. Selections from the #include file
// Open an analog device that is on the other end of a connection
// and handle updates from it. This is the type of analog device
// that user code will deal with.
class vrpn_Analog_Output_Remote : public vrpn_Analog_Output {
public:
// The name of the analog device to connect to
// Optional argument to be used when the Remote should
// listen on a connection that is already open.
vrpn_Analog_Output_Remote(const char* name,
vrpn_Connection* c = NULL);
virtual ~vrpn_Analog_Output_Remote (void);
// Call each time through application main loop.
virtual void mainloop();
// Request the analog to change its value to the
// one specified. Returns false on failure.
virtual bool request_change_channel_value(unsigned int chan,
vrpn_float64 val,
vrpn_uint32 class_of_service = vrpn_CONNECTION_RELIABLE);
// Request the analog to change values all at once. If
// more values are given than we have channels, the extra
// values are discarded. If less values are given than we
// have channels, the extra channels are set to 0.
// Returns false on failure.
virtual bool request_change_channels(int num,
vrpn_float64* vals,
vrpn_uint32 class_of_service = vrpn_CONNECTION_RELIABLE);
};
Using a vrpn_Analog_Output_RemoteA vrpn_Analog_Output_Remote object is used by passing the name of the server you want to connect to as a parameter to the constructor and then calling its mainloop() message each time through the program's main loop. While active, the analog output device is controlled by calling request_change_channel_value() or request_change_channels(). |