Пример #1
0
        static public void RegisterDevices()
        {
            // We only support one device type here
            UInt32 deviceType = 4;

            UInt32 deviceIndex = 0;

            while (NativeFunctions.OpenDevice(deviceType, deviceIndex, 0) == NativeFunctions.ECANStatus.STATUS_OK)
            {
                NativeFunctions.CloseDevice(deviceType, deviceIndex);
                Candle.Device.RegisterAlternativeDevice(new Device(deviceType, deviceIndex));
                deviceIndex++;
            }
        }
Пример #2
0
        public override void Close()
        {
            if (this.FThread != null)
            {
                this.PerformBlocking(() =>
                {
                    this.FIsClosing = true;
                    NativeFunctions.CloseDevice(this.FDeviceType, this.FDeviceIndex);
                });

                // Close queues
                this.FActionQueue.CompleteAdding();
                this.FExceptionQueue.CompleteAdding();

                this.FThread.Join();
                this.FThread = null;

                this.FActionQueue.Dispose();
                this.FActionQueue = null;
                this.FExceptionQueue.Dispose();
                this.FExceptionQueue = null;
            }
        }