vrpn
07.33
Virtual Reality Peripheral Network
|
Go to the documentation of this file.
8 #ifndef VRPN_CLIENT_ONLY
44 printf(
"Analog Report: ");
72 const struct timeval time)
75 vrpn_int32 change = 0;
84 fprintf(stderr,
"No change.\n");
95 const struct timeval time)
99 char *msgbuf = (
char *)fbuf;
118 msgbuf, class_of_service)) {
119 fprintf(stderr,
"vrpn_Analog: cannot write message: tossing\n");
123 #ifndef VRPN_CLIENT_ONLY
125 const char *port,
int baud,
int bits,
137 fprintf(stderr,
"vrpn_Serial_Analog: NULL port name\n");
150 fprintf(stderr,
"vrpn_Serial_Analog: Cannot Open serial port\n");
167 #endif // VRPN_CLIENT_ONLY
170 vrpn_int32 numChannels)
177 fprintf(stderr,
"vrpn_Analog_Server: Can't get connection!\n");
183 const struct timeval time)
190 const struct timeval time)
197 if (sizeRequested < 0) sizeRequested = 0;
205 vrpn_int32 numChannels)
226 double lowzero,
double highzero,
232 "vrpn_Clipping_Analog_Server::setClipValues: Bad channel (%d)\n",
236 if ((lowzero <
min) || (highzero < lowzero) || (max < highzero)) {
237 fprintf(stderr,
"vrpn_Clipping_Analog_Server::setClipValues: Out of "
258 "vrpn_Clipping_Analog_Server::setChannelValue: Bad channel (%d)\n",
310 fprintf(stderr,
"vrpn_Analog_Remote: can't register handler\n");
315 fprintf(stderr,
"vrpn_Analog_Remote: Can't get connection!\n");
339 const char *bufptr = p.
buffer;
340 vrpn_float64 numchannelD;
vrpn_Serial_Analog(const char *name, vrpn_Connection *connection, const char *port, int baud=9600, int bits=8, vrpn_SER_PARITY parity=vrpn_SER_PARITY_NONE, bool rts_flow=false)
vrpn_Analog_Server(const char *name, vrpn_Connection *c, vrpn_int32 numChannels=vrpn_CHANNEL_MAX)
int register_autodeleted_handler(vrpn_int32 type, vrpn_MESSAGEHANDLER handler, void *userdata, vrpn_int32 sender=vrpn_ANY_SENDER)
Registers a handler with the connection, and remembers to delete at destruction.
virtual int pack_message(vrpn_uint32 len, struct timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer, vrpn_uint32 class_of_service)
Pack a message that will be sent the next time mainloop() is called. Turn off the RELIABLE flag if yo...
void client_mainloop(void)
Handles functions that all clients should provide in their mainloop() (warning of no server,...
virtual vrpn_int32 encode_to(char *buf)
vrpn_float64 channel[vrpn_CHANNEL_MAX]
vrpn_int32 setNumChannels(vrpn_int32 sizeRequested)
Sets the size of the array; returns the size actually set. (May be clamped to vrpn_CHANNEL_MAX) This ...
int setClipValues(int channel, double min, double lowzero, double highzero, double max)
Set the clipping values for the specified channel. min maps to -1, values between lowzero and highzer...
unsigned char buffer[1024]
clipvals_struct clipvals[vrpn_CHANNEL_MAX]
const int vrpn_ANALOG_FAIL
virtual void report(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
Send a report whether something has changed or not (for servers) Optionally, tell what time to stamp ...
vrpn_Callback_List< vrpn_ANALOGCB > d_callback_list
vrpn_Serial: Pulls all the serial port routines into one file to make porting to new operating system...
vrpn_Analog(const char *name, vrpn_Connection *c=NULL)
int setChannelValue(int channel, double value)
This method should be used to set the value of a channel. It will be scaled and clipped as described ...
VRPN_API int vrpn_unbuffer(const char **buffer, timeval *t)
Utility routine for taking a struct timeval from a buffer that was sent as a message.
vrpn_Clipping_Analog_Server(const char *name, vrpn_Connection *c, vrpn_int32 numChannels=vrpn_CHANNEL_MAX)
const struct timeval vrpn_ANALOG_NOW
vrpn_Connection * d_connection
Connection that this object talks to.
virtual vrpn_int32 register_message_type(const char *name)
const int vrpn_ANALOG_RESETTING
This structure is what is passed to a vrpn_Connection message callback.
vrpn_int32 d_sender_id
Sender ID registered with the connection.
static int VRPN_CALLBACK handle_change_message(void *userdata, vrpn_HANDLERPARAM p)
vrpn_int32 getNumChannels(void) const
vrpn_float64 channel[vrpn_CHANNEL_MAX]
virtual void report(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
Makes public the protected base class function.
virtual void mainloop()
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
virtual int mainloop(const struct timeval *timeout=NULL)=0
Call each time through program main loop to handle receiving any incoming messages and sending any pa...
Generic connection class not specific to the transport mechanism.
#define vrpn_gettimeofday
int vrpn_close_commport(int comm)
vrpn_float64 last[vrpn_CHANNEL_MAX]
virtual int init(void)
Initialize things that the constructor can't. Returns 0 on success, -1 on failure.
virtual void report_changes(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
Makes public the protected base class function.
VRPN_API int vrpn_buffer(char **insertPt, vrpn_int32 *buflen, const timeval t)
Utility routine for placing a timeval struct into a buffer that is to be sent as a message.
int vrpn_open_commport(const char *portname, long baud, int charsize, vrpn_SER_PARITY parity, bool rts_flow)
Open a serial port, given its name and baud rate.
void call_handlers(const CALLBACK_STRUCT &info)
This will pass the referenced parameter as a const to all the callbacks.
virtual void report_changes(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
Send a report only if something has changed (for servers) Optionally, tell what time to stamp the val...
vrpn_Analog_Remote(const char *name, vrpn_Connection *c=NULL)
Class from which all user-level (and other) classes that communicate with vrpn_Connections should der...
virtual int register_types(void)
Register the types of messages this device sends/receives. Return 0 on success, -1 on fail.