Wave Inspector: Add support for exporting to RAW binary file

merge-requests/1/head
Mariusz Bialonczyk 2019-03-10 13:45:25 +01:00
rodzic 5b021d8582
commit a49cb31f31
4 zmienionych plików z 56 dodań i 0 usunięć

Wyświetl plik

@ -117,6 +117,7 @@ public:
void set_cue_cmd(const char *, char *);
void serial_decoder(struct device_settings *);
void save_wave_inspector_buffer_to_edf(struct device_settings *);
void save_wave_inspector_buffer_to_raw(struct device_settings *);
struct device_settings devparms;

Wyświetl plik

@ -792,9 +792,56 @@ OUT_ERROR:
// rec_len = wfp.xincrement[i] * wfp.points;
void UI_Mainwindow::save_wave_inspector_buffer_to_raw(struct device_settings *d_parms)
{
int i, chn, chns=0, mempnts;
char opath[MAX_PATHLEN];
mempnts = d_parms->acquirememdepth;
//checking if we have active channels
for (i=0; i<MAX_CHNS; i++) {
if (!d_parms->chandisplay[i])
continue;
chns++;
}
if (!chns) {
statusLabel->setText("No active channels.");
return;
}
//preparing file path
opath[0] = 0;
if (recent_savedir[0]!=0) {
strcpy(opath, recent_savedir);
strcat(opath, "/");
}
strcat(opath, "waveform");
//asking for filename
strcpy(opath, QFileDialog::getSaveFileName(this, "Save file", opath, "RAW files (*.raw *.RAW)").toLocal8Bit().data());
if (!strcmp(opath, ""))
return;
//saving data from each channel
for (chn=0; chn<MAX_CHNS; chn++) {
if (!d_parms->chandisplay[chn])
continue;
statusLabel->setText("Saving RAW file...");
QFile file(QString("%1_ch%2.raw").arg(opath, QString::number(chn)));
if (!file.open(QIODevice::WriteOnly))
return;
QDataStream out(&file);
for (i=0; i<mempnts; i++)
out << d_parms->wavebuf[chn][i];
}
//saving recent path for future use and exiting
get_directory_from_path(recent_savedir, opath, MAX_PATHLEN);
statusLabel->setText("Saved memory buffer to RAW file.");
}
void UI_Mainwindow::save_screen_waveform()
{

Wyświetl plik

@ -96,6 +96,7 @@ UI_wave_window::UI_wave_window(struct device_settings *p_devparms, short *wbuf[M
savemenu = new QMenu(this);
savemenu->setTitle("Save");
savemenu->addAction("Save to EDF file", this, SLOT(save_wi_buffer_to_edf()));
savemenu->addAction("Save to RAW binary file", this, SLOT(save_wi_buffer_to_raw()));
menubar->addMenu(savemenu);
helpmenu = new QMenu(this);
@ -174,6 +175,12 @@ void UI_wave_window::save_wi_buffer_to_edf()
}
void UI_wave_window::save_wi_buffer_to_raw()
{
mainwindow->save_wave_inspector_buffer_to_raw(devparms);
}
void UI_wave_window::wavslider_value_changed(int val)
{
devparms->wave_mem_view_sample_start = val;

Wyświetl plik

@ -102,6 +102,7 @@ void center_position();
void center_trigger();
void save_wi_buffer_to_edf();
void save_wi_buffer_to_raw();
};