Open Lighting Architecture
Latest Git
|
A Ja Rule hardware device (widget).
Ja Rule devices may have more than one DMX/RDM port.
This class provides two ways to control the ports on the device:
To obtain a JaRulePortHandle, call ClaimPort(), when you're finished with the JaRulePortHandle you must call ReleasePort().
Public Member Functions | |
JaRuleWidget (ola::thread::ExecutorInterface *executor, AsynchronousLibUsbAdaptor *adaptor, libusb_device *usb_device) | |
Create a new Ja Rule widget. More... | |
~JaRuleWidget () | |
Destructor. | |
bool | Init () |
Initialize the Ja Rule widget. More... | |
USBDeviceID | GetDeviceId () const |
The device ID of this widget. More... | |
void | CancelAll (uint8_t port_id) |
Cancel all queued and inflight commands. More... | |
uint8_t | PortCount () const |
The number of ports on the widget. More... | |
ola::rdm::UID | GetUID () const |
The UID of the widget. More... | |
std::string | ManufacturerString () const |
Get the manufacturer string. More... | |
std::string | ProductString () const |
Get the product string. More... | |
class JaRulePortHandle * | ClaimPort (uint8_t port_index) |
Claim a handle to a port. More... | |
void | ReleasePort (uint8_t port_index) |
Release a handle to a port. More... | |
void | SendCommand (uint8_t port_index, CommandClass command, const uint8_t *data, unsigned int size, CommandCompleteCallback *callback) |
The low level API to send a command to the widget. More... | |
ola::usb::JaRuleWidget::JaRuleWidget | ( | ola::thread::ExecutorInterface * | executor, |
AsynchronousLibUsbAdaptor * | adaptor, | ||
libusb_device * | usb_device | ||
) |
Create a new Ja Rule widget.
executor | The Executor to run the callbacks on. |
adaptor | The LibUsbAdaptor to use. |
usb_device | the libusb_device for the Ja Rule widget. |
void ola::usb::JaRuleWidget::CancelAll | ( | uint8_t | port_id | ) |
Cancel all queued and inflight commands.
port_id | The port id of the commands to cancel |
This will immediately run all CommandCompleteCallbacks with the COMMAND_CANCELLED code.
JaRulePortHandle * ola::usb::JaRuleWidget::ClaimPort | ( | uint8_t | port_index | ) |
Claim a handle to a port.
port_index | The port to claim. |
USBDeviceID ola::usb::JaRuleWidget::GetDeviceId | ( | ) | const |
The device ID of this widget.
UID ola::usb::JaRuleWidget::GetUID | ( | ) | const |
The UID of the widget.
bool ola::usb::JaRuleWidget::Init | ( | ) |
Initialize the Ja Rule widget.
string ola::usb::JaRuleWidget::ManufacturerString | ( | ) | const |
Get the manufacturer string.
uint8_t ola::usb::JaRuleWidget::PortCount | ( | ) | const |
The number of ports on the widget.
Ports are numbered consecutively from 0.
string ola::usb::JaRuleWidget::ProductString | ( | ) | const |
Get the product string.
void ola::usb::JaRuleWidget::ReleasePort | ( | uint8_t | port_index | ) |
Release a handle to a port.
port_index | The port to claim |
void ola::usb::JaRuleWidget::SendCommand | ( | uint8_t | port_index, |
CommandClass | command, | ||
const uint8_t * | data, | ||
unsigned int | size, | ||
CommandCompleteCallback * | callback | ||
) |
The low level API to send a command to the widget.
port_index | The port on which to send the command. |
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.