public static VectorSignalGenerator ConnectVecorSG(string currentAddress, SignalGenerator.ValidateSupportDelegate supportDelegate, bool interactive) { VectorSignalGenerator VectorSigGen = null; string str = (currentAddress != null ? currentAddress : "GPIB0::19::INSTR"); SignalGenerator.m_validateSupportDelegate = supportDelegate; if (interactive) { throw new Exception("不支持交互模式"); } try { string str1 = VectorSignalGenerator.DetermineSupport(str); if (str1 != null) { throw new Exception(str1); } VectorSigGen = VectorSignalGenerator.CreateDetectedVectorSignalGenerator(str); } catch { throw; } VectorSignalGenerator.m_validateSupportDelegate = null; if (VectorSigGen != null) { VectorSigGen.Connected = true; VectorSigGen.m_firmwareVersion = VectorSigGen.GetFirmwareVersion(VectorSigGen); } return(VectorSigGen); }
private static string DetermineSupport(string address) { if (SignalGenerator.m_validateSupportDelegate == null) { return(null); } VectorSignalGenerator VectorSignalGenerator = null; try { VectorSignalGenerator = VectorSignalGenerator.CreateDetectedVectorSignalGenerator(address); } catch { throw; } if (VectorSignalGenerator == null) { return("无法识别信号源"); } return(SignalGenerator.m_validateSupportDelegate(VectorSignalGenerator)); }