RflySimSDK
v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
simulink
vrpn
vrpn_DreamCheeky.h
1
#pragma once
2
3
#include <stddef.h>
// for size_t
4
5
#include "
vrpn_BaseClass.h
"
// for vrpn_BaseClass
6
#include "vrpn_Button.h"
// for vrpn_Button_Filter
7
#include "vrpn_Configure.h"
// for VRPN_USE_HID
8
#include "vrpn_HumanInterface.h"
// for vrpn_HidAcceptor (ptr only), etc
9
#include "vrpn_Shared.h"
// for timeval
10
#include "vrpn_Types.h"
// for vrpn_uint8
11
12
// Device drivers for the Dream Cheeky USB Roll-Up Drum Kit; done in such a
13
// way that any other USB devices from this vendow should be easy to add.
14
// Based on the X-Keys driver.
15
//
16
// For the Dreamcheeky:
17
// Button 0 is the upper-left triangle
18
// Button 1 is hte upper-right triangle
19
// Button 2 is the upper center round pad
20
// Button 3 is the lower-right round pad
21
// Button 4 is the lower-center round pad
22
// Button 5 is the lower-left round pad
23
24
#if defined(VRPN_USE_HID)
25
26
class
VRPN_API
vrpn_DreamCheeky
:
public
vrpn_BaseClass
,
protected
vrpn_HidInterface
{
27
public
:
28
vrpn_DreamCheeky
(
vrpn_HidAcceptor
*filter,
const
char
*name,
vrpn_Connection
*c = 0,
29
vrpn_uint16 vendor = 0, vrpn_uint16 product = 0);
30
virtual
~vrpn_DreamCheeky
();
31
32
virtual
void
mainloop
() = 0;
33
34
protected
:
35
// Set up message handlers, etc.
36
void
on_data_received
(
size_t
bytes, vrpn_uint8 *buffer);
37
38
virtual
void
decodePacket(
size_t
bytes, vrpn_uint8 *buffer) = 0;
39
struct
timeval _timestamp;
40
vrpn_HidAcceptor
*_filter;
41
42
// No actual types to register, derived classes will be buttons, analogs, and/or dials
43
int
register_types
(
void
) {
return
0; }
44
};
45
46
class
VRPN_API
vrpn_DreamCheeky_Drum_Kit
:
protected
vrpn_DreamCheeky
,
public
vrpn_Button_Filter
{
47
public
:
48
// The sensors "bounce" a lot when the buttons are pressed and released,
49
// causing spurious readings of press/release. Debouncing looks at ensembles
50
// of events to make sure that the buttons have settled before reporting
51
// events.
52
vrpn_DreamCheeky_Drum_Kit
(
const
char
*name,
vrpn_Connection
*c = 0,
bool
debounce =
true
);
53
virtual
~vrpn_DreamCheeky_Drum_Kit
() {};
54
55
virtual
void
mainloop
();
56
57
protected
:
58
// Do we try to debounce the buttons?
59
bool
d_debounce;
60
61
// Send report iff changed
62
void
report_changes (
void
);
63
// Send report whether or not changed
64
void
report (
void
);
65
66
void
decodePacket(
size_t
bytes, vrpn_uint8 *buffer);
67
};
68
69
#else
70
class
vrpn_DreamCheeky_Drum_Kit
;
71
#endif
72
73
vrpn_BaseClass
定义
vrpn_BaseClass.h:310
vrpn_Button_Filter
定义
vrpn_Button.h:66
vrpn_Connection
Generic connection class not specific to the transport mechanism.
定义
vrpn_Connection.h:562
vrpn_DreamCheeky_Drum_Kit
定义
vrpn_DreamCheeky.h:46
vrpn_DreamCheeky_Drum_Kit::mainloop
virtual void mainloop()
vrpn_DreamCheeky
定义
vrpn_DreamCheeky.h:26
vrpn_DreamCheeky::on_data_received
void on_data_received(size_t bytes, vrpn_uint8 *buffer)
Derived class reimplements this callback. It is called whenever a read returns some data.
vrpn_DreamCheeky::mainloop
virtual void mainloop()=0
vrpn_DreamCheeky::register_types
int register_types(void)
定义
vrpn_DreamCheeky.h:43
vrpn_HidAcceptor
定义
vrpn_HumanInterface.h:56
vrpn_HidInterface
定义
vrpn_HumanInterface.h:70
vrpn_BaseClass.h
制作者
1.11.0