Example #1
0
        /// <summary>
        /// 方法:设置触发信号边缘
        /// [注:用于触发源为硬触发]
        /// </summary>
        /// <param name="dege">边缘信号</param>
        /// <returns></returns>
        protected override bool DoSetTriggerActivation(ProCommon.Communal.EffectiveSignal edge)
        {
            bool rt = false;

            try
            {
                if (_deviceRef != null)
                {
                    switch (edge)
                    {
                    case ProCommon.Communal.EffectiveSignal.FallEdge:
                    {
                        using (ThridLibray.IEnumParameter p = _deviceRef.ParameterCollection[ThridLibray.ParametrizeNameSet.TriggerActivation])
                        {
                            rt = p.SetValue("FallingEdge");
                        }
                    }
                    break;

                    case ProCommon.Communal.EffectiveSignal.RaiseEdge:
                    {
                        using (ThridLibray.IEnumParameter p = _deviceRef.ParameterCollection[ThridLibray.ParametrizeNameSet.TriggerActivation])
                        {
                            rt = p.SetValue("RisingEdge");
                        }
                    }
                    break;

                    default:
                        break;
                    }
                }

                rt = true;
                if (!rt)
                {
                    if (DriverExceptionDel != null)
                    {
                        DriverExceptionDel(string.Format("错误:大华相机触信号边沿设置失败!\n错误代码:{0:X8}", 99));
                    }
                }
            }
            catch
            {
            }
            finally
            {
            }
            return(rt);
        }
Example #2
0
        /// <summary>
        /// 打开设备
        /// </summary>
        /// <returns></returns>
        protected override bool DoOpen()
        {
            bool rt = false;

            try
            {
                if (_deviceRef != null)
                {
                    if (!_deviceRef.IsOpen)
                    {
                        rt = _deviceRef.Open();
                    }

                    if (!rt)
                    {
                        if (DriverExceptionDel != null)
                        {
                            DriverExceptionDel(string.Format("错误:大华相机打开失败!\n错误代码:{0:X8}", 99));
                        }
                    }
                    else
                    {
                        /* 设置缓存个数为8(默认值为16) */
                        /* set buffer count to 8 (default 16) */
                        _deviceRef.StreamGrabber.SetBufferCount(8);

                        /* 设置图像格式 */
                        /* set PixelFormat */
                        using (ThridLibray.IEnumParameter p = _deviceRef.ParameterCollection[ThridLibray.ParametrizeNameSet.ImagePixelFormat])
                        {
                            p.SetValue("Mono8");
                        }
                    }
                }
            }
            catch
            {
            }
            finally
            {
            }
            return(rt);
        }