21 #ifndef PLUGINS_USBPRO_USBPRODEVICE_H_
22 #define PLUGINS_USBPRO_USBPRODEVICE_H_
27 #include "olad/TokenBucket.h"
28 #include "olad/PluginAdaptor.h"
29 #include "olad/Port.h"
31 #include "plugins/usbpro/EnttecUsbProWidget.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;
53 unsigned int fps_limit);
55 string DeviceId()
const {
return m_serial; }
57 void Configure(RpcController *controller,
58 const string &request,
60 google::protobuf::Closure *done);
62 bool AllowMultiPortPatching()
const {
return true; }
75 void UpdateParams(
unsigned int port_id,
bool status,
78 void HandleParametersRequest(RpcController *controller,
79 const Request *request,
81 google::protobuf::Closure *done);
83 void HandleParametersResponse(RpcController *controller,
85 google::protobuf::Closure *done,
90 void HandleSerialRequest(RpcController *controller,
91 const Request *request,
93 google::protobuf::Closure *done);
95 void HandlePortAssignmentRequest(RpcController *controller,
96 const Request *request,
98 google::protobuf::Closure *done);
100 void HandlePortAssignmentResponse(RpcController *controller,
102 google::protobuf::Closure *done,
104 uint8_t port1_assignment,
105 uint8_t port2_assignment);
107 static string SerialToString(uint32_t serial);
111 vector<PortParams> m_port_params;
125 const string &serial)
131 return m_port->FetchDMX();
134 string Description()
const {
return "Serial #: " + m_serial; }
137 const string m_serial;
151 const string &serial,
153 unsigned int max_burst,
158 m_bucket(max_burst, rate, max_burst, *wake_time),
159 m_wake_time(wake_time) {}
161 bool WriteDMX(
const DmxBuffer &buffer, uint8_t) {
162 if (m_bucket.GetToken(*m_wake_time))
163 return m_port->SendDMX(buffer);
165 OLA_INFO <<
"Port rated limited, dropping frame";
171 m_port->ChangeToReceiveMode(
false);
184 m_port->RunIncrementalDiscovery(callback);
187 string Description()
const {
return "Serial #: " + m_serial; }
190 const string m_serial;
198 #endif // PLUGINS_USBPRO_USBPRODEVICE_H_