1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
// Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
#include <QSerialPort>
#include <QTimer>
QT_BEGIN_NAMESPACE
class QLabel;
class QLineEdit;
class QSpinBox;
class QPushButton;
class QComboBox;
QT_END_NAMESPACE
class Dialog : public QDialog
{
Q_OBJECT
public:
explicit Dialog(QWidget *parent = nullptr);
private slots:
void sendRequest();
void readResponse();
void processTimeout();
private:
void setControlsEnabled(bool enable);
void processError(const QString &error);
private:
int m_transactionCount = 0;
QLabel *m_serialPortLabel = nullptr;
QComboBox *m_serialPortComboBox = nullptr;
QLabel *m_waitResponseLabel = nullptr;
QSpinBox *m_waitResponseSpinBox = nullptr;
QLabel *m_requestLabel = nullptr;
QLineEdit *m_requestLineEdit = nullptr;
QLabel *m_trafficLabel = nullptr;
QLabel *m_statusLabel = nullptr;
QPushButton *m_runButton = nullptr;
QSerialPort m_serial;
QByteArray m_response;
QTimer m_timer;
};
#endif // DIALOG_H
|