public ScpiIOResult Open(string visaAddress, bool exclusiveLock) { if (instrument != Visa.VI_NULL) { throw new Exception("IO is already open"); } var res2 = Visa.viOpenDefaultRM(out rm); if (res2 < 0) { return(MakeError(res2)); } var res = Visa.viOpen(ScpiInstrument.GetResourceManager(), visaAddress, exclusiveLock ? Visa.VI_EXCLUSIVE_LOCK : Visa.VI_NO_LOCK, IOTimeoutMS, out instrument); // Use sensible defaults sendEnd = true; useTermChar = false; if (res >= 0) { SyncSettings(); } else { instrument = Visa.VI_NULL; } return(MakeError(res)); }