21 #ifndef PLUGINS_USBDMX_JARULEENDPOINT_H_
22 #define PLUGINS_USBDMX_JARULEENDPOINT_H_
25 #include <ola/io/ByteString.h>
26 #include <ola/thread/ExecutorInterface.h>
27 #include <ola/thread/Mutex.h>
28 #include <ola/util/SequenceNumber.h>
33 #include "plugins/usbdmx/LibUsbAdaptor.h"
119 SET_BREAK_TIME = 0x10,
120 GET_BREAK_TIME = 0x11,
123 SET_RDM_BROADCAST_LISTEN = 0x20,
124 GET_RDM_BROADCAST_LISTEN = 0x21,
125 SET_RDM_WAIT_TIME = 0x22,
126 GET_RDM_WAIT_TIME = 0x23,
130 RDM_BROADCAST_REQUEST = 0x42,
145 libusb_device *device);
197 IN_BUFFER_SIZE = 1024
201 OUT_BUFFER_SIZE = 1024
222 uint8_t status_flags;
226 typedef std::map<uint8_t, PendingCommand> PendingCommandMap;
227 typedef std::queue<QueuedCommand> CommandQueue;
230 LibUsbAdaptor *m_adaptor;
231 libusb_device *m_device;
232 libusb_device_handle *m_usb_handle;
236 CommandQueue m_queued_commands;
237 PendingCommandMap m_pending_commands;
239 uint8_t m_out_buffer[OUT_BUFFER_SIZE];
240 libusb_transfer *m_out_transfer;
241 bool m_out_in_progress;
243 uint8_t m_in_buffer[IN_BUFFER_SIZE];
244 libusb_transfer *m_in_transfer;
245 bool m_in_in_progress;
247 void MaybeSendCommand();
248 bool SubmitInTransfer();
249 void HandleResponse(
const uint8_t *data,
255 uint8_t status_flags,
259 static const uint8_t EOF_IDENTIFIER = 0xa5;
260 static const uint8_t SOF_IDENTIFIER = 0x5a;
261 static const unsigned int MAX_PAYLOAD_SIZE = 513;
262 static const unsigned int MIN_RESPONSE_SIZE = 9;
263 static const unsigned int USB_PACKET_SIZE = 64;
264 static const unsigned int MAX_IN_FLIGHT = 2;
265 static const unsigned int MAX_QUEUED_MESSAGES = 10;
266 static const unsigned int INTERFACE_OFFSET = 2;
268 static const uint8_t IN_ENDPOINT = 0x81;
269 static const uint8_t OUT_ENDPOINT = 0x01;
270 static const unsigned int ENDPOINT_TIMEOUT_MS = 1000;
279 #endif // PLUGINS_USBDMX_JARULEENDPOINT_H_