Files
HPPA/HPPA/CommunicationInterfaceBase.h
tangchao0503 4a62d9a007 add,计划采集8:
实现部分计划采集功能:电源通断控制
2026-06-09 11:08:02 +08:00

37 lines
862 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include <QObject>
#include <QString>
#include "motorParams.h"
namespace MotorParams {
struct TCPConnectionParams
{
QString serverIP;
int port;
};
class CommunicationInterfaceBase :public QObject
{
Q_OBJECT
public:
CommunicationInterfaceBase(QObject* parent = nullptr);
~CommunicationInterfaceBase();
virtual bool connect2Motor() = 0;
//virtual void disconnect() = 0;
//virtual bool isConnected() const = 0;
virtual int sendCommand(const QString command) = 0;
//virtual void sendCommandAsync(const QString& command) = 0;
virtual int recvData(QByteArray& dataRecv) = 0;
signals:
void dataReceived(const QByteArray& data);
void connected(); // 不管串口还是TCP都会发这个信号
void disconnected();
void errorOccurred(QString msg);
};
} // namespace MotorParams