Struct kiibohd_hid_io::CommandInterface
source · pub struct CommandInterface<KINTF: KiibohdCommandInterface<H>, const TX: usize, const RX: usize, const N: usize, const H: usize, const S: usize, const ID: usize> {
pub rx_bytebuf: Buffer<RX, N>,
pub tx_bytebuf: Buffer<TX, N>,
/* private fields */
}
Fields§
§rx_bytebuf: Buffer<RX, N>
§tx_bytebuf: Buffer<TX, N>
Implementations§
source§impl<KINTF: KiibohdCommandInterface<H>, const TX: usize, const RX: usize, const N: usize, const H: usize, const S: usize, const ID: usize> CommandInterface<KINTF, TX, RX, N, H, S, ID>
impl<KINTF: KiibohdCommandInterface<H>, const TX: usize, const RX: usize, const N: usize, const H: usize, const S: usize, const ID: usize> CommandInterface<KINTF, TX, RX, N, H, S, ID>
pub fn new( ids: &[HidIoCommandId], interface: KINTF ) -> Result<CommandInterface<KINTF, TX, RX, N, H, S, ID>, CommandError>
pub fn host_info_cached(&self) -> &HidIoHostInfo
sourcepub fn interface(&self) -> &KINTF
pub fn interface(&self) -> &KINTF
Reference to the customized interface The interface will likely have custom datastructures that you want access to (e.g. manufacturing toggles)
sourcepub fn mut_interface(&mut self) -> &mut KINTF
pub fn mut_interface(&mut self) -> &mut KINTF
Mut reference to the customized interface The interface will likely have custom datastructures that you want access to (e.g. manufacturing toggles)
sourcepub fn rx_packetbuffer_decode(&mut self) -> Result<bool, CommandError>
pub fn rx_packetbuffer_decode(&mut self) -> Result<bool, CommandError>
Decode rx_bytebuf into a HidIoPacketBuffer Returns true if buffer ready, false if not
sourcepub fn process_rx(&mut self, count: u8) -> Result<u8, CommandError>
pub fn process_rx(&mut self, count: u8) -> Result<u8, CommandError>
Process rx buffer until empty Handles flushing tx->rx, decoding, then processing buffers Returns the number of buffers processed
sourcepub fn term_buffer_flush(&mut self) -> Result<(), CommandError>
pub fn term_buffer_flush(&mut self) -> Result<(), CommandError>
Flush the term buffer
sourcepub fn process_event(&mut self, event: HidIoEvent) -> Result<(), CommandError>
pub fn process_event(&mut self, event: HidIoEvent) -> Result<(), CommandError>
Process incoming events through HID-IO This is the preferred mechanism to interact with HID-IO (if possible for your situation)
Trait Implementations§
source§impl<KINTF: KiibohdCommandInterface<H>, const TX: usize, const RX: usize, const N: usize, const H: usize, const S: usize, const ID: usize> Commands<H, { MESSAGE_LEN - 1 }, { MESSAGE_LEN - 2 }, { MESSAGE_LEN - 4 }, ID> for CommandInterface<KINTF, TX, RX, N, H, S, ID>
impl<KINTF: KiibohdCommandInterface<H>, const TX: usize, const RX: usize, const N: usize, const H: usize, const S: usize, const ID: usize> Commands<H, { MESSAGE_LEN - 1 }, { MESSAGE_LEN - 2 }, { MESSAGE_LEN - 4 }, ID> for CommandInterface<KINTF, TX, RX, N, H, S, ID>
CommandInterface for Commands TX - tx byte buffer size (in multiples of N) RX - tx byte buffer size (in multiples of N) N - Max payload length (HidIoPacketBuffer), used for default values H - Max data payload length (HidIoPacketBuffer) S - Serialization buffer size ID - Max number of HidIoCommandIds
source§fn h0001_info_cmd(&mut self, data: Cmd) -> Result<Ack<{ _ }>, Nak>
fn h0001_info_cmd(&mut self, data: Cmd) -> Result<Ack<{ _ }>, Nak>
Uses the CommandInterface to send data directly
source§fn h0001_info_ack(&mut self, data: Ack<{ _ }>) -> Result<(), CommandError>
fn h0001_info_ack(&mut self, data: Ack<{ _ }>) -> Result<(), CommandError>
Uses the CommandInterface to store data rather than issue a callback