2 #include <Device/Protocol/ProtocolSettingsWidget.hpp>
4 #include <ossia/protocols/osc/osc_factory.hpp>
13 using framing_type = decltype(ossia::net::osc_protocol_configuration::framing);
20 auto layout =
new QFormLayout{
this};
21 layout->setContentsMargins(0, 0, 0, 0);
23 m_baudRate =
new QSpinBox(
this);
24 m_baudRate->setRange(0, 115200);
25 m_baudRate->setValue(9600);
27 m_host =
new QLineEdit(
this);
28 m_host->setText(
"/dev/ttyUSB0");
30 m_framing =
new QComboBox{
this};
31 m_framing->addItems({
"Size prefixing",
"SLIP"});
32 m_framing->setCurrentIndex(1);
34 layout->addRow(tr(
"Host"), m_host);
35 layout->addRow(tr(
"Baud rate"), m_baudRate);
36 layout->addRow(tr(
"Framing"), m_framing);
39 framing_type framing()
const noexcept
41 return (framing_type)m_framing->currentIndex();
44 ossia::net::serial_configuration settings()
const noexcept
46 ossia::net::serial_configuration conf;
47 conf.port = m_host->text().toStdString();
48 conf.baud_rate = m_baudRate->value();
53 const ossia::net::osc_protocol_configuration& c,
54 const ossia::net::serial_configuration& conf)
56 m_framing->setCurrentIndex(c.framing);
57 m_host->setText(QString::fromStdString(conf.port));
58 m_baudRate->setValue(conf.baud_rate);
63 QSpinBox* m_baudRate{};
64 QComboBox* m_framing{};