public PollingLoop ( IDeviceStream deviceStream, DataRequest dataRequest, TimeSpan pollingInterval, Func <DateTimeOffset, byte[], DataSample> sampleParse, ITaskQueue eventsQueue ) { Contract.Requires <ArgumentNullException>(deviceStream != null); Contract.Requires <ArgumentNullException>(sampleParse != null); Contract.Requires <ArgumentNullException>(eventsQueue != null); DeviceStream = deviceStream; EventsQueue = eventsQueue; Cancellation = new CancellationTokenSource(); PollingInterval = pollingInterval; SampleParse = sampleParse; RequestBytes = new byte[DeviceStream.MaxRequestSize]; Contract.Assert(dataRequest.RawBytes.Length == DeviceStream.MaxRequestSize); Array.Copy(dataRequest.RawBytes, RequestBytes, Math.Min(RequestBytes.Length, dataRequest.RawBytes.Length)); LoopThread = new Thread(RunLoop) { IsBackground = true, Priority = ThreadPriority.AboveNormal, Name = Strings.USB_Device_Polling_Loop, }; }
public PseudoDeviceManager(double min, double max, TimeSpan period) { EmulatorStream = new PseudoDeviceStream(min, max, period); EmulatorDeviceInfo = new DeviceInformation(DeviceConstants.SearchPattern, Strings.Emulated_Device_Description); }