public ScpiIOResult Close() { try { return(MakeError(Visa.viClose(instrument))); } finally { Visa.viClose(rm); instrument = Visa.VI_NULL; } }
private static string[] GetDeviceAddresses() { var rm = GetResourceManager(); if (rm == Visa.VI_NULL) { return(new string[0]); } int search, cnt; StringBuilder sb = new StringBuilder(1024); if (Visa.viFindRsrc(rm, "?*", out search, out cnt, sb) >= Visa.VI_SUCCESS) { string[] res = new string[cnt]; if (cnt > 0) { res[0] = sb.ToString(); } int i = 1; while ((cnt-- > 0) && (Visa.viFindNext(search, sb) == Visa.VI_SUCCESS)) { res[i++] = sb.ToString(); } if (i < res.Length) { Array.Resize(ref res, i); } Visa.viClose(search); return(res); } return(new string[0]); }