You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
#ifndef _QPLCDEVICE_H_
|
|
#define _QPLCDEVICE_H_
|
|
|
|
#include <QObject>
|
|
#include "lpRawTcp\lptkRawTcpServer.h"
|
|
#include <QMutex>
|
|
#include "lpThread.h"
|
|
#include "Result2Ui.h"
|
|
/*与PLC设备通讯类*/
|
|
class QPLCDevice : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
QPLCDevice(QObject *parent = nullptr);
|
|
~QPLCDevice();
|
|
|
|
void onInitDevice();
|
|
void onStartServer(int port);
|
|
void onStopServer();
|
|
|
|
void onRecvFunc(QByteArray data);
|
|
void sendByteData(QByteArray byteData);
|
|
|
|
bool onRunTask();
|
|
void onParaster(QByteArray recvData);
|
|
void onSendValueRlt(const ValueResult& rlt);//发送定位结果
|
|
Q_SLOT void onSendHeartBit();//发送心跳
|
|
void onAckTrigerCam(int stationID);//发送触发应答
|
|
Q_SLOT void on_serv_status_changed(int id, ServerStatus status);
|
|
Q_SLOT void on_client_connect_status(QString strID, ServerStatus status);
|
|
bool getClinetInfo(QString &client);
|
|
signals:
|
|
void sgSendAlgResult(int camID);
|
|
void sgTrigerCam(int camID);
|
|
void sgSendDataCallBack(QByteArray);
|
|
void sgRecvDataCallBack(QByteArray);
|
|
void sgRecvHeartBit();
|
|
void sgSendHeartBit();
|
|
private:
|
|
lptkRawTcpServer *m_rawTcpServer{ nullptr };
|
|
QMutex mMtLock;
|
|
QByteArray m_recvData;
|
|
lpThread *m_pTask{ nullptr };
|
|
|
|
QStringList m_clientList;
|
|
};
|
|
|
|
#endif // ifndef _QPLCDEVICE_H_
|