Example #1
0
        public static NetworkAnalyzer Connect(string currentAddress, NetworkAnalyzer.ValidateSupportDelegate supportDelegate, bool interactive)
        {
            NetworkAnalyzer ANetworkAnalyzer = null;
            string          str = (currentAddress != null ? currentAddress : "GPIB0::18::INSTR");

            NetworkAnalyzer.m_validateSupportDelegate = supportDelegate;
            if (interactive)
            {
                throw new Exception("不支持交互模式");
            }
            try
            {
                if (NetworkAnalyzer.DetermineSupport(str) == null)
                {
                    ANetworkAnalyzer = NetworkAnalyzer.CreateDetectedNetworkAnalyzer(str);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            NetworkAnalyzer.m_validateSupportDelegate = null;
            if (ANetworkAnalyzer != null)
            {
                ANetworkAnalyzer.Connected = true;
            }
            return(ANetworkAnalyzer);
        }
Example #2
0
        public static NetworkAnalyzer CreateDetectedNetworkAnalyzer(string address)
        {
            NetworkAnalyzer APna;

            try
            {
                string str = ScpiInstrument.DetermineModel(address);
                if (!NetworkAnalyzer.IsPNA(str))
                {
                    throw new Exception(string.Concat(str, " ,不支持对应型号的网络分析仪"));
                }
                APna = new AgilentPNA(address);
            }
            catch (Exception exception)
            {
                throw new Exception(string.Concat("连接矢网错误: ", exception.Message));
            }
            return(APna);
        }
Example #3
0
        private static string DetermineSupport(string address)
        {
            if (NetworkAnalyzer.m_validateSupportDelegate == null)
            {
                return(null);
            }
            NetworkAnalyzer spectrumAnalyzer = null;

            try
            {
                spectrumAnalyzer = NetworkAnalyzer.CreateDetectedNetworkAnalyzer(address);
            }
            catch
            {
                throw;
            }
            if (spectrumAnalyzer == null)
            {
                return("无法识别对应的矢网");
            }
            return(NetworkAnalyzer.m_validateSupportDelegate(spectrumAnalyzer));
        }