Open Lighting Architecture: libs/usb/JaRuleConstants.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
JaRuleConstants.h
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU Library General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15 *
16 * JaRuleConstants.h
17 * Constants used with Ja Rule devices.
18 * Copyright (C) 2015 Simon Newton
19 */
20
21#ifndef LIBS_USB_JARULECONSTANTS_H_
22#define LIBS_USB_JARULECONSTANTS_H_
23
24#include <ola/Callback.h>
25#include <ola/io/ByteString.h>
26#include <ostream>
27
28namespace ola {
29namespace usb {
30
34 typedef enum {
35 FLAGS_CHANGED_FLAG = 0x02,
36 MSG_TRUNCATED_FLAG = 0x04
37} JaRuleStatusFlags;
38
42 typedef enum {
43 CONTROLLER_MODE,
44 RESPONDER_MODE,
45 SELF_TEST_MODE,
46} JaRulePortMode;
47
53 typedef enum {
57 COMMAND_RESULT_OK,
58
65 COMMAND_RESULT_MALFORMED,
66
70 COMMAND_RESULT_SEND_ERROR,
71
75 COMMAND_RESULT_QUEUE_FULL,
76
80 COMMAND_RESULT_TIMEOUT,
81
85 COMMAND_RESULT_CLASS_MISMATCH,
86
90 COMMAND_RESULT_CANCELLED,
91
95 COMMAND_RESULT_INVALID_PORT
96} USBCommandResult;
97
101 typedef enum {
102 JARULE_CMD_RESET_DEVICE = 0x00,
103 JARULE_CMD_SET_MODE = 0x01,
104 JARULE_CMD_GET_HARDWARE_INFO = 0x02,
105 JARULE_CMD_RUN_SELF_TEST = 0x03,
106 JARULE_CMD_SET_BREAK_TIME = 0x10,
107 JARULE_CMD_GET_BREAK_TIME = 0x11,
108 JARULE_CMD_SET_MARK_TIME = 0x12,
109 JARULE_CMD_GET_MARK_TIME = 0x13,
110 JARULE_CMD_SET_RDM_BROADCAST_TIMEOUT = 0x20,
111 JARULE_CMD_GET_RDM_BROADCAST_TIMEOUT = 0x21,
112 JARULE_CMD_SET_RDM_RESPONSE_TIMEOUT = 0x22,
113 JARULE_CMD_GET_RDM_RESPONSE_TIMEOUT = 0x23,
114 JARULE_CMD_SET_RDM_DUB_RESPONSE_LIMIT = 0x24,
115 JARULE_CMD_GET_RDM_DUB_RESPONSE_LIMIT = 0x25,
116 JARULE_CMD_SET_RDM_RESPONDER_DELAY = 0x26,
117 JARULE_CMD_GET_RDM_RESPONDER_DELAY = 0x27,
118 JARULE_CMD_SET_RDM_RESPONDER_JITTER = 0x28,
119 JARULE_CMD_GET_RDM_RESPONDER_JITTER = 0x29,
120 JARULE_CMD_TX_DMX = 0x30,
121 JARULE_CMD_RDM_DUB_REQUEST = 0x40,
122 JARULE_CMD_RDM_REQUEST = 0x41,
123 JARULE_CMD_RDM_BROADCAST_REQUEST = 0x42,
124
125 // Experimental / testing
126 JARULE_CMD_ECHO = 0xf0,
127 JARULE_CMD_GET_FLAGS = 0xf2,
128} CommandClass;
129
133 typedef enum {
134 RC_OK,
135 RC_UNKNOWN,
139 RC_BUFFER_FULL,
140 RC_BAD_PARAM,
141 RC_TX_ERROR,
142 RC_RDM_TIMEOUT,
143
149 RC_RDM_BCAST_RESPONSE,
150 RC_RDM_INVALID_RESPONSE,
151 RC_INVALID_MODE,
152
153 RC_LAST
154} JaRuleReturnCode;
155
166typedef ola::BaseCallback4<void, USBCommandResult, JaRuleReturnCode, uint8_t,
167 const ola::io::ByteString&> CommandCompleteCallback;
168
169
170std::ostream& operator<<(std::ostream& os, const USBCommandResult &result);
171std::ostream& operator<<(std::ostream& os, const CommandClass &command_class);
172std::ostream& operator<<(std::ostream& os, const JaRuleReturnCode &rc);
173
174} // namespace usb
175} // namespace ola
176
177#endif // LIBS_USB_JARULECONSTANTS_H_
Callback.h
ola::BaseCallback4
The base class for all 4 argument callbacks.
Definition Callback.h:3811
ola::usb
USB Device drivers.
ola::usb::CommandCompleteCallback
ola::BaseCallback4< void, USBCommandResult, JaRuleReturnCode, uint8_t, const ola::io::ByteString & > CommandCompleteCallback
A command completion callback.
Definition JaRuleConstants.h:167
ola::usb::CommandClass
CommandClass
The Ja Rule command set.
Definition JaRuleConstants.h:101
ola::usb::USBCommandResult
USBCommandResult
Indicates the eventual state of a Ja Rule command.
Definition JaRuleConstants.h:53
ola::usb::COMMAND_RESULT_SEND_ERROR
@ COMMAND_RESULT_SEND_ERROR
An error occurred when trying to send the command.
Definition JaRuleConstants.h:70
ola::usb::COMMAND_RESULT_CLASS_MISMATCH
@ COMMAND_RESULT_CLASS_MISMATCH
The command class returned did not match the request.
Definition JaRuleConstants.h:85
ola::usb::COMMAND_RESULT_TIMEOUT
@ COMMAND_RESULT_TIMEOUT
The command was sent but no response was received.
Definition JaRuleConstants.h:80
ola::usb::COMMAND_RESULT_OK
@ COMMAND_RESULT_OK
The command was sent and a response was received.
Definition JaRuleConstants.h:57
ola::usb::COMMAND_RESULT_INVALID_PORT
@ COMMAND_RESULT_INVALID_PORT
Invalid port.
Definition JaRuleConstants.h:95
ola::usb::COMMAND_RESULT_MALFORMED
@ COMMAND_RESULT_MALFORMED
The command is malformed.
Definition JaRuleConstants.h:65
ola::usb::COMMAND_RESULT_CANCELLED
@ COMMAND_RESULT_CANCELLED
The command was cancelled.
Definition JaRuleConstants.h:90
ola::usb::COMMAND_RESULT_QUEUE_FULL
@ COMMAND_RESULT_QUEUE_FULL
The command was not sent as the TX queue was full.
Definition JaRuleConstants.h:75
ola::usb::JaRuleReturnCode
JaRuleReturnCode
JaRule command return codes.
Definition JaRuleConstants.h:133
ola::usb::RC_UNKNOWN
@ RC_UNKNOWN
Unknown command.
Definition JaRuleConstants.h:135
ola::usb::RC_RDM_BCAST_RESPONSE
@ RC_RDM_BCAST_RESPONSE
Data was received in response to a broadcast RDM command.
Definition JaRuleConstants.h:149
ola::usb::RC_RDM_TIMEOUT
@ RC_RDM_TIMEOUT
No RDM response was received.
Definition JaRuleConstants.h:142
ola::usb::RC_LAST
@ RC_LAST
One past the last valid return code.
Definition JaRuleConstants.h:153
ola::usb::RC_TX_ERROR
@ RC_TX_ERROR
There was an error during transceiver transmit.
Definition JaRuleConstants.h:141
ola::usb::RC_BAD_PARAM
@ RC_BAD_PARAM
The command was malformed.
Definition JaRuleConstants.h:140
ola::usb::RC_RDM_INVALID_RESPONSE
@ RC_RDM_INVALID_RESPONSE
An invalid RDM response was received.
Definition JaRuleConstants.h:150
ola::usb::RC_OK
@ RC_OK
The command completed successfully.
Definition JaRuleConstants.h:134
ola::usb::RC_BUFFER_FULL
@ RC_BUFFER_FULL
The command could not be completed due to a full memory buffer.
Definition JaRuleConstants.h:139
ola::usb::RC_INVALID_MODE
@ RC_INVALID_MODE
The command is invalid in the current mode.
Definition JaRuleConstants.h:151
ola::usb::JaRulePortMode
JaRulePortMode
Ja Rule Port modes.
Definition JaRuleConstants.h:42
ola::usb::SELF_TEST_MODE
@ SELF_TEST_MODE
Self test mode.
Definition JaRuleConstants.h:45
ola::usb::CONTROLLER_MODE
@ CONTROLLER_MODE
DMX/RDM Controller mode.
Definition JaRuleConstants.h:43
ola::usb::RESPONDER_MODE
@ RESPONDER_MODE
DMX/RDM Responder mode.
Definition JaRuleConstants.h:44
ola::usb::JaRuleStatusFlags
JaRuleStatusFlags
Ja Rule status flags.
Definition JaRuleConstants.h:34
ola::usb::MSG_TRUNCATED_FLAG
@ MSG_TRUNCATED_FLAG
The message has been truncated.
Definition JaRuleConstants.h:36
ola::usb::FLAGS_CHANGED_FLAG
@ FLAGS_CHANGED_FLAG
Flags have changed.
Definition JaRuleConstants.h:35
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44