RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_Retrolink.h
1#pragma once
2
3#include "vrpn_Analog.h" // for vrpn_Analog
4#include "vrpn_Button.h" // for vrpn_Button_Filter
5#include "vrpn_HumanInterface.h" // for vrpn_HidAcceptor (ptr only), etc
6#include <stddef.h> // for size_t
7
8#if defined(VRPN_USE_HID)
9
10// Device drivers for the Retrolink Classic Controller USB line of products
11// Currently supported: GameCube
12//
13// Exposes two major VRPN device classes: Button, Analog. See vrpn.cfg for
14// a description of which buttons and control map where.
15//
16
18public:
19 vrpn_Retrolink(vrpn_HidAcceptor *filter, const char *name, vrpn_Connection *c = 0,
20 vrpn_uint16 vendor = 0, vrpn_uint16 product = 0);
21 virtual ~vrpn_Retrolink(void);
22
23 virtual void mainloop(void) = 0;
24
25protected:
26 // Set up message handlers, etc.
27 void init_hid(void);
28 void on_data_received(size_t bytes, vrpn_uint8 *buffer);
29
30 static int VRPN_CALLBACK on_connect(void *thisPtr, vrpn_HANDLERPARAM p);
31 static int VRPN_CALLBACK on_last_disconnect(void *thisPtr, vrpn_HANDLERPARAM p);
32
33 virtual void decodePacket(size_t bytes, vrpn_uint8 *buffer) = 0;
34 struct timeval _timestamp;
35 vrpn_HidAcceptor *_filter;
36
37 // No actual types to register, derived classes will be buttons, analogs
38 int register_types(void) { return 0; }
39};
40
41//--------------------------------------------------------------------------------
42// For GameCube :
43// Analog channel assignments :
44// 0 = Left joystick X axis; -1 = left, 1 = right
45// 1 = Left joystick Y axis; -1 = up, 1 = down
46// 2 = Right joystick X axis; -1 = left, 1 = right
47// 3 = Right joystick Y axis; -1 = up, 1 = down
48// 4 = Left rocker switch angle in degrees(-1 if nothing is pressed)
49// Button number assignments :
50// 0 = Y
51// 1 = X
52// 2 = A
53// 3 = B
54// 4 = left trigger
55// 5 = right trigger
56// 6 = Z
57// 7 = Start / pause
58// Buttons 8 - 11 are duplicate mappings for the rocker - switch; both
59// these and the analog angle in degrees will change as they are pressed
60// 8 = up
61// 9 = right
62// 10 = down
63// 11 = left
64
66public:
67 vrpn_Retrolink_GameCube(const char *name, vrpn_Connection *c = 0);
68 virtual ~vrpn_Retrolink_GameCube(void) {};
69
70 virtual void mainloop(void);
71
72protected:
73 // Send report iff changed
74 void report_changes (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
75 // Send report whether or not changed
76 void report (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
77
78 void decodePacket(size_t bytes, vrpn_uint8 *buffer);
79};
80
81//--------------------------------------------------------------------------------
82// For Genesis :
83// Analog channel assignments :
84// 0 = Rocker switch angle in degrees(-1 if nothing is pressed)
85// Button number assignments :
86// 0 = A
87// 1 = B
88// 2 = C
89// 3 = X
90// 4 = Y
91// 5 = Z
92// 6 = Mode
93// 7 = Start
94// Buttons 8 - 11 are duplicate mappings for the rocker - switch; both
95// these and the analog angle in degrees will change as they are pressed
96// 8 = up
97// 9 = right
98// 10 = down
99// 11 = left
100
102public:
103 vrpn_Retrolink_Genesis(const char *name, vrpn_Connection *c = 0);
104 virtual ~vrpn_Retrolink_Genesis(void) {};
105
106 virtual void mainloop(void);
107
108protected:
109 // Send report iff changed
110 void report_changes (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
111 // Send report whether or not changed
112 void report (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
113
114 void decodePacket(size_t bytes, vrpn_uint8 *buffer);
115};
116
117// end of VRPN_USE_HID
118#else
119class VRPN_API vrpn_Retrolink;
120class VRPN_API vrpn_Retrolink_GameCube;
121class VRPN_API vrpn_Retrolink_Genesis;
122#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_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