pub struct HidppDevice { /* private fields */ }Expand description
A HID++ device with protocol support.
Implementations§
Source§impl HidppDevice
impl HidppDevice
Sourcepub fn new(channel: HidapiChannel, device_index: u8) -> Self
pub fn new(channel: HidapiChannel, device_index: u8) -> Self
Creates a new HID++ device wrapper.
§Arguments
channel- HID channel for communicationdevice_index- Device index (0xFF for direct, 1-6 for receiver)
Sourcepub fn direct(channel: HidapiChannel) -> Self
pub fn direct(channel: HidapiChannel) -> Self
Creates a device for direct USB/Bluetooth connection.
Sourcepub fn channel(&self) -> &HidapiChannel
pub fn channel(&self) -> &HidapiChannel
Returns the underlying HID channel.
Sourcepub fn device_index(&self) -> u8
pub fn device_index(&self) -> u8
Returns the device index.
Sourcepub fn info(&self) -> Option<&DeviceInfo>
pub fn info(&self) -> Option<&DeviceInfo>
Returns device info if initialized.
Sourcepub async fn initialize(&mut self) -> Result<&DeviceInfo>
pub async fn initialize(&mut self) -> Result<&DeviceInfo>
Initializes the device by querying protocol version, name, and features.
This should be called after creating the device to populate device info.
§Errors
Returns an error if HID++ communication fails or the device doesn’t respond.
§Panics
Panics if called after successful initialization (info already set).
Sourcepub fn has_feature(&self, feature_id: u16) -> bool
pub fn has_feature(&self, feature_id: u16) -> bool
Checks if a feature is supported by this device.
Sourcepub fn get_feature_index(&self, feature_id: u16) -> Option<u8>
pub fn get_feature_index(&self, feature_id: u16) -> Option<u8>
Gets the feature index for a given feature ID.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HidppDevice
impl !RefUnwindSafe for HidppDevice
impl Send for HidppDevice
impl Sync for HidppDevice
impl Unpin for HidppDevice
impl !UnwindSafe for HidppDevice
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