vrpn 07.35
Virtual Reality Peripheral Network
Loading...
Searching...
No Matches
vrpn_nVidia_shield_controller.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_Button.h" // for vrpn_Button_Filter
7#include "vrpn_HumanInterface.h" // for vrpn_HidAcceptor (ptr only), etc
8
9#if defined(VRPN_USE_HID)
10
11// Device drivers for the nVidia Shield controller line of products
12// Currently supported: Shield controller plugged into USB
13
15public:
16 vrpn_nVidia_shield(vrpn_HidAcceptor *filter, const char *name, vrpn_Connection *c = 0,
17 vrpn_uint16 vendor = 0, vrpn_uint16 product = 0);
18 virtual ~vrpn_nVidia_shield(void);
19
20 virtual void mainloop(void) = 0;
21
22protected:
23 // Set up message handlers, etc.
24 void init_hid(void);
25 void on_data_received(size_t bytes, vrpn_uint8 *buffer);
26
27 virtual void decodePacket(size_t bytes, vrpn_uint8 *buffer) = 0;
28 struct timeval d_timestamp;
30
31 // No actual types to register, derived classes will be buttons or analogs
32 int register_types(void) { return 0; }
33};
34
36 public vrpn_Analog, public vrpn_Button_Filter {
37public:
38 vrpn_nVidia_shield_USB(const char *name, vrpn_Connection *c = 0);
39 virtual ~vrpn_nVidia_shield_USB(void) {};
40
41 virtual void mainloop(void);
42
43protected:
44 // Send report iff changed
45 void report_changes (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
46 // Send report whether or not changed
47 void report (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
48
49 void decodePacket(size_t bytes, vrpn_uint8 *buffer);
50};
51
53 public vrpn_Analog, public vrpn_Button_Filter {
54public:
55 vrpn_nVidia_shield_stealth_USB(const char *name, vrpn_Connection *c = 0);
57
58 virtual void mainloop(void);
59
60protected:
61 // Send report iff changed
62 void report_changes (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
63 // Send report whether or not changed
64 void report (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
65
66 void decodePacket(size_t bytes, vrpn_uint8 *buffer);
67};
68
69// end of VRPN_USE_HID
70#else
74#endif
75
Class from which all user-level (and other) classes that communicate with vrpn_Connections should der...
All button servers should derive from this class, which provides the ability to turn any of the butto...
Definition vrpn_Button.h:66
virtual void report_changes(void)
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...
void report(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY)
vrpn_nVidia_shield_USB(const char *name, vrpn_Connection *c=0)
virtual void mainloop(void)
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
void decodePacket(size_t bytes, vrpn_uint8 *buffer)
vrpn_nVidia_shield_stealth_USB(const char *name, vrpn_Connection *c=0)
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 decodePacket(size_t bytes, vrpn_uint8 *buffer)
int register_types(void)
Register the types of messages this device sends/receives. Return 0 on success, -1 on fail.
virtual void decodePacket(size_t bytes, vrpn_uint8 *buffer)=0
virtual void mainloop(void)=0
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
vrpn_nVidia_shield(vrpn_HidAcceptor *filter, const char *name, vrpn_Connection *c=0, vrpn_uint16 vendor=0, vrpn_uint16 product=0)
void on_data_received(size_t bytes, vrpn_uint8 *buffer)
Derived class reimplements this callback.
#define VRPN_API
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY