| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- #ifndef MAINWIDGET_H
- #define MAINWIDGET_H
- #include <QLabel>
- #include <QWidget>
- #include <QTimer>
- #include "USB485_Ctrl.h"
- #include "widget.h"
- #include <QJniObject>
- QT_BEGIN_NAMESPACE
- namespace Ui { class MainWidget; }
- QT_END_NAMESPACE
- //==========================PDU数据结构=======================
- struct PDUAllInfo
- {
- float AllVoltage_L1 =0;
- float AllCurrent_L1=0;
- float AllPower_L1=0;
- float AllConsumption_L1=0;
- float AllVoltage_L2=0;
- float AllCurrent_L2=0;
- float AllPower_L2=0;
- float AllConsumption_L2=0;
- float AllVoltage_L3=0;
- float AllCurrent_L3=0;
- float AllPower_L3=0;
- float AllConsumption_L3=0;
- float Sensor_Temperature=0;
- float Sensor_Humidity=0;
- bool Sensor_WaterImmersion=true;
- float Sensor_INTemperature=0;
- float Sensor_OUTTemperature=0;
- };
- struct PDUCHInfo
- {
- int CHNum=0;
- QString CHName=0;
- int CHPhase=0;
- float CHVoltage=0;
- float CHCurrent=0;
- float CHPower=0;
- float CHFactor=0;
- float CHConsumption=0;
- bool CHStatus=false;
- };
- class MainWidget : public QWidget
- {
- Q_OBJECT
- public:
- MainWidget(QWidget *parent = nullptr);
- ~MainWidget();
- void InitUI();
- void InitConnect();
- bool InitSerial();
- private slots:
- /*手动连接槽函数*/
- void manual_serialPortReadyRead();
- /*以下为mainwindow.ui文件中点击“转到槽”自动生成的函数*/
- void on_Button_openserial_clicked();
- void on_Button_tx_clicked();
- void on_Button_clearrecive_clicked();
- void on_Button_cleartx_clicked();
- void on_check_autosend_stateChanged(int arg1);
- void on_Button_checkserial_clicked();
- void slot_changeDebugMode();
- void UpdateStatusInfo();
- private:
- void setNumOnLabel(QLabel *lbl, QString strS, long num);
- private:
- Ui::MainWidget *ui;
- // 发送、接收字节计数
- long sendNum, recvNum;
- QLabel *lblSendNum;
- QLabel *lblRecvNum;
- QLabel *lblPortState;
- // 定时发送-定时器
- QTimer *timSend;
- QTimer *_timer_update_info = NULL;
- Usb485_Ctrl m_USBCtrl;
- int m_TotalCHNum;
- PDUAllInfo m_PDUAllInfo;
- PDUCHInfo m_PDUCHInfo[64];
- Widget m_chWidget[64];
- };
- #endif // MAINWIDGET_H
|