#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QLabel>
#include <QMainWindow>
#include <QPushButton>
#include <QTimer>
#include "bridge.h"
#include <windows.h>
#include "voicecontrol/voiceform.h"
using namespace std;
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    long play(HWND hWnd,NET_DVR_PREVIEWINFO struPlayInfo,long userID);
private:
    void init();    //软件初始化
    void SoftStart();
    void ReadSystemInfo();
    void CheckAll();
    bool CheckComIsAlive(); //检查串口是否活着
    void SoftClose();
    void dataUpDate();
    void Pbn_clicked();
    void SetLineEdit(bool status);
    QStringList getAvailablePort(); //获取串口
    char * StrToChar(QString data);
    void ShowMessage(QString msg,int time); //显示提示,时间
protected:
    bool eventFilter(QObject *watched, QEvent *event);
    bool nativeEvent(const QByteArray &eventType, void *message, long *result);
    void closeEvent(QCloseEvent *event);
private:
    Ui::MainWindow *ui;
    VoiceForm *m_VoiceForm; //语音控制
    Bridge *m_Bridge;   //中间类
    QLabel *m_systemTime;   //系统运行时间
    QLabel *m_ScanCode; //二维码识别器
    QLabel *m_Rfid; //FRID读卡器
    QLabel *m_Trunk;    //道闸
    QLabel *m_SportsCamera; //抓拍相机
    QLabel *m_monitorCamera; //监控相机
    QLabel *m_ServerStatus; //服务器状态
    QLabel *m_carplnumPic;
    //QPushButton *m_ScanStatus;
    QTimer *m_SoftBreath;

    int m_SoftBreath_s = 0;
    int m_SoftBreath_m = 0;
    int m_SoftBreath_h = 0;
    int m_SoftBreath_d = 0;

    int changeVehTotal;    //变化车辆数
    int VehTotal;    //厂区容纳车辆
    long UserID;    //监控机UserID
    long previewID;    //监控机UserID
};
#endif // MAINWINDOW_H
