Ejemplo n.º 1
0
        /// <summary>
        /// 连接光谱仪
        /// </summary>
        public override bool Connect()
        {
            bool result = Types.InstrumentTypeBase.Connect();

            baseObj = Types.InstrumentTypeBase.baseObj;
            return(result);
        }
        /// <summary>
        /// 初始化仪器操作接口
        /// </summary>
        /// <param name="ins">1,光纤,2:积分球,6:积分球+透射</param>
        private static bool InitInstrumentObject(int type)
        {
            info = new InstrumentInterface.InstrumentInfo();
            info.instrumentFactor = FTNirInterface.enumInstrumentFactor.Vspec;
            //判断仪器是否是积分球类型
            string jsonString = GetParametersTable();

            if (jsonString != null)
            {
                JsonString.ParametersTable par = JsonString.JsonToObj <JsonString.ParametersTable>(jsonString);
                info.serialNumber = par.serialNum;
            }
            switch (type)
            {
            case 1:
                baseObj             = new Types.Fiber();
                info.instrumentType = FTNirInterface.enumInstrumentType.Fiber;
                return(true);

            case 2:
                baseObj             = new Types.IntegratingSphere();
                info.instrumentType = FTNirInterface.enumInstrumentType.IntegratingSphere;
                return(true);

            case 6:
                baseObj             = new Types.IntegratingSphereTrans();
                info.instrumentType = FTNirInterface.enumInstrumentType.QuasIR;
                return(true);

            default:
                errorCode = -19; return(false);
            }
        }