/// <summary> /// Called when an infrared sensor raw data buffer becomes available. /// </summary> /// <param name="pulses">The pulses.</param> /// <param name="state">The state.</param> private void OnInfraredSensorRawDataAvailable(InfraredPulse[] pulses, ReceiverFlushReason state) { if (_isDisposed || DataAvailable == null) { return; } var args = new InfraredSensorDataEventArgs(pulses, state); ThreadPool.QueueUserWorkItem(a => { DataAvailable?.Invoke(this, a as InfraredSensorDataEventArgs); }, args); }
/// <summary> /// Initializes a new instance of the <see cref="InfraRedSensorDataEventArgs" /> class. /// </summary> /// <param name="pulses">The pulses.</param> /// <param name="flushReason">The state.</param> internal InfraRedSensorDataEventArgs(InfraRedPulse[] pulses, ReceiverFlushReason flushReason) { Pulses = pulses; FlushReason = flushReason; TrainDurationUsecs = pulses.Sum(s => s.DurationUsecs); }
/// <summary> /// Called when an infrared sensor raw data buffer becomes available. /// </summary> /// <param name="pulses">The pulses.</param> /// <param name="state">The state.</param> private void OnInfraredSensorRawDataAvailable(InfraRedPulse[] pulses, ReceiverFlushReason state) { DataAvailable?.Invoke(this, new InfraRedSensorDataEventArgs(pulses, state)); }