kopia lustrzana https://gitlab.com/Teuniz/DSRemote
Work in progress.
rodzic
08d99c7f31
commit
2bf709b09f
|
@ -25,6 +25,7 @@ HEADERS += tmc_dev.h
|
||||||
HEADERS += tled.h
|
HEADERS += tled.h
|
||||||
HEADERS += edflib.h
|
HEADERS += edflib.h
|
||||||
HEADERS += signalcurve.h
|
HEADERS += signalcurve.h
|
||||||
|
HEADERS += select_device_dialog.h
|
||||||
|
|
||||||
SOURCES += main.cpp
|
SOURCES += main.cpp
|
||||||
SOURCES += mainwindow.cpp
|
SOURCES += mainwindow.cpp
|
||||||
|
@ -37,6 +38,7 @@ SOURCES += tmc_dev.c
|
||||||
SOURCES += tled.cpp
|
SOURCES += tled.cpp
|
||||||
SOURCES += edflib.c
|
SOURCES += edflib.c
|
||||||
SOURCES += signalcurve.cpp
|
SOURCES += signalcurve.cpp
|
||||||
|
SOURCES += select_device_dialog.cpp
|
||||||
|
|
||||||
RESOURCES = images.qrc
|
RESOURCES = images.qrc
|
||||||
|
|
||||||
|
|
3
global.h
3
global.h
|
@ -75,6 +75,9 @@ struct device_settings
|
||||||
{
|
{
|
||||||
int connected;
|
int connected;
|
||||||
char modelname[128];
|
char modelname[128];
|
||||||
|
char serialnr[128];
|
||||||
|
char softwvers[128];
|
||||||
|
|
||||||
double samplerate; // Samplefrequency
|
double samplerate; // Samplefrequency
|
||||||
int memdepth; // Number of waveform points that the oscilloscope can store in a single trigger sample
|
int memdepth; // Number of waveform points that the oscilloscope can store in a single trigger sample
|
||||||
int channel_cnt; // Device has 2 or 4 channels
|
int channel_cnt; // Device has 2 or 4 channels
|
||||||
|
|
|
@ -55,6 +55,10 @@ UI_Mainwindow::UI_Mainwindow()
|
||||||
|
|
||||||
setlocale(LC_NUMERIC, "C");
|
setlocale(LC_NUMERIC, "C");
|
||||||
|
|
||||||
|
QCoreApplication::setOrganizationName("TvB");
|
||||||
|
QCoreApplication::setOrganizationDomain("teuniz.net");
|
||||||
|
QCoreApplication::setApplicationName(PROGRAM_NAME);
|
||||||
|
|
||||||
memset(&devparms, 0, sizeof(struct device_settings));
|
memset(&devparms, 0, sizeof(struct device_settings));
|
||||||
|
|
||||||
devparms.screenshot_buf = (char *)malloc(1024 * 1024 * 2);
|
devparms.screenshot_buf = (char *)malloc(1024 * 1024 * 2);
|
||||||
|
@ -70,8 +74,7 @@ UI_Mainwindow::UI_Mainwindow()
|
||||||
devicemenu->setTitle("Device");
|
devicemenu->setTitle("Device");
|
||||||
devicemenu->addAction("Connect", this, SLOT(open_connection()));
|
devicemenu->addAction("Connect", this, SLOT(open_connection()));
|
||||||
devicemenu->addAction("Disconnect", this, SLOT(close_connection()));
|
devicemenu->addAction("Disconnect", this, SLOT(close_connection()));
|
||||||
// devicemenu->addAction("Save waveform", this, SLOT(save_waveform()));
|
devicemenu->addAction("Select", this, SLOT(select_device()));
|
||||||
// devicemenu->addAction("Save screenshot", this, SLOT(save_screenshot()));
|
|
||||||
devicemenu->addAction("Exit", this, SLOT(close()), QKeySequence::Quit);
|
devicemenu->addAction("Exit", this, SLOT(close()), QKeySequence::Quit);
|
||||||
menubar->addMenu(devicemenu);
|
menubar->addMenu(devicemenu);
|
||||||
|
|
||||||
|
@ -396,20 +399,37 @@ UI_Mainwindow::~UI_Mainwindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UI_Mainwindow::select_device()
|
||||||
|
{
|
||||||
|
UI_select_device_window sel_device;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void UI_Mainwindow::open_connection()
|
void UI_Mainwindow::open_connection()
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
char str[1024],
|
char str[1024],
|
||||||
dev_str[128] = {"/dev/usbtmc0"},
|
dev_str[128] = {""},
|
||||||
resp_str[1024],
|
resp_str[1024],
|
||||||
*ptr;
|
*ptr;
|
||||||
|
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
if(device != NULL)
|
if(device != NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strcpy(dev_str, settings.value("connection/device").toString().toLocal8Bit().data());
|
||||||
|
|
||||||
|
if(!strcmp(dev_str, ""))
|
||||||
|
{
|
||||||
|
strcpy(dev_str, "/dev/usbtmc0");
|
||||||
|
|
||||||
|
settings.setValue("connection/device", dev_str);
|
||||||
|
}
|
||||||
|
|
||||||
device = tmcdev_open(dev_str);
|
device = tmcdev_open(dev_str);
|
||||||
if(device == NULL)
|
if(device == NULL)
|
||||||
{
|
{
|
||||||
|
@ -473,6 +493,26 @@ void UI_Mainwindow::open_connection()
|
||||||
goto OUT_ERROR;
|
goto OUT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ptr = strtok(NULL, ",");
|
||||||
|
if(ptr == NULL)
|
||||||
|
{
|
||||||
|
snprintf(str, 1024, "Received an unknown identification string from device:\n\n%s\n ", device->buf);
|
||||||
|
str[1023] = 0;
|
||||||
|
goto OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy(devparms.serialnr, ptr);
|
||||||
|
|
||||||
|
ptr = strtok(NULL, ",");
|
||||||
|
if(ptr == NULL)
|
||||||
|
{
|
||||||
|
snprintf(str, 1024, "Received an unknown identification string from device:\n\n%s\n ", device->buf);
|
||||||
|
str[1023] = 0;
|
||||||
|
goto OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy(devparms.softwvers, ptr);
|
||||||
|
|
||||||
if(strncmp(devparms.modelname, "DS6", 3))
|
if(strncmp(devparms.modelname, "DS6", 3))
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
|
@ -553,6 +593,10 @@ void UI_Mainwindow::open_connection()
|
||||||
connect(trigAdjustDial, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(trigAdjustDialClicked(QPoint)));
|
connect(trigAdjustDial, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(trigAdjustDialClicked(QPoint)));
|
||||||
connect(adjDial, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(adjustDialClicked(QPoint)));
|
connect(adjDial, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(adjustDialClicked(QPoint)));
|
||||||
|
|
||||||
|
sprintf(str, PROGRAM_NAME " " PROGRAM_VERSION " %s %s", devparms.serialnr, devparms.softwvers);
|
||||||
|
|
||||||
|
setWindowTitle(str);
|
||||||
|
|
||||||
statusLabel->setText("Connected");
|
statusLabel->setText("Connected");
|
||||||
|
|
||||||
devparms.connected = 1;
|
devparms.connected = 1;
|
||||||
|
@ -594,6 +638,8 @@ void UI_Mainwindow::close_connection()
|
||||||
|
|
||||||
adjdial_timer->stop();
|
adjdial_timer->stop();
|
||||||
|
|
||||||
|
setWindowTitle(PROGRAM_NAME " " PROGRAM_VERSION);
|
||||||
|
|
||||||
disconnect(adjDial, SIGNAL(valueChanged(int)), this, SLOT(adjDialChanged(int)));
|
disconnect(adjDial, SIGNAL(valueChanged(int)), this, SLOT(adjDialChanged(int)));
|
||||||
disconnect(trigAdjustDial, SIGNAL(valueChanged(int)), this, SLOT(trigAdjustDialChanged(int)));
|
disconnect(trigAdjustDial, SIGNAL(valueChanged(int)), this, SLOT(trigAdjustDialChanged(int)));
|
||||||
disconnect(horScaleDial, SIGNAL(valueChanged(int)), this, SLOT(horScaleDialChanged(int)));
|
disconnect(horScaleDial, SIGNAL(valueChanged(int)), this, SLOT(horScaleDialChanged(int)));
|
||||||
|
@ -1896,4 +1942,3 @@ void UI_Mainwindow::get_device_model(const char *str)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QDial>
|
#include <QDial>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -75,6 +76,7 @@
|
||||||
#include "tled.h"
|
#include "tled.h"
|
||||||
#include "edflib.h"
|
#include "edflib.h"
|
||||||
#include "signalcurve.h"
|
#include "signalcurve.h"
|
||||||
|
#include "select_device_dialog.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -202,6 +204,7 @@ private slots:
|
||||||
void show_about_dialog();
|
void show_about_dialog();
|
||||||
void open_connection();
|
void open_connection();
|
||||||
void close_connection();
|
void close_connection();
|
||||||
|
void select_device();
|
||||||
int get_device_settings();
|
int get_device_settings();
|
||||||
void save_waveform();
|
void save_waveform();
|
||||||
void save_screenshot();
|
void save_screenshot();
|
||||||
|
|
Ładowanie…
Reference in New Issue