22 #ifndef PLUGINS_USBPRO_BASEUSBPROWIDGET_H_
23 #define PLUGINS_USBPRO_BASEUSBPROWIDGET_H_
29 #include "ola/io/Descriptor.h"
30 #include "plugins/usbpro/SerialWidgetInterface.h"
48 void DescriptorReady();
51 virtual bool SendDMX(
const DmxBuffer &buffer);
53 bool SendMessage(uint8_t label,
55 unsigned int length)
const;
59 static const uint8_t DMX_LABEL = 6;
60 static const uint8_t SERIAL_LABEL = 10;
61 static const uint8_t MANUFACTURER_LABEL = 77;
62 static const uint8_t DEVICE_LABEL = 78;
63 static const uint8_t HARDWARE_VERSION_LABEL = 14;
75 enum {MAX_DATA_SIZE = 600};
85 receive_state m_state;
86 unsigned int m_bytes_received;
87 message_header m_header;
88 uint8_t m_recv_buffer[MAX_DATA_SIZE];
90 void ReceiveMessage();
91 virtual void HandleMessage(uint8_t label,
93 unsigned int length) = 0;
95 static const uint8_t EOM = 0xe7;
96 static const uint8_t SOM = 0x7e;
97 static const unsigned int HEADER_SIZE;
114 m_callback(callback) {
129 m_callback = callback;
135 void HandleMessage(uint8_t label,
137 unsigned int length) {
138 m_callback->Run(label, data, length);
144 #endif // PLUGINS_USBPRO_BASEUSBPROWIDGET_H_