Open Lighting Architecture
0.10.4
|
The internal model of a port on a JaRule device.
Each port has its own libusb transfers as well as a command queue. This avoids slow commands on one port blocking another.
Public Member Functions | |
JaRuleWidgetPort (ola::thread::ExecutorInterface *executor, LibUsbAdaptor *adaptor, libusb_device_handle *usb_handle, uint8_t endpoint_number, const ola::rdm::UID &uid, uint8_t physical_port) | |
Create a new JaRuleWidgetPort. More... | |
~JaRuleWidgetPort () | |
Destructor. | |
JaRulePortHandle * | ClaimPort () |
Claim the handle to this port. More... | |
void | ReleasePort () |
Release a handle to a port. More... | |
void | CancelAll () |
Cancel all commands for this port. | |
void | SendCommand (CommandClass command, const uint8_t *data, unsigned int size, CommandCompleteCallback *callback) |
Send a command on this port. More... | |
void | _OutTransferComplete () |
Called by the libusb callback when the transfer completes or is cancelled. | |
void | _InTransferComplete () |
Called by the libusb callback when the transfer completes or is cancelled. | |
ola::usb::JaRuleWidgetPort::JaRuleWidgetPort | ( | ola::thread::ExecutorInterface * | executor, |
LibUsbAdaptor * | adaptor, | ||
libusb_device_handle * | usb_handle, | ||
uint8_t | endpoint_number, | ||
const ola::rdm::UID & | uid, | ||
uint8_t | physical_port | ||
) |
Create a new JaRuleWidgetPort.
executor | The Executor to run the callbacks on. |
adaptor | The LibUsbAdaptor to use. |
usb_handle | the libusb_device_handle for the Ja Rule widget. |
endpoint_number | The endpoint to use for transfers. |
uid | The device's UID. |
physical_port | The physical port index. |
JaRulePortHandle * ola::usb::JaRuleWidgetPort::ClaimPort | ( | ) |
Claim the handle to this port.
void ola::usb::JaRuleWidgetPort::ReleasePort | ( | ) |
Release a handle to a port.
void ola::usb::JaRuleWidgetPort::SendCommand | ( | CommandClass | command, |
const uint8_t * | data, | ||
unsigned int | size, | ||
CommandCompleteCallback * | callback | ||
) |
Send a command on this port.
command | the Command type. |
data | the payload data. The data is copied and can be freed once the method returns. |
size | the payload size. |
callback | The callback to run when the command completes. This may be run immediately in some conditions. |
SendCommand() can be called from any thread, and messages will be queued.