79 lines
1.9 KiB
C++
79 lines
1.9 KiB
C++
//
|
|
// Created by Administrator on 2025/12/9.
|
|
//
|
|
|
|
#ifndef PROBE_TUBE_H
|
|
#define PROBE_TUBE_H
|
|
#include <QObject>
|
|
#include <QtSerialPort/QSerialPort>
|
|
#include <QtSerialPort/QSerialPortInfo>
|
|
|
|
|
|
class ProbeTube : public QObject {
|
|
Q_OBJECT
|
|
public:
|
|
ProbeTube(QObject* parent = nullptr);
|
|
~ProbeTube();
|
|
// 串口
|
|
QSerialPort serial;
|
|
// 读取缓冲区
|
|
QByteArray m_readBuffer;
|
|
// 连接成功标志
|
|
bool isConnected = false;
|
|
|
|
public slots:
|
|
// 功能:归零
|
|
void doBakeZero();
|
|
// 功能:控制模式选择A
|
|
void doControlModeSelectionA();
|
|
// 功能:控制模式选择B
|
|
void doControlModeSelectionB();
|
|
// 功能:获取绝对位置
|
|
void doGetAbsolutePosition();
|
|
// 功能:目标速度
|
|
void doTargetSpeed(int speed);
|
|
// 功能:加速度
|
|
void doAcceleratedSpeed(int speed);
|
|
// 功能:减速度
|
|
void doDecelerationSpeed(int speed);
|
|
// 功能:移动目标位置A
|
|
void doMoveTargetPositionA();
|
|
// 功能:移动目标位置B
|
|
void doMoveTargetPositionB();
|
|
// 功能:设置目标位置
|
|
void doSetTargetPosition(int position);
|
|
|
|
signals:
|
|
// 功能:归零
|
|
void finishBakeZero();
|
|
// 功能:控制模式选择A
|
|
void finishControlModeSelectionA();
|
|
// 功能:控制模式选择B
|
|
void finishControlModeSelectionB();
|
|
// 功能:获取绝对位置
|
|
void finishGetAbsolutePosition();
|
|
// 功能:目标速度
|
|
void finishTargetSpeed();
|
|
// 功能:加速度
|
|
void finishAcceleratedSpeed();
|
|
// 功能:减速度
|
|
void finishDecelerationSpeed();
|
|
// 功能:移动目标位置A
|
|
void finishMoveTargetPositionA();
|
|
// 功能:移动目标位置B
|
|
void finishMoveTargetPositionB();
|
|
// 功能:设置目标位置
|
|
void finishSetTargetPosition();
|
|
|
|
private slots:
|
|
// 串口读取数据
|
|
void SerialRead();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //PROBE_TUBE_H
|