Pages
API Documentation
On this page

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

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.

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.