11#if defined(VRPN_USE_HID)
16static const vrpn_uint16 VALITY_VENDOR = 0x0483;
17static const vrpn_uint16 VALITY_VGLASS = 0x5740;
21 vrpn_uint16 vendor, vrpn_uint16 product)
34 fprintf(stderr,
"vrpn_Vality::~vrpn_Vality(): delete failed\n");
65 name, c, VALITY_VENDOR, VALITY_VGLASS)
79 struct timeval current_time;
126 if (buffer[0] != 1) {
141 static const double MSS_SCALE = (1.0 / 32767) * 16 * 9.807;
142 bufptr = &buffer[12];
143 channel[0] = -vrpn_unbuffer_from_little_endian<vrpn_int16>(bufptr) * MSS_SCALE;
144 channel[1] = -vrpn_unbuffer_from_little_endian<vrpn_int16>(bufptr) * MSS_SCALE;
145 channel[2] = -vrpn_unbuffer_from_little_endian<vrpn_int16>(bufptr) * MSS_SCALE;
153 static const double RS_SCALE = (1.0 / 32767) * 2000 * (
VRPN_PI/180);
155 channel[3] = vrpn_unbuffer_from_little_endian<vrpn_int16>(bufptr) * RS_SCALE;
156 channel[4] = vrpn_unbuffer_from_little_endian<vrpn_int16>(bufptr) * RS_SCALE;
157 channel[5] = vrpn_unbuffer_from_little_endian<vrpn_int16>(bufptr) * RS_SCALE;
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...
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.
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...
Class from which all user-level (and other) classes that communicate with vrpn_Connections should der...
Generic connection class not specific to the transport mechanism.
virtual vrpn_int32 register_message_type(const char *name)
virtual void update()
Polls the device buffers and causes on_data_received callbacks if appropriate You NEED to call this f...
Accepts any device with the given vendor and product IDs.
vrpn_Vality_vGlass(const char *name, vrpn_Connection *c=0)
void report_changes(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY)
void decodePacket(size_t bytes, vrpn_uint8 *buffer)
void report(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY)
virtual void mainloop(void)
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
void on_data_received(size_t bytes, vrpn_uint8 *buffer)
Derived class reimplements this callback.
static int VRPN_CALLBACK on_last_disconnect(void *thisPtr, vrpn_HANDLERPARAM p)
struct timeval _timestamp
virtual ~vrpn_Vality(void)
vrpn_Vality(vrpn_HidAcceptor *filter, const char *name, vrpn_Connection *c=0, vrpn_uint16 vendor=0, vrpn_uint16 product=0)
vrpn_HidAcceptor * _filter
virtual void decodePacket(size_t bytes, vrpn_uint8 *buffer)=0
static int VRPN_CALLBACK on_connect(void *thisPtr, vrpn_HANDLERPARAM p)
This structure is what is passed to a vrpn_Connection message callback.
const char * vrpn_dropped_last_connection
const char * vrpn_got_connection
Header containing macros formerly duplicated in a lot of implementation files.
#define VRPN_MSG_ERROR(msg)
unsigned long vrpn_TimevalDuration(struct timeval endT, struct timeval startT)
Return number of microseconds between startT and endT.
#define vrpn_gettimeofday