#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <drivers/spi/drv_spi.h>
#include <QVector>
// #include "SpiApi.h"
#include "apps/icd/app_icd.h"

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

#define VERSION             "V1.1"
#define MOD_TIME            "25/07/17"
#define ICD_VERSION         "V2.0.1"


class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    /******************函数声明*****************/
    static void mw_logOutPut(QtMsgType type, const QMessageLogContext &context, const QString &msg);
    void        mw_findSpiDev(void);
    void        mw_sendTestData(void);
    void        mw_tableInit(void);

    void        mw_onCellChanged(int row, int column);
    void        mw_menuBarInit(void);

    // 定义对象
    DRV_Spi *m_DRV_Spi;     // spi驱动对象
    APP_Icd *m_APP_Icd;     // ICD应用层类
    QByteArray revData;
    // // SpiApi底层驱动类
    // SpiApi spiApi;
    // QVector<DevSimple> devices;
    ParsedData regParsedData;

signals:

private slots:
    void on_pushButton_refreshDev_clicked();

    void on_pushButton_closeDev_clicked();

    void on_pushButton_openDev_clicked();

    void on_pushButton_uartRefreshDev_clicked();

    void on_pushButton_uartOpenDev_clicked();

    void on_pushButton_uartCloseDev_clicked();

    void on_pushButton_uartSetPara_clicked();

    void on_comboBox_icdGroup_currentIndexChanged(int index);

    void on_pushButton_icdSendVolCMD_clicked();

    void on_pushButton_icdRegConfig_clicked();

    void mw_showVersionInfo();
    void mw_showUserManual();

    void on_pushButton_icdRegRead_clicked();

    void on_pushButton_icdReadCurrVol_clicked();

private:
    Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
