GrpcPrint/PrintS/Controller/Controller.cpp

71 lines
2.1 KiB
C++
Raw Normal View History

2024-04-10 16:15:33 +08:00
#include "Controller.h"
2024-03-25 13:22:32 +08:00
2024-04-10 16:15:33 +08:00
Controller::Controller()
2024-03-25 13:22:32 +08:00
: m_Machine(nullptr)
, m_CoreCommunication(nullptr)
, m_Axis(nullptr)
, m_StateCtrlWrapper(nullptr)
, m_SysParamWrapper(nullptr)
, m_AxisRecordWrapper(nullptr)
2024-04-10 16:15:33 +08:00
, m_SignalStateWrapper(nullptr){
2024-03-25 13:22:32 +08:00
}
2024-04-10 16:15:33 +08:00
Controller::~Controller() {
2024-03-26 10:33:00 +08:00
DELP(m_CoreCommunication);
DELP(m_Axis);
DELP(m_StateCtrlWrapper);
DELP(m_SysParamWrapper);
DELP(m_AxisRecordWrapper);
DELP(m_SignalStateWrapper);
DELP(m_ComServer);
}
2024-04-10 16:15:33 +08:00
void Controller::Init(){
2024-03-25 13:22:32 +08:00
m_CoreCommunication = new CoreCommunication();
m_CoreCommunication->SetIOCfgWrapper(ConfigManager::GetInstance()->GetIoCfgWrapper());
2024-03-26 10:33:00 +08:00
m_CoreCommunication->SetSysParamWrapper(m_SysParamWrapper);
m_CoreCommunication->SetPLCAxis(m_Axis);
m_CoreCommunication->SetAlarmStateWrapper(m_SignalStateWrapper);
m_CoreCommunication->SetAxisRecordWrapper(m_AxisRecordWrapper);
2024-03-25 13:22:32 +08:00
m_CoreCommunication->Init();
2024-03-26 10:33:00 +08:00
m_CoreCommunication->Startup();
2024-03-25 13:22:32 +08:00
m_SysParamWrapper = new SysParamWrapper;
m_StateCtrlWrapper = new StateCtrlWrapper;
m_StateCtrlWrapper->Init(m_CoreCommunication);
m_AxisRecordWrapper = new AxisRecordWrapper;
m_AxisRecordWrapper->Init(m_CoreCommunication);
m_SignalStateWrapper = new SignalStateWrapper();
2024-03-26 10:33:00 +08:00
m_Machine = ConfigManager::GetInstance()->GetMachine();
2024-03-25 13:22:32 +08:00
m_Machine->InitSignal(m_SignalStateWrapper, m_CoreCommunication);
m_Machine->InitSysParam(m_SysParamWrapper, m_CoreCommunication);
m_Axis = new PLCAxis(m_SysParamWrapper, m_StateCtrlWrapper);
m_Machine->SetAxisAndSignal(m_SysParamWrapper, m_AxisRecordWrapper, m_Axis);
2024-03-26 10:33:00 +08:00
m_MachineCtrl = new MachineCtrl();
m_MachineCtrl->Init(m_CoreCommunication, m_SysParamWrapper, m_SignalStateWrapper, m_Axis);
m_Machine->SetMachineCtrl(m_MachineCtrl);
m_MachineCtrl->MachineStartup();
m_ComServer = new ComServer(); //辅机服务
m_ComServer->Init();
m_RemoteClient = new RemoteClient(nullptr, nullptr/*m_ScannerCtrl*/);
m_RemoteClient->Init();
//m_RemoteClient->SetCamera( nullptr /*m_Camera*/);
if (m_RemoteClient->GetConfig()->m_Enable) {
m_RemoteClient->StartRemote();
}
//m_ScannerCtrl->SetRemoteClient(m_RemoteClient);
//m_ScannerCtrl->SetMachineCtrl(m_MachineCtrl);
2024-04-10 16:15:33 +08:00
}