SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL::HidDevice Struct Reference

An opaque handle representing an open HID device. More...

Inheritance diagram for SDL::HidDevice:
[legend]

Public Member Functions

constexpr HidDevice (HidDeviceRaw resource) noexcept
 Constructs from raw HidDevice.
constexpr HidDevice (const HidDevice &other)=delete
 Copy constructor.
constexpr HidDevice (HidDevice &&other) noexcept
 Move constructor.
constexpr HidDevice (const HidDeviceRef &other)=delete
constexpr HidDevice (HidDeviceRef &&other)=delete
 HidDevice (unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number)
 Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number.
 HidDevice (StringParam path)
 Open a HID device by its path name.
 ~HidDevice ()
 Destructor.
constexpr HidDeviceoperator= (HidDevice &&other) noexcept
 Assignment operator.
HidDeviceoperator= (const HidDevice &other)=delete
 Assignment operator.
void close ()
 Close a HID device.
PropertiesRef hid_get_properties ()
 Get the properties associated with an HidDevice.
int write (SourceBytes data)
 Write an Output report to a HID device.
int read_timeout (TargetBytes data, Milliseconds timeout)
 Read an Input report from a HID device with timeout.
int read (TargetBytes data)
 Read an Input report from a HID device.
void set_nonblocking (bool nonblock)
 Set the device handle to be non-blocking.
int send_feature_report (SourceBytes data)
 Send a Feature report to the device.
int get_feature_report (TargetBytes data)
 Get a feature report from a HID device.
int get_input_report (TargetBytes data)
 Get an input report from a HID device.
void get_manufacturer_string (wchar_t *string, size_t maxlen)
 Get The Manufacturer String from a HID device.
void get_product_string (wchar_t *string, size_t maxlen)
 Get The Product String from a HID device.
void get_serial_number_string (wchar_t *string, size_t maxlen)
 Get The Serial Number String from a HID device.
void get_indexed_string (int string_index, wchar_t *string, size_t maxlen)
 Get a string from a HID device, based on its string index.
hid_device_infoget_device_info ()
 Get the device info from a HID device.
int get_report_descriptor (TargetBytes buf)
 Get a report descriptor from a HID device.
constexpr ResourceBase (RawPointer resource)
 Constructs from resource pointer.
constexpr ResourceBase (std::nullptr_t=nullptr)
 Constructs null/invalid.
Public Member Functions inherited from SDL::ResourceBase< HidDeviceRaw >
constexpr ResourceBase (RawPointer resource)
 Constructs from resource pointer.
constexpr operator bool () const
 Converts to bool.
constexpr auto operator<=> (const ResourceBase &other) const=default
 Comparison.
constexpr RawConstPointer operator-> () const noexcept
 member access to underlying resource pointer.
constexpr RawPointer get () const noexcept
 Retrieves underlying resource pointer.
constexpr RawPointer release () noexcept
 Retrieves underlying resource pointer and clear this.

Additional Inherited Members

Public Types inherited from SDL::ResourceBase< HidDeviceRaw >
using RawPointer
 The underlying raw pointer type.
using RawConstPointer
 The underlying const raw pointer type.

Detailed Description

An opaque handle representing an open HID device.

Since
This struct is available since SDL 3.2.0.
Category:
Resource

Constructor & Destructor Documentation

◆ HidDevice()

SDL::HidDevice::HidDevice ( HidDeviceRaw resource)
inlineexplicitconstexprnoexcept

Constructs from raw HidDevice.

Parameters
resourcea HidDeviceRaw to be wrapped.

This assumes the ownership, call release() if you need to take back.


The documentation for this struct was generated from the following file: