21 #ifndef PLUGINS_USBPRO_ULTRADMXPRODEVICE_H_
22 #define PLUGINS_USBPRO_ULTRADMXPRODEVICE_H_
27 #include "olad/TokenBucket.h"
28 #include "olad/PluginAdaptor.h"
29 #include "olad/Port.h"
31 #include "plugins/usbpro/UltraDMXProWidget.h"
32 #include "plugins/usbpro/UsbSerialDevice.h"
33 #include "plugins/usbpro/messages/UsbProConfigMessages.pb.h"
39 using google::protobuf::RpcController;
40 using ola::plugin::usbpro::Request;
55 unsigned int fps_limit);
57 string DeviceId()
const {
return m_serial; }
59 bool AllowMultiPortPatching()
const {
return true; }
61 void Configure(RpcController *controller,
62 const string &request,
64 google::protobuf::Closure *done);
72 void HandleParametersRequest(RpcController *controller,
73 const Request *request,
75 google::protobuf::Closure *done);
77 void HandleParametersResponse(RpcController *controller,
79 google::protobuf::Closure *done,
83 void HandleSerialRequest(RpcController *controller,
84 const Request *request,
86 google::protobuf::Closure *done);
91 bool m_got_parameters;
107 const string &serial)
116 string Description()
const {
117 std::stringstream str;
118 str <<
"Serial " << m_serial;
138 unsigned int max_burst,
144 m_bucket(max_burst, rate, max_burst, *wake_time),
145 m_wake_time(wake_time),
146 m_primary(primary) {}
148 bool WriteDMX(
const DmxBuffer &buffer, uint8_t priority) {
149 if (m_bucket.GetToken(*m_wake_time))
151 return m_widget->SendDMX(buffer);
153 return m_widget->SendSecondaryDMX(buffer);
155 OLA_INFO <<
"Port rated limited, dropping frame";
160 string Description()
const {
161 std::stringstream str;
162 str <<
"Serial " << m_serial <<
", " <<
163 (m_primary ?
"Port 1" :
"Port 2");
177 #endif // PLUGINS_USBPRO_ULTRADMXPRODEVICE_H_