com_client/com_erpc_core.hpp

48 lines
1.0 KiB
C++
Raw Normal View History

2024-12-25 03:03:01 +00:00
#pragma once
2024-11-20 02:16:11 +00:00
#include <qtimer.h>
#include <QMainWindow>
#include <QSerialPort>
2024-12-25 03:03:01 +00:00
#include <QCoreApplication>
#include <QSerialPortInfo>
#include <QDebug>
2024-11-20 02:16:11 +00:00
QT_BEGIN_NAMESPACE
namespace Ui {
2024-12-25 03:03:01 +00:00
class com_erpc_core;
2024-11-20 02:16:11 +00:00
}
QT_END_NAMESPACE
2024-12-25 03:03:01 +00:00
class com_erpc_core : public QMainWindow {
2024-11-20 02:16:11 +00:00
Q_OBJECT
QSerialPort *serial;
public:
2024-12-25 03:03:01 +00:00
com_erpc_core(QWidget *parent = nullptr);
~com_erpc_core();
2024-11-20 02:16:11 +00:00
void load_default_settings();
void open_com_port();
void close_com_port();
2024-12-25 03:03:01 +00:00
void com_port_disconnect(QSerialPort::SerialPortError error);
2024-11-20 02:16:11 +00:00
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:
2024-12-25 03:03:01 +00:00
Ui::com_erpc_core *ui;
2024-11-20 02:16:11 +00:00
QTimer *scan_com;
2024-12-25 03:03:01 +00:00
QTimer *stop_com;
2024-11-20 02:16:11 +00:00
};
#define CHECK_SERRIAL_IS_OPEN() if (serial == nullptr || !serial->isOpen()) { \
return; \
}
2024-12-25 03:03:01 +00:00