Esempio n. 1
0
        internal WindowsUsbInterop(DeviceInfo deviceInfo, CriticalParams criticalParams)
            : base(deviceInfo, criticalParams)
        {
            //m_aiScanResetPacket.TransferType = UsbTransferTypes.ControlOut;
            //m_aiScanResetPacket.Request = 0x80;
            //m_aiScanResetPacket.DeferTransfer = false;
            //m_aiScanResetPacket.BytesTransfered = 0;

            //for (int i = 0; i < m_aiScanResetPacket.Length; i++)
            //    m_aiScanResetPacket.Buffer[i] = m_aiScanStatusMessage[i];
        }
Esempio n. 2
0
        //=====================================================================================
        /// <summary>
        /// Device-specific constructor used by the driver interface
        /// </summary>
        /// <param name="deviceNumber">The device number</param>
        //=====================================================================================
        internal LibUsbInterop(DeviceInfo deviceInfo, CriticalParams criticalParams)
            : base(deviceInfo, criticalParams)
        {
            InitializeDevice(m_deviceInfo);

            if (m_errorCode == ErrorCodes.NoErrors && !m_deviceInitialized)
                m_errorCode = ErrorCodes.DeviceNotInitialized;

            m_maxTransferSize = 8192;

            #if DEBUG
            //LibUsbInterop.LibUsbSetDebug(IntPtr.Zero, 3);
            #endif
        }
Esempio n. 3
0
        //=====================================================================================
        /// <summary>
        /// Device-specific constructor used by the driver interface
        /// </summary>
        /// <param name="deviceNumber">The device number</param>
        //=====================================================================================
        internal McUsbInterop(DeviceInfo deviceInfo, CriticalParams criticalParams)
            : base(deviceInfo, criticalParams)
        {
            m_deviceInfo = deviceInfo;

            InitializeDevice(m_deviceInfo);

            if (m_errorCode == ErrorCodes.NoErrors && !m_deviceInitialized)
                m_errorCode = ErrorCodes.DeviceNotInitialized;

            // create a setup packet for reading device status
            m_statusPacket = new WindowsUsbSetupPacket();
            m_statusPacket.RequestType = ControlRequestType.VENDOR_CONTROL_IN;
            m_statusPacket.Request = 0x44;
            m_statusPacket.Value = 0;
            m_statusPacket.Index = 0;
            m_statusPacket.Length = 2;
            m_statusBuffer = new byte[2];
            m_maxTransferSize = 256000;
        }
Esempio n. 4
0
        internal UsbPlatformInterop(DeviceInfo deviceInfo, CriticalParams criticalParams)
            : base(deviceInfo, criticalParams)
        {
            string msg;

            // create a device ID message
            msg = Messages.DEV_ID_QUERY;

            for (int i = 0; i < msg.Length; i++)
                m_devIdMessage[i] = (byte)msg[i];

            // create a mfg serno message
            msg = Messages.DEV_SERNO_QUERY;

            for (int i = 0; i < msg.Length; i++)
                m_sernoMessage[i] = (byte)msg[i];

            // create an aiscan status message
            msg = Messages.AISCAN_STATUS_QUERY;

            for (int i = 0; i < msg.Length; i++)
                m_aiScanStatusMessage[i] = (byte)msg[i];

            // create an aoscan status message
            msg = Messages.AOSCAN_STATUS_QUERY;

            for (int i = 0; i < msg.Length; i++)
                m_aoScanStatusMessage[i] = (byte)msg[i];

            // build an ai scan reset packet
            byte[] aiScanResetCmd = new byte[Constants.MAX_MESSAGE_LENGTH];

            msg = Messages.AISCAN_RESET;

            for (int i = 0; i < msg.Length; i++)
                aiScanResetCmd[i] = (byte)msg[i];

            m_aiScanResetPacket.TransferType = UsbTransferTypes.ControlOut;
            m_aiScanResetPacket.Request = 0x80;
            m_aiScanResetPacket.DeferTransfer = false;
            m_aiScanResetPacket.BytesTransfered = 0;

            for (int i = 0; i < aiScanResetCmd.Length; i++)
                m_aiScanResetPacket.Buffer[i] = aiScanResetCmd[i];

            // build an ao scan reset packet
            byte[] aoScanResetCmd = new byte[Constants.MAX_MESSAGE_LENGTH];

            msg = Messages.AOSCAN_RESET;

            for (int i = 0; i < msg.Length; i++)
                aoScanResetCmd[i] = (byte)msg[i];

            m_aoScanResetPacket.TransferType = UsbTransferTypes.ControlOut;
            m_aoScanResetPacket.Request = 0x80;
            m_aoScanResetPacket.DeferTransfer = false;
            m_aoScanResetPacket.BytesTransfered = 0;

            for (int i = 0; i < aoScanResetCmd.Length; i++)
                m_aoScanResetPacket.Buffer[i] = aoScanResetCmd[i];
        }
 //=====================================================================================
 /// <summary>
 /// Device-specific constructor used by the driver interface
 /// </summary>
 /// <param name="deviceNumber">The device number</param>
 //=====================================================================================
 internal SynchronousUsbInterop(DeviceInfo deviceInfo, CriticalParams criticalParams)
     : base(deviceInfo, criticalParams)
 {
     m_readyToStartOutputScan = false;
 }
Esempio n. 6
0
 //===================================================================================
 /// <summary>
 /// ctor - stores the deviceInfo and criticalParams to members
 /// </summary>
 /// <param name="deviceInfo">A DeviceInfo object</param>
 /// <param name="criticalParams">A criticalParams object</param>
 //===================================================================================
 internal PlatformInterop(DeviceInfo deviceInfo, CriticalParams criticalParams)
 {
     m_deviceInfo = deviceInfo;
     m_criticalParams = criticalParams;
     m_readyToStartOutputScan = true;
     m_stopWatchResolution = 1.0 / (double)System.Diagnostics.Stopwatch.Frequency;
 }
Esempio n. 7
0
        internal static HidPlatformInterop GetHidPlatformInterop(DeviceInfo deviceInfo, CriticalParams criticalParams)
        {
            if (Environment.OSVersion.Platform == PlatformID.Unix)
               {
              return null;// new LibUsbInterop(deviceInfo, criticalParams);
               }
               else if (Environment.OSVersion.Platform == PlatformID.Win32NT)
               {
              //return new WinUsbInterop(deviceInfo, criticalParams);
              return new WindowsHidInterop(deviceInfo, criticalParams); //new McUsbInterop(deviceInfo, criticalParams);
               }

               return null;
        }
Esempio n. 8
0
        //=========================================================================================================
        /// <summary>
        /// Creates a platform specific interop object based on the platform that application is running on
        /// </summary>
        /// <returns>The platform interop object</returns>
        //=========================================================================================================
        internal static UsbPlatformInterop GetUsbPlatformInterop(DeviceInfo deviceInfo, CriticalParams criticalParams)
        {
            #if WindowsCE
            return new WinCeUsbInterop(deviceInfo, criticalParams);
            #else
            if (Environment.OSVersion.Platform == PlatformID.Unix)
            {
                return new LibUsbInterop(deviceInfo, criticalParams);
            }
            else if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                //return new WinUsbInterop(deviceInfo, criticalParams);
                return new McUsbInterop(deviceInfo, criticalParams);
            }

            return null;
            #endif
        }
Esempio n. 9
0
 internal HidPlatformInterop(DeviceInfo deviceInfo, CriticalParams criticalParams)
     : base(deviceInfo, criticalParams)
 {
 }
Esempio n. 10
0
 internal WindowsHidInterop(DeviceInfo deviceInfo, CriticalParams criticalParams)
     : base(deviceInfo, criticalParams)
 {
     InitializeDevice(m_deviceInfo);
     if (m_errorCode == ErrorCodes.NoErrors && !m_deviceInitialized)
        m_errorCode = ErrorCodes.DeviceNotInitialized;
 }