114 lines
2.6 KiB
C++
114 lines
2.6 KiB
C++
#ifndef CELLSMONITORPAGE_H
|
||
#define CELLSMONITORPAGE_H
|
||
|
||
#include <QWidget>
|
||
#include <QTableView>
|
||
#include <QVector>
|
||
|
||
#include "bmsinterface.h"
|
||
|
||
namespace Ui {
|
||
class CellsMonitorPage;
|
||
}
|
||
|
||
struct CellInfo
|
||
{
|
||
public:
|
||
CellInfo() : voltage(0), balancing(false)
|
||
{}
|
||
CellInfo(double v, bool b)
|
||
:voltage(v), balancing(b)
|
||
{}
|
||
|
||
double voltage;
|
||
bool balancing;
|
||
};
|
||
|
||
|
||
class CellsMonitorPage : public QFrame
|
||
{
|
||
Q_OBJECT
|
||
|
||
public:
|
||
explicit CellsMonitorPage(QWidget *parent = nullptr);
|
||
~CellsMonitorPage();
|
||
|
||
enum TablesNumber
|
||
{
|
||
TwoTables = 2,
|
||
ThreeTables = 3
|
||
};
|
||
enum TableIndex
|
||
{
|
||
FirstSubTable = 0,
|
||
SecondSubTable = 1,
|
||
ThirdSubTable = 2
|
||
};
|
||
enum ColumnsInSubTables
|
||
{
|
||
ColNumber = 0,
|
||
ColVoltage, //Столбец с делегатом
|
||
ColBalancing //Столбец с делегатом
|
||
};
|
||
|
||
int MODEL_ROWS_IN_ONE_TABLE = 13; //Количество строк модели одной из таблиц
|
||
static constexpr int MODEL_COLUMN_IN_ONE_TABLE = 3; //Количество столбцов модели одной из таблиц (№,Напр,Баланс)
|
||
static constexpr int MAX_ROWS_ALL_TABLES = 26; //Количество строк для всех трёх таблиц
|
||
|
||
BMSInterface *bms() const;
|
||
void setDieBieMS(BMSInterface *dieBieMS);
|
||
|
||
private slots:
|
||
void on_editCols_textChanged(const QString &arg1);
|
||
void on_editCells_textChanged(const QString &arg1);
|
||
void on_pbTestOne_clicked();
|
||
void on_pbTestTwo_clicked();
|
||
|
||
private:
|
||
Ui::CellsMonitorPage *ui;
|
||
void hideTestUi();
|
||
|
||
BMSInterface *mDieBieMS;
|
||
|
||
int m_tablesNumber;
|
||
int m_cellsNumber;
|
||
|
||
QVector<CellInfo> mCellVoltageArray;
|
||
|
||
void createUI();
|
||
|
||
void clearTables();
|
||
|
||
void initTableHeader();
|
||
// this one is for the real usage
|
||
void initTableView(QTableView* tableView, bool doInitForCellVoltagArray = true);
|
||
void initTableView(int tablesNum = TwoTables, bool doInitForCellVoltagArray = true);
|
||
// this one is just for test
|
||
//void initTableView(int cellsNum = 0, int tablesNum = TwoTables, bool doInitForCellVoltagArray = true);
|
||
|
||
//
|
||
public slots:
|
||
///void onLoadParams();
|
||
|
||
private slots:
|
||
//void timerSlot();
|
||
//void valuesReceived(BMS_VALUES values);
|
||
void cellsReceived(int cellCount, QVector<double> cellVoltageArray);
|
||
/*
|
||
QVector<double> mSeconds;
|
||
|
||
double mSecondCounter;
|
||
qint64 mLastUpdateTime;
|
||
bool mUpdateValPlot;
|
||
|
||
QTimer* mTimer;
|
||
*/
|
||
///void initForCharts();
|
||
|
||
void appendDoubleAndTrunc(QVector<double> *vec, double num, int maxSize);
|
||
///void clearControlls();
|
||
|
||
};
|
||
|
||
#endif // CELLSMONITORPAGE_H
|