48 lines
994 B
C++
48 lines
994 B
C++
#pragma once
|
|
|
|
#include <qtimer.h>
|
|
|
|
#include <QMainWindow>
|
|
#include <QSerialPort>
|
|
#include <QCoreApplication>
|
|
#include <QSerialPortInfo>
|
|
#include <QDebug>
|
|
QT_BEGIN_NAMESPACE
|
|
namespace Ui {
|
|
class com_erpc_core;
|
|
}
|
|
QT_END_NAMESPACE
|
|
|
|
class com_erpc_core : public QMainWindow {
|
|
Q_OBJECT
|
|
QSerialPort *serial;
|
|
|
|
public:
|
|
com_erpc_core(QWidget *parent = nullptr);
|
|
~com_erpc_core();
|
|
void load_default_settings();
|
|
void open_com_port();
|
|
void close_com_port();
|
|
void com_port_disconnect(QSerialPort::SerialPortError error);
|
|
void lock_config_ui();
|
|
void unlock_config_ui();
|
|
void sipm_cmd_send(int cmd , char *data, int len);
|
|
void sipm_read_gain();
|
|
void sipm_read_SN();
|
|
void sipm_read_temp();
|
|
void sipm_set_gain();
|
|
public slots:
|
|
void data_append();
|
|
void scan_com_port();
|
|
void start_scan_com_port();
|
|
|
|
private:
|
|
Ui::com_erpc_core *ui;
|
|
QTimer *scan_com;
|
|
QTimer *stop_com;
|
|
};
|
|
#define CHECK_SERRIAL_IS_OPEN() if (serial == nullptr || !serial->isOpen()) { \
|
|
return; \
|
|
}
|
|
|