Beispiel #1
0
        public static SignalGenerator Connect(string currentAddress, SignalGenerator.ValidateSupportDelegate supportDelegate, bool interactive)
        {
            SignalGenerator AnalogSignalGenerator = null;
            string          str = (currentAddress != null ? currentAddress : "GPIB0::19::INSTR");

            SignalGenerator.m_validateSupportDelegate = supportDelegate;
            if (interactive)
            {
                throw new Exception("不支持交互模式");
            }
            try
            {
                string str1 = SignalGenerator.DetermineSupport(str);
                if (str1 != null)
                {
                    throw new Exception(str1);
                }
                AnalogSignalGenerator = SignalGenerator.CreateDetectedAnalogSignalGenerator(str);
            }
            catch
            {
                //throw;
            }
            SignalGenerator.m_validateSupportDelegate = null;
            if (AnalogSignalGenerator != null)
            {
                AnalogSignalGenerator.Connected   = true;
                SignalGenerator.m_FirmwareVersion = AnalogSignalGenerator.GetFirmwareVersion(AnalogSignalGenerator);
            }
            return(AnalogSignalGenerator);
        }
Beispiel #2
0
        private static string DetermineSupport(string address)
        {
            if (VectorSignalGenerator.m_validateSupportDelegate == null)
            {
                return(null);
            }
            SignalGenerator AnalogSignalGenerator = null;

            try
            {
                AnalogSignalGenerator = SignalGenerator.CreateDetectedAnalogSignalGenerator(address);
            }
            catch
            {
                throw;
            }
            if (AnalogSignalGenerator == null)
            {
                return("无法识别对应的模拟信号源");
            }
            return(SignalGenerator.m_validateSupportDelegate(AnalogSignalGenerator));
        }