#ifndef GLOBALPARAMETERS_H #define GLOBALPARAMETERS_H #pragma execution_character_set("utf-8") #include #include "singleton.h" class QAbstractTableModel; class QTableView; class MyTableModel; //采集设备参数所处的状态 typedef enum _tagSignalStatus { STATUS_NORMAL = 0, STATUS_WARN = 1, STATUS_ERROR = 2, STATUS_INFO = 3, } SignalStatus; typedef struct _ModelItem { SignalStatus status; std::string ParameterName; std::string value; std::string unit; std::string sampleTime; } ModelItem; typedef QList TableData; //用来处理串口各种参数的ComboBox的Model //设置奇偶检验 #define EMS_PARITY_NONE 0 #define EMS_PARITY_ODD 1 #define EMS_PARITY_EVEN 2 typedef std::pair ParityItemData; typedef std::vector vecParityItemData; //设置数据位 #define EMS_DATA_8_BITS 8 #define EMS_DATA_7_BITS 7 typedef std::pair DataBitsItemData; typedef std::vector vecDataBitsItemData; //设置停止位 #define EMS_1_STOP_BITS 1 #define EMS_2_STOP_BITS 2 typedef std::pair StopBitsItemData; typedef std::vector vecStopBitsItemData; //设置串口模式 #define EMS_RTU_MODE 1 #define EMS_ASCII_MODE 2 typedef std::pair PortModeItemData; typedef std::vector vecPortModeItemData; //设置串口类型 #define EMS_SERIALPORT_TYPE 1 #define EMS_CANPORT_TYPE 2 typedef std::pair PortTypeItemData; typedef std::vector vecPortTypeItemData; //设置串口类型 #define EMS_BAUND_2400 2400 #define EMS_BAUND_4800 4800 #define EMS_BAUND_9600 9600 #define EMS_BAUND_19200 19200 #define EMS_BAUND_38400 38400 #define EMS_BAUND_57600 57600 #define EMS_BAUND_115200 115200 #define EMS_BAUND_128000 128000 #define EMS_BAUND_153600 153600 #define EMS_BAUND_230400 230400 #define EMS_BAUND_460800 460800 #define EMS_BAUND_921600 921600 typedef std::pair BaundItemData; typedef std::vector vecBaundItemData; class CWaitorCursor { public: CWaitorCursor(); ~CWaitorCursor(); }; //全局变量 class AppData:public Singleton { public: AppData(token); ~AppData(); AppData(const AppData &other) = delete; AppData& operator=(const AppData &other) = delete; public: //数据表格的表头 QStringList lstDataTableHeaderText; //定时刷新间隔 int nTimeOut; //目标机器IP QString qsDestinationIp; //最后的错误信息 QString qsLastErrorString; }; //全局通用类 class AppCommon:public Singleton { public: AppCommon(token); ~AppCommon(); AppCommon(const AppCommon&)=delete; AppCommon& operator =(const AppCommon&)= delete; public: void InitializeTableView(MyTableModel* model,QTableView* tableView); }; #endif // GLOBALPARAMETERS_H