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
impl IrUser
sourcepub fn init(
recv_buffer_size: usize,
recv_packet_count: usize,
send_buffer_size: usize,
send_packet_count: usize
) -> Result<Self>
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.
sourcepub fn require_connection(&mut self, device_id: IrDeviceId) -> Result<()>
pub fn require_connection(&mut self, device_id: IrDeviceId) -> Result<()>
Try to connect to the device with the provided ID.
sourcepub fn disconnect(&mut self) -> Result<()>
pub fn disconnect(&mut self) -> Result<()>
Close the current IR connection.
sourcepub fn get_connection_status_event(&self) -> Result<Handle>
pub fn get_connection_status_event(&self) -> Result<Handle>
Get an event handle that activates on connection status changes.
sourcepub fn get_recv_event(&self) -> Result<Handle>
pub fn get_recv_event(&self) -> Result<Handle>
Get an event handle that activates when a packet is received.
sourcepub fn request_input_polling(&mut self, period_ms: u8) -> Result<()>
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.
sourcepub fn release_received_data(&mut self, packet_count: u32) -> Result<()>
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.
This will let you directly read the ir:USER shared memory via a callback.
sourcepub fn get_status_info(&self) -> IrUserStatusInfo
pub fn get_status_info(&self) -> IrUserStatusInfo
Read and parse the ir:USER service status data from shared memory.
sourcepub fn get_packets(&self) -> Result<Vec<IrUserPacket>, String>
pub fn get_packets(&self) -> Result<Vec<IrUserPacket>, String>
Read and parse the current packets received from the IR device.