Files
checker_host/interface/if_tcp.h
ranchuan 92f3ebbe33 添加tcp心跳
添加升级小板程序、方案、jwt文件的进度条命令
2023-12-29 09:41:37 +08:00

55 lines
996 B
C++

#ifndef IF_TCP_H
#define IF_TCP_H
#include <QObject>
#include <interface/interface.h>
#include "QTimer"
#include <QNetworkInterface>
#include <QTcpSocket>
#include <QObject>
#include <QThread>
#include <QTimer>
#include "QByteArray"
#include "base/mycfg.h"
class if_tcp : public InterFace
{
Q_OBJECT
public:
if_tcp();
virtual ~if_tcp();
void init();
int write(myarray data);
protected:
QString get_local_ip();
protected slots:
void reconnect_cb();
void connected_cb();
void disconnected_cb();
void state_changed_cb(QAbstractSocket::SocketState nSocketState);
void on_error_cb(QAbstractSocket::SocketError nErrCode);
void ready_read_cb();
signals:
void tcp_connected_signal();
void tcp_recv_signal();
void tcp_send_signal();
protected:
mycfg *cfg_;
QTimer *timer_reconnect_;
int reconnect_timeout_ms;
QTcpSocket *tcp_socket_;
bool connect_state;
QTimer *timer_recv_end_;
int recv_end_timeout_ms;
};
InterFace *if_tcp_get();
#endif // IF_TCP_H