Backup.
This commit is contained in:
@@ -27,11 +27,11 @@ windows
|
|||||||
SOURCES += \
|
SOURCES += \
|
||||||
bc.cpp \
|
bc.cpp \
|
||||||
bcdataitem.cpp \
|
bcdataitem.cpp \
|
||||||
|
bcdatamanager.cpp \
|
||||||
bcdatamodel.cpp \
|
bcdatamodel.cpp \
|
||||||
bcitemdelegate.cpp \
|
bcitemdelegate.cpp \
|
||||||
bclegacy.cpp \
|
bclegacy.cpp \
|
||||||
bctransmitter.cpp \
|
bctransmitter.cpp \
|
||||||
bcvdatamanager.cpp \
|
|
||||||
lib/can_drv_win.c \
|
lib/can_drv_win.c \
|
||||||
bccandriver.cpp \
|
bccandriver.cpp \
|
||||||
bccandrivertinycan.cpp \
|
bccandrivertinycan.cpp \
|
||||||
@@ -43,11 +43,11 @@ HEADERS += \
|
|||||||
bccandriver.h \
|
bccandriver.h \
|
||||||
bccandrivertinycan.h \
|
bccandrivertinycan.h \
|
||||||
bcdataitem.h \
|
bcdataitem.h \
|
||||||
|
bcdatamanager.h \
|
||||||
bcdatamodel.h \
|
bcdatamodel.h \
|
||||||
bcitemdelegate.h \
|
bcitemdelegate.h \
|
||||||
bcmainwindow.h \
|
bcmainwindow.h \
|
||||||
bctransmitter.h \
|
bctransmitter.h
|
||||||
bcvdatamanager.h
|
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
bcmainwindow.ui
|
bcmainwindow.ui
|
||||||
|
|||||||
@@ -37,8 +37,18 @@ BCDataType::BCDataType()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BCDataType::BCDataType( TypeID ID_, QString unitLabel_, optDouble factor_, optDouble min_, optDouble max_ )
|
BCDataType::BCDataType( QString unitLabel_, double factor_, optDouble min_, optDouble max_ )
|
||||||
: ID{ID_}, unitLabel{unitLabel_}, factor{factor_}, min{min_}, max{max_}
|
: unitLabel{unitLabel_}, factor{factor_}, min{min_}, max{max_}
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
double BCDataType::readValue( const BCAbstractTransmitter& transmitter )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BCDataType::writeValue( const BCAbstractTransmitter& transmitter )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -46,19 +56,25 @@ BCDataType::BCDataType( TypeID ID_, QString unitLabel_, optDouble factor_, optDo
|
|||||||
///-------------------------------
|
///-------------------------------
|
||||||
|
|
||||||
|
|
||||||
BCDataItem::BCDataItem(const BCDataType& valueType_, BCDevice::ID deviceID_, BC::ID registerID_)
|
BCDataItem::BCDataItem(const BCDataType* valueType_, BCDevice::ID deviceID_, BC::ID registerID_)
|
||||||
: valueType{valueType_}, deviceID{deviceID_}, registerID{registerID_}
|
: valueType{valueType_}, deviceID{deviceID_}, registerID{registerID_}
|
||||||
{
|
{
|
||||||
value = "--";
|
value = "--";
|
||||||
}
|
}
|
||||||
|
|
||||||
void BCDataItem::readRawValue( const BCAbstractTransmitter& transmitter ) const
|
void BCDataItem::readRawValueX( const BCAbstractTransmitter& transmitter ) const
|
||||||
{
|
{
|
||||||
uint32_t rawValue = transmitter.readRawValue( deviceID, registerID );
|
qDebug() << " --- READ X!";
|
||||||
|
//uint32_t rawValue = transmitter.readRawValue( deviceID, registerID );
|
||||||
|
|
||||||
|
//const BCDataType& xxx = valueType.value().get();
|
||||||
|
|
||||||
|
//uint32_t result = std::visit( myVisi, BCTypeVariant{valueType} );
|
||||||
}
|
}
|
||||||
|
|
||||||
void BCDataItem::writeRawValue( const BCAbstractTransmitter& transmitter ) const
|
void BCDataItem::writeRawValueX( const BCAbstractTransmitter& transmitter ) const
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
101
bcdataitem.h
101
bcdataitem.h
@@ -66,6 +66,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class BCDataItem;
|
||||||
|
|
||||||
using optDouble = std::optional<double>;
|
using optDouble = std::optional<double>;
|
||||||
|
|
||||||
struct BCDataType
|
struct BCDataType
|
||||||
@@ -75,43 +77,63 @@ struct BCDataType
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum class TypeID : uint8_t
|
|
||||||
{
|
|
||||||
Invalid = 0x0,
|
|
||||||
Text,
|
|
||||||
Number,
|
|
||||||
Float,
|
|
||||||
Byte,
|
|
||||||
Word,
|
|
||||||
Quad,
|
|
||||||
Percent,
|
|
||||||
KWh,
|
|
||||||
Watt,
|
|
||||||
Km,
|
|
||||||
Kmh,
|
|
||||||
Mm,
|
|
||||||
Sec,
|
|
||||||
SoC,
|
|
||||||
Odo,
|
|
||||||
Assist,
|
|
||||||
AssistFac,
|
|
||||||
Date
|
|
||||||
};
|
|
||||||
Q_ENUM(TypeID)
|
|
||||||
|
|
||||||
BCDataType();
|
BCDataType();
|
||||||
BCDataType( TypeID ID_, QString unitLabel_="", optDouble factor_=std::nullopt, optDouble min_=std::nullopt, optDouble max_= std::nullopt );
|
BCDataType( QString unitLabel_, double factor_= 1.0, optDouble min_=std::nullopt, optDouble max_= std::nullopt );
|
||||||
|
|
||||||
TypeID ID{TypeID::Invalid};
|
|
||||||
QString unitLabel;
|
QString unitLabel;
|
||||||
optDouble factor;
|
double factor;
|
||||||
optDouble min;
|
optDouble min;
|
||||||
optDouble max;
|
optDouble max;
|
||||||
|
|
||||||
|
virtual double readValue( const BCAbstractTransmitter& transmitter ) = 0;
|
||||||
|
virtual void writeValue( const BCAbstractTransmitter& transmitter ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct BCDataTypeByte : public BCDataType
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
double readValue( const BCAbstractTransmitter& transmitter, const BCDA ) override
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void writeValue( const BCAbstractTransmitter& transmitter ) override;
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ODO : public BCDataType
|
||||||
|
{
|
||||||
|
double readValue( const BCAbstractTransmitter& transmitter ) override
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void writeValue( const BCAbstractTransmitter& transmitter ) override;
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Long : public BCDataType
|
||||||
|
{};
|
||||||
|
|
||||||
|
struct Fitz : public BCDataType
|
||||||
|
{};
|
||||||
|
|
||||||
|
struct Fatz : public BCDataType
|
||||||
|
{};
|
||||||
|
|
||||||
|
using BCTypeVariant = std::variant<BCDataType,ODO,Long,Fitz,Fatz>;
|
||||||
|
|
||||||
// really needed?
|
// really needed?
|
||||||
using BCDataTypeCRef = std::optional<std::reference_wrapper<const BCDataType>>;
|
//using BCDataTypeCRef = std::optional<std::reference_wrapper<const BCTypeVariant>>;
|
||||||
|
|
||||||
|
|
||||||
class BCDataItem
|
class BCDataItem
|
||||||
@@ -119,13 +141,15 @@ class BCDataItem
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
BCDataItem( const BCDataType& valueType_, BCDevice::ID deviceID_, BC::ID registerID_ );
|
BCDataItem( const BCDataType* valueType_, BCDevice::ID deviceID_, BC::ID registerID_ );
|
||||||
|
|
||||||
void readRawValue( const BCAbstractTransmitter& transmitter ) const;
|
void readRawValueX( const BCAbstractTransmitter& transmitter ) const;
|
||||||
void writeRawValue( const BCAbstractTransmitter& transmitter ) const;
|
void writeRawValueX( const BCAbstractTransmitter& transmitter ) const;
|
||||||
// void reset()
|
// void reset()
|
||||||
|
|
||||||
BCDataTypeCRef valueType;
|
//const BCDataType& valueType;
|
||||||
|
//BCDataTypeCRef valueType;
|
||||||
|
const BCDataType* valueType{};
|
||||||
BCDevice::ID deviceID{BCDevice::ID::Invalid};
|
BCDevice::ID deviceID{BCDevice::ID::Invalid};
|
||||||
BC::ID registerID{BC::ID::Invalid};
|
BC::ID registerID{BC::ID::Invalid};
|
||||||
int rowInModel{-1};
|
int rowInModel{-1};
|
||||||
@@ -144,13 +168,10 @@ public:
|
|||||||
Q_DECLARE_METATYPE(BCDataItem*)
|
Q_DECLARE_METATYPE(BCDataItem*)
|
||||||
|
|
||||||
|
|
||||||
struct BCDataParams
|
using BCDataList = QVector<BCDataItem>;
|
||||||
{
|
|
||||||
QString ID;
|
|
||||||
QString Label;
|
|
||||||
QString Default;
|
|
||||||
QString UnitType;
|
|
||||||
};
|
|
||||||
|
|
||||||
// abbreviations:
|
// abbreviations:
|
||||||
// SOC = State Of Charge
|
// SOC = State Of Charge
|
||||||
@@ -168,7 +189,7 @@ constexpr auto to_u(E e) noexcept {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using BCDataList = QVector<BCDataItem>;
|
|
||||||
|
|
||||||
|
|
||||||
#endif // BCDATAITEM_H
|
#endif // BCDATAITEM_H
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
|
|
||||||
#include <bcvdatamanager.h>
|
#include <bcdatamanager.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace Qt::StringLiterals;
|
using namespace Qt::StringLiterals;
|
||||||
@@ -96,29 +96,31 @@ void BCDataManager::createValueTypes()
|
|||||||
"Date"
|
"Date"
|
||||||
|
|
||||||
*/
|
*/
|
||||||
//_valueTypes.insert( { BCDataType::TypeID::Invalid, "Invalid" } );
|
//_dataTypes.insert( { BCDataType::TypeID::Invalid, "Invalid" } );
|
||||||
|
|
||||||
_valueTypes.insert( "Invalid", { BCDataType::TypeID::Invalid, "Invalid" } );
|
/*
|
||||||
_valueTypes.insert( "Text", { BCDataType::TypeID::Text } );
|
_dataTypes.insert( "Invalid", { BCDataType::TypeID::Invalid, "Invalid" } );
|
||||||
_valueTypes.insert( "Number", { BCDataType::TypeID::Number } );
|
_dataTypes.insert( "Text", { BCDataType::TypeID::Text } );
|
||||||
|
_dataTypes.insert( "Number", { BCDataType::TypeID::Number } );
|
||||||
|
|
||||||
_valueTypes.insert( "Byte", { BCDataType::TypeID::Byte } );
|
_dataTypes.insert( "Byte", { BCDataType::TypeID::Byte } );
|
||||||
_valueTypes.insert( "Word", { BCDataType::TypeID::Word } );
|
_dataTypes.insert( "Word", { BCDataType::TypeID::Word } );
|
||||||
_valueTypes.insert( "Quad", { BCDataType::TypeID::Quad } );
|
_dataTypes.insert( "Quad", { BCDataType::TypeID::Quad } );
|
||||||
|
*/
|
||||||
|
|
||||||
_valueTypes.insert( "Float", { BCDataType::TypeID::Float, "", 1.5625} );
|
_dataTypes.insert( "Float", new Fitz{{ "", 1.5625F}} );
|
||||||
_valueTypes.insert( "Percent",{ BCDataType::TypeID::Percent, "%", 1.5625 } );
|
_dataTypes.insert( "Percent",new Fatz{{ "%", 1.5625 }} );
|
||||||
_valueTypes.insert( "KWh", { BCDataType::TypeID::KWh, "kwh", 1.5625 } );
|
_dataTypes.insert( "KWh", new Fatz{{ "kwh", 1.5625 }} );
|
||||||
_valueTypes.insert( "Watt", { BCDataType::TypeID::Watt, "w", 1.5625 } );
|
_dataTypes.insert( "Watt", new Long{{ "w", 1.5625 }} );
|
||||||
_valueTypes.insert( "Km", { BCDataType::TypeID::Km, "km", 1.5625 } );
|
_dataTypes.insert( "Km", new ODO{{ "km", 1.5625 }} );
|
||||||
_valueTypes.insert( "Kmh", { BCDataType::TypeID::Kmh, "km/h", 0.1 } );
|
_dataTypes.insert( "Kmh", new ODO{{ "km/h", 0.1 }} );
|
||||||
_valueTypes.insert( "Mm", { BCDataType::TypeID::Mm, "mm", 1.5625 } );
|
_dataTypes.insert( "Mm", new ODO{{ "mm", 1.5625 }} );
|
||||||
_valueTypes.insert( "Sec", { BCDataType::TypeID::Sec, "s", 1.5625 } );
|
_dataTypes.insert( "Sec", new ODO{{ "s", 1.5625 }} );
|
||||||
_valueTypes.insert( "SoC", { BCDataType::TypeID::SoC, "%", 1.5625 } );
|
_dataTypes.insert( "SoC", new Long{{ "%", 1.5625 }} );
|
||||||
_valueTypes.insert( "Odo", { BCDataType::TypeID::Odo, "km", 1.5625 } );
|
_dataTypes.insert( "Odo", new Fitz{{ "km", 1.5625 }} );
|
||||||
_valueTypes.insert( "Assist", { BCDataType::TypeID::Assist, "", 0 ,4 } );
|
_dataTypes.insert( "Assist", new Fatz{{ "", 0 ,4 }} );
|
||||||
_valueTypes.insert( "Assist", { BCDataType::TypeID::AssistFac, "%" } );
|
_dataTypes.insert( "Assist", new Fatz{{ "%" }} );
|
||||||
_valueTypes.insert( "Date", { BCDataType::TypeID::Date } );
|
//_dataTypes.insert( "Date", { BCDataType::TypeID::Date } );
|
||||||
}
|
}
|
||||||
|
|
||||||
void BCDataManager::onCommandFinished(int id, bool success)
|
void BCDataManager::onCommandFinished(int id, bool success)
|
||||||
@@ -337,10 +339,10 @@ std::optional<BCDataItem> BCDataManager::makeDataItem( BCDevice::ID deviceID, co
|
|||||||
std::optional<quint64> IDVal = s_bcValueEnum.keyToValue64( params.ID.toLatin1().constData() );
|
std::optional<quint64> IDVal = s_bcValueEnum.keyToValue64( params.ID.toLatin1().constData() );
|
||||||
if( IDVal.has_value() )
|
if( IDVal.has_value() )
|
||||||
{
|
{
|
||||||
if( _valueTypes.contains( params.UnitType ) )
|
if( _dataTypes.contains( params.UnitType ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
const BCDataType& valueType = _valueTypes[params.UnitType];
|
const BCDataType& valueType = *_dataTypes[params.UnitType];
|
||||||
newValue = BCDataItem( valueType, deviceID, static_cast<BC::ID>(IDVal.value()) );
|
newValue = BCDataItem( valueType, deviceID, static_cast<BC::ID>(IDVal.value()) );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -28,8 +28,8 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef BCVDATAMANAGER_H
|
#ifndef BCDATAMANAGER_H
|
||||||
#define BCVDATAMANAGER_H
|
#define BCDATAMANAGER_H
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QXmlStreamReader>
|
#include <QXmlStreamReader>
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include <bctransmitter.h>
|
#include <bctransmitter.h>
|
||||||
|
|
||||||
|
|
||||||
class BCDataManager : public QObject
|
class BCDataManager : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -53,7 +54,7 @@ public:
|
|||||||
std::optional<BCDataModel*> getModel(BCDevice::ID deviceID );
|
std::optional<BCDataModel*> getModel(BCDevice::ID deviceID );
|
||||||
BCTransmitter* getTransmitter();
|
BCTransmitter* getTransmitter();
|
||||||
|
|
||||||
std::optional<BCDataItem> makeDataItem( BCDevice::ID deviceID, const BCDataParams& params );
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
@@ -76,14 +77,24 @@ private slots:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
struct BCDataParams
|
||||||
|
{
|
||||||
|
QString ID;
|
||||||
|
QString Label;
|
||||||
|
QString Default;
|
||||||
|
QString UnitType;
|
||||||
|
};
|
||||||
|
|
||||||
void createValueTypes();
|
void createValueTypes();
|
||||||
void loadDeviceData( BCDataList& parsedValues );
|
void loadDeviceData( BCDataList& parsedValues );
|
||||||
|
|
||||||
|
std::optional<BCDataItem> makeDataItem( BCDevice::ID deviceID, const BCDataParams& params );
|
||||||
|
|
||||||
using BCDeviceModels = QMap<BCDevice::ID, BCDataModel*>;
|
using BCDeviceModels = QMap<BCDevice::ID, BCDataModel*>;
|
||||||
using BCDataTypes = QMap<QString,BCDataType>;
|
using BCDataTypes = QMap<QString,BCDataType*>;
|
||||||
|
|
||||||
QXmlStreamReader _xml;
|
QXmlStreamReader _xml;
|
||||||
BCDataTypes _valueTypes;
|
BCDataTypes _dataTypes;
|
||||||
BCDeviceModels _valueModels;
|
BCDeviceModels _valueModels;
|
||||||
BCDevice::ID _currentDeviceID{BCDevice::ID::Invalid};
|
BCDevice::ID _currentDeviceID{BCDevice::ID::Invalid};
|
||||||
QMetaEnum _bcDeviceEnum{QMetaEnum::fromType<BCDevice::ID>()};
|
QMetaEnum _bcDeviceEnum{QMetaEnum::fromType<BCDevice::ID>()};
|
||||||
@@ -93,4 +104,4 @@ protected:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BCVDATAMANAGER_H
|
#endif // BCDATAMANAGER_H
|
||||||
@@ -38,7 +38,7 @@ QString BCItemDelegate::displayText(const QVariant& dataValue, const QLocale& lo
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << " --- Nö!";
|
//qDebug() << " --- Nö!";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback für normale Strings/Zahlen
|
// Fallback für normale Strings/Zahlen
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
|
||||||
#include <ui_bcmainwindow.h>
|
#include <ui_bcmainwindow.h>
|
||||||
#include <bcvdatamanager.h>
|
#include <bcdatamanager.h>
|
||||||
|
|
||||||
|
|
||||||
class AnimatedDelegate;
|
class AnimatedDelegate;
|
||||||
|
|||||||
@@ -96,9 +96,9 @@ void BCTransmitter::processValueOp( BC::OpID opID )
|
|||||||
|
|
||||||
|
|
||||||
if( opID == BC::OpID::ReadValue )
|
if( opID == BC::OpID::ReadValue )
|
||||||
currentValue->readRawValue( *this );
|
currentValue->readRawValueX( *this );
|
||||||
else if( opID == BC::OpID::WriteValue )
|
else if( opID == BC::OpID::WriteValue )
|
||||||
currentValue->writeRawValue( *this );
|
currentValue->writeRawValueX( *this );
|
||||||
|
|
||||||
|
|
||||||
//emit commandFinished(cmd.id, true);
|
//emit commandFinished(cmd.id, true);
|
||||||
|
|||||||
BIN
doc/~$_ConsoleInformation.docx
Normal file
BIN
doc/~$_ConsoleInformation.docx
Normal file
Binary file not shown.
54
main.cpp
54
main.cpp
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
#include <bcmainwindow.h>
|
#include <bcmainwindow.h>
|
||||||
#include <bcdataitem.h>
|
#include <bcdataitem.h>
|
||||||
#include <bcvdatamanager.h>
|
#include <bcdatamanager.h>
|
||||||
|
|
||||||
#include <variant>
|
#include <variant>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -78,7 +78,7 @@ struct CpuLoad : public moo{ int percentage; };
|
|||||||
struct Status : public moo{ std::string message; };
|
struct Status : public moo{ std::string message; };
|
||||||
|
|
||||||
// Die Variant als universeller Datencontainer
|
// Die Variant als universeller Datencontainer
|
||||||
using SensorReading = std::variant<Temperature, CpuLoad, Status>;
|
using SensorReadingPtr = std::variant<Temperature*, CpuLoad*, Status*>;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -89,25 +89,28 @@ struct UIUpdateVisitor
|
|||||||
QLabel* statusLabel;
|
QLabel* statusLabel;
|
||||||
|
|
||||||
// Überladene operator() für jeden Typ in der Variant
|
// Überladene operator() für jeden Typ in der Variant
|
||||||
void operator()(const Temperature& t) const
|
double operator()(Temperature* t) const
|
||||||
{
|
{
|
||||||
tempLabel->setText(QString("Temp: %1°C").arg(t.celsius, 0, 'f', 1));
|
//tempLabel->setText(QString("Temp: %1°C").arg(t.celsius, 0, 'f', 1));
|
||||||
tempLabel->setStyleSheet(t.celsius > 40 ? "color: red;" : "color: black;");
|
//tempLabel->setStyleSheet(t.celsius > 40 ? "color: red;" : "color: black;");
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(const CpuLoad& c) const
|
double operator()(CpuLoad* c) const
|
||||||
{
|
{
|
||||||
cpuBar->setValue(c.percentage);
|
cpuBar->setValue(c->percentage);
|
||||||
qDebug() << c.moo_str;
|
qDebug() << c->moo_str;
|
||||||
|
return -42.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(const Status& s) const
|
double operator()(const Status* s) const
|
||||||
{
|
{
|
||||||
statusLabel->setText(QString::fromStdString(s.message));
|
//statusLabel->setText(QString::fromStdString(s.message));
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void onNewDataReceived(const SensorReading& data)
|
void onNewDataReceived(const SensorReadingPtr& data)
|
||||||
{
|
{
|
||||||
QLabel* labelTemp = nullptr;
|
QLabel* labelTemp = nullptr;
|
||||||
QProgressBar* progressCpu = nullptr;
|
QProgressBar* progressCpu = nullptr;
|
||||||
@@ -117,14 +120,39 @@ void onNewDataReceived(const SensorReading& data)
|
|||||||
UIUpdateVisitor visitor { labelTemp, progressCpu, labelStatus };
|
UIUpdateVisitor visitor { labelTemp, progressCpu, labelStatus };
|
||||||
|
|
||||||
// Die Magie: std::visit wählt zur Kompilierzeit die richtige Methode
|
// Die Magie: std::visit wählt zur Kompilierzeit die richtige Methode
|
||||||
std::visit(visitor, data);
|
double result = std::visit(visitor, data);
|
||||||
|
Q_UNUSED(result)
|
||||||
|
|
||||||
|
|
||||||
|
Temperature myTemp{};
|
||||||
|
SensorReadingPtr xxx{&myTemp};
|
||||||
|
double result2 = std::visit(visitor, SensorReadingPtr{&myTemp} );
|
||||||
}
|
}
|
||||||
// 2. Datei öffnen und lesen
|
|
||||||
|
struct mookoo
|
||||||
|
{
|
||||||
|
QString a="firz";
|
||||||
|
int b=2;
|
||||||
|
double c=1.0;
|
||||||
|
QString hidden{"Fatz!"};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct mookoo2 : public mookoo
|
||||||
|
{
|
||||||
|
int another;
|
||||||
|
};
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
setApplicationStyleSheet( ":/bionxcontrol.qss"_L1 );
|
setApplicationStyleSheet( ":/bionxcontrol.qss"_L1 );
|
||||||
|
|
||||||
|
mookoo myMookoo{"",1,1.0};
|
||||||
|
mookoo myMooko2{"",1};
|
||||||
|
mookoo2 myMooko3{{"superfitze",1},8};
|
||||||
|
|
||||||
|
qDebug() << " --- haha: " << myMooko3.a << ": " << myMooko3.hidden;
|
||||||
|
|
||||||
BCMainWindow w;
|
BCMainWindow w;
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user