qt/LedOK/communication/network.h
2022-08-25 18:37:24 +08:00

42 lines
1.0 KiB
C++

#ifndef NETWORK_H
#define NETWORK_H
#include <QObject>
#include <QUdpSocket>
#include <QNetworkInterface>
#include <QList>
#include <wDevicesManager/ledcard.h>
#include <communication/hpptclient.h>
#include <globaldefine.h>
#include <QTimer>
#include <windows.h>
class NetComm : public QObject {
Q_OBJECT
public:
NetComm(QObject *p = nullptr);
STREAM_PACKET LedOkMakeStreamPacket(int iComType,int iLen,unsigned char *ucBuf,QString str);
static DWORD WINAPI send(void *);
void JieXiQJsonObjectOfLedCardInfo(const QJsonObject &subObj,const QString &strIp);
void JieXiQJsonObjectOfLedCardInfoOld(const QString &strId,const QString &strIp);
QList<LedCard *> LedCardList;
QTimer mUdpTimer;
QUdpSocket mUdpSocket;
signals:
void addLedCard(LedCard *);
void ClearHeartbeatFlagByUdp(LedCard *);
public slots:
void RestoreLedCardIpByUdpCmd();
private:
QString m_strCardId;
qint32 m_iWidth;
LedCard *m_pLedCard;
int m_port = 31296;
};
extern NetComm *gUdp;
#endif // NETWORK_H