You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cbhw. should throw an error when the true instrument IP is not as configured. For example, on my 257-512ch hub, the instrument IP is hard coded to 192.168.137.201. I then tell python to use the instrument address 192.168.137.200 in the hub object, call cbsdk.connect with the hub object, and got no connection error. Confirmed that an error should have been received because run_level = 0 after cbsdk.connect() ran with no errors.
The text was updated successfully, but these errors were encountered:
Currently an error is logged. This is what I get when I try to cbsdk.connect(device_obj, startup_sequence=True) when device_obj params points to an IP that I know is not connected.
Did not receive SYSREPRUNLEV in expected timeout.
Device did not reply to startup sequence. This could be caused by a network problem or by a protocol mismatch.
However, this is just a printout and it's easy to miss if you aren't paying attention. It does not raise an error.
This is one of those quirks that arises as a result of the cbsdk serving as a prototype to a C interface. In C, it's quite normal for a failed connection to return some sort of int that the client must check and act accordingly, e.g. by exiting gracefully. Whereas in Python, it's the norm to raise an error, and the client can catch the error and respond accordingly.
I would like to keep the pseudo-C interface in cbsdk. I think that your Python code should instead interface with nsp.NSPDevice.
But... that object's connect doesn't raise an error either yet, but it could, and without breaking my design! That would be more pythonic and user-friendly. For the pseudo-C API, the thin cbsdk layer can catch the error and return an error int.
This will require a bit of refactoring on my part.
In the interim, I suggest you modify your code to check that .connect(...) == 50.
cboulay
changed the title
No error reported when configured instr-addr and actual instr-addr are different
NSPDevice should raise error on failed connection and cbsdk should return runlevel
Mar 12, 2024
cbhw. should throw an error when the true instrument IP is not as configured. For example, on my 257-512ch hub, the instrument IP is hard coded to 192.168.137.201. I then tell python to use the instrument address 192.168.137.200 in the hub object, call cbsdk.connect with the hub object, and got no connection error. Confirmed that an error should have been received because run_level = 0 after cbsdk.connect() ran with no errors.
The text was updated successfully, but these errors were encountered: