1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
use bitflags;
bitflags!
/// Represents the full input state of a virtual Xbox 360 controller.
///
/// An instance of this struct is sent to the bus via `TargetHandle::update` to
/// update the controller's state.
///
/// # Examples
///
/// ```no_run
/// # use vigem_rust::{Client, X360Report, X360Button};
/// # let client = Client::connect().unwrap();
/// # let x360 = client.new_x360_target().plugin().unwrap();
/// # x360.wait_for_ready().unwrap();
/// let mut report = X360Report::default();
///
/// // Press the A and Start buttons
/// report.buttons = X360Button::A | X360Button::START;
///
/// // Move the left thumbstick halfway to the right
/// report.thumb_lx = 16384;
///
/// // Pull the right trigger all the way
/// report.right_trigger = 255;
///
/// x360.update(&report).unwrap();
/// ```
pub
/// A notification received from the bus for an Xbox 360 target.
///
/// This contains feedback from the system or a game, such as rumble commands
/// or the player index assigned to the controller. You can receive these by
/// calling `TargetHandle::<Xbox360>::register_notification`.
///
/// # Examples
/// ```no_run
/// # use vigem_rust::{Client, target::Xbox360};
/// # use std::time::Duration;
/// # let client = Client::connect().unwrap();
/// # let x360 = client.new_x360_target().plugin().unwrap();
/// let notifications = x360.register_notification().unwrap();
///
/// // In a real application, you might check for notifications on a separate thread.
/// if let Ok(Ok(notification)) = notifications.try_recv() {
/// println!(
/// "Received notification: Player LED = {}, Large Motor = {}",
/// notification.led_number,
/// notification.large_motor
/// );
/// }
/// ```