FireUsbError() 정적인 개인적인 메소드

static private FireUsbError ( object sender, UsbError usbError ) : void
sender object
usbError UsbError
리턴 void
예제 #1
0
        internal static UsbError Error(ErrorCode errorCode, int ret, string description, object sender)
        {
            string win32Error = String.Empty;

            if (errorCode == ErrorCode.Win32Error && !UsbDevice.IsLinux && ret != 0)
            {
                win32Error = Kernel32.FormatSystemMessage(ret);
            }
            else if (errorCode == ErrorCode.MonoApiError && ret != 0)
            {
                win32Error = ((MonoUsbError)ret) + ":" + MonoUsbApi.StrError((MonoUsbError)ret);
            }
            UsbError err = new UsbError(errorCode, ret, win32Error, description, sender);

            lock (mLastErrorString)
            {
                mLastErrorNumber = (int)err.ErrorCode;
                mLastErrorString = err.ToString();
            }
            UsbDevice.FireUsbError(sender, err);

            return(err);
        }
예제 #2
0
        public static UsbError Error(ErrorCode errorCode, int ret, string description, object sender)
        {
            string win32Error = String.Empty;

            if (errorCode == ErrorCode.Win32Error && !UsbDevice.IsLinux && ret != 0)
            {
                win32Error = Kernel32.FormatSystemMessage(ret);
            }
            else if (errorCode == ErrorCode.MonoApiError && ret != 0)
            {
                Debug.Assert(false, "libusb-1.0 error codes should be resolved within LibUsbDotNet.LibUsb");
                // win32Error = ((MonoUsbError) ret) + ":" + MonoUsbApi.StrError((MonoUsbError) ret);
            }
            UsbError err = new UsbError(errorCode, ret, win32Error, description, sender);

            lock (mLastErrorString)
            {
                mLastErrorNumber = (int)err.ErrorCode;
                mLastErrorString = err.ToString();
            }
            UsbDevice.FireUsbError(sender, err);

            return(err);
        }