Ds4ReportExData

Struct Ds4ReportExData 

Source
#[repr(C, packed(1))]
pub struct Ds4ReportExData {
Show 22 fields pub thumb_lx: u8, pub thumb_ly: u8, pub thumb_rx: u8, pub thumb_ry: u8, pub buttons: u16, pub special: u8, pub trigger_l: u8, pub trigger_r: u8, pub timestamp: u16, pub battery_lvl: u8, pub gyro_x: i16, pub gyro_y: i16, pub gyro_z: i16, pub accel_x: i16, pub accel_y: i16, pub accel_z: i16, pub _unknown1: [u8; 5], pub battery_lvl_special: u8, pub _unknown2: [u8; 2], pub touch_packets_n: u8, pub current_touch: Ds4Touch, pub previous_touch: [Ds4Touch; 2],
}
Expand description

Represents the complete, extended input state of a virtual DualShock 4 controller.

This struct is used for advanced scenarios that require simulating motion controls (gyroscope and accelerometer) and detailed touchpad activity. It contains all the fields from the standard Ds4Report plus additional data.

Fields§

§thumb_lx: u8§thumb_ly: u8§thumb_rx: u8§thumb_ry: u8§buttons: u16§special: u8§trigger_l: u8§trigger_r: u8§timestamp: u16§battery_lvl: u8§gyro_x: i16§gyro_y: i16§gyro_z: i16§accel_x: i16§accel_y: i16§accel_z: i16§_unknown1: [u8; 5]§battery_lvl_special: u8§_unknown2: [u8; 2]§touch_packets_n: u8§current_touch: Ds4Touch§previous_touch: [Ds4Touch; 2]

Implementations§

Source§

impl Ds4ReportExData

Source

pub fn as_report(&self) -> &Ds4Report

Returns an immutable reference to the standard Ds4Report portion of this extended report. This is safe because Ds4ReportExData is #[repr(C)] and starts with the exact same fields as Ds4Report.

Source

pub fn as_report_mut(&mut self) -> &mut Ds4Report

Returns a mutable reference to the standard Ds4Report portion of this extended report. This allows using helpers like set_dpad on the extended report.

Source

pub fn set_dpad(&mut self, dpad: Ds4Dpad)

A convenience method to set the D-Pad state on the extended report. It correctly manipulates the buttons field.

Trait Implementations§

Source§

impl Clone for Ds4ReportExData

Source§

fn clone(&self) -> Ds4ReportExData

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Ds4ReportExData

Source§

fn default() -> Self

Creates a new Ds4ReportExData with a valid default state (e.g., centered sticks).

Source§

impl Copy for Ds4ReportExData

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.