54 lines
1008 B
C++
54 lines
1008 B
C++
|
|
#ifndef DLINKMONITOR_H
|
||
|
|
#define DLINKMONITOR_H
|
||
|
|
|
||
|
|
#include "ToolsUI/ToolsWidget.h"
|
||
|
|
#include "QSerialPort"
|
||
|
|
#include "QUdpSocket"
|
||
|
|
#include "SerialPortDialog/connectdialog.h"
|
||
|
|
#include "SerialPortDialog/disconnectdialog.h"
|
||
|
|
|
||
|
|
namespace Ui {
|
||
|
|
class DlinkMonitor;
|
||
|
|
}
|
||
|
|
|
||
|
|
class DlinkMonitor : public ToolsWidget
|
||
|
|
{
|
||
|
|
Q_OBJECT
|
||
|
|
|
||
|
|
struct Node{
|
||
|
|
QUdpSocket * sock;
|
||
|
|
QHostAddress addr;
|
||
|
|
quint16 port;
|
||
|
|
};
|
||
|
|
|
||
|
|
public:
|
||
|
|
explicit DlinkMonitor(QWidget *parent = nullptr);
|
||
|
|
~DlinkMonitor();
|
||
|
|
|
||
|
|
private slots:
|
||
|
|
bool setupPort(const QString port, qint32 baudrate, QSerialPort::Parity parity);
|
||
|
|
bool statesPort();
|
||
|
|
void stopPort();
|
||
|
|
void readPendingDatagramsSerialPort(void);
|
||
|
|
|
||
|
|
|
||
|
|
int parse(uint8_t c);
|
||
|
|
void showinfo(QByteArray data);
|
||
|
|
int SendMessageTo(quint8 ch, quint8 *msg, quint16 len);
|
||
|
|
|
||
|
|
void on_pushButton_clicked();
|
||
|
|
|
||
|
|
private:
|
||
|
|
Ui::DlinkMonitor *ui;
|
||
|
|
|
||
|
|
|
||
|
|
QSerialPort *serialPort = nullptr;
|
||
|
|
QList<Node> clientSockets;
|
||
|
|
|
||
|
|
|
||
|
|
QByteArray DlinkData;
|
||
|
|
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif // DLINKMONITOR_H
|