Open Lighting Architecture
0.9.6
|
A base class that send DMX data asynchronously to a libusb_device.
This encapsulates much of the asynchronous libusb logic. Subclasses should implement the SetupHandle() and PerformTransfer() methods.
Public Member Functions | |
AsyncUsbSender (class LibUsbAdaptor *const adaptor, libusb_device *usb_device) | |
Create a new AsyncUsbSender. | |
virtual | ~AsyncUsbSender () |
Destructor. | |
bool | Init () |
Initialize the sender. | |
bool | SendDMX (const DmxBuffer &buffer) |
Send one frame of DMX data. | |
void | TransferComplete (struct libusb_transfer *transfer) |
Called from the libusb callback when the asynchronous transfer completes. |
Protected Member Functions | |
virtual libusb_device_handle * | SetupHandle ()=0 |
Open the device handle. | |
virtual bool | PerformTransfer (const DmxBuffer &buffer)=0 |
Perform the DMX transfer. | |
virtual void | PostTransferHook () |
Called when the transfer completes. | |
void | CancelTransfer () |
Cancel any pending transfers. | |
void | FillControlTransfer (unsigned char *buffer, unsigned int timeout) |
Fill a control transfer. | |
void | FillBulkTransfer (unsigned char endpoint, unsigned char *buffer, int length, unsigned int timeout) |
Fill a bulk transfer. | |
void | FillInterruptTransfer (unsigned char endpoint, unsigned char *buffer, int length, unsigned int timeout) |
Fill an interrupt transfer. | |
int | SubmitTransfer () |
Submit the transfer for tx. | |
bool | TransferPending () const |
Check if there is a pending transfer. |
Protected Attributes | |
class LibUsbAdaptor *const | m_adaptor |
The LibUsbAdaptor passed in the constructor. | |
libusb_device *const | m_usb_device |
The libusb_device passed in the constructor. |
ola::plugin::usbdmx::AsyncUsbSender::AsyncUsbSender | ( | class LibUsbAdaptor *const | adaptor, |
libusb_device * | usb_device | ||
) |
Create a new AsyncUsbSender.
adaptor | the LibUsbAdaptor to use. |
usb_device | the libusb_device to use for the widget. |
|
protected |
Fill a control transfer.
buffer | passed to libusb_fill_control_transfer. |
timeout | passed to libusb_fill_control_transfer. |
bool ola::plugin::usbdmx::AsyncUsbSender::Init | ( | ) |
Initialize the sender.
|
protectedpure virtual |
Perform the DMX transfer.
buffer | the DMX buffer to send. |
This method is implemented by the subclass. The subclass should call FillControlTransfer() / FillBulkTransfer() as appropriate and then call SubmitTransfer().
Implemented in ola::plugin::usbdmx::VellemanAsyncUsbSender, ola::plugin::usbdmx::FadecandyAsyncUsbSender, ola::plugin::usbdmx::EuroliteProAsyncUsbSender, ola::plugin::usbdmx::SunliteAsyncUsbSender, and ola::plugin::usbdmx::AnymaAsyncUsbSender.
|
inlineprotectedvirtual |
Called when the transfer completes.
Some devices require multiple transfers per DMX frame. This provides a hook for continuation.
Reimplemented in ola::plugin::usbdmx::VellemanAsyncUsbSender.
bool ola::plugin::usbdmx::AsyncUsbSender::SendDMX | ( | const DmxBuffer & | buffer | ) |
Send one frame of DMX data.
buffer | the DMX data to send. |
|
protectedpure virtual |
Open the device handle.
Implemented in ola::plugin::usbdmx::VellemanAsyncUsbSender, ola::plugin::usbdmx::FadecandyAsyncUsbSender, ola::plugin::usbdmx::EuroliteProAsyncUsbSender, ola::plugin::usbdmx::SunliteAsyncUsbSender, and ola::plugin::usbdmx::AnymaAsyncUsbSender.
|
protected |
Submit the transfer for tx.
void ola::plugin::usbdmx::AsyncUsbSender::TransferComplete | ( | struct libusb_transfer * | transfer | ) |
Called from the libusb callback when the asynchronous transfer completes.
transfer | the completed transfer. |
|
inlineprotected |
Check if there is a pending transfer.