RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_Contour.h
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_Button.h" // for vrpn_Button_Filter
8#include "vrpn_Configure.h" // for VRPN_CALLBACK, VRPN_USE_HID
9#include "vrpn_Connection.h" // for vrpn_CONNECTION_LOW_LATENCY, etc
10#include "vrpn_Dial.h" // for vrpn_Dial
11#include "vrpn_HumanInterface.h" // for vrpn_HidAcceptor (ptr only), etc
12#include "vrpn_Shared.h" // for timeval
13#include "vrpn_Types.h" // for vrpn_uint8, vrpn_uint32
14
15#if defined(VRPN_USE_HID)
16
17// Device drivers for the Contour Design USB line of products
18// Currently supported: ShuttleXpress
19//
20// Exposes three major VRPN device classes: Button, Analog, Dial (as appropriate).
21// All models expose Buttons for the keys on the device.
22//
23
25public:
26 vrpn_Contour(vrpn_HidAcceptor *filter, const char *name, vrpn_Connection *c = 0,
27 vrpn_uint16 vendor = 0, vrpn_uint16 product = 0);
28 virtual ~vrpn_Contour(void);
29
30 virtual void mainloop(void) = 0;
31
32protected:
33 // Set up message handlers, etc.
34 void init_hid(void);
35 void on_data_received(size_t bytes, vrpn_uint8 *buffer);
36
37 static int VRPN_CALLBACK on_connect(void *thisPtr, vrpn_HANDLERPARAM p);
38 static int VRPN_CALLBACK on_last_disconnect(void *thisPtr, vrpn_HANDLERPARAM p);
39
40 virtual void decodePacket(size_t bytes, vrpn_uint8 *buffer) = 0;
41 struct timeval _timestamp;
42 vrpn_HidAcceptor *_filter;
43
44 // No actual types to register, derived classes will be buttons, analogs, and/or dials
45 int register_types(void) { return 0; }
46
47 // Have we gotten a dial response yet? If not, we store the value
48 // rather than reporting it.
49 bool _gotDial;
50
51 // Previous dial value, used to determine delta to send when it changes.
52 vrpn_uint8 _lastDial;
53};
54
56public:
57 vrpn_Contour_ShuttleXpress(const char *name, vrpn_Connection *c = 0);
58 virtual ~vrpn_Contour_ShuttleXpress(void) {};
59
60 virtual void mainloop(void);
61
62protected:
63 // Send report iff changed
64 void report_changes (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
65 // Send report whether or not changed
66 void report (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
67
68 void decodePacket(size_t bytes, vrpn_uint8 *buffer);
69};
70
72public:
73 vrpn_Contour_ShuttlePROv2(const char *name, vrpn_Connection *c = 0);
74 virtual ~vrpn_Contour_ShuttlePROv2(void) {};
75
76 virtual void mainloop(void);
77
78protected:
79 // Send report iff changed
80 void report_changes(vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
81 // Send report whether or not changed
82 void report(vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
83
84 void decodePacket(size_t bytes, vrpn_uint8 *buffer);
85
86 // Previous dial value, used to determine delta to send when it changes.
87 vrpn_uint8 _lastDial;
88};
89
90// end of VRPN_USE_HID
91#else
92class VRPN_API vrpn_Contour;
93class VRPN_API vrpn_Contour_ShuttleXpress;
94class VRPN_API vrpn_Contour_ShuttlePROv2;
95#endif
定义 vrpn_Analog.h:28
定义 vrpn_BaseClass.h:310
定义 vrpn_Button.h:66
Generic connection class not specific to the transport mechanism.
定义 vrpn_Connection.h:562
定义 vrpn_Contour.h:71
virtual void mainloop(void)
定义 vrpn_Contour.h:55
virtual void mainloop(void)
定义 vrpn_Contour.h:24
virtual void mainloop(void)=0
void on_data_received(size_t bytes, vrpn_uint8 *buffer)
Derived class reimplements this callback. It is called whenever a read returns some data.
int register_types(void)
定义 vrpn_Contour.h:45
定义 vrpn_Dial.h:21
定义 vrpn_HumanInterface.h:56
定义 vrpn_HumanInterface.h:70
vrpn_uint16 product() const
vrpn_uint16 vendor() const
This structure is what is passed to a vrpn_Connection message callback.
定义 vrpn_Connection.h:41