13 #include <QFileDialog>
14 #include <QMessageBox>
22 return static_cast<double>(*
reinterpret_cast<const T*
>(
data));
28 _ui =
new Ui::DialogZcm;
43 return "Zcm Streamer";
58 auto const subscribe_text = settings.value(
"DataStreamZcm::subscribe",
".*").toString();
59 _ui->lineEditSubscribe->setText(subscribe_text);
62 auto transport = QString(getenv(
"ZCM_DEFAULT_URL"));
63 transport = settings.value(
"DataStreamZcm::transport", transport).toString();
64 _ui->lineEditTransport->setText(transport);
68 _dialog->restoreGeometry(settings.value(
"DataStreamZcm::geometry").toByteArray());
71 settings.setValue(
"DataStreamZcm::geometry",
_dialog->saveGeometry());
72 if (res == QDialog::Rejected)
78 settings.setValue(
"DataStreamZcm::subscribe",
_ui->lineEditSubscribe->text());
79 settings.setValue(
"DataStreamZcm::transport",
_ui->lineEditTransport->text());
89 catch (std::exception& ex)
91 QMessageBox::warning(
nullptr,
"Error",
92 tr(
"Exception from zcm::ZCM() :\n%1").
arg(ex.what()));
97 QMessageBox::warning(
nullptr,
"Error",
"Failed to create zcm::ZCM()");
112 QMessageBox::warning(
nullptr,
"Error",
"Failed to create zcm::TypeDb()");
129 QMessageBox::warning(
nullptr,
"Error",
"Failed to subscribe");
163 QDomElement elem = doc.createElement(
"config");
167 parent_element.appendChild(elem);
173 QDomElement elem = parent_element.firstChildElement(
"config");
183 settings.setValue(
"DataStreamZcm::transport",
_transport);
189 const void*
data,
void* usr)
194 case ZCM_FIELD_INT8_T:
197 case ZCM_FIELD_INT16_T:
200 case ZCM_FIELD_INT32_T:
203 case ZCM_FIELD_INT64_T:
209 case ZCM_FIELD_FLOAT:
212 case ZCM_FIELD_DOUBLE:
215 case ZCM_FIELD_BOOLEAN:
218 case ZCM_FIELD_STRING:
221 case ZCM_FIELD_USER_TYPE:
222 assert(
false &&
"Should not be possble");
228 zcm::Introspection::processEncodedType(channel, rbuf->data, rbuf->data_size,
"/",
231 std::lock_guard<std::mutex> lock(
mutex());
236 if (itr ==
dataMap().numeric.end())
240 itr->second.pushBack({ double(rbuf->recv_utime) / 1e6, n.second });
245 if (itr ==
dataMap().strings.end())
249 itr->second.pushBack({ double(rbuf->recv_utime) / 1e6,
s.second });
261 QString url = getenv(
"ZCM_DEFAULT_URL");
264 QMessageBox::warning(
nullptr,
"Error",
265 "Environment variable ZCM_DEFAULT_URL not set");
269 _ui->lineEditTransport->setText(url);