Пример #1
0
        /// <summary>
        /// 方法:设置采集模式
        /// </summary>
        /// <param name="acqmode"></param>
        /// 0-连续采集,触发采集[1-单帧模式,2-多帧模式]
        /// <param name="frameNum">
        /// 多帧模式下的帧数</param>
        /// <returns></returns>
        public override bool DoSetAcquisitionMode(ProCommon.Communal.AcquisitionMode acqmode, uint frameNum)
        {
            bool rt = false;

            try
            {
                if (_device != null)
                {
                    if (_device.StreamGrabber.IsGrabbing)
                    {
                        DoStopGrab();
                    }
                    switch (acqmode)
                    {
                    case AcquisitionMode.Continue:
                        if (SetFreeRun())
                        {
                            rt = SetContinueRun();
                        }
                        break;

                    case AcquisitionMode.ExternalTrigger:
                    {
                        if (SetExternalTrigger())
                        {
                            rt = SetFrameNumber(frameNum);
                        }
                        rt = true;
                    }
                    break;

                    case AcquisitionMode.SoftTrigger:
                    {
                        if (SetInternalTrigger())
                        {
                            rt = SetFrameNumber(frameNum);
                        }
                    }
                    break;

                    default: break;
                    }
                }
                else
                {
                    if (DriverExceptionDel != null)
                    {
                        DriverExceptionDel(string.Format("错误:巴斯勒相机设置设备采集模式失败!\n:{0}", "设备未连接"));
                    }
                }
            }
            catch
            {
            }
            finally
            {
            }

            return(rt);
        }
Пример #2
0
        /// <summary>
        /// 方法:设置采集模式
        /// </summary>
        /// <param name="acqmode"></param>
        /// <param name="frameNum"></param>
        /// <returns></returns>
        protected override bool DoSetAcquisitionMode(ProCommon.Communal.AcquisitionMode acqmode, uint frameNum)
        {
            bool rt = false;

            USBCamera.HVSTATUS status = USBCamera.HVSTATUS.STATUS_OK;
            try
            {
                if (_deviceRef != System.IntPtr.Zero)
                {
                    DoStartGrab();
                    switch (acqmode)
                    {
                    case ProCommon.Communal.AcquisitionMode.Continue:
                        status = USBCamera.API.HVSetSnapMode(_deviceRef, USBCamera.HV_SNAP_MODE.CONTINUATION);
                        USBCamera.API.HV_VERIFY(status);
                        break;

                    case ProCommon.Communal.AcquisitionMode.SoftTrigger:
                        break;

                    case ProCommon.Communal.AcquisitionMode.ExternalTrigger:
                        status = USBCamera.API.HVSetSnapMode(_deviceRef, USBCamera.HV_SNAP_MODE.TRIGGER);
                        USBCamera.API.HV_VERIFY(status);
                        break;

                    default: break;
                    }

                    rt = (USBCamera.HVSTATUS.STATUS_OK == status) ? true : false;
                    if (!rt)
                    {
                        if (DriverExceptionDel != null)
                        {
                            DriverExceptionDel(string.Format("错误:大恒USB2.0相机设置采集模式失败!\n错误代码:{0:X8}", System.Convert.ToInt32(status)));
                        }
                    }
                }
                else
                {
                    if (DriverExceptionDel != null)
                    {
                        DriverExceptionDel(string.Format("错误:大恒USB2.0相机设置设备采集模式失败!\n错误描述:{0}", "设备未连接"));
                    }
                }
            }
            catch
            {
            }
            finally
            {
            }

            return(rt);
        }
Пример #3
0
 public bool SetAcquisitionMode(ProCommon.Communal.AcquisitionMode acqmode, uint frameNum)
 {
     return(DoSetAcquisitionMode(acqmode, frameNum));
 }
Пример #4
0
 protected abstract bool DoSetAcquisitionMode(ProCommon.Communal.AcquisitionMode acqmode, uint frameNum);