vrpn
07.33
Virtual Reality Peripheral Network
|
Go to the documentation of this file.
25 fprintf(stderr,
"vrpn_Dial: Can't register type IDs\n");
34 vrpn_int32 buflensofar = buflen;
41 fprintf(stderr,
"vrpn_Dial::encode_to: Can't buffer delta\n");
45 fprintf(stderr,
"vrpn_Dial::encode_to: Can't buffer dial\n");
48 return sizeof(vrpn_float64) +
sizeof(vrpn_int32);
69 "vrpn_Dial: can't write message: tossing\n");
95 fprintf(stderr,
"vrpn_Dial: can't write message: tossing\n");
107 vrpn_float64 spin_rate,
108 vrpn_float64 update_rate)
111 _spin_rate(spin_rate)
113 _update_rate(update_rate)
117 fprintf(stderr,
"vrpn_Dial_Example_Server: Only using %d dials\n",
130 struct timeval current_time;
146 timestamp.tv_usec = current_time.tv_usec;
177 fprintf(stderr,
"vrpn_Dial_Remote: can't register handler\n");
182 fprintf(stderr,
"vrpn_Dial_Remote: Can't get connection!\n");
209 const char *bufptr = p.
buffer;
static int VRPN_CALLBACK handle_change_message(void *userdata, vrpn_HANDLERPARAM p)
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 void report(void)
unsigned long vrpn_TimevalDuration(struct timeval endT, struct timeval startT)
Return number of microseconds between startT and endT.
virtual vrpn_int32 encode_to(char *buf, vrpn_int32 buflen, vrpn_int32 dial, vrpn_float64 delta)
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_float64 _update_rate
vrpn_Connection * d_connection
Connection that this object talks to.
vrpn_Dial_Remote(const char *name, vrpn_Connection *c=NULL)
virtual vrpn_int32 register_message_type(const char *name)
const vrpn_uint32 vrpn_CONNECTION_RELIABLE
Classes of service for messages, specify multiple by ORing them together Priority of satisfying these...
This structure is what is passed to a vrpn_Connection message callback.
virtual int register_types(void)
Register the types of messages this device sends/receives. Return 0 on success, -1 on fail.
vrpn_int32 d_sender_id
Sender ID registered with the connection.
vrpn_float64 dials[vrpn_DIAL_MAX]
virtual void mainloop()
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
virtual void report_changes(void)
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
vrpn_Dial_Example_Server(const char *name, vrpn_Connection *c, vrpn_int32 numdials=1, vrpn_float64 spin_rate=1.0, vrpn_float64 update_rate=10.0)
virtual int init(void)
Initialize things that the constructor can't. Returns 0 on success, -1 on failure.
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.
void call_handlers(const CALLBACK_STRUCT &info)
This will pass the referenced parameter as a const to all the callbacks.
virtual void mainloop()
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
void server_mainloop(void)
Handles functions that all servers should provide in their mainloop() (ping/pong, for example) Should...
Class from which all user-level (and other) classes that communicate with vrpn_Connections should der...
vrpn_Callback_List< vrpn_DIALCB > d_callback_list
vrpn_Dial(const char *name, vrpn_Connection *c=NULL)