22#define STATUS_RESETTING (-1)
23#define STATUS_SYNCING (0)
24#define STATUS_READING (1)
26#define MAX_TIME_INTERVAL (2000000)
77 unsigned char l_inbuf [45];
80 struct timeval start, now;
88 }
else if(l_inbuf[0] ==
'<' ) {
98 if (now.tv_sec > start.tv_sec + 2) {
99 fprintf(stderr,
"vrpn_5dt16::reset(): Timeout during reset\n");
106 sprintf(text,
"Hardware Version %i.0%i",l_inbuf[0],l_inbuf[1]);
159 if (l_ret != 0) printf(
"... got %d characters (%d total)\n",l_ret,
_bufcount);
187 VRPN_MSG_INFO (
"Unexpected first character in report, probably info packet (recovering)");
188 for(
int i=0;i<29;i++) {
204 for(
int i=0;i<16;i++) {
286 struct timeval current_time;
290 sprintf (l_errmsg,
"vrpn_5dt16::mainloop: Timeout... current_time=%ld:%ld, timestamp=%ld:%ld",
292 static_cast<long>(current_time.tv_usec),
302 VRPN_MSG_ERROR (
"vrpn_5dt16::mainloop: Unknown mode (internal error)");
316 printf(
"vrpn_Button_5DT_Server: Adding local analog %s\n",name);
334 for(
int i=0;i<16;i++) {
345 struct timeval current_time;
vrpn_5dt16(const char *name, vrpn_Connection *c, const char *port, int baud=19200)
virtual void get_report(void)
virtual void mainloop()
Called once through each main loop iteration to handle updates.
virtual void report_changes(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY)
send report iff changed
unsigned char _buffer[512]
virtual void report(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY)
send report whether or not changed
virtual void clear_values(void)
virtual void mainloop()
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
virtual int register_change_handler(void *userdata, vrpn_ANALOGCHANGEHANDLER handler)
vrpn_float64 last[vrpn_CHANNEL_MAX]
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 ...
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_Connection * d_connection
Connection that this object talks to.
void server_mainloop(void)
Handles functions that all servers should provide in their mainloop() (ping/pong, for example) Should...
Generic connection class not specific to the transport mechanism.
vrpn_float64 channel[vrpn_CHANNEL_MAX]
#define MAX_TIME_INTERVAL
All types of client/server/peer objects in VRPN should be derived from the vrpn_BaseClass type descri...
Header containing macros formerly duplicated in a lot of implementation files.
#define VRPN_MSG_INFO(msg)
#define VRPN_MSG_ERROR(msg)
#define VRPN_MSG_WARNING(msg)
int vrpn_read_available_characters(int comm, unsigned char *buffer, size_t bytes)
vrpn_Serial: Pulls all the serial port routines into one file to make porting to new operating system...
unsigned long vrpn_TimevalDuration(struct timeval endT, struct timeval startT)
Return number of microseconds between startT and endT.
void vrpn_SleepMsecs(double dMilliSecs)
#define vrpn_gettimeofday