代码拉取完成,页面将自动刷新
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QList>
#include <QEvent>
#include <QTimer>
#include <QVector>
#include <QThread>
#include <QMainWindow>
#include <QModelIndex>
#include "Help/help.h"
#include "mydatatype.h"
#include "mydashboard.h"
#include "myPlot/mycurveplot.h"
#include "mySerialPort/myserialport.h"
#include "mySerialPort/myserialcombox.h"
#include "myTableWidget/mycomboxdelegate.h"
#include "gnss_parse.h" // GNSS报文解析
#define HEAD_NMEA_GGA0 "$GPGGA"
#define HEAD_NMEA_GGA1 "$GNGGA"
#define HEAD_NMEA_VTG0 "$GPVTG"
#define HEAD_NMEA_VTG1 "$GNVTG"
#define HEAD_NOVT_POS "#BESTP"
#define HEAD_NOVT_VEL "#BESTV"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
//表格
// QModelIndex currentItemIndex;
myComboboxDelegate comBoxDelegate;
enum CellType {ctName=1000, ctType, ctData, ctScal, ctIsCurve,ctIsCurve1,ctIsCurve2 };
enum FieldColNum {colName=0, colType, colData, colScal, colIsCurve,colIsCurve1,colIsCurve2 };
void isEnabledAllFrameBtn(bool checked);
void creatItemsARow(int curRow, QString name = "dataName", QString type = "char", QString data = "0", QString scal="/", QString Curve = " ");
void isEnableCurvePlotCheckBox(QVector<quint8>& plotXxx, FieldColNum colIsCurvex, bool checked);
void detectAllCurvePlotCheckBox();
//定时器
QTimer* runTimer = nullptr;
quint16 timingPeriod10ms;
qlonglong timing10msCounter;
quint8 parseOrSaveDataTask();
quint8 parseOrSaveDataTask_GNSS();
void refreshTableTask(quint8 xPacket);
//串口
bool isOpenSerialPort;
QThread* serialPortSubThread = nullptr;
mySerialPort* serialPortModule = nullptr;
void isEnabledSerialPortPanelBtn(bool checked);
void setSerialLedState(bool led_active);
QVector<quint8> recvThreadDataBuffer; //串口线程数据资源同步
// GNSS串口
bool isOpenSerialPort_GNSS;
QThread* serialPortSubThread_GNSS = nullptr;
mySerialPort* serialPortModule_GNSS = nullptr;
void isEnabledSerialPortPanelBtn_GNSS(bool checked);
QList<QString> recvThreadDataBuffer_GNSS; //串口线程数据资源同步
void setGNSSLedState(bool led_active);
void toggleGNSSLedState();
GNSSMeasType gnssMeasType = velpos;
// GNSS轨迹
QVector<double> pos_ew, pos_ns;
double posxy0[2] = {0.0}, posxy_1[2] = {0.0}, dx=0, dy=0;
double RMh = 6378136.46, clRNh;
bool isGNSSWorking = false;
void init_mapplot();
void mapplot_update_scal(double lat, double lng);
//协议帧
quint16 frameLen; //用来解析整帧数据
quint8 frameHeaderLen; //帧头长度
quint16 frameDataTypeLen; //每帧中数据(类型)的个数(不包括帧头帧尾)
qint16 checkSumPosOnframeDataType; //没定义校验和 = -1; 有校验和 >= 0
qint16 TimeStampPosOnframeDataType; //没定义数据戳 = -1; 有数据戳 >= 0
QVector<quint8> frameHeaderNum; //用来判断帧头长度 和 解析数据
QVector<quint8> frameDataType; //用来判断数据长度 和 解析数据
QVector<quint8> frameTailNum; //一般的仅使用校验和做为帧尾,该链表用处不大
QVector<float> dataTypeDivisorFactor; //刻度因子
QVector<QString> frameDataName; //用于存储和绘图显示
//解析数据
myDataType CV;
//绘图
bool isOpenCurvePlot;
bool isStartCurvePlot;
myCurvePlot* curvePlot = nullptr;
enum X_AxisType {frameCount=0, TimeStamp};
X_AxisType XAxis;
quint8 curveRefreshCycle;
quint32 clearCurveTiming_3min;
QVector<quint8> xIsPlot1,xIsPlot2,xIsPlot3;
QVector<QString> xIsPlot1Name,xIsPlot2Name,xIsPlot3Name;
QVector<double> xPlotKeys; //横坐标数值
QVector<double> xPlot1Value[3],xPlot2Value[3],xPlot3Value[3]; //纵坐标数值
QVector<quint8> isPlotXyz,isPlotxYz,isPlotxyZ;
qlonglong xIsPlotPacketCount; //绘图帧计数
qlonglong recv_frameCounter; //接收帧计数
//仪表盘
bool isOpenDashBoard;
qint16 pitchPosOnframeDataType;
qint16 rollPosOnframeDataType;
qint16 yawPosOnframeDataType;
//myDashBoard* attDashBoard = nullptr;
//void detectEulerAnglesToDashBoard();
//文件保存
QFile txtFile; //解析后的文本
QFile txtFileHex; //未解析的文本
bool isSaveTxtFile;
QVector<QString> outStr;
QVector<quint8> saveXDataTypeToTxt;
//帮助
bool isOpenHelpUi;
help* helpInfo = nullptr;
//串口按键
bool isIMUSerOpen = false;
bool isGNSSSerOpen = false;
bool isGNSSActive = false;
// GNSS解析结果
bool isGNSSUpdata = false; // GNSS完成解析标志
double gnss_vp[8] = {0.0}; // GNSS数据:速度+位置+时间+DOP
QString str_gnss_save;
GPGGAData ggadata;
GPVTGData vtgdata;
NovAPData napdata;
NovAVData navdata;
void GNSSDataDisplayUpdate(double* gnssdata);
signals:
//串口
void signal_openSerialPortx(QString portName, qint32 baudRate, qint8 dataBits, qint8 parity, qint8 stopBits);
void signal_closeSerialPortx();
void signal_openSerialPortx_g(QString portName, qint32 baudRate, qint8 dataBits, qint8 parity, qint8 stopBits);
void signal_closeSerialPortx_g();
//协议帧
void signal_sendFrameInfoToSerialSubThread(quint16 _frameLen, QVector<quint8> _frameHeaderNum);
void signal_updateMeasType(GNSSMeasType measType);
private slots:
//表格
void slot_clickedItemAction();
//协议帧
void on_insertRow_btn_clicked();
void on_addRow_btn_clicked();
void on_insertFrameHeader_btn_clicked();
void on_insertFrameTail_btn_clicked();
void on_insertTimeStamp_btn_clicked();
void on_insertCheckSum_btn_clicked();
void on_deleteRow_btn_clicked();
void on_clearDataFrame_btn_clicked();
void on_saveDataFrame_btn_clicked();
void on_loadDataFrame_btn_clicked();
void on_confirmDataFrame_btn_clicked(bool checked);
//串口
//void slot_switchSerialPort(bool checked);
void slot_switchSerialPort();
void slot_showSerialPortxOpenStatus(bool checked);
void slot_showSerialPortxCloseStauts(bool checked);
void on_changeGNSSActiveState();
void on_changeGNSSMeasType(int index);
void slot_showSerialPortxOpenStatus_GNSS(bool checked);
void slot_showSerialPortxCloseStauts_GNSS(bool checked);
//保存数据
void on_saveData_btn_clicked();
//曲线显示
void on_curveShow_btn_toggled(bool checked);
//仪表盘显示
//void on_dashboardShow_btn_toggled(bool checked);
//任务调度
void slot_taskScheduler();
//大小端设置
void on_comboBox_setEndianMode_currentIndexChanged(int index);
//设置图形界面X轴的物理意义(0:帧计数 1:下位机发的时间戳)
void on_comboBox_setXAxis_currentIndexChanged(int index);
//帮助界面
void on_showHelp_btn_clicked();
protected:
//重写关闭时间
void closeEvent(QCloseEvent *event);
};
#endif // MAINWINDOW_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。