pub struct Ds4Notification {
pub large_motor: u8,
pub small_motor: u8,
pub lightbar: Ds4LightbarColor,
}Expand description
A notification received from the bus for a DualShock 4 target.
This contains feedback from the system (e.g., a game), like rumble and
lightbar color commands. You can listen for these notifications using
TargetHandle<DualShock4>::register_notification.
§Examples
let receiver = ds4.register_notification()?;
// In a separate thread or an event loop:
if let Ok(Ok(notification)) = receiver.recv() {
println!("Rumble: large={}, small={}", notification.large_motor, notification.small_motor);
println!("Lightbar: R={}, G={}, B={}",
notification.lightbar.red,
notification.lightbar.green,
notification.lightbar.blue
);
}Fields§
§large_motor: u8Rumble strength for the large motor (0-255).
small_motor: u8Rumble strength for the small motor (0-255).
lightbar: Ds4LightbarColorThe color for the controller’s lightbar.
Trait Implementations§
Source§impl Clone for Ds4Notification
impl Clone for Ds4Notification
Source§fn clone(&self) -> Ds4Notification
fn clone(&self) -> Ds4Notification
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Ds4Notification
impl Debug for Ds4Notification
Source§impl Default for Ds4Notification
impl Default for Ds4Notification
Source§fn default() -> Ds4Notification
fn default() -> Ds4Notification
Returns the “default value” for a type. Read more
Source§impl PartialEq for Ds4Notification
impl PartialEq for Ds4Notification
impl Copy for Ds4Notification
impl Eq for Ds4Notification
impl StructuralPartialEq for Ds4Notification
Auto Trait Implementations§
impl Freeze for Ds4Notification
impl RefUnwindSafe for Ds4Notification
impl Send for Ds4Notification
impl Sync for Ds4Notification
impl Unpin for Ds4Notification
impl UnwindSafe for Ds4Notification
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more