public void DelegatesSampleRateToController()
        {
            var c = new NIDAQController();
            var s = new NIDAQOutputStream("none", 0, c);
            var srate = new Measurement(1000, "Hz");
            c.SampleRate = srate;

            Assert.That(s.SampleRate, Is.EqualTo(c.SampleRate));
            Assert.Throws<NotSupportedException>(() => s.SampleRate = srate);
        }
 private void WriteSingleDigital(NIDAQOutputStream stream, double value)
 {
     using (var t = new DAQTask())
     {
         t.DOChannels.CreateChannel(stream.PhysicalName, "", ChannelLineGrouping.OneChannelForAllLines);
         var writer = new DigitalSingleChannelWriter(t.Stream);
         writer.WriteSingleSamplePort(true, (UInt32) value);
     }
 }
 private void WriteSingle(NIDAQOutputStream stream, IMeasurement value)
 {
     var quantity = (double) Converters.Convert(value, stream.DAQUnits).QuantityInBaseUnits;
     if (stream.PhysicalChannelType == PhysicalChannelTypes.AO)
         WriteSingleAnalog(stream, quantity);
     else if (stream.PhysicalChannelType == PhysicalChannelTypes.DOPort)
         WriteSingleDigital(stream, quantity);
 }
 private void WriteSingleAnalog(NIDAQOutputStream stream, double value)
 {
     using (var t = new DAQTask())
     {
         t.AOChannels.CreateVoltageChannel(stream.PhysicalName, "", Device.AOVoltageRanges.Min(),
                                           Device.AOVoltageRanges.Max(), AOVoltageUnits.Volts);
         var writer = new AnalogSingleChannelWriter(t.Stream);
         writer.WriteSingleSample(true, value);
     }
 }
 public void SetStreamBackground(NIDAQOutputStream stream)
 {
     if (stream != null)
     {
         WriteSingle(stream, stream.Background);
     }
 }