Open Lighting Architecture  0.10.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Member Functions | List of all members
ola::usb::JaRuleWidgetPort Class Reference

Detailed Description

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.
 
JaRulePortHandleClaimPort ()
 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.
 

Constructor & Destructor Documentation

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.

Parameters
executorThe Executor to run the callbacks on.
adaptorThe LibUsbAdaptor to use.
usb_handlethe libusb_device_handle for the Ja Rule widget.
endpoint_numberThe endpoint to use for transfers.
uidThe device's UID.
physical_portThe physical port index.

Member Function Documentation

JaRulePortHandle * ola::usb::JaRuleWidgetPort::ClaimPort ( )

Claim the handle to this port.

Returns
a port handle, ownership is not transferred. Will return NULL if the port is already claimed.
void ola::usb::JaRuleWidgetPort::ReleasePort ( )

Release a handle to a port.

Returns
a port handle, ownership is not transferred.
void ola::usb::JaRuleWidgetPort::SendCommand ( CommandClass  command,
const uint8_t *  data,
unsigned int  size,
CommandCompleteCallback callback 
)

Send a command on this port.

Parameters
commandthe Command type.
datathe payload data. The data is copied and can be freed once the method returns.
sizethe payload size.
callbackThe 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.


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