/// <summary> /// 示波器连接 /// </summary> /// <param name="currentAddress"></param> /// <param name="supportDelegate"></param> /// <param name="interactive"></param> /// <returns></returns> public static OSCBase Connect(string currentAddress = null, OSCBase.ValidateSupportDelegate supportDelegate = null, bool interactive = true) { OSCBase Oscillo = null; string str = (currentAddress != null ? currentAddress : "GPIB0::18::INSTR"); OSCBase.m_validateSupportDelegate = supportDelegate; if (interactive) { throw new Exception("不支持交互模式"); } try { if (OSCBase.DetermineSupport(str) == null) { Oscillo = OSCBase.CreateDetectedOscillo(str); } } catch { //throw; } OSCBase.m_validateSupportDelegate = null; if (Oscillo != null) { Oscillo.Connected = true; } return(Oscillo); }
/// <summary> /// 作为接收机对外公布接口 /// </summary> /// <param name="visaAddr">visa地址</param> /// <param name="inModelKey">选型的key值</param> /// <returns>创建的对象</returns> public static OSCBase CreateObj(string visaAddr) { OSCBase tmpObj = null; try { } catch (Exception) { } return(tmpObj); }
/// <summary> /// 示波器识别(确认支持该仪表) /// </summary> /// <param name="address">地址</param> /// <returns></returns> private static string DetermineSupport(string address) { if (OSCBase.m_validateSupportDelegate == null) { return(null); } OSCBase Oscillo = null; try { Oscillo = OSCBase.CreateDetectedOscillo(address); } catch { throw; } if (Oscillo == null) { return("无法识别对应的示波器"); } return(OSCBase.m_validateSupportDelegate(Oscillo)); }