vrpn 07.35
Virtual Reality Peripheral Network
Loading...
Searching...
No Matches
vrpn_Vality.h
Go to the documentation of this file.
1#pragma once
2
3#include <stddef.h> // for size_t
4
5#include "vrpn_Analog.h" // for vrpn_Analog
6#include "vrpn_BaseClass.h" // for vrpn_BaseClass
7#include "vrpn_Configure.h" // for VRPN_CALLBACK, VRPN_USE_HID
8#include "vrpn_Connection.h" // for vrpn_CONNECTION_LOW_LATENCY, etc
9#include "vrpn_HumanInterface.h" // for vrpn_HidAcceptor (ptr only), etc
10#include "vrpn_Shared.h" // for timeval
11#include "vrpn_Types.h" // for vrpn_uint8, vrpn_uint32
12
13#if defined(VRPN_USE_HID)
14
15// Device drivers for the Vality USB line of products
16// Currently supported: vGlass
17
19public:
20 vrpn_Vality(vrpn_HidAcceptor *filter, const char *name,
21 vrpn_Connection *c = 0,
22 vrpn_uint16 vendor = 0, vrpn_uint16 product = 0);
23 virtual ~vrpn_Vality(void);
24
25 virtual void mainloop(void) = 0;
26
27protected:
28 // Set up message handlers, etc.
29 void init_hid(void);
30 void on_data_received(size_t bytes, vrpn_uint8 *buffer);
31
32 static int VRPN_CALLBACK on_connect(void *thisPtr, vrpn_HANDLERPARAM p);
33 static int VRPN_CALLBACK on_last_disconnect(void *thisPtr, vrpn_HANDLERPARAM p);
34
35 virtual void decodePacket(size_t bytes, vrpn_uint8 *buffer) = 0;
36 struct timeval _timestamp;
38
39 // No actual types to register, derived classes will be buttons, analogs, and/or dials
40 int register_types(void) { return 0; }
41};
42
44 public vrpn_Analog {
45public:
46 vrpn_Vality_vGlass(const char *name, vrpn_Connection *c = 0);
47 virtual ~vrpn_Vality_vGlass(void){};
48
49 virtual void mainloop(void);
50
51protected:
52 // Send report iff changed
53 void report_changes (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
54 // Send report whether or not changed
55 void report (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
56
57 void decodePacket(size_t bytes, vrpn_uint8 *buffer);
58};
59
60// end of VRPN_USE_HID
61#else
63class VRPN_API vrpn_Vality_ShuttleXpress;
64class VRPN_API vrpn_Vality_ShuttlePROv2;
65#endif
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.
vrpn_uint16 product() const
Returns USB product ID of connected device May not contain valid if an already-open device was provid...
vrpn_uint16 vendor() const
Returns USB vendor ID of connected device May not contain valid if an already-open device was provide...
vrpn_Vality_vGlass(const char *name, vrpn_Connection *c=0)
Definition vrpn_Vality.C:61
void report_changes(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY)
void decodePacket(size_t bytes, vrpn_uint8 *buffer)
virtual ~vrpn_Vality_vGlass(void)
Definition vrpn_Vality.h:47
void report(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY)
Definition vrpn_Vality.C:90
virtual void mainloop(void)
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
Definition vrpn_Vality.C:75
virtual void mainloop(void)=0
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.
Definition vrpn_Vality.C:46
static int VRPN_CALLBACK on_last_disconnect(void *thisPtr, vrpn_HANDLERPARAM p)
Definition vrpn_Vality.C:51
struct timeval _timestamp
Definition vrpn_Vality.h:36
void init_hid(void)
Definition vrpn_Vality.C:39
virtual ~vrpn_Vality(void)
Definition vrpn_Vality.C:29
vrpn_Vality(vrpn_HidAcceptor *filter, const char *name, vrpn_Connection *c=0, vrpn_uint16 vendor=0, vrpn_uint16 product=0)
Definition vrpn_Vality.C:19
vrpn_HidAcceptor * _filter
Definition vrpn_Vality.h:37
virtual void decodePacket(size_t bytes, vrpn_uint8 *buffer)=0
static int VRPN_CALLBACK on_connect(void *thisPtr, vrpn_HANDLERPARAM p)
Definition vrpn_Vality.C:56
int register_types(void)
Register the types of messages this device sends/receives. Return 0 on success, -1 on fail.
Definition vrpn_Vality.h:40
This structure is what is passed to a vrpn_Connection message callback.
All types of client/server/peer objects in VRPN should be derived from the vrpn_BaseClass type descri...
#define VRPN_API
#define VRPN_CALLBACK
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY