Skip to content

Commit e688950

Browse files
authored
Scanlab SMC Driver: Implements commands to execute laser init/shutdown sequence (#29)
* Extends ISMCJob interface with ExecuteLaser(Init/Shutdown)Sequence * Implements API to ExecuteLaser(Init/Shutdown)Sequence Signed-off-by: Yury Rodzikau <[email protected]>
1 parent 89a3478 commit e688950

12 files changed

+191
-0
lines changed

Drivers/ScanLabSMC/ACT/LibMCDriver_ScanLabSMC.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,11 @@ Custom implementation
340340
<param name="JobDuration" type="double" pass="return" description="Duration in seconds." />
341341
</method>
342342

343+
<method name="ExecuteLaserInitSequence" description="Starts the laser initialization sequence.">
344+
</method>
345+
346+
<method name="ExecuteLaserShutdownSequence" description="Starts the laser shutdown sequence.">
347+
</method>
343348

344349
</class>
345350

Drivers/ScanLabSMC/Headers/CppDynamic/libmcdriver_scanlabsmc_dynamic.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,22 @@ typedef LibMCDriver_ScanLabSMCResult (*PLibMCDriver_ScanLabSMCSMCJob_GetJobChara
271271
*/
272272
typedef LibMCDriver_ScanLabSMCResult (*PLibMCDriver_ScanLabSMCSMCJob_GetJobDurationPtr) (LibMCDriver_ScanLabSMC_SMCJob pSMCJob, LibMCDriver_ScanLabSMC_double * pJobDuration);
273273

274+
/**
275+
* Starts the laser initialization sequence.
276+
*
277+
* @param[in] pSMCJob - SMCJob instance.
278+
* @return error code or 0 (success)
279+
*/
280+
typedef LibMCDriver_ScanLabSMCResult (*PLibMCDriver_ScanLabSMCSMCJob_ExecuteLaserInitSequencePtr) (LibMCDriver_ScanLabSMC_SMCJob pSMCJob);
281+
282+
/**
283+
* Starts the laser shutdown sequence.
284+
*
285+
* @param[in] pSMCJob - SMCJob instance.
286+
* @return error code or 0 (success)
287+
*/
288+
typedef LibMCDriver_ScanLabSMCResult (*PLibMCDriver_ScanLabSMCSMCJob_ExecuteLaserShutdownSequencePtr) (LibMCDriver_ScanLabSMC_SMCJob pSMCJob);
289+
274290
/*************************************************************************************************************************
275291
Class definition for SMCConfiguration
276292
**************************************************************************************************************************/
@@ -858,6 +874,8 @@ typedef struct {
858874
PLibMCDriver_ScanLabSMCSMCJob_LoadSimulationDataPtr m_SMCJob_LoadSimulationData;
859875
PLibMCDriver_ScanLabSMCSMCJob_GetJobCharacteristicPtr m_SMCJob_GetJobCharacteristic;
860876
PLibMCDriver_ScanLabSMCSMCJob_GetJobDurationPtr m_SMCJob_GetJobDuration;
877+
PLibMCDriver_ScanLabSMCSMCJob_ExecuteLaserInitSequencePtr m_SMCJob_ExecuteLaserInitSequence;
878+
PLibMCDriver_ScanLabSMCSMCJob_ExecuteLaserShutdownSequencePtr m_SMCJob_ExecuteLaserShutdownSequence;
861879
PLibMCDriver_ScanLabSMCSMCConfiguration_SetDynamicViolationReactionPtr m_SMCConfiguration_SetDynamicViolationReaction;
862880
PLibMCDriver_ScanLabSMCSMCConfiguration_GetDynamicViolationReactionPtr m_SMCConfiguration_GetDynamicViolationReaction;
863881
PLibMCDriver_ScanLabSMCSMCConfiguration_SetWarnLevelPtr m_SMCConfiguration_SetWarnLevel;

Drivers/ScanLabSMC/Headers/CppDynamic/libmcdriver_scanlabsmc_dynamic.hpp

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,8 @@ class CSMCJob : public CBase {
554554
inline void LoadSimulationData(classParam<LibMCEnv::CDataTable> pSimulationDataTable);
555555
inline LibMCDriver_ScanLabSMC_double GetJobCharacteristic(const eJobCharacteristic eValueType);
556556
inline LibMCDriver_ScanLabSMC_double GetJobDuration();
557+
inline void ExecuteLaserInitSequence();
558+
inline void ExecuteLaserShutdownSequence();
557559
};
558560

559561
/*************************************************************************************************************************
@@ -796,6 +798,8 @@ class CDriver_ScanLabSMC : public CDriver {
796798
pWrapperTable->m_SMCJob_LoadSimulationData = nullptr;
797799
pWrapperTable->m_SMCJob_GetJobCharacteristic = nullptr;
798800
pWrapperTable->m_SMCJob_GetJobDuration = nullptr;
801+
pWrapperTable->m_SMCJob_ExecuteLaserInitSequence = nullptr;
802+
pWrapperTable->m_SMCJob_ExecuteLaserShutdownSequence = nullptr;
799803
pWrapperTable->m_SMCConfiguration_SetDynamicViolationReaction = nullptr;
800804
pWrapperTable->m_SMCConfiguration_GetDynamicViolationReaction = nullptr;
801805
pWrapperTable->m_SMCConfiguration_SetWarnLevel = nullptr;
@@ -1091,6 +1095,24 @@ class CDriver_ScanLabSMC : public CDriver {
10911095
if (pWrapperTable->m_SMCJob_GetJobDuration == nullptr)
10921096
return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT;
10931097

1098+
#ifdef _WIN32
1099+
pWrapperTable->m_SMCJob_ExecuteLaserInitSequence = (PLibMCDriver_ScanLabSMCSMCJob_ExecuteLaserInitSequencePtr) GetProcAddress(hLibrary, "libmcdriver_scanlabsmc_smcjob_executelaserinitsequence");
1100+
#else // _WIN32
1101+
pWrapperTable->m_SMCJob_ExecuteLaserInitSequence = (PLibMCDriver_ScanLabSMCSMCJob_ExecuteLaserInitSequencePtr) dlsym(hLibrary, "libmcdriver_scanlabsmc_smcjob_executelaserinitsequence");
1102+
dlerror();
1103+
#endif // _WIN32
1104+
if (pWrapperTable->m_SMCJob_ExecuteLaserInitSequence == nullptr)
1105+
return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT;
1106+
1107+
#ifdef _WIN32
1108+
pWrapperTable->m_SMCJob_ExecuteLaserShutdownSequence = (PLibMCDriver_ScanLabSMCSMCJob_ExecuteLaserShutdownSequencePtr) GetProcAddress(hLibrary, "libmcdriver_scanlabsmc_smcjob_executelasershutdownsequence");
1109+
#else // _WIN32
1110+
pWrapperTable->m_SMCJob_ExecuteLaserShutdownSequence = (PLibMCDriver_ScanLabSMCSMCJob_ExecuteLaserShutdownSequencePtr) dlsym(hLibrary, "libmcdriver_scanlabsmc_smcjob_executelasershutdownsequence");
1111+
dlerror();
1112+
#endif // _WIN32
1113+
if (pWrapperTable->m_SMCJob_ExecuteLaserShutdownSequence == nullptr)
1114+
return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT;
1115+
10941116
#ifdef _WIN32
10951117
pWrapperTable->m_SMCConfiguration_SetDynamicViolationReaction = (PLibMCDriver_ScanLabSMCSMCConfiguration_SetDynamicViolationReactionPtr) GetProcAddress(hLibrary, "libmcdriver_scanlabsmc_smcconfiguration_setdynamicviolationreaction");
10961118
#else // _WIN32
@@ -1695,6 +1717,14 @@ class CDriver_ScanLabSMC : public CDriver {
16951717
if ( (eLookupError != 0) || (pWrapperTable->m_SMCJob_GetJobDuration == nullptr) )
16961718
return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT;
16971719

1720+
eLookupError = (*pLookup)("libmcdriver_scanlabsmc_smcjob_executelaserinitsequence", (void**)&(pWrapperTable->m_SMCJob_ExecuteLaserInitSequence));
1721+
if ( (eLookupError != 0) || (pWrapperTable->m_SMCJob_ExecuteLaserInitSequence == nullptr) )
1722+
return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT;
1723+
1724+
eLookupError = (*pLookup)("libmcdriver_scanlabsmc_smcjob_executelasershutdownsequence", (void**)&(pWrapperTable->m_SMCJob_ExecuteLaserShutdownSequence));
1725+
if ( (eLookupError != 0) || (pWrapperTable->m_SMCJob_ExecuteLaserShutdownSequence == nullptr) )
1726+
return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT;
1727+
16981728
eLookupError = (*pLookup)("libmcdriver_scanlabsmc_smcconfiguration_setdynamicviolationreaction", (void**)&(pWrapperTable->m_SMCConfiguration_SetDynamicViolationReaction));
16991729
if ( (eLookupError != 0) || (pWrapperTable->m_SMCConfiguration_SetDynamicViolationReaction == nullptr) )
17001730
return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT;
@@ -2180,6 +2210,22 @@ class CDriver_ScanLabSMC : public CDriver {
21802210
return resultJobDuration;
21812211
}
21822212

2213+
/**
2214+
* CSMCJob::ExecuteLaserInitSequence - Starts the laser initialization sequence.
2215+
*/
2216+
void CSMCJob::ExecuteLaserInitSequence()
2217+
{
2218+
CheckError(m_pWrapper->m_WrapperTable.m_SMCJob_ExecuteLaserInitSequence(m_pHandle));
2219+
}
2220+
2221+
/**
2222+
* CSMCJob::ExecuteLaserShutdownSequence - Starts the laser shutdown sequence.
2223+
*/
2224+
void CSMCJob::ExecuteLaserShutdownSequence()
2225+
{
2226+
CheckError(m_pWrapper->m_WrapperTable.m_SMCJob_ExecuteLaserShutdownSequence(m_pHandle));
2227+
}
2228+
21832229
/**
21842230
* Method definitions for class CSMCConfiguration
21852231
*/

Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_sdk.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ CScanLabSMCSDK::CScanLabSMCSDK(const std::string& sDLLNameUTF8, const std::strin
170170
this->slsc_job_stop_record = (PScanLabSMCPtr_slsc_job_stop_record)_loadScanLabSMCAddress(hLibrary, "slsc_job_stop_record");
171171
this->slsc_ctrl_log_record = (PScanLabSMCPtr_slsc_ctrl_log_record)_loadScanLabSMCAddress(hLibrary, "slsc_ctrl_log_record");
172172

173+
this->slsc_ctrl_exec_init_laser_sequence = (PScanLabSMCPtr_slsc_ctrl_exec_init_laser_sequence)_loadScanLabSMCAddress(hLibrary, "slsc_ctrl_exec_init_laser_sequence");
174+
this->slsc_ctrl_exec_shutdown_laser_sequence = (PScanLabSMCPtr_slsc_ctrl_exec_shutdown_laser_sequence)_loadScanLabSMCAddress(hLibrary, "slsc_ctrl_exec_shutdown_laser_sequence");
175+
173176
m_LibraryHandle = (void*) hLibrary;
174177
}
175178

Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_sdk.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ namespace LibMCDriver_ScanLabSMC {
236236
typedef slscReturnValue(SCANLABSMC_CALLINGCONVENTION* PScanLabSMCPtr_slsc_job_stop_record) (size_t Handle);
237237
typedef slscReturnValue(SCANLABSMC_CALLINGCONVENTION* PScanLabSMCPtr_slsc_ctrl_log_record) (size_t Handle, const char* DatasetPath, slsc_TransformationStep Step);
238238

239+
typedef slscReturnValue(SCANLABSMC_CALLINGCONVENTION* PScanLabSMCPtr_slsc_ctrl_exec_init_laser_sequence) (size_t Handle);
240+
typedef slscReturnValue(SCANLABSMC_CALLINGCONVENTION* PScanLabSMCPtr_slsc_ctrl_exec_shutdown_laser_sequence) (size_t Handle);
241+
239242
class CScanLabSMCSDK_DLLDirectoryCache {
240243
private:
241244
#ifdef _WIN32
@@ -294,6 +297,8 @@ namespace LibMCDriver_ScanLabSMC {
294297
PScanLabSMCPtr_slsc_job_start_record slsc_job_start_record = nullptr;
295298
PScanLabSMCPtr_slsc_job_stop_record slsc_job_stop_record = nullptr;
296299
PScanLabSMCPtr_slsc_ctrl_log_record slsc_ctrl_log_record = nullptr;
300+
PScanLabSMCPtr_slsc_ctrl_exec_init_laser_sequence slsc_ctrl_exec_init_laser_sequence = nullptr;
301+
PScanLabSMCPtr_slsc_ctrl_exec_shutdown_laser_sequence slsc_ctrl_exec_shutdown_laser_sequence = nullptr;
297302

298303
CScanLabSMCSDK(const std::string & sDLLNameUTF8, const std::string& sDLLDirectoryUTF8);
299304
~CScanLabSMCSDK();

Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjob.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,13 @@ LibMCDriver_ScanLabSMC_double CSMCJob::GetJobDuration()
141141
{
142142
return m_pJobInstance->GetJobDuration ();
143143
}
144+
145+
void CSMCJob::ExecuteLaserInitSequence()
146+
{
147+
m_pJobInstance->ExecuteLaserInitSequence();
148+
}
149+
150+
void CSMCJob::ExecuteLaserShutdownSequence()
151+
{
152+
m_pJobInstance->ExecuteLaserShutdownSequence();
153+
}

Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjob.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ class CSMCJob : public virtual ISMCJob, public virtual CBase {
100100

101101
LibMCDriver_ScanLabSMC_double GetJobDuration() override;
102102

103+
void ExecuteLaserInitSequence() override;
104+
105+
void ExecuteLaserShutdownSequence() override;
106+
103107
};
104108

105109
} // namespace Impl

Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjobinstance.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,24 @@ double CSMCJobInstance::GetJobDuration()
661661

662662
}
663663

664+
void CSMCJobInstance::ExecuteLaserInitSequence()
665+
{
666+
auto contextHandle = m_pContextHandle->getHandle();
667+
668+
std::cout << "Executing laser init sequence" << std::endl;
669+
670+
m_pSDK->checkError(contextHandle, m_pSDK->slsc_ctrl_exec_init_laser_sequence(contextHandle));
671+
}
672+
673+
void CSMCJobInstance::ExecuteLaserShutdownSequence()
674+
{
675+
auto contextHandle = m_pContextHandle->getHandle();
676+
677+
std::cout << "Executing laser shutdown sequence" << std::endl;
678+
679+
m_pSDK->checkError(contextHandle, m_pSDK->slsc_ctrl_exec_shutdown_laser_sequence(contextHandle));
680+
}
681+
664682
void CSMCJobInstance::ReadSimulationFile(LibMCEnv::PDataTable pDataTable)
665683
{
666684
slsc_VersionInfo version = m_pSDK->slsc_cfg_get_scanmotioncontrol_version();

Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjobinstance.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ class CSMCJobInstance {
106106

107107
double GetJobDuration();
108108

109+
void ExecuteLaserInitSequence();
110+
111+
void ExecuteLaserShutdownSequence();
112+
109113
private:
110114

111115
void ReadSimulationFile_SMC_v0_8(LibMCEnv::PDataTable pDataTable);

Drivers/ScanLabSMC/Interfaces/libmcdriver_scanlabsmc_abi.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,22 @@ LIBMCDRIVER_SCANLABSMC_DECLSPEC LibMCDriver_ScanLabSMCResult libmcdriver_scanlab
284284
*/
285285
LIBMCDRIVER_SCANLABSMC_DECLSPEC LibMCDriver_ScanLabSMCResult libmcdriver_scanlabsmc_smcjob_getjobduration(LibMCDriver_ScanLabSMC_SMCJob pSMCJob, LibMCDriver_ScanLabSMC_double * pJobDuration);
286286

287+
/**
288+
* Starts the laser initialization sequence.
289+
*
290+
* @param[in] pSMCJob - SMCJob instance.
291+
* @return error code or 0 (success)
292+
*/
293+
LIBMCDRIVER_SCANLABSMC_DECLSPEC LibMCDriver_ScanLabSMCResult libmcdriver_scanlabsmc_smcjob_executelaserinitsequence(LibMCDriver_ScanLabSMC_SMCJob pSMCJob);
294+
295+
/**
296+
* Starts the laser shutdown sequence.
297+
*
298+
* @param[in] pSMCJob - SMCJob instance.
299+
* @return error code or 0 (success)
300+
*/
301+
LIBMCDRIVER_SCANLABSMC_DECLSPEC LibMCDriver_ScanLabSMCResult libmcdriver_scanlabsmc_smcjob_executelasershutdownsequence(LibMCDriver_ScanLabSMC_SMCJob pSMCJob);
302+
287303
/*************************************************************************************************************************
288304
Class definition for SMCConfiguration
289305
**************************************************************************************************************************/

0 commit comments

Comments
 (0)