Open Lighting Architecture: ola::usb Namespace Reference

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
ola::usb Namespace Reference

## Detailed Description

USB Device drivers.

## Classes
class | HotplugAgent
| Detects when USB devices are added or removed. More...
class | JaRulePortHandle
| Represents a DMX/RDM port on a Ja Rule device. More...
class | JaRulePortHandleImpl
| The internal implementation of a Ja Rule Port Handle. More...
class | JaRuleWidget
| A Ja Rule hardware device (widget). More...
class | JaRuleWidgetPort
| The internal model of a port on a JaRule device. More...
class | LibUsbAdaptor
| Wraps calls to libusb so we can test the code. More...
class | BaseLibUsbAdaptor
| The base LibUsbAdaptor that passes most calls through to libusb. More...
class | SyncronousLibUsbAdaptor
| A LibUsbAdaptor for use with Syncronous widgets. More...
class | AsyncronousLibUsbAdaptor
| A LibUsbAdaptor for use with Asyncronous widgets. More...
class | LibUsbThread
| The base class for the dedicated libusb thread. More...
class | LibUsbSimpleThread
| The non-hotplug version of LibUsbThread. More...
class | USBDeviceID
class | auto_ptr
| STL class. More...
class | pair
| STL class. More...
class | ostream
| STL class. More...
class | DiscoveryAgent
| An asynchronous RDM Discovery algorithm. More...
class | DiscoverableQueueingRDMController
class | RDMCommand
| The base class that all RDM requests & responses inherit from. More...
class | RDMCommandSerializer
| Serializes RDMCommands. More...
class | RDMDiscoveryResponse
| An RDM response of type DISCOVER_COMMAND. More...
struct | RDMReply
| Holds the final state of an RDM request. More...
class | RDMRequest
| RDM Commands that represent requests (GET, SET or DISCOVER). More...
class | RDMResponse
| An RDM Command that represents responses (GET, SET or DISCOVER). More...
class | UID
| Represents a RDM UID. More...
class | UIDSet
| Represents a set of RDM UIDs. More...
class | vector
| STL class. More...
class | string
| STL class. More...
class | MutexLocker
class | ostringstream
| STL class. More...

## Typedefs
typedef ola::BaseCallback4< void, USBCommandResult, JaRuleReturnCode, uint8_t, const ola::io::ByteString & > | CommandCompleteCallback
| A command completion callback.
typedef ola::BaseCallback1< void, RDMReply * > | RDMCallback
| The callback run when a RDM request completes.
typedef ola::BaseCallback1< void, const ola::rdm::UIDSet & > | RDMDiscoveryCallback
| The callback run when a discovery operation completes.
typedef BaseRDMRequest< RDMCommand::SET_COMMAND > | RDMSetRequest

## Enumerations
enum | JaRuleStatusFlags { FLAGS_CHANGED_FLAG = 0x02 , MSG_TRUNCATED_FLAG = 0x04 }
| Ja Rule status flags. More...
enum | JaRulePortMode { CONTROLLER_MODE , RESPONDER_MODE , SELF_TEST_MODE }
| Ja Rule Port modes. More...
enum | USBCommandResult { COMMAND_RESULT_OK , COMMAND_RESULT_MALFORMED , COMMAND_RESULT_SEND_ERROR , COMMAND_RESULT_QUEUE_FULL , COMMAND_RESULT_TIMEOUT , COMMAND_RESULT_CLASS_MISMATCH , COMMAND_RESULT_CANCELLED , COMMAND_RESULT_INVALID_PORT }
| Indicates the eventual state of a Ja Rule command. More...
enum | CommandClass { JARULE_CMD_RESET_DEVICE = 0x00 , JARULE_CMD_SET_MODE = 0x01 , JARULE_CMD_GET_HARDWARE_INFO = 0x02 , JARULE_CMD_RUN_SELF_TEST = 0x03 , JARULE_CMD_SET_BREAK_TIME = 0x10 , JARULE_CMD_GET_BREAK_TIME = 0x11 , JARULE_CMD_SET_MARK_TIME = 0x12 , JARULE_CMD_GET_MARK_TIME = 0x13 , JARULE_CMD_SET_RDM_BROADCAST_TIMEOUT = 0x20 , JARULE_CMD_GET_RDM_BROADCAST_TIMEOUT = 0x21 , JARULE_CMD_SET_RDM_RESPONSE_TIMEOUT = 0x22 , JARULE_CMD_GET_RDM_RESPONSE_TIMEOUT = 0x23 , JARULE_CMD_SET_RDM_DUB_RESPONSE_LIMIT = 0x24 , JARULE_CMD_GET_RDM_DUB_RESPONSE_LIMIT = 0x25 , JARULE_CMD_SET_RDM_RESPONDER_DELAY = 0x26 , JARULE_CMD_GET_RDM_RESPONDER_DELAY = 0x27 , JARULE_CMD_SET_RDM_RESPONDER_JITTER = 0x28 , JARULE_CMD_GET_RDM_RESPONDER_JITTER = 0x29 , JARULE_CMD_TX_DMX = 0x30 , JARULE_CMD_RDM_DUB_REQUEST = 0x40 , JARULE_CMD_RDM_REQUEST = 0x41 , JARULE_CMD_RDM_BROADCAST_REQUEST = 0x42 , JARULE_CMD_ECHO = 0xf0 , JARULE_CMD_GET_FLAGS = 0xf2 }
| The Ja Rule command set.
enum | JaRuleReturnCode { RC_OK , RC_UNKNOWN , RC_BUFFER_FULL , RC_BAD_PARAM , RC_TX_ERROR , RC_RDM_TIMEOUT , RC_RDM_BCAST_RESPONSE , RC_RDM_INVALID_RESPONSE , RC_INVALID_MODE , RC_LAST }
| JaRule command return codes. More...
enum | RDMStatusCode
| RDM Status Codes. More...

## Functions
ostream & | operator<< (ostream &os, const USBCommandResult &result)
ostream & | operator<< (ostream &os, const CommandClass &command_class)
ostream & | operator<< (ostream &os, const JaRuleReturnCode &rc)
ostream & | operator<< (std::ostream &os, const USBDeviceID &id)
template<typename ReturnType>
SingleUseCallback0< ReturnType > * | NewSingleCallback (ReturnType(*callback)())
| A helper function to create a new SingleUseCallback with 0 create-time arguments and 0 execution time arguments.
void | RunRDMCallback (RDMCallback *callback, RDMStatusCode status_code)
| A helper message to run a RDMCallback with the given status code.
template<typename T>
_ToHex< T > | ToHex (T v, bool prefix=true)
| Convert a value to a hex string.
template<typename ReturnType>
SingleUseCallback0< ReturnType > * | NewSingleCallback (ReturnType(*callback)())
| A helper function to create a new SingleUseCallback with 0 create-time arguments and 0 execution time arguments.
template<typename T>
_ToHex< T > | ToHex (T v, bool prefix=true)
| Convert a value to a hex string.
uint16_t | JoinUInt8 (uint8_t high, uint8_t low)
| Convert two uint8_t's to a uint16_t.
void | SplitUInt16 (uint16_t input, uint8_t *high, uint8_t *low)
| Convert a uint16_t to two uint8_t's.

## Typedef Documentation

## ◆ CommandCompleteCallback

typedef ola::BaseCallback4<void, USBCommandResult, JaRuleReturnCode, uint8_t, const ola::io::ByteString&> ola::usb::CommandCompleteCallback

A command completion callback.

Template Parameters

  The | result of the command operation
  The | return code from the Ja Rule device.
  The | status flags.
  The | response payload.

If the USBCommandResult is not COMMAND_COMPLETED_OK, the remaining values are undefined.

## ◆ RDMCallback

typedef ola::BaseCallback1<void, RDMReply*> ola::rdm::RDMCallback

The callback run when a RDM request completes.

Template Parameters

  reply | The RDMReply object. The reply object is valid for the duration of the call.

The RDMReply is not const, since some stages of the pipeline may need to rewrite the UID / Transaction Number.

For performance reasons this can be either a single use callback or a permanent callback.

## ◆ RDMDiscoveryCallback

typedef ola::BaseCallback1<void, const ola::rdm::UIDSet&> ola::rdm::RDMDiscoveryCallback

The callback run when a discovery operation completes.

Template Parameters

  UIDSet | The UIDs that were discovered.

## Enumeration Type Documentation

## ◆ JaRulePortMode

enum ola::usb::JaRulePortMode

Ja Rule Port modes.

Enumerator
CONTROLLER_MODE | DMX/RDM Controller mode.
RESPONDER_MODE | DMX/RDM Responder mode.
SELF_TEST_MODE | Self test mode.

## ◆ JaRuleReturnCode

enum ola::usb::JaRuleReturnCode

JaRule command return codes.

Enumerator
RC_OK | The command completed successfully.
RC_UNKNOWN | Unknown command.
RC_BUFFER_FULL | The command could not be completed due to a full memory buffer.
RC_BAD_PARAM | The command was malformed.
RC_TX_ERROR | There was an error during transceiver transmit.
RC_RDM_TIMEOUT | No RDM response was received.
RC_RDM_BCAST_RESPONSE | Data was received in response to a broadcast RDM command. This usually indicates a broken responder.
RC_RDM_INVALID_RESPONSE | An invalid RDM response was received.
RC_INVALID_MODE | The command is invalid in the current mode.
RC_LAST | One past the last valid return code.

## ◆ JaRuleStatusFlags

enum ola::usb::JaRuleStatusFlags

Ja Rule status flags.

Enumerator
FLAGS_CHANGED_FLAG | Flags have changed.
MSG_TRUNCATED_FLAG | The message has been truncated.

## ◆ RDMStatusCode

enum ola::rdm::RDMStatusCode

RDM Status Codes.

The status codes indicates the outcome of an RDM Request. The two most common status codes are RDM_COMPLETED_OK and RDM_WAS_BROADCAST. The other codes generally indicate some sort of failure.

## ◆ USBCommandResult

enum ola::usb::USBCommandResult

Indicates the eventual state of a Ja Rule command.

Various failures can occur at the libusb layer.

Enumerator
COMMAND_RESULT_OK | The command was sent and a response was received.
COMMAND_RESULT_MALFORMED | The command is malformed. This could mean the payload is too big or a NULL pointer with a non-0 size was provided.
COMMAND_RESULT_SEND_ERROR | An error occurred when trying to send the command.
COMMAND_RESULT_QUEUE_FULL | The command was not sent as the TX queue was full.
COMMAND_RESULT_TIMEOUT | The command was sent but no response was received.
COMMAND_RESULT_CLASS_MISMATCH | The command class returned did not match the request.
COMMAND_RESULT_CANCELLED | The command was cancelled.
COMMAND_RESULT_INVALID_PORT | Invalid port.

## Function Documentation

## ◆ JoinUInt8()

uint16_t ola::utils::JoinUInt8 | ( | uint8_t | high,
|  | uint8_t | low )
| inline

Convert two uint8_t's to a uint16_t.

Parameters

  high | the high byte
  low | the low byte

Returns
  the combined uint16_t

## ◆ NewSingleCallback() [1/2]

template<typename ReturnType>

SingleUseCallback0< ReturnType > * ola::NewSingleCallback | ( | ReturnType(* | callback )() | ) |
| inline

A helper function to create a new SingleUseCallback with 0 create-time arguments and 0 execution time arguments.

Template Parameters

  ReturnType | the return type of the callback.

Parameters

  callback | the function pointer to use when executing the callback.

Returns
  The same return value as the function.

## ◆ NewSingleCallback() [2/2]

template<typename ReturnType>

SingleUseCallback0< ReturnType > * ola::NewSingleCallback | ( | ReturnType(* | callback )() | ) |
| inline

A helper function to create a new SingleUseCallback with 0 create-time arguments and 0 execution time arguments.

Template Parameters

  ReturnType | the return type of the callback.

Parameters

  callback | the function pointer to use when executing the callback.

Returns
  The same return value as the function.

## ◆ RunRDMCallback()

void ola::rdm::RunRDMCallback | ( | RDMCallback * | callback,
|  | RDMStatusCode | status_code )
| inline

A helper message to run a RDMCallback with the given status code.

Parameters

  callback | The RDMCallback to run.
  status_code | The status code to use in the RDMReply.

## ◆ SplitUInt16()

void ola::utils::SplitUInt16 | ( | uint16_t | input,
|  | uint8_t * | high,
|  | uint8_t * | low )
| inline

Convert a uint16_t to two uint8_t's.

Parameters

  [in] | input | the uint16_t to split
  [out] | high | the high byte
  [out] | low | the low byte

## ◆ ToHex() [1/2]

template<typename T>

_ToHex< T > ola::strings::ToHex | ( | T | v,
|  | bool | prefix = true )

Convert a value to a hex string.

Automatic constructor for _ToHex that deals with widths

Template Parameters

  T | the type of value to convert

Parameters

  v | the value to convert
  prefix | show the 0x prefix

Returns
  A _ToHex struct representing the value, output it to an ostream to use it.

Note
  We only currently support unsigned ints due to a lack of requirement for anything else

## ◆ ToHex() [2/2]

template<typename T>

_ToHex< T > ola::strings::ToHex | ( | T | v,
|  | bool | prefix = true )

Convert a value to a hex string.

Automatic constructor for _ToHex that deals with widths

Template Parameters

  T | the type of value to convert

Parameters

  v | the value to convert
  prefix | show the 0x prefix

Returns
  A _ToHex struct representing the value, output it to an ostream to use it.

Note
  We only currently support unsigned ints due to a lack of requirement for anything else