diff --git a/Drivers/ScanLabSMC/ACT/LibMCDriver_ScanLabSMC.xml b/Drivers/ScanLabSMC/ACT/LibMCDriver_ScanLabSMC.xml index 90a79e42..481d413a 100644 --- a/Drivers/ScanLabSMC/ACT/LibMCDriver_ScanLabSMC.xml +++ b/Drivers/ScanLabSMC/ACT/LibMCDriver_ScanLabSMC.xml @@ -340,6 +340,11 @@ Custom implementation + + + + + diff --git a/Drivers/ScanLabSMC/Headers/CppDynamic/libmcdriver_scanlabsmc_dynamic.h b/Drivers/ScanLabSMC/Headers/CppDynamic/libmcdriver_scanlabsmc_dynamic.h index 33754374..e4bc6c9a 100644 --- a/Drivers/ScanLabSMC/Headers/CppDynamic/libmcdriver_scanlabsmc_dynamic.h +++ b/Drivers/ScanLabSMC/Headers/CppDynamic/libmcdriver_scanlabsmc_dynamic.h @@ -271,6 +271,22 @@ typedef LibMCDriver_ScanLabSMCResult (*PLibMCDriver_ScanLabSMCSMCJob_GetJobChara */ typedef LibMCDriver_ScanLabSMCResult (*PLibMCDriver_ScanLabSMCSMCJob_GetJobDurationPtr) (LibMCDriver_ScanLabSMC_SMCJob pSMCJob, LibMCDriver_ScanLabSMC_double * pJobDuration); +/** +* Starts the laser initialization sequence. +* +* @param[in] pSMCJob - SMCJob instance. +* @return error code or 0 (success) +*/ +typedef LibMCDriver_ScanLabSMCResult (*PLibMCDriver_ScanLabSMCSMCJob_ExecuteLaserInitSequencePtr) (LibMCDriver_ScanLabSMC_SMCJob pSMCJob); + +/** +* Starts the laser shutdown sequence. +* +* @param[in] pSMCJob - SMCJob instance. +* @return error code or 0 (success) +*/ +typedef LibMCDriver_ScanLabSMCResult (*PLibMCDriver_ScanLabSMCSMCJob_ExecuteLaserShutdownSequencePtr) (LibMCDriver_ScanLabSMC_SMCJob pSMCJob); + /************************************************************************************************************************* Class definition for SMCConfiguration **************************************************************************************************************************/ @@ -858,6 +874,8 @@ typedef struct { PLibMCDriver_ScanLabSMCSMCJob_LoadSimulationDataPtr m_SMCJob_LoadSimulationData; PLibMCDriver_ScanLabSMCSMCJob_GetJobCharacteristicPtr m_SMCJob_GetJobCharacteristic; PLibMCDriver_ScanLabSMCSMCJob_GetJobDurationPtr m_SMCJob_GetJobDuration; + PLibMCDriver_ScanLabSMCSMCJob_ExecuteLaserInitSequencePtr m_SMCJob_ExecuteLaserInitSequence; + PLibMCDriver_ScanLabSMCSMCJob_ExecuteLaserShutdownSequencePtr m_SMCJob_ExecuteLaserShutdownSequence; PLibMCDriver_ScanLabSMCSMCConfiguration_SetDynamicViolationReactionPtr m_SMCConfiguration_SetDynamicViolationReaction; PLibMCDriver_ScanLabSMCSMCConfiguration_GetDynamicViolationReactionPtr m_SMCConfiguration_GetDynamicViolationReaction; PLibMCDriver_ScanLabSMCSMCConfiguration_SetWarnLevelPtr m_SMCConfiguration_SetWarnLevel; diff --git a/Drivers/ScanLabSMC/Headers/CppDynamic/libmcdriver_scanlabsmc_dynamic.hpp b/Drivers/ScanLabSMC/Headers/CppDynamic/libmcdriver_scanlabsmc_dynamic.hpp index b626ab5d..deea2391 100644 --- a/Drivers/ScanLabSMC/Headers/CppDynamic/libmcdriver_scanlabsmc_dynamic.hpp +++ b/Drivers/ScanLabSMC/Headers/CppDynamic/libmcdriver_scanlabsmc_dynamic.hpp @@ -554,6 +554,8 @@ class CSMCJob : public CBase { inline void LoadSimulationData(classParam pSimulationDataTable); inline LibMCDriver_ScanLabSMC_double GetJobCharacteristic(const eJobCharacteristic eValueType); inline LibMCDriver_ScanLabSMC_double GetJobDuration(); + inline void ExecuteLaserInitSequence(); + inline void ExecuteLaserShutdownSequence(); }; /************************************************************************************************************************* @@ -796,6 +798,8 @@ class CDriver_ScanLabSMC : public CDriver { pWrapperTable->m_SMCJob_LoadSimulationData = nullptr; pWrapperTable->m_SMCJob_GetJobCharacteristic = nullptr; pWrapperTable->m_SMCJob_GetJobDuration = nullptr; + pWrapperTable->m_SMCJob_ExecuteLaserInitSequence = nullptr; + pWrapperTable->m_SMCJob_ExecuteLaserShutdownSequence = nullptr; pWrapperTable->m_SMCConfiguration_SetDynamicViolationReaction = nullptr; pWrapperTable->m_SMCConfiguration_GetDynamicViolationReaction = nullptr; pWrapperTable->m_SMCConfiguration_SetWarnLevel = nullptr; @@ -1091,6 +1095,24 @@ class CDriver_ScanLabSMC : public CDriver { if (pWrapperTable->m_SMCJob_GetJobDuration == nullptr) return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_SMCJob_ExecuteLaserInitSequence = (PLibMCDriver_ScanLabSMCSMCJob_ExecuteLaserInitSequencePtr) GetProcAddress(hLibrary, "libmcdriver_scanlabsmc_smcjob_executelaserinitsequence"); + #else // _WIN32 + pWrapperTable->m_SMCJob_ExecuteLaserInitSequence = (PLibMCDriver_ScanLabSMCSMCJob_ExecuteLaserInitSequencePtr) dlsym(hLibrary, "libmcdriver_scanlabsmc_smcjob_executelaserinitsequence"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_SMCJob_ExecuteLaserInitSequence == nullptr) + return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_SMCJob_ExecuteLaserShutdownSequence = (PLibMCDriver_ScanLabSMCSMCJob_ExecuteLaserShutdownSequencePtr) GetProcAddress(hLibrary, "libmcdriver_scanlabsmc_smcjob_executelasershutdownsequence"); + #else // _WIN32 + pWrapperTable->m_SMCJob_ExecuteLaserShutdownSequence = (PLibMCDriver_ScanLabSMCSMCJob_ExecuteLaserShutdownSequencePtr) dlsym(hLibrary, "libmcdriver_scanlabsmc_smcjob_executelasershutdownsequence"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_SMCJob_ExecuteLaserShutdownSequence == nullptr) + return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_SMCConfiguration_SetDynamicViolationReaction = (PLibMCDriver_ScanLabSMCSMCConfiguration_SetDynamicViolationReactionPtr) GetProcAddress(hLibrary, "libmcdriver_scanlabsmc_smcconfiguration_setdynamicviolationreaction"); #else // _WIN32 @@ -1695,6 +1717,14 @@ class CDriver_ScanLabSMC : public CDriver { if ( (eLookupError != 0) || (pWrapperTable->m_SMCJob_GetJobDuration == nullptr) ) return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("libmcdriver_scanlabsmc_smcjob_executelaserinitsequence", (void**)&(pWrapperTable->m_SMCJob_ExecuteLaserInitSequence)); + if ( (eLookupError != 0) || (pWrapperTable->m_SMCJob_ExecuteLaserInitSequence == nullptr) ) + return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("libmcdriver_scanlabsmc_smcjob_executelasershutdownsequence", (void**)&(pWrapperTable->m_SMCJob_ExecuteLaserShutdownSequence)); + if ( (eLookupError != 0) || (pWrapperTable->m_SMCJob_ExecuteLaserShutdownSequence == nullptr) ) + return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("libmcdriver_scanlabsmc_smcconfiguration_setdynamicviolationreaction", (void**)&(pWrapperTable->m_SMCConfiguration_SetDynamicViolationReaction)); if ( (eLookupError != 0) || (pWrapperTable->m_SMCConfiguration_SetDynamicViolationReaction == nullptr) ) return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT; @@ -2180,6 +2210,22 @@ class CDriver_ScanLabSMC : public CDriver { return resultJobDuration; } + /** + * CSMCJob::ExecuteLaserInitSequence - Starts the laser initialization sequence. + */ + void CSMCJob::ExecuteLaserInitSequence() + { + CheckError(m_pWrapper->m_WrapperTable.m_SMCJob_ExecuteLaserInitSequence(m_pHandle)); + } + + /** + * CSMCJob::ExecuteLaserShutdownSequence - Starts the laser shutdown sequence. + */ + void CSMCJob::ExecuteLaserShutdownSequence() + { + CheckError(m_pWrapper->m_WrapperTable.m_SMCJob_ExecuteLaserShutdownSequence(m_pHandle)); + } + /** * Method definitions for class CSMCConfiguration */ diff --git a/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_sdk.cpp b/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_sdk.cpp index 4b48de29..84998b3f 100644 --- a/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_sdk.cpp +++ b/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_sdk.cpp @@ -170,6 +170,9 @@ CScanLabSMCSDK::CScanLabSMCSDK(const std::string& sDLLNameUTF8, const std::strin this->slsc_job_stop_record = (PScanLabSMCPtr_slsc_job_stop_record)_loadScanLabSMCAddress(hLibrary, "slsc_job_stop_record"); this->slsc_ctrl_log_record = (PScanLabSMCPtr_slsc_ctrl_log_record)_loadScanLabSMCAddress(hLibrary, "slsc_ctrl_log_record"); + this->slsc_ctrl_exec_init_laser_sequence = (PScanLabSMCPtr_slsc_ctrl_exec_init_laser_sequence)_loadScanLabSMCAddress(hLibrary, "slsc_ctrl_exec_init_laser_sequence"); + this->slsc_ctrl_exec_shutdown_laser_sequence = (PScanLabSMCPtr_slsc_ctrl_exec_shutdown_laser_sequence)_loadScanLabSMCAddress(hLibrary, "slsc_ctrl_exec_shutdown_laser_sequence"); + m_LibraryHandle = (void*) hLibrary; } diff --git a/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_sdk.hpp b/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_sdk.hpp index 7a4a9db5..7751ab6d 100644 --- a/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_sdk.hpp +++ b/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_sdk.hpp @@ -236,6 +236,9 @@ namespace LibMCDriver_ScanLabSMC { typedef slscReturnValue(SCANLABSMC_CALLINGCONVENTION* PScanLabSMCPtr_slsc_job_stop_record) (size_t Handle); typedef slscReturnValue(SCANLABSMC_CALLINGCONVENTION* PScanLabSMCPtr_slsc_ctrl_log_record) (size_t Handle, const char* DatasetPath, slsc_TransformationStep Step); + typedef slscReturnValue(SCANLABSMC_CALLINGCONVENTION* PScanLabSMCPtr_slsc_ctrl_exec_init_laser_sequence) (size_t Handle); + typedef slscReturnValue(SCANLABSMC_CALLINGCONVENTION* PScanLabSMCPtr_slsc_ctrl_exec_shutdown_laser_sequence) (size_t Handle); + class CScanLabSMCSDK_DLLDirectoryCache { private: #ifdef _WIN32 @@ -294,6 +297,8 @@ namespace LibMCDriver_ScanLabSMC { PScanLabSMCPtr_slsc_job_start_record slsc_job_start_record = nullptr; PScanLabSMCPtr_slsc_job_stop_record slsc_job_stop_record = nullptr; PScanLabSMCPtr_slsc_ctrl_log_record slsc_ctrl_log_record = nullptr; + PScanLabSMCPtr_slsc_ctrl_exec_init_laser_sequence slsc_ctrl_exec_init_laser_sequence = nullptr; + PScanLabSMCPtr_slsc_ctrl_exec_shutdown_laser_sequence slsc_ctrl_exec_shutdown_laser_sequence = nullptr; CScanLabSMCSDK(const std::string & sDLLNameUTF8, const std::string& sDLLDirectoryUTF8); ~CScanLabSMCSDK(); diff --git a/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjob.cpp b/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjob.cpp index 1295c8b1..349f66f8 100644 --- a/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjob.cpp +++ b/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjob.cpp @@ -141,3 +141,13 @@ LibMCDriver_ScanLabSMC_double CSMCJob::GetJobDuration() { return m_pJobInstance->GetJobDuration (); } + +void CSMCJob::ExecuteLaserInitSequence() +{ + m_pJobInstance->ExecuteLaserInitSequence(); +} + +void CSMCJob::ExecuteLaserShutdownSequence() +{ + m_pJobInstance->ExecuteLaserShutdownSequence(); +} diff --git a/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjob.hpp b/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjob.hpp index acc75d6b..5ef02a9c 100644 --- a/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjob.hpp +++ b/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjob.hpp @@ -100,6 +100,10 @@ class CSMCJob : public virtual ISMCJob, public virtual CBase { LibMCDriver_ScanLabSMC_double GetJobDuration() override; + void ExecuteLaserInitSequence() override; + + void ExecuteLaserShutdownSequence() override; + }; } // namespace Impl diff --git a/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjobinstance.cpp b/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjobinstance.cpp index d2f5efac..e559ec47 100644 --- a/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjobinstance.cpp +++ b/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjobinstance.cpp @@ -661,6 +661,24 @@ double CSMCJobInstance::GetJobDuration() } +void CSMCJobInstance::ExecuteLaserInitSequence() +{ + auto contextHandle = m_pContextHandle->getHandle(); + + std::cout << "Executing laser init sequence" << std::endl; + + m_pSDK->checkError(contextHandle, m_pSDK->slsc_ctrl_exec_init_laser_sequence(contextHandle)); +} + +void CSMCJobInstance::ExecuteLaserShutdownSequence() +{ + auto contextHandle = m_pContextHandle->getHandle(); + + std::cout << "Executing laser shutdown sequence" << std::endl; + + m_pSDK->checkError(contextHandle, m_pSDK->slsc_ctrl_exec_shutdown_laser_sequence(contextHandle)); +} + void CSMCJobInstance::ReadSimulationFile(LibMCEnv::PDataTable pDataTable) { slsc_VersionInfo version = m_pSDK->slsc_cfg_get_scanmotioncontrol_version(); diff --git a/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjobinstance.hpp b/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjobinstance.hpp index 92e69545..9bdca9ed 100644 --- a/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjobinstance.hpp +++ b/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjobinstance.hpp @@ -106,6 +106,10 @@ class CSMCJobInstance { double GetJobDuration(); + void ExecuteLaserInitSequence(); + + void ExecuteLaserShutdownSequence(); + private: void ReadSimulationFile_SMC_v0_8(LibMCEnv::PDataTable pDataTable); diff --git a/Drivers/ScanLabSMC/Interfaces/libmcdriver_scanlabsmc_abi.hpp b/Drivers/ScanLabSMC/Interfaces/libmcdriver_scanlabsmc_abi.hpp index 5c551adb..3ef9f713 100644 --- a/Drivers/ScanLabSMC/Interfaces/libmcdriver_scanlabsmc_abi.hpp +++ b/Drivers/ScanLabSMC/Interfaces/libmcdriver_scanlabsmc_abi.hpp @@ -284,6 +284,22 @@ LIBMCDRIVER_SCANLABSMC_DECLSPEC LibMCDriver_ScanLabSMCResult libmcdriver_scanlab */ LIBMCDRIVER_SCANLABSMC_DECLSPEC LibMCDriver_ScanLabSMCResult libmcdriver_scanlabsmc_smcjob_getjobduration(LibMCDriver_ScanLabSMC_SMCJob pSMCJob, LibMCDriver_ScanLabSMC_double * pJobDuration); +/** +* Starts the laser initialization sequence. +* +* @param[in] pSMCJob - SMCJob instance. +* @return error code or 0 (success) +*/ +LIBMCDRIVER_SCANLABSMC_DECLSPEC LibMCDriver_ScanLabSMCResult libmcdriver_scanlabsmc_smcjob_executelaserinitsequence(LibMCDriver_ScanLabSMC_SMCJob pSMCJob); + +/** +* Starts the laser shutdown sequence. +* +* @param[in] pSMCJob - SMCJob instance. +* @return error code or 0 (success) +*/ +LIBMCDRIVER_SCANLABSMC_DECLSPEC LibMCDriver_ScanLabSMCResult libmcdriver_scanlabsmc_smcjob_executelasershutdownsequence(LibMCDriver_ScanLabSMC_SMCJob pSMCJob); + /************************************************************************************************************************* Class definition for SMCConfiguration **************************************************************************************************************************/ diff --git a/Drivers/ScanLabSMC/Interfaces/libmcdriver_scanlabsmc_interfaces.hpp b/Drivers/ScanLabSMC/Interfaces/libmcdriver_scanlabsmc_interfaces.hpp index 0da4bb34..d8fe81fe 100644 --- a/Drivers/ScanLabSMC/Interfaces/libmcdriver_scanlabsmc_interfaces.hpp +++ b/Drivers/ScanLabSMC/Interfaces/libmcdriver_scanlabsmc_interfaces.hpp @@ -448,6 +448,16 @@ class ISMCJob : public virtual IBase { */ virtual LibMCDriver_ScanLabSMC_double GetJobDuration() = 0; + /** + * ISMCJob::ExecuteLaserInitSequence - Starts the laser initialization sequence. + */ + virtual void ExecuteLaserInitSequence() = 0; + + /** + * ISMCJob::ExecuteLaserShutdownSequence - Starts the laser shutdown sequence. + */ + virtual void ExecuteLaserShutdownSequence() = 0; + }; typedef IBaseSharedPtr PISMCJob; diff --git a/Drivers/ScanLabSMC/Interfaces/libmcdriver_scanlabsmc_interfacewrapper.cpp b/Drivers/ScanLabSMC/Interfaces/libmcdriver_scanlabsmc_interfacewrapper.cpp index 4a287526..387d28b0 100644 --- a/Drivers/ScanLabSMC/Interfaces/libmcdriver_scanlabsmc_interfacewrapper.cpp +++ b/Drivers/ScanLabSMC/Interfaces/libmcdriver_scanlabsmc_interfacewrapper.cpp @@ -705,6 +705,54 @@ LibMCDriver_ScanLabSMCResult libmcdriver_scanlabsmc_smcjob_getjobduration(LibMCD } } +LibMCDriver_ScanLabSMCResult libmcdriver_scanlabsmc_smcjob_executelaserinitsequence(LibMCDriver_ScanLabSMC_SMCJob pSMCJob) +{ + IBase* pIBaseClass = (IBase *)pSMCJob; + + try { + ISMCJob* pISMCJob = dynamic_cast(pIBaseClass); + if (!pISMCJob) + throw ELibMCDriver_ScanLabSMCInterfaceException(LIBMCDRIVER_SCANLABSMC_ERROR_INVALIDCAST); + + pISMCJob->ExecuteLaserInitSequence(); + + return LIBMCDRIVER_SCANLABSMC_SUCCESS; + } + catch (ELibMCDriver_ScanLabSMCInterfaceException & Exception) { + return handleLibMCDriver_ScanLabSMCException(pIBaseClass, Exception); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException); + } + catch (...) { + return handleUnhandledException(pIBaseClass); + } +} + +LibMCDriver_ScanLabSMCResult libmcdriver_scanlabsmc_smcjob_executelasershutdownsequence(LibMCDriver_ScanLabSMC_SMCJob pSMCJob) +{ + IBase* pIBaseClass = (IBase *)pSMCJob; + + try { + ISMCJob* pISMCJob = dynamic_cast(pIBaseClass); + if (!pISMCJob) + throw ELibMCDriver_ScanLabSMCInterfaceException(LIBMCDRIVER_SCANLABSMC_ERROR_INVALIDCAST); + + pISMCJob->ExecuteLaserShutdownSequence(); + + return LIBMCDRIVER_SCANLABSMC_SUCCESS; + } + catch (ELibMCDriver_ScanLabSMCInterfaceException & Exception) { + return handleLibMCDriver_ScanLabSMCException(pIBaseClass, Exception); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException); + } + catch (...) { + return handleUnhandledException(pIBaseClass); + } +} + /************************************************************************************************************************* Class implementation for SMCConfiguration @@ -2201,6 +2249,10 @@ LibMCDriver_ScanLabSMCResult LibMCDriver_ScanLabSMC::Impl::LibMCDriver_ScanLabSM *ppProcAddress = (void*) &libmcdriver_scanlabsmc_smcjob_getjobcharacteristic; if (sProcName == "libmcdriver_scanlabsmc_smcjob_getjobduration") *ppProcAddress = (void*) &libmcdriver_scanlabsmc_smcjob_getjobduration; + if (sProcName == "libmcdriver_scanlabsmc_smcjob_executelaserinitsequence") + *ppProcAddress = (void*) &libmcdriver_scanlabsmc_smcjob_executelaserinitsequence; + if (sProcName == "libmcdriver_scanlabsmc_smcjob_executelasershutdownsequence") + *ppProcAddress = (void*) &libmcdriver_scanlabsmc_smcjob_executelasershutdownsequence; if (sProcName == "libmcdriver_scanlabsmc_smcconfiguration_setdynamicviolationreaction") *ppProcAddress = (void*) &libmcdriver_scanlabsmc_smcconfiguration_setdynamicviolationreaction; if (sProcName == "libmcdriver_scanlabsmc_smcconfiguration_getdynamicviolationreaction")