MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ write()

int MayaFlux::Core::SerialInputBackend::write ( uint32_t ,
std::span< const uint8_t >  )
overridevirtual

Send an output report to an open device, for rumble, LEDs or commands.

Parameters
device_idTarget device
dataReport bytes, the first being the report id when the device uses report ids
Returns
Bytes sent, or -1 when the device is not open or the backend cannot write

Reimplemented from MayaFlux::Core::IInputBackend.

Definition at line 393 of file SerialInputBackend.cpp.

394{
395 const auto device = get_device(device_id);
396 if (!device || !device->send(data)) {
397 return -1;
398 }
399 return static_cast<int>(data.size());
400}
std::shared_ptr< SerialDevice > get_device(uint32_t device_id) const
The open device, or null.

References get_device(), and write().

Referenced by write().

Here is the call graph for this function:
Here is the caller graph for this function: