Beispiel #1
0
        protected bool IsDeviceAccessible()
        {
            Debug.Assert(_handle == IntPtr.Zero);

            var isAccessible = OfficialApi.IsDeviceAccessible(_handle, ref _deviceInformation,
                                                              AccessMode.独占权限);

            this.InfoSuccessWithDescription(isAccessible);

            return(isAccessible);
        }
        private ErrorCode EnumDevices(ref DeviceInformationCollection deviceInfoCollection)
        {
            var errorCode = OfficialApi.EnumDevices(DeviceType.GigeDevice, ref deviceInfoCollection);

            if (errorCode != ErrorCode.MV_OK)
            {
                this.ErrorFailWithReason(errorCode);
            }
            else
            {
                this.InfoSuccess();
            }
            return(errorCode);
        }
Beispiel #3
0
        protected ErrorCode SetStreamChannelPacketSize(uint value = 8164)
        {
            Debug.Assert(_handle != IntPtr.Zero);

            var errorCode = OfficialApi.SetStreamChannelPacketSize(_handle, value);

            if (errorCode != ErrorCode.MV_OK)
            {
                this.ErrorFailWithReason(errorCode);
            }
            else
            {
                this.InfoSuccess();
            }
            return(errorCode);
        }
Beispiel #4
0
        protected ErrorCode GetStreamChannelPacketSize(ref Int32Value value)
        {
            Debug.Assert(_handle != IntPtr.Zero);

            var errorCode = OfficialApi.GetStreamChannelPacketSize(_handle, ref value);

            if (errorCode != ErrorCode.MV_OK)
            {
                this.ErrorFailWithReason(errorCode);
            }
            else
            {
                this.InfoSuccessWithDescription(value);
            }
            return(errorCode);
        }
Beispiel #5
0
        protected ErrorCode StopGrabbing()
        {
            Debug.Assert(_handle != IntPtr.Zero);

            var errorCode = OfficialApi.StopGrabbing(_handle);

            if (errorCode != ErrorCode.MV_OK)
            {
                this.ErrorFailWithReason(errorCode);
            }
            else
            {
                this.InfoSuccess();
            }
            return(errorCode);
        }
Beispiel #6
0
        protected ErrorCode OpenDevice()
        {
            Debug.Assert(_handle != IntPtr.Zero);

            var errorCode = OfficialApi.OpenDevice(_handle, AccessMode.独占权限);

            if (errorCode != ErrorCode.MV_OK)
            {
                this.ErrorFailWithReason(errorCode);
            }
            else
            {
                this.InfoSuccess();
            }
            return(errorCode);
        }
Beispiel #7
0
        protected ErrorCode CreateHandle()
        {
            Debug.Assert(_handle == IntPtr.Zero);

            var errorCode = OfficialApi.CreateHandle(ref _handle, ref _deviceInformation);

            if (errorCode != ErrorCode.MV_OK)
            {
                this.ErrorFailWithReason(errorCode);
            }
            else
            {
                Debug.Assert(_handle != IntPtr.Zero);

                this.InfoSuccess();
            }
            return(errorCode);
        }
Beispiel #8
0
        protected ErrorCode DestroyHandle()
        {
            Debug.Assert(_handle != IntPtr.Zero);

            var errorCode = OfficialApi.DestroyHandle(_handle);

            if (errorCode != ErrorCode.MV_OK)
            {
                this.ErrorFailWithReason(errorCode);
            }
            else
            {
                this.InfoSuccess();
            }

            _handle = IntPtr.Zero;

            return(errorCode);
        }
Beispiel #9
0
        protected ErrorCode GetOneFrame(Bitmap bitmap)
        {
            Debug.Assert(_handle != IntPtr.Zero);

            var errorCode = OfficialApi.GetOneFrame(_handle, bitmap.Buffer, bitmap.BufferLength,
                                                    ref _frameOutInformation);

            switch (errorCode)
            {
            case ErrorCode.MV_OK:
                return(errorCode);

            case ErrorCode.MV_E_NODATA:
                return(errorCode);

            default:
                this.ErrorFailWithReason(errorCode);
                return(errorCode);
            }
        }
Beispiel #10
0
 protected ErrorCode SetCommandValue(CommondType commond)
 {
     Debug.Assert(_handle != IntPtr.Zero);
     return(OfficialApi.SetCommandValue(_handle, commond.ToString()));
 }
Beispiel #11
0
 protected ErrorCode SetEnumValue(CommondType commond, uint value)
 {
     Debug.Assert(_handle != IntPtr.Zero);
     return(OfficialApi.SetEnumValue(_handle, commond.ToString(), value));
 }
Beispiel #12
0
 protected ErrorCode SetInt32Value(string strValue, uint value)
 {
     Debug.Assert(_handle != IntPtr.Zero);
     return(OfficialApi.SetIntValue(_handle, strValue, value));
 }
Beispiel #13
0
 protected ErrorCode GetInt32Value(CommondType commond, ref Int32Value value)
 {
     Debug.Assert(_handle != IntPtr.Zero);
     return(OfficialApi.GetIntValue(_handle, commond.ToString(), ref value));
 }