Open Lighting Architecture  Latest Git
Public Member Functions | Protected Member Functions | List of all members
ola::plugin::usbdmx::AsyncUsbSender Class Referenceabstract

Detailed Description

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.

Inheritance diagram for ola::plugin::usbdmx::AsyncUsbSender:
Inheritance graph
[legend]
Collaboration diagram for ola::plugin::usbdmx::AsyncUsbSender:
Collaboration graph
[legend]

Public Member Functions

 AsyncUsbSender (ola::usb::LibUsbAdaptor *const adaptor, libusb_device *usb_device)
 Create a new AsyncUsbSender. More...
 
virtual ~AsyncUsbSender ()
 Destructor.
 
bool SendDMX (const DmxBuffer &buffer)
 Send one frame of DMX data. More...
 
void TransferComplete (struct libusb_transfer *transfer)
 Called from the libusb callback when the asynchronous transfer completes. More...
 
- Public Member Functions inherited from ola::plugin::usbdmx::AsyncUsbTransceiverBase
 AsyncUsbTransceiverBase (ola::usb::LibUsbAdaptor *const adaptor, libusb_device *usb_device)
 Create a new AsyncUsbTransceiverBase. More...
 
virtual ~AsyncUsbTransceiverBase ()
 Destructor.
 
bool Init ()
 Initialize the transceiver. More...
 
libusb_device_handle * GetHandle ()
 Get the libusb_device_handle of an already opened widget. More...
 

Protected Member Functions

virtual bool PerformTransfer (const DmxBuffer &buffer)=0
 Perform the DMX transfer. More...
 
virtual void PostTransferHook ()
 Called when the transfer completes. More...
 
bool TransferPending () const
 Check if there is a pending transfer. More...
 
- Protected Member Functions inherited from ola::plugin::usbdmx::AsyncUsbTransceiverBase
virtual libusb_device_handle * SetupHandle ()=0
 Open the device handle. More...
 
void CancelTransfer ()
 Cancel any pending transfers.
 
void FillControlTransfer (unsigned char *buffer, unsigned int timeout)
 Fill a control transfer. More...
 
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. More...
 

Additional Inherited Members

- Protected Types inherited from ola::plugin::usbdmx::AsyncUsbTransceiverBase
enum  TransferState { IDLE, IN_PROGRESS, DISCONNECTED }
 
- Protected Attributes inherited from ola::plugin::usbdmx::AsyncUsbTransceiverBase
ola::usb::LibUsbAdaptor *const m_adaptor
 The LibUsbAdaptor passed in the constructor.
 
libusb_device *const m_usb_device
 The libusb_device passed in the constructor.
 
libusb_device_handle * m_usb_handle
 
bool m_suppress_continuation
 
struct libusb_transfer * m_transfer
 
TransferState m_transfer_state
 
ola::thread::Mutex m_mutex
 

Constructor & Destructor Documentation

◆ AsyncUsbSender()

ola::plugin::usbdmx::AsyncUsbSender::AsyncUsbSender ( ola::usb::LibUsbAdaptor *const  adaptor,
libusb_device *  usb_device 
)

Create a new AsyncUsbSender.

Parameters
adaptorthe LibUsbAdaptor to use.
usb_devicethe libusb_device to use for the widget.

Member Function Documentation

◆ PerformTransfer()

virtual bool ola::plugin::usbdmx::AsyncUsbSender::PerformTransfer ( const DmxBuffer buffer)
protectedpure virtual

◆ PostTransferHook()

virtual void ola::plugin::usbdmx::AsyncUsbSender::PostTransferHook ( )
inlineprotectedvirtual

Called when the transfer completes.

Some devices require multiple transfers per DMX frame. This provides a hook for continuation.

Reimplemented from ola::plugin::usbdmx::AsyncUsbTransceiverBase.

Reimplemented in ola::plugin::usbdmx::DMXCProjectsNodleU1AsyncUsbSender, ola::plugin::usbdmx::VellemanAsyncUsbSender, and ola::plugin::usbdmx::DMXCreator512BasicAsyncUsbSender.

◆ SendDMX()

bool ola::plugin::usbdmx::AsyncUsbSender::SendDMX ( const DmxBuffer buffer)

Send one frame of DMX data.

Parameters
bufferthe DMX data to send.
Returns
the value of PerformTransfer().

◆ TransferComplete()

void ola::plugin::usbdmx::AsyncUsbSender::TransferComplete ( struct libusb_transfer *  transfer)
virtual

Called from the libusb callback when the asynchronous transfer completes.

Parameters
transferthe completed transfer.

Implements ola::plugin::usbdmx::AsyncUsbTransceiverBase.

◆ TransferPending()

bool ola::plugin::usbdmx::AsyncUsbSender::TransferPending ( ) const
inlineprotected

Check if there is a pending transfer.

Returns
true if there is a transfer in progress, false otherwise.

The documentation for this class was generated from the following files: