ViaDevice Class
A thin, blocking wrapper over a single HID device path. More...
- Header:
#include <via/viadevice.h> - CMake:
find_package(SonicVia REQUIRED)
target_link_libraries(mytarget PRIVATE SonicVia::SonicVia)
List of all members, including inherited members
Public Functions
- ViaDevice(QString devicePath)
- bool close()
- QString devicePath() const
- bool isOpen() const
- QString lastError() const
- bool open()
- QByteArray sendReport(const QByteArray &report)
Detailed Description
sendReport() is virtual so that unit tests can inject a mock device.
Member Function Documentation
[explicit] ViaDevice::ViaDevice(QString devicePath)
Creates a device for the HID path devicePath, as ViaDiscovery lists it.
bool ViaDevice::close()
Closes the device; always true.
QString ViaDevice::devicePath() const
The device's HID path.
bool ViaDevice::isOpen() const
Whether open() succeeded and close() hasn't been called since.
QString ViaDevice::lastError() const
hidapi's description of the last error.
bool ViaDevice::open()
Opens the device; true when it is open. Always false when built without VIA support (no hidapi).
[virtual] QByteArray ViaDevice::sendReport(const QByteArray &report)
Sends the 33-byte VIA report and reads the (<=32 byte) response. Returns an empty QByteArray on any error or when built as a stub.