Files

57 lines
1.2 KiB
C
Raw Permalink Normal View History

#ifndef DEVICESTATUSPANEL_H
#define DEVICESTATUSPANEL_H
#include <QWidget>
#include <QtSerialPort/QSerialPortInfo>
#include <QSerialPort>
namespace Ui {
class DeviceStatusPanel;
}
class DeviceStatusPanel : public QWidget
{
Q_OBJECT
public:
struct Settings
{
QString name;
qint32 baudRate;
QString stringBaudRate;
QSerialPort::DataBits dataBits;
QString stringDataBits;
QSerialPort::Parity parity;
QString stringParity;
QSerialPort::StopBits stopBits;
QString stringStopBits;
QSerialPort::FlowControl flowControl;
QString stringFlowControl;
bool localEchoEnabled;
};
public:
explicit DeviceStatusPanel(QWidget *parent = nullptr);
~DeviceStatusPanel();
protected:
void FillPortsParameters();
void FillPortsInfo();
void UpdateSettings();
void OpenSerialPort();
void CloseSerialPort();
private slots:
void OnClicked_OpenCloseSerialPort();
private:
Ui::DeviceStatusPanel *ui;
Settings m_varSerialPortSettings;
bool m_bIsOpen_SerialPort;
QSerialPort* m_pSerialPort;
};
#endif // DEVICESTATUSPANEL_H