Files
gcs-nf/MavLinkNode/Terminal.h
T

71 lines
1.3 KiB
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.
#ifndef TERMINAL_H
#define TERMINAL_H
#include <QObject>
#include "QDebug"
#include "QThread"
#include "mavlink.h"
#include "QTimer"
#include "QTime"
#include <QtEndian>
#include "ThreadTemplet.h"
#ifdef QtMavlinkNode
#include <mavlinknodeglobal.h>
class MAVLINKNODESHARED_EXPORT terminal : public ThreadTemplet {
#else
class terminal : public ThreadTemplet
{
#endif
Q_OBJECT
public:
explicit terminal(QObject *parent = nullptr);
~terminal();
mavlink_serial_control_t m_serial_control;
public slots:
//读取和写入指令
void Transmit(QString msg);
//线程对外接口
void Parse(mavlink_message_t msg);
private slots:
//线程私有接口
void process();
//状态机
void ReadStateMachine(void);
void WriteStateMachine(void);
//所有相关函数
void serial_control(void);
signals:
void readError();
void commandAccepted(bool flag,uint16_t command,uint8_t result);
void Recieve(QString msg);
private:
bool running_flag = false;
quint32 running_frq = 200;//200Hz
QThread *thread = nullptr;
//超时时间(ms
int readTimeout = 5000;
int sendTimeout = 5000;
QString SerialData;
};
#endif // STATUSPROCESS_H