Open Lighting Architecture: ola::plugin::usbdmx::AsyncUsbTransceiverBase Class Reference

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
ola::plugin::usbdmx::AsyncUsbTransceiverBase Class Referenceabstract

## Detailed Description

A base class that implements common functionality to send or receive DMX asynchronously to a libusb_device.

Inheritance diagram for ola::plugin::usbdmx::AsyncUsbTransceiverBase:

## Public Member Functions
| AsyncUsbTransceiverBase (ola::usb::LibUsbAdaptor *const adaptor, libusb_device *usb_device)
| Create a new AsyncUsbTransceiverBase.
virtual | ~AsyncUsbTransceiverBase ()
| Destructor.
bool | Init ()
| Initialize the transceiver.
virtual void | TransferComplete (struct libusb_transfer *transfer)=0
| Called from the libusb callback when the asynchronous transfer completes.
libusb_device_handle * | GetHandle ()
| Get the libusb_device_handle of an already opened widget.

## Protected Types
enum | TransferState { IDLE , IN_PROGRESS , DISCONNECTED }

## Protected Member Functions
virtual libusb_device_handle * | SetupHandle ()=0
| Open the device handle.
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.

## Protected Attributes
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

## ◆ AsyncUsbTransceiverBase()

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

Create a new AsyncUsbTransceiverBase.

Parameters

  adaptor | the LibUsbAdaptor to use.
  usb_device | the libusb_device to use for the widget.

## Member Function Documentation

## ◆ FillControlTransfer()

void ola::plugin::usbdmx::AsyncUsbTransceiverBase::FillControlTransfer | ( | unsigned char * | buffer,
|  | unsigned int | timeout )
| protected

Fill a control transfer.

Parameters

  buffer | passed to libusb_fill_control_transfer.
  timeout | passed to libusb_fill_control_transfer.

## ◆ GetHandle()

libusb_device_handle * ola::plugin::usbdmx::AsyncUsbTransceiverBase::GetHandle | ( |  | ) |
| inline

Get the libusb_device_handle of an already opened widget.

Returns
  the handle of the widget or NULL if it was not opened

## ◆ Init()

bool ola::plugin::usbdmx::AsyncUsbTransceiverBase::Init | ( |  | ) |

Initialize the transceiver.

Returns
  true if SetupHandle() returned a valid handle, false otherwise.

## ◆ PostTransferHook()

virtual void ola::plugin::usbdmx::AsyncUsbTransceiverBase::PostTransferHook | ( |  | ) |
| 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::AsyncUsbSender, ola::plugin::usbdmx::DMXCProjectsNodleU1AsyncUsbSender, and ola::plugin::usbdmx::VellemanAsyncUsbSender.

## ◆ SetupHandle()

virtual libusb_device_handle * ola::plugin::usbdmx::AsyncUsbTransceiverBase::SetupHandle | ( |  | ) |
| protectedpure virtual

Open the device handle.

Returns
  A valid libusb_device_handle or NULL if the device could not be opened.

Implemented in ola::plugin::usbdmx::AnymaAsyncUsbSender, ola::plugin::usbdmx::DMXCProjectsNodleU1AsyncUsbReceiver, ola::plugin::usbdmx::DMXCProjectsNodleU1AsyncUsbSender, ola::plugin::usbdmx::EuroliteProAsyncUsbSender, ola::plugin::usbdmx::FadecandyAsyncUsbSender, ola::plugin::usbdmx::SunliteAsyncUsbSender, and ola::plugin::usbdmx::VellemanAsyncUsbSender.

## ◆ SubmitTransfer()

int ola::plugin::usbdmx::AsyncUsbTransceiverBase::SubmitTransfer | ( |  | ) |
| protected

Submit the transfer for tx.

Returns
  the result of libusb_submit_transfer().

## ◆ TransferComplete()

virtual void ola::plugin::usbdmx::AsyncUsbTransceiverBase::TransferComplete | ( | struct libusb_transfer * | transfer | ) |
| pure virtual

Called from the libusb callback when the asynchronous transfer completes.

Parameters

  transfer | the completed transfer.

Implemented in ola::plugin::usbdmx::AsyncUsbReceiver, and ola::plugin::usbdmx::AsyncUsbSender.

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

- plugins/usbdmx/AsyncUsbTransceiverBase.h
- plugins/usbdmx/AsyncUsbTransceiverBase.cpp