Пример #1
0
        private void InitializeDevice(DeviceType type, DeviceID id)
        {
            // Wait a few seconds until device becomes ready
            Thread.Sleep(2000);
            switch (type)
            {
            case DeviceType.RTKIR:
                RTKIR rtk = new RTKIR(id);
                if (rtk.TryInitIRDevice())
                {
                    RTKDevice = rtk;
                    OnIRDeviceArrived(new IRDeviceChangeEventArgs()
                    {
                        Device = DeviceType.RTKIR, DeviceID = id
                    });
                }
                break;

            case DeviceType.AF9100IR:
                AF9100IR af = new AF9100IR(id);
                if (af.TryInitIRDevice())
                {
                    AFDevice = af;
                    OnIRDeviceArrived(new IRDeviceChangeEventArgs()
                    {
                        Device = DeviceType.AF9100IR, DeviceID = id
                    });
                }
                break;
            }
        }
Пример #2
0
        private static bool TryParseDeviceId(string input, out DeviceID devID)
        {
            devID = new DeviceID();

            string pattern = "VID_([0-9A-F]{4})&PID_([0-9A-F]{4})";
            Match  match   = Regex.Match(input, pattern);

            if (!match.Success)
            {
                return(false);
            }

            devID.Vid = UInt16.Parse(match.Groups[1].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
            devID.Pid = UInt16.Parse(match.Groups[2].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);

            return(true);
        }
Пример #3
0
        private void CheckDevice(DeviceID devID)
        {
            if (RTKDevice == null && RTKDeviceIdLookup.Contains(devID))
            {
                Thread initThread = new Thread(() => InitializeDevice(DeviceType.RTKIR, devID));
                initThread.SetApartmentState(ApartmentState.STA);
                initThread.IsBackground = true;
                initThread.Start();
                return;
            }

            if (AFDevice == null && AFDeviceIdLookup.Contains(devID))
            {
                Thread initThread = new Thread(() => InitializeDevice(DeviceType.AF9100IR, devID));
                initThread.SetApartmentState(ApartmentState.STA);
                initThread.IsBackground = true;
                initThread.Start();
            }
        }
Пример #4
0
 public USBDeviceInfo(DeviceID deviceID)
 {
     this.DeviceID = deviceID;
     //this.PnpDeviceID = pnpDeviceID;
     //this.Description = description;
 }
Пример #5
0
 public DeviceRemovedEventArgs(DeviceID deviceID)
 {
     this.DeviceID = deviceID;
 }
Пример #6
0
 public DeviceArrivedEventArgs(DeviceID deviceID)
 {
     this.DeviceID = deviceID;
 }
Пример #7
0
 public AF9100IR(DeviceID deviceID)
 {
     this.DeviceID = deviceID;
 }
Пример #8
0
 public RTKIR(DeviceID deviceID)
 {
     this.DeviceID = deviceID;
 }