public MavlinkV2Connection(IDataStream dataStream, Action <IPacketDecoder <IPacketV2 <IPayload> > > register) { DataStream = dataStream; register(_decoder); DataStream.SelectMany(_ => _).Subscribe(_decoder, _disposeCancel.Token); _decoder.Subscribe(_ => Interlocked.Increment(ref _rxPackets), _disposeCancel.Token); _decoder.OutError.Subscribe(_ => Interlocked.Increment(ref _skipPackets), _disposeCancel.Token); }