2024-03-19 17:45:12 +08:00
|
|
|
|
#pragma once
|
2024-03-22 11:28:06 +08:00
|
|
|
|
#include "../external/SQLiteCpp/SQLiteCpp.h"
|
2024-03-19 17:45:12 +08:00
|
|
|
|
#include "dao/HbdLanguageDao.h"
|
|
|
|
|
#include "dao/MachineCfgDao.h"
|
|
|
|
|
#include "dao/BaseConfigDao.h"
|
|
|
|
|
#include "dao/AxisCfgDao.h"
|
|
|
|
|
#include "dao/IOCfgDao.h"
|
|
|
|
|
#include "dao/ScanCfgDao.h"
|
|
|
|
|
#include "dao/InfoTextDao.h"
|
|
|
|
|
#include "dao/PowerCompensateDao.h"
|
|
|
|
|
#include "dao/AlarmCfgDao.h"
|
|
|
|
|
#include "dao/SystemBaseDao.h"
|
|
|
|
|
#include "dao/ParamSetCfgDao.h"
|
|
|
|
|
#include "dao/CommunicationCfgDao.h"
|
|
|
|
|
#include "dao/PrepareJobCfgDao.h"
|
|
|
|
|
#include "dao/IOVersionDao.h"
|
|
|
|
|
#include "dao/ScannerControlCfgDao.h"
|
|
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
#include "bean/HbdLanguage.h"
|
|
|
|
|
#include "bean/CoverCfg.h"
|
|
|
|
|
#include "bean/ExtCfg.h"
|
|
|
|
|
#include "bean/AxisCfg.h"
|
|
|
|
|
#include "bean/ScanParamCfg.h"
|
|
|
|
|
#include "bean/ScanTestCfg.h"
|
|
|
|
|
#include "bean/CorrectParamCfg.h"
|
|
|
|
|
#include "bean/AlarmCfg.h"
|
|
|
|
|
#include "bean/SystemBase.h"
|
|
|
|
|
#include "../Machine/Machine.h"
|
|
|
|
|
#include "bean/ParamSetCfg.h"
|
|
|
|
|
#include "bean/FavoriteCfg.h"
|
|
|
|
|
#include "../Communication/ConnectInterface.h"
|
|
|
|
|
|
|
|
|
|
#include "bean/CameraCalibrationCfg.h"
|
|
|
|
|
#include "../global.h"
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
2024-05-28 13:28:07 +08:00
|
|
|
|
enum ConfigFunc{
|
|
|
|
|
SAVECONFIG =0,
|
|
|
|
|
SAVEMACHINECONFIG,
|
2024-05-28 18:07:35 +08:00
|
|
|
|
DELETEMACHINEIO,
|
2024-05-28 13:28:07 +08:00
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2024-03-19 17:45:12 +08:00
|
|
|
|
class ConfigManager
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
static ConfigManager* GetInstance();
|
2024-03-22 11:28:06 +08:00
|
|
|
|
void Init();
|
2024-03-19 17:45:12 +08:00
|
|
|
|
bool InitFromSetup(void);
|
2024-05-22 15:58:54 +08:00
|
|
|
|
void SaveConfig(); //传
|
2024-03-19 17:45:12 +08:00
|
|
|
|
void SaveExtConfig() { m_pBaseConfigDao->SaveExtCfg(m_ExtCfg); }
|
2024-05-22 15:58:54 +08:00
|
|
|
|
void SaveMachineConfig() { m_pMachineCfgDao->Save(m_MachineCfg); } //传
|
2024-03-19 17:45:12 +08:00
|
|
|
|
void SaveParamSetCfg() { m_pParamSetCfgDao->Save(m_ParamSetCfg); }
|
2024-05-22 15:58:54 +08:00
|
|
|
|
void Export(string file_path); //导入导出先放放
|
2024-03-19 17:45:12 +08:00
|
|
|
|
void Import(string file_path);
|
|
|
|
|
void ExportPC(string file_path);
|
|
|
|
|
void ImportPC(string file_path);
|
|
|
|
|
void ExportParamSet(string file_path);
|
|
|
|
|
void ImportParamSet(string file_path);
|
|
|
|
|
|
2024-05-28 13:28:07 +08:00
|
|
|
|
map<short, AxisCfg*>* GetAxisSetting() { return &m_AxisCfgs; } //不传
|
2024-03-19 17:45:12 +08:00
|
|
|
|
|
2024-05-28 13:28:07 +08:00
|
|
|
|
AxisCfg* GetArmCfg(); //以下几个已经传了
|
2024-03-19 17:45:12 +08:00
|
|
|
|
AxisCfg* GetMoldCfg();
|
|
|
|
|
AxisCfg* GetLoadCfg();
|
|
|
|
|
AxisCfg* GetSupplyCfg();
|
|
|
|
|
AxisCfg* GetCleanCfg() { return m_CleanCfg; }
|
2024-05-28 13:28:07 +08:00
|
|
|
|
AxisCfg* GetEleCfg() { return m_EleCfg; }
|
|
|
|
|
CoverCfg* GetCoverCfg() { return &m_CoverCfg; } //不传 界面没有用到
|
|
|
|
|
ExtCfg* GetExtCfg() { return &m_ExtCfg; } //已传 1
|
|
|
|
|
RunCfg* GetRunCfg() { return &m_RunCfg; } //未传
|
|
|
|
|
UIShowCfg* GetUIShowCfg() { return &m_UIShowCfg; } //未传
|
|
|
|
|
IOCfgWrapper* GetIoCfgWrapper() { return m_IOCfgWrapper; } //传的参数
|
|
|
|
|
void DeleteMachineIO(); //传
|
|
|
|
|
vector<IOVersion*>* GetIOVersions(int machineid); //返回一个string, req-rsp模式
|
|
|
|
|
|
|
|
|
|
PowderEstimateCfg* GetPowderEstimateCfg() { return &m_PowderEstimateCfg; } //传
|
|
|
|
|
map<string, CommunicationCfg*>* GetCommunicationCfg() { return m_pCommunicationCfgDao->GetCommunicationCfg(); } //传
|
|
|
|
|
|
|
|
|
|
InfraredTempCfg* GetInfraredTempCfg() { //传
|
2024-05-22 15:58:54 +08:00
|
|
|
|
return &m_InfraredTempCfg;
|
2024-03-19 17:45:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-28 13:28:07 +08:00
|
|
|
|
ParamLimitCfg* GetParamLimitCfg() { return &m_ParamLimitCfg; } //传
|
2024-03-19 17:45:12 +08:00
|
|
|
|
MachineCfg* GetMachineCfg() { return &m_MachineCfg; }
|
|
|
|
|
Machine* GetMachine() { return m_Machine; }
|
|
|
|
|
AlarmCfgWrapper* GetAlarmCfg() { return m_AlarmCfgWrapper; }
|
|
|
|
|
|
|
|
|
|
RecoatCheckCfg* GetRecoatCheckCfg() { return &m_RecoatCheckCfg; }
|
|
|
|
|
|
|
|
|
|
HbdLanguage* GetLanguage(int id);
|
|
|
|
|
void GetDefaultText(map<string,string>& textmap);
|
|
|
|
|
|
|
|
|
|
ParamSetCfg* GetParamSetCfg() { return &m_ParamSetCfg; }
|
|
|
|
|
//map<int, LaserCfg*>* GetLaserCfgMap() { return &m_pLaserCfgDao->m_LaserCfgMap; }
|
|
|
|
|
//vector<LaserCfg*>* GetLaserCfgs() { return &m_pLaserCfgDao->m_LaserCfgs; }
|
|
|
|
|
map<int, ScannerControlCfg*>* GetScannerControlCfg() { return &m_ScannerControlCfgDao->m_ScannerControlCfgMap; }
|
|
|
|
|
vector<ScannerControlCfg*>* GetScannerControlCfgs() { return &m_ScannerControlCfgDao->m_ScannerControlCfgs; }
|
|
|
|
|
vector<ScannerControlCfg*>* GetMatchScannerControlCfg() { return &m_ScannerControlCfgDao->m_MatchCfg; }
|
|
|
|
|
ScannerControlCfgDao* GetScannerControlCfgDao() { return m_ScannerControlCfgDao; }
|
|
|
|
|
|
|
|
|
|
//vector<LaserCfg*> *GetMatchLaser() { return &m_pLaserCfgDao->m_MatchLaser; }
|
|
|
|
|
//LaserCfgDao* GetLaserCfgDao() { return m_pLaserCfgDao; }
|
|
|
|
|
FavoriteCfg* GetFavoriteCfg() { return &m_FavoriteCfg; }
|
|
|
|
|
FixPointDao* GetFixPointDao() { return m_ScannerControlCfgDao->GetFixPointDao(); }
|
|
|
|
|
CameraCalibrationCfg* GetCameraCalibrationCfg() { return &m_CameraCalibrationCfg; }
|
|
|
|
|
void SaveCameraCalibrationCfg() {
|
|
|
|
|
SQLite::Transaction transaction(*m_pDB);
|
|
|
|
|
m_pBaseConfigDao->SaveCameraCalibrationCfg(m_CameraCalibrationCfg);
|
|
|
|
|
transaction.commit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AddComRefCfg(CommunicationCfg* cfg, IConnect* ic) { m_ComRefCfg[cfg] = ic; }
|
|
|
|
|
map<CommunicationCfg*, IConnect*>* GetComRefCfg() { return &m_ComRefCfg; }
|
|
|
|
|
|
|
|
|
|
// map<unsigned char, ServoCfg*>* GetMitsubishiCfg() { return &m_MitsubishiCfgMap; }
|
|
|
|
|
// map<unsigned char, ServoCfg*>* GetSanyoCfg() { return &m_SanyoCfgMap; }
|
|
|
|
|
// map<unsigned char, ServoCfg*>* GetSiemensCfg() { return &m_SiemensCfgMap; }
|
|
|
|
|
// map<string, ServoCfg*>* GetServoCfg() { return &m_ServoCfgMap; }
|
|
|
|
|
void UpdateZeroOffset(int id, long value);
|
|
|
|
|
|
|
|
|
|
map<int, bool>* GetPreJobParamCfg() { return &m_PrepareJobCfgs; }
|
|
|
|
|
void SavePreJobParamCfg() { m_PrepareJobCfgDao->Save(m_MachineCfg.m_MachineType, m_PrepareJobCfgs); }
|
|
|
|
|
|
2024-05-06 10:49:15 +08:00
|
|
|
|
void SendCfgToClients();
|
|
|
|
|
void UpdateCfg(const ReadData& rd);
|
2024-03-19 17:45:12 +08:00
|
|
|
|
private:
|
|
|
|
|
ConfigManager(const ConfigManager&) {};
|
|
|
|
|
ConfigManager& operator=(const ConfigManager&) {};
|
|
|
|
|
ConfigManager();
|
|
|
|
|
~ConfigManager();
|
|
|
|
|
void GenerateTable();
|
|
|
|
|
void ReadConfig();
|
|
|
|
|
void Export(string &content, string file_path);
|
|
|
|
|
void Import(string &content, string file_path);
|
|
|
|
|
|
2024-03-22 11:28:06 +08:00
|
|
|
|
|
|
|
|
|
private:
|
2024-03-19 17:45:12 +08:00
|
|
|
|
SQLite::Database* m_pDB;
|
|
|
|
|
HbdLanguageDao* m_pHbdLanguageDao;
|
|
|
|
|
MachineCfgDao* m_pMachineCfgDao;
|
|
|
|
|
BaseConfigDao* m_pBaseConfigDao;
|
|
|
|
|
AxisCfgDao* m_pAxisConfigDao;
|
|
|
|
|
IOCfgDao* m_pIOCfgDao;
|
|
|
|
|
CommunicationCfgDao* m_pCommunicationCfgDao;
|
|
|
|
|
InfoTextDao* m_pInfoTextDao;
|
|
|
|
|
AlarmCfgDao* m_pAlarmCfgDao;
|
|
|
|
|
SystemBaseDao* m_pSystemBaseDao;
|
|
|
|
|
ParamSetCfgDao* m_pParamSetCfgDao;
|
|
|
|
|
//LaserCfgDao* m_pLaserCfgDao;
|
|
|
|
|
PrepareJobCfgDao* m_PrepareJobCfgDao;
|
|
|
|
|
IOVersionDao* m_IOVersionDao;
|
|
|
|
|
ScannerControlCfgDao* m_ScannerControlCfgDao;
|
|
|
|
|
|
|
|
|
|
SystemBaseCfg m_SystemBaseCfg;
|
|
|
|
|
map<int,HbdLanguage*> m_LanguageMap;
|
|
|
|
|
MachineCfg m_MachineCfg;
|
|
|
|
|
ExtCfg m_ExtCfg;
|
2024-05-06 10:49:15 +08:00
|
|
|
|
ExtCfgNew m_ExtCfgNew;
|
2024-03-19 17:45:12 +08:00
|
|
|
|
map<short, AxisCfg*> m_AxisCfgs;
|
|
|
|
|
AxisCfg* m_MoldCfg;
|
|
|
|
|
AxisCfg* m_LoadCfg;
|
|
|
|
|
AxisCfg* m_ArmCfg;
|
|
|
|
|
AxisCfg* m_SupplyCfg;
|
|
|
|
|
AxisCfg* m_CleanCfg;
|
|
|
|
|
AxisCfg* m_EleCfg;
|
|
|
|
|
CoverCfg m_CoverCfg;
|
|
|
|
|
RunCfg m_RunCfg;
|
|
|
|
|
//map <int,LaserCfg*> m_LaserCfgs;
|
|
|
|
|
FavoriteCfg m_FavoriteCfg;
|
|
|
|
|
ParamLimitCfg m_ParamLimitCfg;
|
2024-05-06 10:49:15 +08:00
|
|
|
|
ParamLimitCfgNew m_ParamLimitCfgNew;
|
|
|
|
|
|
2024-03-19 17:45:12 +08:00
|
|
|
|
IOCfgWrapper* m_IOCfgWrapper;
|
|
|
|
|
map<int, vector<IOVersion*>*> m_IOVersions;
|
|
|
|
|
|
|
|
|
|
map<CommunicationCfg*, IConnect*> m_ComRefCfg;
|
|
|
|
|
CameraCalibrationCfg m_CameraCalibrationCfg;
|
|
|
|
|
PowderEstimateCfg m_PowderEstimateCfg;
|
|
|
|
|
ParamSetCfg m_ParamSetCfg;
|
|
|
|
|
|
|
|
|
|
AlarmCfgWrapper* m_AlarmCfgWrapper;
|
|
|
|
|
Machine* m_Machine;
|
|
|
|
|
|
|
|
|
|
RecoatCheckCfg m_RecoatCheckCfg;
|
|
|
|
|
|
|
|
|
|
map<int, bool> m_PrepareJobCfgs;
|
2024-05-22 15:58:54 +08:00
|
|
|
|
|
|
|
|
|
InfraredTempCfg m_InfraredTempCfg;
|
|
|
|
|
UIShowCfg m_UIShowCfg;
|
2024-03-19 17:45:12 +08:00
|
|
|
|
};
|