12-11-2015 08:48 AM
I am using he .NET wrapper for niSwitch. In it is a function called "CanConnect", which should verify if a path is possible and/or exists between two channels. However, when I use it to test if a path is indeed available, I get a "0" returned no matter what. My understanding is that I should call it, and send three arguments: the first channel, the second channel, and the condition I'd like to check (integer values 1-6 correspond to the 6 possible conditions).
But when I call it like so:
Const PATH_DOES_EXIST = 1
result = niSwitch.CanConnect(CH2, COM2, PATH_DOES_EXIST)
I get a zero returned whether channel 2 is actually closed or not, as verified by the Soft Panel.
What am I doing wrong?
Solved! Go to Solution.
12-11-2015 12:12 PM
jvavra,
niSwitch.CanConnect will return an error code. An error code of 0 means that no errors occurred :).
I would reference the C API Help if you are looking for info on using the .NET API (it should be nearly the same).
http://zone.ni.com/reference/en-XX/help/375472C-01/switchcref/c_nisw_canconnect/
The third argument should actually be a variable. Calling that function will update the variable's value with the current status of that path between the two channels. You can later check if the Variable's value == PATH_DOES_EXIST.
Cheers!
12-11-2015 01:19 PM
Frank,
Thanks, that did it. Just needed to pass in a "Status" variable which I then read after.