public void SetBlanking() { System.Diagnostics.Debug.Assert(m_pHandle != IntPtr.Zero); HVSTATUS status = USBCameraAPI.HVSetBlanking(m_pHandle, m_kHBlanking, m_kVBlanking); USBCameraAPI.HV_VERIFY(status); }
public void SetSnapSpeed() { System.Diagnostics.Debug.Assert(m_pHandle != IntPtr.Zero); HVSTATUS status = USBCameraAPI.HVSetSnapSpeed(m_pHandle, m_kSnapSpeed); USBCameraAPI.HV_VERIFY(status); }
public void SetADC() { System.Diagnostics.Debug.Assert(m_pHandle != IntPtr.Zero); HVSTATUS status = USBCameraAPI.HVADCControl(m_pHandle, (byte)HV_ADC_CONTROL.ADC_BITS, m_kADCLevel); USBCameraAPI.HV_VERIFY(status); }
public void SetResolution() { System.Diagnostics.Debug.Assert(m_pHandle != IntPtr.Zero); HVSTATUS status = USBCameraAPI.HVSetResolution(m_pHandle, m_kResolotion); USBCameraAPI.HV_VERIFY(status); }
public void BeginDevice() { if (m_pHandle == IntPtr.Zero) { HVSTATUS status = USBCameraAPI.BeginHVDevice(m_kCameraNums, ref m_pHandle); USBCameraAPI.HV_VERIFY(status); } }
public void EndDevice() { if (m_pHandle != IntPtr.Zero) { HVSTATUS status = USBCameraAPI.EndHVDevice(m_pHandle); USBCameraAPI.HV_VERIFY(status); } }
public void SetExposureTime(int exposureTime) { System.Diagnostics.Debug.Assert(m_pHandle != IntPtr.Zero); HVSTATUS status = SetExposureTime(m_OutPutWindow.Width, exposureTime, m_kLowerET, m_kHBlanking, m_kSnapSpeed, m_kResolotion); USBCameraAPI.HV_VERIFY(status); }
private void OpenSnap() { System.Diagnostics.Debug.Assert(m_Camera.GetHandle() != IntPtr.Zero); HVSTATUS status = USBCameraAPI.HVOpenSnap(m_Camera.GetHandle(), snapCallback, this.Handle); USBCameraAPI.HV_VERIFY(status); if (USBCameraAPI.HV_SUCCESS(status)) { m_bIsOpen = true; } }
public void SetGain(int gainValue) { System.Diagnostics.Debug.Assert(m_pHandle != IntPtr.Zero); m_kGain = gainValue; HVSTATUS status = HVSTATUS.STATUS_OK; for (int i = 0; i < 4; i++) { status = USBCameraAPI.HVAGCControl(m_pHandle, (byte)(HV_CHANNEL.RED_CHANNEL + i), m_kGain); USBCameraAPI.HV_VERIFY(status); } }
private void CloseSnap() { System.Diagnostics.Debug.Assert(m_Camera.GetHandle() != IntPtr.Zero); StopSnap(); HVSTATUS status = USBCameraAPI.HVCloseSnap(m_Camera.GetHandle()); USBCameraAPI.HV_VERIFY(status); if (USBCameraAPI.HV_SUCCESS(status)) { m_bIsOpen = false; } }
private void StartSnap() { System.Diagnostics.Debug.Assert(m_Camera.GetHandle() != IntPtr.Zero); IntPtr[] pBuffers = new IntPtr[1]; pBuffers[0] = m_Camera.GetRawBuffer(); HVSTATUS status = USBCameraAPI.HVStartSnap(m_Camera.GetHandle(), pBuffers, 1); USBCameraAPI.HV_VERIFY(status); if (USBCameraAPI.HV_SUCCESS(status)) { m_bIsSnap = true; } }
public void SetOutPutWindow() { System.Diagnostics.Debug.Assert(m_pHandle != IntPtr.Zero); IntPtr buffer = new IntPtr(); int size = 0; HVSTATUS status = USBCameraAPI.HVGetDeviceInfo(m_pHandle, HV_DEVICE_INFO.DESC_RESOLUTION, buffer, ref size); buffer = Marshal.AllocHGlobal(size); status = USBCameraAPI.HVGetDeviceInfo(m_pHandle, HV_DEVICE_INFO.DESC_RESOLUTION, buffer, ref size); USBCameraAPI.HV_VERIFY(status); int[] type = new int[64]; Marshal.Copy(buffer, type, 0, 64); Marshal.FreeHGlobal(buffer); m_OutPutWindow.Width = type[(int)m_kResolotion * 2]; m_OutPutWindow.Height = type[(int)m_kResolotion * 2 + 1]; status = USBCameraAPI.HVSetOutputWindow(m_pHandle, m_OutPutWindow.X, m_OutPutWindow.Y, m_OutPutWindow.Width, m_OutPutWindow.Height); USBCameraAPI.HV_VERIFY(status); }
public void GetCameraType() { System.Diagnostics.Debug.Assert(m_pHandle != IntPtr.Zero); IntPtr buffer = new IntPtr(); int size = sizeof(HVTYPE); StringBuilder str = new StringBuilder(); buffer = Marshal.AllocHGlobal(size); HVSTATUS status = USBCameraAPI.HVGetDeviceInfo(m_pHandle, HV_DEVICE_INFO.DESC_DEVICE_TYPE, buffer, ref size); USBCameraAPI.HV_VERIFY(status); int[] type = new int[size / 4]; Marshal.Copy(buffer, type, 0, size / 4); for (int i = 0; i < size / 4; i++) { str.Append(((HVTYPE)type[i]).ToString().Substring(0, 8)); } m_strCameraType = str.ToString(); str.Remove(0, str.Length); Marshal.FreeHGlobal(buffer); }