Add Config JSONs to Config Manager
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
ConfigManager::ConfigManager(QObject *parent) : QObject(parent)
|
||||
{
|
||||
new ConfigManagerAdaptor(this);
|
||||
|
||||
|
||||
QDBusConnection dbus = QDBusConnection::sessionBus();
|
||||
dbus.registerObject("/configuration", this);
|
||||
dbus.registerService("com.infraredinspectionsystems.FaultFinder");
|
||||
@@ -26,6 +26,7 @@ bool ConfigManager::GetRecordingState()
|
||||
|
||||
void ConfigManager::SetRecordingState(bool enable)
|
||||
{
|
||||
// if sensor is cold
|
||||
qDebug() << "ConfigManager::SetRecordingState";
|
||||
if (this->recording != enable) {
|
||||
this->recording = enable;
|
||||
@@ -61,4 +62,32 @@ void ConfigManager::SetEmissivity(double emissivity)
|
||||
this->emissivity = emissivity;
|
||||
emit NewEmissivity(this->emissivity);
|
||||
}
|
||||
}
|
||||
|
||||
QString ConfigManager::GetViewfinderConfig()
|
||||
{
|
||||
qDebug() << "ConfigManager::GetViewfinderConfig";
|
||||
QJsonDocument doc(this->viewfinder_config);
|
||||
return doc.toJson();
|
||||
}
|
||||
|
||||
void ConfigManager::SetViewfinderConfig(QString config)
|
||||
{
|
||||
qDebug() << "ConfigManager::SetViewfinderConfig";
|
||||
QJsonDocument doc = QJsonDocument::fromJson(config.toUtf8());
|
||||
this->viewfinder_config = doc.object();
|
||||
}
|
||||
|
||||
QString ConfigManager::GetTriggerConfig()
|
||||
{
|
||||
qDebug() << "ConfigManager::GetTriggerConfig";
|
||||
QJsonDocument doc(this->trigger_config);
|
||||
return doc.toJson();
|
||||
}
|
||||
|
||||
void ConfigManager::SetTriggerConfig(QString config)
|
||||
{
|
||||
qDebug() << "ConfigManager::SetTriggerConfig";
|
||||
QJsonDocument doc = QJsonDocument::fromJson(config.toUtf8());
|
||||
this->trigger_config = doc.object();
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
#define CONFIG_MANAGER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QJsonObject>
|
||||
|
||||
class ConfigManager: public QObject
|
||||
{
|
||||
@@ -9,6 +10,8 @@ class ConfigManager: public QObject
|
||||
Q_PROPERTY(bool recording READ GetRecordingState WRITE SetRecordingState)
|
||||
Q_PROPERTY(int frame_rate READ GetFrameRate WRITE SetFrameRate)
|
||||
Q_PROPERTY(double emissivity READ GetEmissivity WRITE SetEmissivity)
|
||||
Q_PROPERTY(QString viewfinder_config READ GetViewfinderConfig WRITE SetViewfinderConfig)
|
||||
Q_PROPERTY(QString trigger_config READ GetTriggerConfig WRITE SetTriggerConfig)
|
||||
|
||||
public:
|
||||
ConfigManager(QObject *parent);
|
||||
@@ -21,6 +24,10 @@ public slots:
|
||||
void SetFrameRate(int frame_rate);
|
||||
double GetEmissivity();
|
||||
void SetEmissivity(double emissivity);
|
||||
QString GetViewfinderConfig();
|
||||
void SetViewfinderConfig(QString config);
|
||||
QString GetTriggerConfig();
|
||||
void SetTriggerConfig(QString config);
|
||||
|
||||
signals:
|
||||
void NewRecordingState(bool enable);
|
||||
@@ -31,7 +38,18 @@ private:
|
||||
bool recording = false;
|
||||
int frame_rate = 5;
|
||||
double emissivity = 0.95;
|
||||
|
||||
QJsonObject viewfinder_config = QJsonObject(
|
||||
{
|
||||
qMakePair(QString("palette"), QJsonValue("rainbow")),
|
||||
qMakePair(QString("low_temp"), QJsonValue(0)),
|
||||
qMakePair(QString("high_temp"), QJsonValue(100))
|
||||
});
|
||||
QJsonObject trigger_config = QJsonObject(
|
||||
{
|
||||
qMakePair(QString("method"), QJsonValue("threshold")),
|
||||
qMakePair(QString("min"), QJsonValue(50)),
|
||||
qMakePair(QString("max"), QJsonValue(100))
|
||||
});
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user