vrpn
07.33
Virtual Reality Peripheral Network
|
Go to the documentation of this file.
22 #define STATUS_RESETTING (-1) // Resetting the device
23 #define STATUS_SYNCING (0) // Looking for the first character of report
24 #define STATUS_READING (1) // Looking for the rest of the report
26 #define MAX_TIME_INTERVAL (2000000) // max time between reports (usec)
75 unsigned char l_inbuf [45];
78 struct timeval start, now;
86 }
else if(l_inbuf[0] ==
'<' ) {
96 if (now.tv_sec > start.tv_sec + 2) {
97 fprintf(stderr,
"vrpn_5dt16::reset(): Timeout during reset\n");
104 sprintf(text,
"Hardware Version %i.0%i",l_inbuf[0],l_inbuf[1]);
157 if (l_ret != 0) printf(
"... got %d characters (%d total)\n",l_ret,
_bufcount);
185 VRPN_MSG_INFO (
"Unexpected first character in report, probably info packet (recovering)");
186 for(
int i=0;i<29;i++) {
202 for(
int i=0;i<16;i++) {
284 struct timeval current_time;
288 sprintf (l_errmsg,
"vrpn_5dt16::mainloop: Timeout... current_time=%ld:%ld, timestamp=%ld:%ld",
290 static_cast<long>(current_time.tv_usec),
300 VRPN_MSG_ERROR (
"vrpn_5dt16::mainloop: Unknown mode (internal error)");
313 printf(
"vrpn_Button_5DT_Server: Adding local analog %s\n",name);
331 for(
int i=0;i<16;i++) {
342 struct timeval current_time;
unsigned long vrpn_TimevalDuration(struct timeval endT, struct timeval startT)
Return number of microseconds between startT and endT.
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)
Send a report whether something has changed or not (for servers) Optionally, tell what time to stamp ...
vrpn_Serial: Pulls all the serial port routines into one file to make porting to new operating system...
#define MAX_TIME_INTERVAL
virtual void mainloop()
Called once through each main loop iteration to handle updates.
vrpn_Connection * d_connection
Connection that this object talks to.
void vrpn_SleepMsecs(double dMsecs)
#define VRPN_MSG_WARNING(msg)
vrpn_5dt16(const char *name, vrpn_Connection *c, const char *port, int baud=19200)
vrpn_float64 channel[vrpn_CHANNEL_MAX]
virtual void mainloop()
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
unsigned char _buffer[512]
Generic connection class not specific to the transport mechanism.
#define vrpn_gettimeofday
virtual void report(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY)
send report whether or not changed
int vrpn_read_available_characters(int comm, unsigned char *buffer, size_t bytes)
virtual void clear_values(void)
vrpn_float64 last[vrpn_CHANNEL_MAX]
#define VRPN_MSG_INFO(msg)
virtual void get_report(void)
Header containing macros formerly duplicated in a lot of implementation files.
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...
virtual void report_changes(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY)
send report iff changed
#define VRPN_MSG_ERROR(msg)
virtual int register_change_handler(void *userdata, vrpn_ANALOGCHANGEHANDLER handler)
void server_mainloop(void)
Handles functions that all servers should provide in their mainloop() (ping/pong, for example) Should...