Struct ctru::services::ir_user::IrUser

source ·
pub struct IrUser { /* private fields */ }
Expand description

The “ir:USER” service. This service is used to talk to IR devices such as the Circle Pad Pro.

Implementations§

source§

impl IrUser

source

pub fn init( recv_buffer_size: usize, recv_packet_count: usize, send_buffer_size: usize, send_packet_count: usize ) -> Result<Self>

Initialize the ir:USER service. The provided buffer sizes and packet counts are used to calculate the size of shared memory used by the service.

source

pub fn require_connection(&mut self, device_id: IrDeviceId) -> Result<()>

Try to connect to the device with the provided ID.

source

pub fn disconnect(&mut self) -> Result<()>

Close the current IR connection.

source

pub fn get_connection_status_event(&self) -> Result<Handle>

Get an event handle that activates on connection status changes.

source

pub fn get_recv_event(&self) -> Result<Handle>

Get an event handle that activates when a packet is received.

source

pub fn request_input_polling(&mut self, period_ms: u8) -> Result<()>

Circle Pad Pro specific request.

This will send a packet to the CPP requesting it to send back packets with the current device input values.

source

pub fn release_received_data(&mut self, packet_count: u32) -> Result<()>

Mark the last packet_count packets as processed, so their memory in the receive buffer can be reused.

source

pub fn process_shared_memory(&self, process_fn: impl FnOnce(&[u8]))

This will let you directly read the ir:USER shared memory via a callback.

source

pub fn get_status_info(&self) -> IrUserStatusInfo

Read and parse the ir:USER service status data from shared memory.

source

pub fn get_packets(&self) -> Result<Vec<IrUserPacket>, String>

Read and parse the current packets received from the IR device.

Auto Trait Implementations§

§

impl !RefUnwindSafe for IrUser

§

impl !Send for IrUser

§

impl Sync for IrUser

§

impl Unpin for IrUser

§

impl !UnwindSafe for IrUser

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.