46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
#include "gtl_hw_recorder_gtr.h"
|
|
|
|
#include <QDomDocument>
|
|
|
|
namespace gtl
|
|
{
|
|
namespace hw
|
|
{
|
|
recorder_gtr::recorder_gtr(const std::vector<gtl::analog_data*> &ad, qreal time, QString comment, QString dir, QString file, QObject *parent)
|
|
: recorder(ad, time, comment, dir, file, "gtr", parent)
|
|
{
|
|
if(!is_success())
|
|
return;
|
|
|
|
|
|
QDomDocument doc;
|
|
QDomElement root = doc.createElement("gtr_header");
|
|
root.setAttribute("device", _device->name());
|
|
root.setAttribute("rate", _device->rate());
|
|
root.setAttribute("time", time);
|
|
root.setAttribute("comment", comment);
|
|
doc.appendChild(root);
|
|
|
|
QDomElement recorder_element = doc.createElement("recorder");
|
|
root.appendChild(recorder_element);
|
|
|
|
for(auto it : _ad)
|
|
{
|
|
QDomElement channel_element = doc.createElement("input");
|
|
recorder_element.appendChild(channel_element);
|
|
|
|
channel_element.setAttribute("name", it->name());
|
|
channel_element.setAttribute("color", it->color());
|
|
channel_element.setAttribute("reference", it->reference());
|
|
}
|
|
|
|
QByteArray header;
|
|
QTextStream stream(&header);
|
|
doc.save(stream, 0, QDomNode::EncodingFromTextStream);
|
|
|
|
*_stream << header;
|
|
|
|
}
|
|
}
|
|
}
|