89 lines
2.2 KiB
C++
89 lines
2.2 KiB
C++
#ifndef CONFIGMANAGER_H
|
|
#define CONFIGMANAGER_H
|
|
|
|
#include "../db/dbconfig.h"
|
|
#include "../modbus/modbusconfig.h"
|
|
|
|
#include <QString>
|
|
#include <QStringList>
|
|
#include <QMap>
|
|
|
|
struct VisionConfig
|
|
{
|
|
bool enabled = false;
|
|
bool contractConfirmed = false;
|
|
bool photoPoseReadyConfirmed = false;
|
|
QString executablePath;
|
|
QString ipcName = "ssp_visionguide_v1";
|
|
int startupTimeoutMs = 15000;
|
|
int initializeTimeoutMs = 60000;
|
|
int requestTimeoutMs = 15000;
|
|
int photoPoseR = 40;
|
|
int graspPoseR = 60;
|
|
bool lowWordFirst = true;
|
|
int photoMoveCoil = 850;
|
|
int photoMoveCoilFeedback = 851;
|
|
int comparisonPickCoil = 852;
|
|
QMap<int, int> trayMap;
|
|
|
|
bool isValid(QString *error = nullptr) const;
|
|
int visionTrayNo(int sspTrayNo) const;
|
|
};
|
|
|
|
struct ProductionConfig
|
|
{
|
|
int loadStep = 1;
|
|
int frontCheckStep = 2;
|
|
int backCheckStep = 3;
|
|
int unloadStep = 4;
|
|
int cycleCompleteStep = 5;
|
|
int okResult = 1;
|
|
int ngResult = 2;
|
|
int errorResult = 3;
|
|
int simulationResult = 1;
|
|
int timeoutWarningMs = 8000;
|
|
int stateTimeoutMs = 10000;
|
|
int readyTimeoutMs = 10000;
|
|
int photoMoveTimeoutMs = 10000;
|
|
int handlingTimeoutMs = 10000;
|
|
int flipTimeoutMs = 10000;
|
|
int inspectionTimeoutMs = 10000;
|
|
int maxRecoveryRetries = 1;
|
|
int simulationStepMs = 500;
|
|
bool usePlcErrorCode = false;
|
|
};
|
|
|
|
class ConfigManager
|
|
{
|
|
public:
|
|
static ConfigManager &instance();
|
|
|
|
bool load(const QString &filePath = QString());
|
|
QString filePath() const;
|
|
|
|
DbConfig databaseConfig() const;
|
|
ModbusConfig modbusConfig() const;
|
|
ProductionConfig productionConfig() const;
|
|
VisionConfig visionConfig() const;
|
|
bool simulationMode() const;
|
|
bool productionEnabled() const;
|
|
bool validate(QString *error = nullptr) const;
|
|
|
|
private:
|
|
ConfigManager();
|
|
ConfigManager(const ConfigManager &) = delete;
|
|
ConfigManager &operator=(const ConfigManager &) = delete;
|
|
|
|
QString defaultFilePath() const;
|
|
|
|
QString m_filePath;
|
|
DbConfig m_databaseConfig;
|
|
ModbusConfig m_modbusConfig;
|
|
ProductionConfig m_productionConfig;
|
|
VisionConfig m_visionConfig;
|
|
bool m_simulationMode;
|
|
bool m_productionEnabled;
|
|
};
|
|
|
|
#endif // CONFIGMANAGER_H
|