123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- #include "stdafx.h"
- #include "DoNothingHandler.h"
- #include <iostream>
- #include "IMotionModel.h"
- #include "IMotionModelManager.h"
- #include "MotionStages.h"
- #include "CArmComponentNameDef.h"
- #include "CArmGeneralMotionStageArgs.h"
- using namespace DIOS::Dev::Detail::MachineryECOM;
- DoNothingHandler::DoNothingHandler():
- m_modelManager(nullptr)
- {
- }
- DoNothingHandler::~DoNothingHandler()
- {
- }
- void DoNothingHandler::OnModelLoaded(IMotionModelManager *modelManager)
- {
- m_modelManager = modelManager;
- }
- void DoNothingHandler::OnCoordinatesLoaded(IPositionManager *coordinates)
- {
- }
- void DoNothingHandler::OnMotionEvent(const std::string &motionEventName)
- {
- std::cout << "OnMotionEvent " << motionEventName << endl;
- }
- RET_STATUS DoNothingHandler::OnStartMove(DOF_MECH mech, int nOrientation)
- {
- auto model = m_modelManager->Resove(MOTION_MODLE_CARM_GENERAL);
- if (!model)
- {
- return RET_STATUS::RET_FAILED;
- }
- auto modelArgs = (CArmGeneralMotionStageArgs *)model->GetStageArgs();
-
- if (mech == TOMO_TUBE_HEIGHT)
- {
- modelArgs->TubeCircularMoveDirection = nOrientation;
- modelArgs->TubeCircularMoveStep = -1;
- if(gbusinessLog) gbusinessLog->Info("[DoNothingHandler][OnStartMove]->[Enter][TOMO_TUBE_CIRCULAR][Org: {$:d}]", modelArgs->TubeSwingDirection);
- model->ChangeStage(CARM_GENERAL_MOVE_TUBE_CIRCULAR);
- }
- else if (mech == TOMO_TUBE_ANGLE)
- {
- modelArgs->TubeSwingDirection = nOrientation;
- modelArgs->TubeSwingStep = -1;
- if(gbusinessLog) gbusinessLog->Info("[DoNothingHandler][OnStartMove]->[Enter][TOMO_TUBE_ANGLE][Org: {$:d}]", modelArgs->TubeSwingDirection);
- model->ChangeStage(CARM_GENERAL_MOVE_TUBE_SWING);
- }
- if(gbusinessLog) gbusinessLog->Info("[DoNothingHandler][OnStartMove]->[Leave]");
- return RET_STATUS::RET_SUCCEED;
- }
- RET_STATUS DoNothingHandler::OnStopMove(DOF_MECH mech)
- {
- if(gbusinessLog) gbusinessLog->Info("[DoNothingHandler][OnStopMove]->[Enter]");
- auto model = m_modelManager->Resove(MOTION_MODLE_CARM_GENERAL);
- if (!model)
- {
- return RET_STATUS::RET_FAILED;
- }
- model->ChangeStage(CARM_GENERAL_STOP_MECH_MOVING);
- if(gbusinessLog) gbusinessLog->Info("[DoNothingHandler][OnStopMove]->[Leave]");
- return RET_STATUS::RET_SUCCEED;
- }
- void DoNothingHandler::OnHandSwitchGearFirstPressed()
- {
- auto model = m_modelManager->Resove(MOTION_MODLE_CARM_GENERAL);
- if (!model)
- {
- return;
- }
- model->ChangeStage(CARM_GENERAL_START_EXPOSURE);
- }
- void DoNothingHandler::OnHandSwitchGearFirstReleased()
- {
- auto model = m_modelManager->Resove(MOTION_MODLE_CARM_GENERAL);
- if (!model)
- {
- return ;
- }
- model->ChangeStage(CARM_GENERAL_STOP_EXPOSURE);
- }
|