Now statuses have different colors. Various minor fixes
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#ifndef CANCONTROLLER_H
|
||||
#define CANCONTROLLER_H
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariant>
|
||||
#include <QDateTime>
|
||||
@@ -57,7 +59,24 @@ private:
|
||||
void initializeBatteries();
|
||||
|
||||
QList<quint16> registerAddresses() const;
|
||||
QVariant parameterToVariant(quint16 parameter) const;
|
||||
|
||||
template<typename T>
|
||||
static QVariant doubleParameterToVariant(T parameter)
|
||||
{
|
||||
return isParameterEmpty(parameter) ? QVariant() : QVariant::fromValue(parameter / 10.0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static QVariant intParameterToVariant(T parameter)
|
||||
{
|
||||
return isParameterEmpty(parameter) ? QVariant() : QVariant::fromValue(parameter);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static bool isParameterEmpty(T /*parameter*/)
|
||||
{
|
||||
return std::numeric_limits<T>::max();
|
||||
}
|
||||
|
||||
private:
|
||||
bool isConnected_ = false;
|
||||
|
||||
Reference in New Issue
Block a user