DCPlugin/src/ATBAPP/support/PersistentData.h
Siegfried Siegert d2efe566c5
Add persistentData to store dc-fw-version
Reading dc-fw-version is somehow complicated ...
Id does not work reliable on startup, so we do read it also on every
diagRequest().
Version string is then stored in persistent data.
This data can be used e.g. by other tools to show the
device-controller-firmware-version.
2024-01-31 11:34:00 +01:00

50 lines
982 B
C++

#ifndef PERSISTENTDATA_H
#define PERSISTENTDATA_H
#include <QObject>
#include <QHash>
#include <QVariant>
#include <QList>
#include <QString>
class PersistentData : public QObject
{
Q_OBJECT
public:
explicit PersistentData(const QString &datafileName, QObject *parent = nullptr);
void setDCFirmwareVersion(const QString & fw_version);
QString getDCFirmwareVersion();
QVariant getParameter(const QString & key);
QVariant getParameter(const QString & key) const;
void setParameter(const QString & key, QVariant value);
void clearParameter(const QString & key);
bool hasParameter(const QString & key) const;
uint getUintParameter(const QString & key) const;
QList<QString> uniqueKeys() const;
public slots:
void serializeToFile();
signals:
private:
QHash<QString, QVariant> hash;
QString dc_fw_version;
QString filename;
void save();
void read();
bool isChangedFlag;
};
#endif // PERSISTENTDATA_H