public override bool Init(HardwareData hardeareData) { bInitOk = false; #region TCP/IP if (!(null == _aca500M_Camera)) { _aca500M_Camera.Dispose(); } try { aca500M_Camera = new BP.Camera(cameraData.SerialNumber); GetParameter(); if (!_aca500M_Camera.IsOpen) { _aca500M_Camera.Open(); } if (!_aca500M_Camera.StreamGrabber.IsGrabbing) { _aca500M_Camera.StreamGrabber.Start(cameraData.maxPictureNumber, GrabStrategy.OneByOne, GrabLoop.ProvidedByUser); bAsync = false; } bInitOk = true; } catch (Exception ex) { MessageBox.Show(ex.Message); } #endregion return(bInitOk); }
/// <summary> /// 关闭相机,停止抓取相机并断开相机连接 /// </summary> public override bool CloseCamera() { try { #if (SDK) if (g_BaseParCamera.BlUsingTrigger) { //关闭软触发 } if (g_Camera != null && g_Camera.IsOpen && g_Camera.StreamGrabber.IsGrabbing) { g_Camera.StreamGrabber.Stop(); g_Camera.Close(); g_Camera.Dispose(); g_Camera = null; } #endif return(true); } catch (Exception ex) { Log.L_I.WriteError(NameClass, ex); return(false); } }
public override void Close() { try { IsLink = false; // Reset the stopwatch. //stopWatch.Reset(); if (g_camera != null) { // Stop the grabbing. g_camera.StreamGrabber.Stop(); // Close the connection to the camera device. g_camera.Close(); g_camera.Dispose(); g_camera = null; } if (m_latestFrameAddress != IntPtr.Zero) { Marshal.FreeHGlobal(m_latestFrameAddress); m_latestFrameAddress = IntPtr.Zero; } } catch (Exception ex) {/* * Util.WriteLog(this.GetType(), ex); * Util.Notify("相机关闭异常");*/ } }
public override bool CloseCamera() { camera1.StreamGrabber.Stop(); camera1.Close(); camera1.Dispose(); camera1 = null; return(true); }
public short Close() { if (camera == null) { return(-1); } else { camera.Close(); camera.Dispose(); camera = null; return(0); } }
public override void Close() { try { objDev.Close(); objDev.Dispose(); if (latestFrameAddress != null) { Marshal.FreeHGlobal(latestFrameAddress); latestFrameAddress = IntPtr.Zero; } } catch (Exception e) { ShowException(e); } }
/// <summary> /// 关闭相机 /// </summary> /// <returns></returns> public override bool DoClose() { bool rt = false; try { if (_device != null) { SetFreeRun(); _device.Close(); _device.Dispose(); rt = true; } else { if (DriverExceptionDel != null) { DriverExceptionDel(string.Format("错误:巴斯勒相机关闭失败!\n:{0}", "设备未连接")); } } } catch (System.Exception ex) { if (DriverExceptionDel != null) { DriverExceptionDel(string.Format("错误:巴斯勒相机关闭失败!\n错误描述:{0}", ex.Message)); } } finally { } return(rt); }