-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 重构了大量代码,将SerialPort和Terminal分离成单独的类。 * 实现UDP协议,修复TCP/UDP模式的一些bug。
- Loading branch information
gztss
committed
Nov 16, 2017
1 parent
38f1e90
commit 6d7f124
Showing
24 changed files
with
1,640 additions
and
7,898 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#ifndef SERIALPORT_H | ||
#define SERIALPORT_H | ||
|
||
#include <QWidget> | ||
|
||
class QSerialPort; | ||
class QSettings; | ||
|
||
namespace Ui { | ||
class SerialPort; | ||
} | ||
|
||
class SerialPort : public QWidget | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit SerialPort(QWidget *parent = 0); | ||
~SerialPort(); | ||
void retranslate(); | ||
void loadConfig(QSettings *config); | ||
void saveConfig(QSettings *config); | ||
void setVisibleWidget(bool status); | ||
bool open(); | ||
void close(); | ||
QByteArray readAll(); | ||
void write(const QByteArray &data); | ||
bool portStatus(QString &string); | ||
bool isOpen(); | ||
void portSetDialog(); | ||
|
||
signals: | ||
void readyRead(); | ||
void portError(); | ||
void portChanged(); | ||
|
||
private: | ||
void scanPort(); | ||
|
||
private slots: | ||
void onTimerUpdate(); | ||
void setBaudRate(const QString &string); | ||
|
||
private: | ||
Ui::SerialPort *ui; | ||
QSerialPort *serialPort; | ||
QTimer *timer; | ||
}; | ||
|
||
#endif // SERIALPORT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#ifndef TERMINALVIEW_H | ||
#define TERMINALVIEW_H | ||
|
||
#include <QWidget> | ||
|
||
namespace Ui { | ||
class TerminalView; | ||
} | ||
|
||
class QTimer; | ||
class QSettings; | ||
class QByteArray; | ||
|
||
class TerminalView : public QWidget | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit TerminalView(QWidget *parent = 0); | ||
~TerminalView(); | ||
|
||
void retranslate(); | ||
void loadConfig(QSettings *config); | ||
void saveConfig(QSettings *config); | ||
void append(const QByteArray &array); | ||
void clear(); | ||
void setFontFamily(QString fonts, int size, QString style); | ||
void setEnabled(bool status); | ||
void setPaused(bool status); | ||
|
||
signals: | ||
void sendDataRequest(const QByteArray &array); | ||
|
||
private: | ||
void setSendButtonEnabled(bool status); | ||
void arrayToHex(QString &str, const QByteArray &arr, int countOfLine); | ||
void arrayToAscii(QString &str, const QByteArray &arr); | ||
void loadHistory(QSettings *config); | ||
void saveHistory(QSettings *config); | ||
|
||
private slots: | ||
void sendData(); | ||
void onWrapBoxChanged(int status); | ||
void onSendButtonClicked(); | ||
void updateResendTimerStatus(); | ||
void setResendInterval(int msc); | ||
void onHistoryBoxChanged(const QString &string); | ||
|
||
private: | ||
Ui::TerminalView *ui; | ||
bool sendEnabled = false, paused = false; | ||
QTimer *resendTimer; | ||
QByteArray *asciiBuf; | ||
}; | ||
|
||
#endif // TERMINALVIEW_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
#ifndef __VERSION_H | ||
#define __VERSION_H | ||
|
||
#define MAIN_VERSION 1.1.6 | ||
#define MAIN_VERSION 1.1.7b | ||
|
||
#define SOFTWARE_NAME "SerialTool" | ||
#define COPYRIGHT "Copyleft 2017 by Wenliang" | ||
|
||
#define _STR_(s) #s | ||
#define __STR(s) _STR_(s) | ||
|
||
#define BUILD_VERSION _STR_(31806) | ||
#define BUILD_VERSION _STR_(3396eM) | ||
#define SOFTWARE_VERSION __STR(MAIN_VERSION) | ||
|
||
#endif |
Oops, something went wrong.