02-12-2025 09:37 AM
I am facing an interesting problem, that I would guess, can be easily explained with compatibility issues.
We are using TS 2021 SP1 and have a DLL which describes communication with our particular device. I am configuring custom step types for common functions of the device and can use it with a direct call.
But the problem occurs when I try to use it within the step's Substeps. For example, I need to open a COM port, receive the handle object, use it for communication and then close/release it. For whatever reason, even though I see an object being created, it is unable to communicate with the device.
If I move the function to general adapter's code module it works... Is this simply a compatibility issue? DLL is in .NET 4.7.2
Settings are identical
02-12-2025 10:11 AM
Where are you storing the handle?
02-13-2025 12:35 AM
Originally, idea of the framework was to have it in StationGlobals. For debugging purposes, we tried to store it everywhere, locals, fileglobals,stationglobals.
02-13-2025 12:59 AM
Not directly related to the issue you are seeing...
From what I understood from the initial post, the StepType is supposed to open the COM, so the CodeModule can do stuff with it. After the execution of the CodeModule the COM is closed.
If that is the case, IMHO the COM handle should bet stored somewhere in the Step data structure, since it is associated to the particular step only.
Focussing on the current issue... In the StepType definition, you are only having that single PreStep, right?
02-13-2025 02:49 AM
To your first topic - yes and no, later down the road we will have functionality like this, so that one step would have multiple functions (e.g. Open, Read, Write, Close), but currently it should only OPEN the port and store the handle in variable.
And the current issue - yes, we have only 1 PreStep, which should Open the port.
I should add, that if I open the Port from the Pre-Step, I can not even close it using the returned handle, I have to re-plug the device in order to get the COM working again.
02-13-2025 03:03 AM
@luklem wrote:
I should add, that if I open the Port from the Pre-Step, I can not even close it using the returned handle, I have to re-plug the device in order to get the COM working again.
Can you try "Unload Code Modules" instead of unplugging the device?