Class MccDaqBoard
Acquires analogue input from a Measurement Computing DAQ board through the Universal Library.
JSON configuration
Use these block entries inside a pipeline configuration. Input names must match other blocks in that pipeline; device addresses and file paths must match your setup.
JSON pipeline configuration:
{
"Name": "Daq",
"Type": "MccDaq",
"Inputs": [ "Timer100Hz" ],
"Params": [ "0;1;2;3;4;5;6;7", 10, 0, "Bip10Volts", "volts" ]
}
How Type, Inputs and Params work · Block catalogue and parameter reference
Implements
Inherited Members
Namespace: MOSAIC.Models.Devices
Assembly: MOSAIC.dll
Syntax
public sealed class MccDaqBoard : BaseBlock, INotifyPropertyChanged, INotifyPropertyChanging, ISubscriber, IPublisher, IBaseBlockProps, IJsonExportable, IDisposable, IAsyncDisposable
Remarks
Clock driven. The board free-runs into a circular driver buffer — one cbAInScan
started with Background | Continuous — and each tick of the upstream Clock copies
the newest ScansPerPacket scans out of it. The board is therefore asked for
tickRate × ScansPerPacket scans per second, and the block publishes at the clock rate.
Channels. cbAInScan sweeps a contiguous range, so the block acquires every
channel from LowChannel to HighChannel inclusive. A JSON config
carried over from iM-Blocks may give a ";"-separated list instead; its lowest and
highest entries become the range, and anything in between is acquired too.
Output. One scan per packet publishes a MathNet.Numerics.LinearAlgebra.Vector<T> of channels. More than one publishes a MathNet.Numerics.LinearAlgebra.Matrix<T> of rows = scans, columns = channels, the shape the other multi-sample device blocks use.
Board addressing. BoardNumber is the InstaCal board number, not a serial number — a board must be configured in InstaCal before the Universal Library can see it.
Everything that touches the vendor assembly is in the "Universal Library" region at the bottom
of this file, behind a single ENABLE_MCCDAQ guard that MOSAIC.csproj defines
wherever the MCC DAQ Software is installed. Without it the block still compiles, loads and
shows on the palette; it just reports the SDK as missing instead of acquiring.
Constructors
MccDaqBoard(string, double)
Initialises a new MccDaqBoard block.
Declaration
public MccDaqBoard(string name = "MccDaq", double desiredRate = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Display name for this block. |
| double | desiredRate | Tick rate in Hz. 0 inherits the upstream clock's rate. |
Fields
BufferPackets
How many packets the driver's circular buffer holds.
Declaration
private const int BufferPackets = 8
Field Value
| Type | Description |
|---|---|
| int |
Remarks
The depth is the block's tolerance for a late tick — about 80 ms at the default settings. Fixed rather than configurable: there is no setting a user could pick better than this without already knowing the answer.
KnownRanges
Input ranges offered on the card. Every one is a real MccDaq.Range member.
Declaration
public static readonly string[] KnownRanges
Field Value
| Type | Description |
|---|---|
| string[] |
NotInstalled
Message shown when MOSAIC was built without the vendor assembly.
Declaration
private const string NotInstalled = "MCC Universal Library not found. Install the MCC DAQ Software (InstaCal) and rebuild."
Field Value
| Type | Description |
|---|---|
| string |
ScanStoppedMessage
Message shown when the driver ends the scan on its own.
Declaration
private const string ScanStoppedMessage = "Scan stopped by the driver"
Field Value
| Type | Description |
|---|---|
| string |
_actualScanRate
Scans per second the board settled on, which may not be the rate requested.
Declaration
[ObservableProperty]
private double _actualScanRate
Field Value
| Type | Description |
|---|---|
| double |
_boardNumber
InstaCal board number.
Declaration
[ObservableProperty]
private int _boardNumber
Field Value
| Type | Description |
|---|---|
| int |
_bufferSamples
Declaration
private int _bufferSamples
Field Value
| Type | Description |
|---|---|
| int |
_connectionStatus
Connection and driver message shown separately from measured activity.
Declaration
[ObservableProperty]
private string _connectionStatus
Field Value
| Type | Description |
|---|---|
| string |
_disposed
Declaration
private bool _disposed
Field Value
| Type | Description |
|---|---|
| bool |
_gate
Declaration
private readonly object _gate
Field Value
| Type | Description |
|---|---|
| object |
_highChannel
Last channel of the sweep, inclusive.
Declaration
[ObservableProperty]
private int _highChannel
Field Value
| Type | Description |
|---|---|
| int |
_isConnected
Whether a scan is running.
Declaration
[ObservableProperty]
private bool _isConnected
Field Value
| Type | Description |
|---|---|
| bool |
_lastOutput
Declaration
private object? _lastOutput
Field Value
| Type | Description |
|---|---|
| object |
_lowChannel
First channel of the sweep.
Declaration
[ObservableProperty]
private int _lowChannel
Field Value
| Type | Description |
|---|---|
| int |
_offset
Declaration
private double _offset
Field Value
| Type | Description |
|---|---|
| double |
_packet
Declaration
private double[] _packet
Field Value
| Type | Description |
|---|---|
| double[] |
_rangeName
Name of a MccDaq.Range member, e.g. "Bip10Volts".
Declaration
[ObservableProperty]
private string _rangeName
Field Value
| Type | Description |
|---|---|
| string |
_scansPerPacket
Scans taken from the buffer on each clock tick.
Declaration
[ObservableProperty]
private int _scansPerPacket
Field Value
| Type | Description |
|---|---|
| int |
_slope
Declaration
private double _slope
Field Value
| Type | Description |
|---|---|
| double |
_useLegacyScale
Reproduce the iM-Blocks conversion — raw count ÷ 10000 — instead of converting to volts.
Declaration
[ObservableProperty]
private bool _useLegacyScale
Field Value
| Type | Description |
|---|---|
| bool |
Remarks
That conversion is not volts under any range the hardware offers: on a 16-bit board at ±10 V it spans 0 to 6.55 for an input swinging −10 to +10. It exists so a pipeline ported from iM-Blocks can still match its old recordings.
Properties
ActualScanRate
Scans per second the board settled on, which may not be the rate requested.
Declaration
[ExcludeFromCodeCoverage]
public double ActualScanRate { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
AllowableBlocks
The block is polled, not pushed: the clock decides when a packet leaves the driver's buffer, and it also fixes the rate the board is asked to acquire at.
Declaration
public override string[] AllowableBlocks { get; }
Property Value
| Type | Description |
|---|---|
| string[] |
Overrides
BoardNumber
InstaCal board number.
Declaration
[ExcludeFromCodeCoverage]
public int BoardNumber { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
ChannelCount
Channels in one scan.
Declaration
public int ChannelCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
ConnectionStatus
Connection and driver message shown separately from measured activity.
Declaration
[ExcludeFromCodeCoverage]
public string ConnectionStatus { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
DumpFilePrefix
Recordings from this block are named <block>_out.csv.
Declaration
protected override string DumpFilePrefix { get; }
Property Value
| Type | Description |
|---|---|
| string |
Overrides
HighChannel
Last channel of the sweep, inclusive.
Declaration
[ExcludeFromCodeCoverage]
public int HighChannel { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
IsConnected
Whether a scan is running.
Declaration
[ExcludeFromCodeCoverage]
public bool IsConnected { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
JsonTypeName
Block type identifier for JSON serialization. Override for a custom name.
Declaration
protected override string JsonTypeName { get; }
Property Value
| Type | Description |
|---|---|
| string |
Overrides
LowChannel
First channel of the sweep.
Declaration
[ExcludeFromCodeCoverage]
public int LowChannel { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
MaxInputs
Gets the maximum number of input connections allowed for this block.
Declaration
public override int MaxInputs { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
Remarks
Override in derived classes to specify input requirements. Default is 1 (most blocks accept exactly one input). Use MaxValue for blocks that accept unlimited inputs (e.g., Joiner).
MinInputs
Gets the minimum number of input connections required for this block.
Declaration
public override int MinInputs { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
Remarks
Override in derived classes to specify input requirements. Default is 1 (most blocks require exactly one input). Source blocks (devices, generators) should return 0.
PacketSamples
Samples in one packet.
Declaration
public int PacketSamples { get; }
Property Value
| Type | Description |
|---|---|
| int |
PacketsAcquired
Packets acquired since the scan started.
Declaration
public long PacketsAcquired { get; private set; }
Property Value
| Type | Description |
|---|---|
| long |
Remarks
Deliberately not an observable property. It advances on every tick, on the pipeline thread, and raising a change notification at the clock rate would push hundreds of binding updates a second onto the UI thread. The card samples it on its own 10 Hz refresh instead.
RangeName
Name of a MccDaq.Range member, e.g. "Bip10Volts".
Declaration
[ExcludeFromCodeCoverage]
public string RangeName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
RequestedScanRate
Scans per second this block will ask the board for, given the clock it inherited.
Declaration
public double RequestedScanRate { get; }
Property Value
| Type | Description |
|---|---|
| double |
ScansPerPacket
Scans taken from the buffer on each clock tick.
Declaration
[ExcludeFromCodeCoverage]
public int ScansPerPacket { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
UseLegacyScale
Reproduce the iM-Blocks conversion — raw count ÷ 10000 — instead of converting to volts.
Declaration
[ExcludeFromCodeCoverage]
public bool UseLegacyScale { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
That conversion is not volts under any range the hardware offers: on a 16-bit board at ±10 V it spans 0 to 6.55 for an input swinging −10 to +10. It exists so a pipeline ported from iM-Blocks can still match its old recordings.
Visualization
This block's visualization, or null when it has none.
Declaration
protected override BlockVisualization? Visualization { get; }
Property Value
| Type | Description |
|---|---|
| BlockVisualization |
Overrides
Remarks
Blocks own their scope as a public Viz property rather than inheriting one, so the
base class has no way to reach it. Overriding this is what lets the rate below be wired up
automatically. With correct publication metadata, the bundle derives the time axis for
one vector per publication or fixed-size contiguous sample packets from the feed shape.
When a plot needs a rate that publication frequency and feed shape cannot express (for
example, variable-sized packets or overlapping windows), declare it with
Viz.UpdateSignalRate. An explicit declaration wins over the derived rate. A block
with several bundles must configure each one; this hook exposes only one bundle.
Viz
Live plot of the published packet, shown on the device card.
Declaration
public BlockVisualization Viz { get; }
Property Value
| Type | Description |
|---|---|
| BlockVisualization |
Methods
AvailableBoards()
No boards are visible without the vendor assembly.
Declaration
public static string[] AvailableBoards()
Returns
| Type | Description |
|---|---|
| string[] |
BuildOutput(ReadOnlySpan<double>)
Turns a packet of raw counts into the shape this block publishes.
Declaration
public object BuildOutput(ReadOnlySpan<double> rawCounts)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<double> | rawCounts | Interleaved raw counts, |
Returns
| Type | Description |
|---|---|
| object |
Remarks
cbAInScan interleaves by channel — one scan is every channel in order, and scans
follow end to end — so a packet is already a row-major scans × channels matrix. The
iM-Blocks driver flattened the whole thing into one long vector instead, so a ten-scan
packet over eight channels reached downstream as an eighty-channel signal that changed
identity every eight elements.
Public, and taking the counts as a parameter, so the interleave and the scale can be checked without a board attached — the same reason Ingest(byte[], int) is public.
ConfigureInput(IServiceProvider, JsonModel)
Creates an MccDaqBoard from a JSON pipeline definition.
Declaration
public static MccDaqBoard ConfigureInput(IServiceProvider sp, JsonModel m)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceProvider | sp | The application's dependency injection service provider. |
| JsonModel | m | JSON model. |
Returns
| Type | Description |
|---|---|
| MccDaqBoard |
Connect()
Starts a continuous background scan sized to the pipeline's clock rate.
Declaration
public void Connect()
Remarks
Failures are reported through ConnectionStatus rather than thrown, so a missing board cannot tear down the pipeline that owns this block.
Disconnect()
Stops the scan and releases the driver buffer.
Declaration
public void Disconnect()
Dispose()
Stops the scan, frees the driver buffer and releases the visualization.
Declaration
public override void Dispose()
Overrides
GetJsonParams()
Block-specific parameters for JSON. Override to provide custom parameters.
Declaration
protected override IReadOnlyList<object>? GetJsonParams()
Returns
| Type | Description |
|---|---|
| IReadOnlyList<object> | The values for Params, in the order this block's |
Overrides
Remarks
The channel list is written back normalised to its endpoints, so a config saying
"0;2;5" is re-saved as "0;5". Nothing is lost — the hardware sweeps a
contiguous range, so both spell the same acquisition — but the file does change, and it is
better that the saved config says plainly what the board will do.
OnActualScanRateChanged(double)
Publishes the settled scan rate as this block's sample rate, to the graph and to the scope.
Declaration
private void OnActualScanRateChanged(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value |
Remarks
Each scan yields one sample per channel, so the scan rate is the true sample rate of the
signal this block emits — and it has to be the rate the board settled on rather than the one
asked for, which is why this hangs off the property rather than sitting in Connect.
The scope needs telling separately from SignalRate: that propagates
along the block graph, but nothing carries it into the local visualization. And it must be
given the scan rate, not the clock rate — its x-axis advances once per row written and this
block writes ScansPerPacket rows per tick. Without it the scope falls back to
an assumed 200 Hz and the trace scrolls ActualScanRate/200 times too fast.
OnActualScanRateChanged(double, double)
Executes the logic for when ActualScanRate just changed.
Declaration
private void OnActualScanRateChanged(double oldValue, double newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| double | oldValue | The previous property value that was replaced. |
| double | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of ActualScanRate is changed.
OnActualScanRateChanging(double)
Executes the logic for when ActualScanRate is changing.
Declaration
private void OnActualScanRateChanging(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The new property value being set. |
Remarks
This method is invoked right before the value of ActualScanRate is changed.
OnActualScanRateChanging(double, double)
Executes the logic for when ActualScanRate is changing.
Declaration
private void OnActualScanRateChanging(double oldValue, double newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| double | oldValue | The previous property value that is being replaced. |
| double | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of ActualScanRate is changed.
OnBoardNumberChanged(int)
Executes the logic for when BoardNumber just changed.
Declaration
private void OnBoardNumberChanged(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The new property value that was set. |
Remarks
This method is invoked right after the value of BoardNumber is changed.
OnBoardNumberChanged(int, int)
Executes the logic for when BoardNumber just changed.
Declaration
private void OnBoardNumberChanged(int oldValue, int newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | oldValue | The previous property value that was replaced. |
| int | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of BoardNumber is changed.
OnBoardNumberChanging(int)
Executes the logic for when BoardNumber is changing.
Declaration
private void OnBoardNumberChanging(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The new property value being set. |
Remarks
This method is invoked right before the value of BoardNumber is changed.
OnBoardNumberChanging(int, int)
Executes the logic for when BoardNumber is changing.
Declaration
private void OnBoardNumberChanging(int oldValue, int newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | oldValue | The previous property value that is being replaced. |
| int | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of BoardNumber is changed.
OnConnectionStatusChanged(string)
Executes the logic for when ConnectionStatus just changed.
Declaration
private void OnConnectionStatusChanged(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The new property value that was set. |
Remarks
This method is invoked right after the value of ConnectionStatus is changed.
OnConnectionStatusChanged(string?, string)
Executes the logic for when ConnectionStatus just changed.
Declaration
private void OnConnectionStatusChanged(string? oldValue, string newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | oldValue | The previous property value that was replaced. |
| string | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of ConnectionStatus is changed.
OnConnectionStatusChanging(string)
Executes the logic for when ConnectionStatus is changing.
Declaration
private void OnConnectionStatusChanging(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The new property value being set. |
Remarks
This method is invoked right before the value of ConnectionStatus is changed.
OnConnectionStatusChanging(string?, string)
Executes the logic for when ConnectionStatus is changing.
Declaration
private void OnConnectionStatusChanging(string? oldValue, string newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | oldValue | The previous property value that is being replaced. |
| string | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of ConnectionStatus is changed.
OnHighChannelChanged(int)
Executes the logic for when HighChannel just changed.
Declaration
private void OnHighChannelChanged(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The new property value that was set. |
Remarks
This method is invoked right after the value of HighChannel is changed.
OnHighChannelChanged(int, int)
Executes the logic for when HighChannel just changed.
Declaration
private void OnHighChannelChanged(int oldValue, int newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | oldValue | The previous property value that was replaced. |
| int | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of HighChannel is changed.
OnHighChannelChanging(int)
Executes the logic for when HighChannel is changing.
Declaration
private void OnHighChannelChanging(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The new property value being set. |
Remarks
This method is invoked right before the value of HighChannel is changed.
OnHighChannelChanging(int, int)
Executes the logic for when HighChannel is changing.
Declaration
private void OnHighChannelChanging(int oldValue, int newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | oldValue | The previous property value that is being replaced. |
| int | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of HighChannel is changed.
OnIsConnectedChanged(bool)
Executes the logic for when IsConnected just changed.
Declaration
private void OnIsConnectedChanged(bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | value | The new property value that was set. |
Remarks
This method is invoked right after the value of IsConnected is changed.
OnIsConnectedChanged(bool, bool)
Executes the logic for when IsConnected just changed.
Declaration
private void OnIsConnectedChanged(bool oldValue, bool newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | oldValue | The previous property value that was replaced. |
| bool | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of IsConnected is changed.
OnIsConnectedChanging(bool)
Executes the logic for when IsConnected is changing.
Declaration
private void OnIsConnectedChanging(bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | value | The new property value being set. |
Remarks
This method is invoked right before the value of IsConnected is changed.
OnIsConnectedChanging(bool, bool)
Executes the logic for when IsConnected is changing.
Declaration
private void OnIsConnectedChanging(bool oldValue, bool newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | oldValue | The previous property value that is being replaced. |
| bool | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of IsConnected is changed.
OnLowChannelChanged(int)
Executes the logic for when LowChannel just changed.
Declaration
private void OnLowChannelChanged(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The new property value that was set. |
Remarks
This method is invoked right after the value of LowChannel is changed.
OnLowChannelChanged(int, int)
Executes the logic for when LowChannel just changed.
Declaration
private void OnLowChannelChanged(int oldValue, int newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | oldValue | The previous property value that was replaced. |
| int | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of LowChannel is changed.
OnLowChannelChanging(int)
Executes the logic for when LowChannel is changing.
Declaration
private void OnLowChannelChanging(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The new property value being set. |
Remarks
This method is invoked right before the value of LowChannel is changed.
OnLowChannelChanging(int, int)
Executes the logic for when LowChannel is changing.
Declaration
private void OnLowChannelChanging(int oldValue, int newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | oldValue | The previous property value that is being replaced. |
| int | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of LowChannel is changed.
OnRangeNameChanged(string)
Executes the logic for when RangeName just changed.
Declaration
private void OnRangeNameChanged(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The new property value that was set. |
Remarks
This method is invoked right after the value of RangeName is changed.
OnRangeNameChanged(string?, string)
Executes the logic for when RangeName just changed.
Declaration
private void OnRangeNameChanged(string? oldValue, string newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | oldValue | The previous property value that was replaced. |
| string | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of RangeName is changed.
OnRangeNameChanging(string)
Executes the logic for when RangeName is changing.
Declaration
private void OnRangeNameChanging(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The new property value being set. |
Remarks
This method is invoked right before the value of RangeName is changed.
OnRangeNameChanging(string?, string)
Executes the logic for when RangeName is changing.
Declaration
private void OnRangeNameChanging(string? oldValue, string newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | oldValue | The previous property value that is being replaced. |
| string | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of RangeName is changed.
OnReceive(object, object)
Copies the newest packet out of the driver buffer on each clock tick and publishes it.
Declaration
protected override void OnReceive(object sender, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| object | sender | The upstream clock. |
| object | value | The tick timestamp; unused. |
Overrides
OnScansPerPacketChanged(int)
Executes the logic for when ScansPerPacket just changed.
Declaration
private void OnScansPerPacketChanged(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The new property value that was set. |
Remarks
This method is invoked right after the value of ScansPerPacket is changed.
OnScansPerPacketChanged(int, int)
Executes the logic for when ScansPerPacket just changed.
Declaration
private void OnScansPerPacketChanged(int oldValue, int newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | oldValue | The previous property value that was replaced. |
| int | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of ScansPerPacket is changed.
OnScansPerPacketChanging(int)
Executes the logic for when ScansPerPacket is changing.
Declaration
private void OnScansPerPacketChanging(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The new property value being set. |
Remarks
This method is invoked right before the value of ScansPerPacket is changed.
OnScansPerPacketChanging(int, int)
Executes the logic for when ScansPerPacket is changing.
Declaration
private void OnScansPerPacketChanging(int oldValue, int newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | oldValue | The previous property value that is being replaced. |
| int | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of ScansPerPacket is changed.
OnUseLegacyScaleChanged(bool)
Executes the logic for when UseLegacyScale just changed.
Declaration
private void OnUseLegacyScaleChanged(bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | value | The new property value that was set. |
Remarks
This method is invoked right after the value of UseLegacyScale is changed.
OnUseLegacyScaleChanged(bool, bool)
Executes the logic for when UseLegacyScale just changed.
Declaration
private void OnUseLegacyScaleChanged(bool oldValue, bool newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | oldValue | The previous property value that was replaced. |
| bool | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of UseLegacyScale is changed.
OnUseLegacyScaleChanging(bool)
Executes the logic for when UseLegacyScale is changing.
Declaration
private void OnUseLegacyScaleChanging(bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | value | The new property value being set. |
Remarks
This method is invoked right before the value of UseLegacyScale is changed.
OnUseLegacyScaleChanging(bool, bool)
Executes the logic for when UseLegacyScale is changing.
Declaration
private void OnUseLegacyScaleChanging(bool oldValue, bool newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | oldValue | The previous property value that is being replaced. |
| bool | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of UseLegacyScale is changed.
ReadNewestPacket()
Declaration
private bool ReadNewestPacket()
Returns
| Type | Description |
|---|---|
| bool |
Reconnect()
Stops and restarts the scan, picking up changed configuration.
Declaration
public void Reconnect()
SetChannels(string)
Sets the sweep from a channel list such as "0;1;2;3" or "2;5".
Declaration
public void SetChannels(string list)
Parameters
| Type | Name | Description |
|---|---|---|
| string | list |
Remarks
Only the lowest and highest entries matter, because the hardware sweeps a contiguous range.
The iM-Blocks driver parsed this same list and then scanned 0 .. count-1, so the
numbers in it never reached the board — "2;3;5" silently acquired channels 0, 1, 2.
StartScan(double)
Declaration
private bool StartScan(double scanRate)
Parameters
| Type | Name | Description |
|---|---|---|
| double | scanRate |
Returns
| Type | Description |
|---|---|
| bool |
StopScan()
Declaration
private void StopScan()
TryLocatePacket(long, int, int, int, out int, out int)
Works out where the newest whole packet sits in the driver's circular buffer.
Declaration
public static bool TryLocatePacket(long samplesWritten, int channelCount, int packetSamples, int bufferSamples, out int start, out int firstRun)
Parameters
| Type | Name | Description |
|---|---|---|
| long | samplesWritten | The driver's running total of samples written. |
| int | channelCount | Channels in one scan. |
| int | packetSamples | Samples in one packet. |
| int | bufferSamples | Capacity of the circular buffer, in samples. |
| int | start | Sample offset the packet begins at. |
| int | firstRun | Samples available before the end of the buffer. Less than |
Returns
| Type | Description |
|---|---|
| bool | false when a whole packet has not been written yet. |
Remarks
Pure arithmetic, deliberately outside the vendor guard: this is the part a wrong offset corrupts silently. A cursor off by one sample rotates every channel in the output by one position — a fault that looks like miswired hardware rather than like a software bug — so it needs to be checkable on a machine with no board and no SDK.