Class Quattrocento

A BaseBlock that streams multichannel EMG / EEG / AUX data from an OT Bioelettronica Quattrocento amplifier over a direct TCP connection.

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.

Block entry for a larger pipeline. Params are key:value tokens in any order. fsamp 3 selects 10240 Hz; decim 1 enables decimation. Replace the IP address for your amplifier and select channels on the card.

{
  "Quattrocento": {
    "Type": "quattrocento",
    "Inputs": [],
    "Params": ["ip:169.254.1.10", "port:23456", "fsamp:3", "decim:1"]
  }
}

How Type, Inputs and Params work · Block catalogue and parameter reference

Inheritance
Quattrocento
Namespace: MOSAIC.Models.Devices
Assembly: MOSAIC.dll
Syntax
public sealed class Quattrocento : BaseBlock, INotifyPropertyChanged, INotifyPropertyChanging, ISubscriber, IPublisher, IBaseBlockProps, IJsonExportable, IDisposable, IAsyncDisposable
Remarks

Inputs (IN1..IN8 and MULTIPLE IN1..IN4) and AUX are toggled individually. The hardware NCH preset is auto-selected as the smallest that covers all enabled inputs; channels outside the selection are dropped in software. All inputs and AUX default to OFF — the user opts into each.

Publishes MathNet.Numerics.LinearAlgebra.Matrix<T> with rows = samples and columns = (enabled bio in mV) + (optional 16 aux in V).

Constructors

Quattrocento(string, double, string, int, int, bool)

Declaration
public Quattrocento(string name = "Quattrocento", double desiredRate = 16, string ip = "169.254.1.10", int port = 23456, int fsampIndex = 3, bool decimator = true)
Parameters
Type Name Description
string name
double desiredRate
string ip
int port
int fsampIndex
bool decimator

Fields

_auxOffsetCh

Declaration
private int _auxOffsetCh
Field Value
Type Description
int

_bytesPerSample

Declaration
private int _bytesPerSample
Field Value
Type Description
int

_decimatorEnabled

Declaration
[ObservableProperty]
private bool _decimatorEnabled
Field Value
Type Description
bool

_droppedSamplesBacking

Declaration
private long _droppedSamplesBacking
Field Value
Type Description
long

_emitAux

Declaration
private bool _emitAux
Field Value
Type Description
bool

_framesPublishedBacking

Declaration
private long _framesPublishedBacking
Field Value
Type Description
long

_fsampIndex

Declaration
[ObservableProperty]
private int _fsampIndex
Field Value
Type Description
int

_ip

Declaration
[ObservableProperty]
private string _ip
Field Value
Type Description
string

_isAuxEnabled

Whether the 16 AUX channels are forwarded and plotted. Default: false.

Declaration
[ObservableProperty]
private bool _isAuxEnabled
Field Value
Type Description
bool

_lastRamp

Declaration
private ushort _lastRamp
Field Value
Type Description
ushort

_lastVizTime

Declaration
private DateTime _lastVizTime
Field Value
Type Description
DateTime

_outputBioChannels

Declaration
private int _outputBioChannels
Field Value
Type Description
int

_port

Declaration
[ObservableProperty]
private int _port
Field Value
Type Description
int

_presetIns

Declaration
private int _presetIns
Field Value
Type Description
int

_presetMults

Declaration
private int _presetMults
Field Value
Type Description
int

_rampInitialised

Declaration
private bool _rampInitialised
Field Value
Type Description
bool

_readerThread

Declaration
private Thread? _readerThread
Field Value
Type Description
Thread

_reading

Declaration
private volatile bool _reading
Field Value
Type Description
bool

_samplesPerBatch

Declaration
private int _samplesPerBatch
Field Value
Type Description
int

_samplesReceivedBacking

Declaration
private long _samplesReceivedBacking
Field Value
Type Description
long

_stream

Declaration
private NetworkStream? _stream
Field Value
Type Description
NetworkStream

_streamedBioChannels

Declaration
private int _streamedBioChannels
Field Value
Type Description
int

_tcpClient

Declaration
private TcpClient? _tcpClient
Field Value
Type Description
TcpClient

_totalChannels

Declaration
private int _totalChannels
Field Value
Type Description
int

Properties

DecimatorEnabled

Declaration
[ExcludeFromCodeCoverage]
public bool DecimatorEnabled { get; set; }
Property Value
Type Description
bool

EffectiveSummary

Human-readable summary for live UI feedback.

Declaration
public string EffectiveSummary { get; }
Property Value
Type Description
string

FsampIndex

Declaration
[ExcludeFromCodeCoverage]
public int FsampIndex { get; set; }
Property Value
Type Description
int

HasAnyOutput

True when at least one output channel is selected.

Declaration
public bool HasAnyOutput { get; }
Property Value
Type Description
bool

InsCollection

IN1..IN8 (16 ch each), toggleable. Default all off.

Declaration
public ObservableCollection<QuattrocentoInput> InsCollection { get; }
Property Value
Type Description
ObservableCollection<QuattrocentoInput>

Ip

Declaration
[ExcludeFromCodeCoverage]
public string Ip { get; set; }
Property Value
Type Description
string

IsAuxEnabled

Whether the 16 AUX channels are forwarded and plotted. Default: false.

Declaration
[ExcludeFromCodeCoverage]
public bool IsAuxEnabled { 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
BaseBlock.JsonTypeName

MaxInputs

Source block — produces a stream and takes no inputs.

Declaration
public override int MaxInputs { get; }
Property Value
Type Description
int
Overrides
BaseBlock.MaxInputs

MinInputs

Source block — produces a stream and takes no inputs.

Declaration
public override int MinInputs { get; }
Property Value
Type Description
int
Overrides
BaseBlock.MinInputs

MultsCollection

MULTIPLE IN1..IN4 (64 ch each), toggleable. Default all off.

Declaration
public ObservableCollection<QuattrocentoInput> MultsCollection { get; }
Property Value
Type Description
ObservableCollection<QuattrocentoInput>

NchIndex

Effective NCH index — the smallest preset (0–3) whose channel grouping includes every currently enabled input.

Declaration
public int NchIndex { get; }
Property Value
Type Description
int

Port

Declaration
[ExcludeFromCodeCoverage]
public int Port { get; set; }
Property Value
Type Description
int

Scope

Declaration
public ScopeMonitor Scope { get; }
Property Value
Type Description
ScopeMonitor

StreamInfo

Declaration
public QuattrocentoStreamInfo StreamInfo { get; }
Property Value
Type Description
QuattrocentoStreamInfo

Visualization

This block's visualization, or null when it has none.

Declaration
protected override BlockVisualization? Visualization { get; }
Property Value
Type Description
BlockVisualization
Overrides
BaseBlock.Visualization
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

Declaration
public BlockVisualization Viz { get; }
Property Value
Type Description
BlockVisualization

Methods

CheckRamp(byte[], int)

Declaration
private void CheckRamp(byte[] buf, int sampleOffset)
Parameters
Type Name Description
byte[] buf
int sampleOffset

CleanupConnection()

Declaration
private void CleanupConnection()

ConfigureInput(IServiceProvider, JsonModel)

Declaration
public static Quattrocento ConfigureInput(IServiceProvider sp, JsonModel m)
Parameters
Type Name Description
IServiceProvider sp
JsonModel m
Returns
Type Description
Quattrocento

Connect()

Declaration
public void Connect()

ConnectAsync()

Declaration
public Task ConnectAsync()
Returns
Type Description
Task

DecodeBatchAndPublish(byte[], int)

Declaration
private void DecodeBatchAndPublish(byte[] buf, int batchOffset)
Parameters
Type Name Description
byte[] buf
int batchOffset

Disconnect()

Declaration
public void Disconnect()

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public override void Dispose()
Overrides
BaseBlock.Dispose()

FeedViz(Matrix<double>)

Feeds the visualization bundle with the full batch matrix. The scope drains all rows via its batch entry point (no per-sample throttle); spider/heatmap receive only the last row. Throttled to ~60 fps.

Declaration
private void FeedViz(Matrix<double> matrix)
Parameters
Type Name Description
Matrix<double> matrix

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 ConfigureInput reads them, or null when the block takes no parameters.

Overrides
BaseBlock.GetJsonParams()

InitializeInputs()

Declaration
private void InitializeInputs()

OnDecimatorEnabledChanged(bool)

Executes the logic for when DecimatorEnabled just changed.

Declaration
private void OnDecimatorEnabledChanged(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 DecimatorEnabled is changed.

OnDecimatorEnabledChanged(bool, bool)

Executes the logic for when DecimatorEnabled just changed.

Declaration
private void OnDecimatorEnabledChanged(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 DecimatorEnabled is changed.

OnDecimatorEnabledChanging(bool)

Executes the logic for when DecimatorEnabled is changing.

Declaration
private void OnDecimatorEnabledChanging(bool value)
Parameters
Type Name Description
bool value

The new property value being set.

Remarks

This method is invoked right before the value of DecimatorEnabled is changed.

OnDecimatorEnabledChanging(bool, bool)

Executes the logic for when DecimatorEnabled is changing.

Declaration
private void OnDecimatorEnabledChanging(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 DecimatorEnabled is changed.

OnFsampIndexChanged(int)

Executes the logic for when FsampIndex just changed.

Declaration
private void OnFsampIndexChanged(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 FsampIndex is changed.

OnFsampIndexChanged(int, int)

Executes the logic for when FsampIndex just changed.

Declaration
private void OnFsampIndexChanged(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 FsampIndex is changed.

OnFsampIndexChanging(int)

Executes the logic for when FsampIndex is changing.

Declaration
private void OnFsampIndexChanging(int value)
Parameters
Type Name Description
int value

The new property value being set.

Remarks

This method is invoked right before the value of FsampIndex is changed.

OnFsampIndexChanging(int, int)

Executes the logic for when FsampIndex is changing.

Declaration
private void OnFsampIndexChanging(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 FsampIndex is changed.

OnInputChanged(object?, PropertyChangedEventArgs)

Declaration
private void OnInputChanged(object? sender, PropertyChangedEventArgs e)
Parameters
Type Name Description
object sender
PropertyChangedEventArgs e

OnIpChanged(string)

Executes the logic for when Ip just changed.

Declaration
private void OnIpChanged(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 Ip is changed.

OnIpChanged(string?, string)

Executes the logic for when Ip just changed.

Declaration
private void OnIpChanged(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 Ip is changed.

OnIpChanging(string)

Executes the logic for when Ip is changing.

Declaration
private void OnIpChanging(string value)
Parameters
Type Name Description
string value

The new property value being set.

Remarks

This method is invoked right before the value of Ip is changed.

OnIpChanging(string?, string)

Executes the logic for when Ip is changing.

Declaration
private void OnIpChanging(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 Ip is changed.

OnIsAuxEnabledChanged(bool)

Executes the logic for when IsAuxEnabled just changed.

Declaration
private void OnIsAuxEnabledChanged(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 IsAuxEnabled is changed.

OnIsAuxEnabledChanged(bool, bool)

Executes the logic for when IsAuxEnabled just changed.

Declaration
private void OnIsAuxEnabledChanged(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 IsAuxEnabled is changed.

OnIsAuxEnabledChanging(bool)

Executes the logic for when IsAuxEnabled is changing.

Declaration
private void OnIsAuxEnabledChanging(bool value)
Parameters
Type Name Description
bool value

The new property value being set.

Remarks

This method is invoked right before the value of IsAuxEnabled is changed.

OnIsAuxEnabledChanging(bool, bool)

Executes the logic for when IsAuxEnabled is changing.

Declaration
private void OnIsAuxEnabledChanging(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 IsAuxEnabled is changed.

OnPortChanged(int)

Executes the logic for when Port just changed.

Declaration
private void OnPortChanged(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 Port is changed.

OnPortChanged(int, int)

Executes the logic for when Port just changed.

Declaration
private void OnPortChanged(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 Port is changed.

OnPortChanging(int)

Executes the logic for when Port is changing.

Declaration
private void OnPortChanging(int value)
Parameters
Type Name Description
int value

The new property value being set.

Remarks

This method is invoked right before the value of Port is changed.

OnPortChanging(int, int)

Executes the logic for when Port is changing.

Declaration
private void OnPortChanging(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 Port is changed.

OnReceive(object, object)

Processes incoming data from an upstream block. Must be implemented by derived classes.

Declaration
protected override void OnReceive(object sender, object data)
Parameters
Type Name Description
object sender

The publishing block, or whatever else delivered the value.

object data
Overrides
BaseBlock.OnReceive(object, object)
Remarks

Called on the dispatching thread, not the UI thread.

ReadBufferUsage(byte[], int)

Declaration
private void ReadBufferUsage(byte[] buf, int sampleOffset)
Parameters
Type Name Description
byte[] buf
int sampleOffset

ReaderLoop()

Declaration
private void ReaderLoop()

RecalcDerived()

Declaration
private void RecalcDerived()

StartStreaming()

Declaration
private void StartStreaming()

StopStreaming()

Declaration
private void StopStreaming()

Implements

INotifyPropertyChanged
INotifyPropertyChanging
ISubscriber
IPublisher
IBaseBlockProps
IJsonExportable
IDisposable
IAsyncDisposable

Search documentation

Start typing to search the documentation.