Class SiFi
Source block for SiFi Labs BLE biosignal devices (BioArmband / BioPoint).
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: device MAC address, bridge executable, mains notch mode, lower and upper bandpass cutoffs in Hz. Replace the example MAC address with your paired device address.
{
"SiFi": {
"Type": "sifi",
"Inputs": [],
"Params": ["AA:BB:CC:DD:EE:FF", "sifibridge", "on50", 20, 450]
}
}
How Type, Inputs and Params work · Block catalogue and parameter reference
Implements
Inherited Members
Namespace: MOSAIC.Models.Devices
Assembly: MOSAIC.dll
Syntax
public class SiFi : BaseBlock, INotifyPropertyChanged, INotifyPropertyChanging, ISubscriber, IPublisher, IBaseBlockProps, IJsonExportable, IDisposable, IAsyncDisposable
Remarks
Each sensor type gets its own ScopeMonitor for independent visualization. Only sensors included in EnabledSensors are configured on the device; their scopes are created lazily on first data arrival.
Constructors
SiFi(string, double, string, string, MainsNotchMode, double, double)
Declaration
public SiFi(string name, double desiredRate, string macAddress, string bridgePath = "sifibridge", SiFi.MainsNotchMode mainsNotch = MainsNotchMode.On50, double bandpassLow = 20, double bandpassHigh = 450)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| double | desiredRate | |
| string | macAddress | |
| string | bridgePath | |
| SiFi.MainsNotchMode | mainsNotch | |
| double | bandpassLow | |
| double | bandpassHigh |
Fields
_batteryLevel
Battery level (0–100), or -1 if unknown.
Declaration
[ObservableProperty]
private int _batteryLevel
Field Value
| Type | Description |
|---|---|
| int |
_bridge
Declaration
private readonly SifiBridge _bridge
Field Value
| Type | Description |
|---|---|
| SifiBridge |
_deviceInfo
Raw device info from show.
Declaration
[ObservableProperty]
private string _deviceInfo
Field Value
| Type | Description |
|---|---|
| string |
_deviceStatus
Human-readable status.
Declaration
[ObservableProperty]
private string _deviceStatus
Field Value
| Type | Description |
|---|---|
| string |
_displayToMac
Declaration
private readonly Dictionary<string, string> _displayToMac
Field Value
| Type | Description |
|---|---|
| Dictionary<string, string> |
_disposed
Declaration
private bool _disposed
Field Value
| Type | Description |
|---|---|
| bool |
_enabledSensors
Which sensors are enabled. Set before calling connect.
Declaration
[ObservableProperty]
private SiFi.SensorFlags _enabledSensors
Field Value
| Type | Description |
|---|---|
| SiFi.SensorFlags |
_isConnected
Whether the device is connected.
Declaration
[ObservableProperty]
private bool _isConnected
Field Value
| Type | Description |
|---|---|
| bool |
_isStreaming
Whether the device is currently streaming.
Declaration
[ObservableProperty]
private bool _isStreaming
Field Value
| Type | Description |
|---|---|
| bool |
_resolvedMac
Declaration
private string? _resolvedMac
Field Value
| Type | Description |
|---|---|
| string |
_temperature
Device temperature in °C, or NaN if unknown.
Declaration
[ObservableProperty]
private double _temperature
Field Value
| Type | Description |
|---|---|
| double |
_verboseLogging
Declaration
private bool _verboseLogging
Field Value
| Type | Description |
|---|---|
| bool |
Properties
BandpassHigh
EMG bandpass high cutoff in Hz.
Declaration
public double BandpassHigh { get; }
Property Value
| Type | Description |
|---|---|
| double |
BandpassLow
EMG bandpass low cutoff in Hz.
Declaration
public double BandpassLow { get; }
Property Value
| Type | Description |
|---|---|
| double |
BatteryLevel
Battery level (0–100), or -1 if unknown.
Declaration
[ExcludeFromCodeCoverage]
public int BatteryLevel { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
DeviceInfo
Raw device info from show.
Declaration
[ExcludeFromCodeCoverage]
public string DeviceInfo { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
DeviceStatus
Human-readable status.
Declaration
[ExcludeFromCodeCoverage]
public string DeviceStatus { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
DumpFilePrefix
Recordings from this block are named <block>_emg.csv.
Declaration
protected override string DumpFilePrefix { get; }
Property Value
| Type | Description |
|---|---|
| string |
Overrides
EmgChannelCount
Number of EMG channels detected.
Declaration
public int EmgChannelCount { get; private set; }
Property Value
| Type | Description |
|---|---|
| int |
EnabledSensors
Which sensors are enabled. Set before calling connect.
Declaration
[ExcludeFromCodeCoverage]
public SiFi.SensorFlags EnabledSensors { get; set; }
Property Value
| Type | Description |
|---|---|
| SiFi.SensorFlags |
FoundDevices
Discovered BLE devices for the UI picker.
Declaration
public ObservableCollection<string> FoundDevices { get; }
Property Value
| Type | Description |
|---|---|
| ObservableCollection<string> |
IsConnected
Whether the device is connected.
Declaration
[ExcludeFromCodeCoverage]
public bool IsConnected { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsStreaming
Whether the device is currently streaming.
Declaration
[ExcludeFromCodeCoverage]
public bool IsStreaming { 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
MacAddress
BLE MAC address from the JSON config.
Declaration
public string MacAddress { get; }
Property Value
| Type | Description |
|---|---|
| string |
MainsNotch
Mains notch filter mode.
Declaration
public SiFi.MainsNotchMode MainsNotch { get; }
Property Value
| Type | Description |
|---|---|
| SiFi.MainsNotchMode |
MaxInputs
Source block — produces a stream and takes no inputs.
Declaration
public override int MaxInputs { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
MinInputs
Source block — produces a stream and takes no inputs.
Declaration
public override int MinInputs { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
PacketsReceived
Total data packets received.
Declaration
public long PacketsReceived { get; private set; }
Property Value
| Type | Description |
|---|---|
| long |
SamplesPublished
Total EMG sample rows published.
Declaration
public long SamplesPublished { get; private set; }
Property Value
| Type | Description |
|---|---|
| long |
ScopeEcg
Lightweight scope for ECG (single channel).
Declaration
public ScopeMonitor ScopeEcg { get; }
Property Value
| Type | Description |
|---|---|
| ScopeMonitor |
ScopeEda
Lightweight scope for EDA (single channel).
Declaration
public ScopeMonitor ScopeEda { get; }
Property Value
| Type | Description |
|---|---|
| ScopeMonitor |
ScopeImu
Lightweight scope for IMU (7ch: ax,ay,az,qw,qx,qy,qz).
Declaration
public ScopeMonitor ScopeImu { get; }
Property Value
| Type | Description |
|---|---|
| ScopeMonitor |
ScopePpg
Lightweight scope for PPG (4ch: ir,r,g,b).
Declaration
public ScopeMonitor ScopePpg { get; }
Property Value
| Type | Description |
|---|---|
| ScopeMonitor |
Temperature
Device temperature in °C, or NaN if unknown.
Declaration
[ExcludeFromCodeCoverage]
public double Temperature { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
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
Full visualization bundle for EMG (scope + spider + heatmap).
Declaration
public BlockVisualization Viz { get; set; }
Property Value
| Type | Description |
|---|---|
| BlockVisualization |
Methods
ConfigureInput(IServiceProvider, JsonModel)
Declaration
public static SiFi ConfigureInput(IServiceProvider sp, JsonModel m)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceProvider | sp | |
| JsonModel | m |
Returns
| Type | Description |
|---|---|
| SiFi |
ConnectAsync(string, CancellationToken)
Declaration
public Task<bool> ConnectAsync(string selectedDisplayName, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | selectedDisplayName | |
| CancellationToken | ct |
Returns
| Type | Description |
|---|---|
| Task<bool> |
ConnectWithConfigMacAsync(CancellationToken)
Declaration
public Task<bool> ConnectWithConfigMacAsync(CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | ct |
Returns
| Type | Description |
|---|---|
| Task<bool> |
DisconnectAsync()
Declaration
public Task DisconnectAsync()
Returns
| Type | Description |
|---|---|
| Task |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public override void Dispose()
Overrides
Flag(SensorFlags, SensorFlags)
Declaration
private static string Flag(SiFi.SensorFlags flags, SiFi.SensorFlags sensor)
Parameters
| Type | Name | Description |
|---|---|---|
| SiFi.SensorFlags | flags | |
| SiFi.SensorFlags | sensor |
Returns
| Type | Description |
|---|---|
| string |
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
HandleDeviceInfoPacket(JsonElement)
Declaration
private void HandleDeviceInfoPacket(JsonElement root)
Parameters
| Type | Name | Description |
|---|---|---|
| JsonElement | root |
HandleEmgArmband(JsonElement)
Declaration
private void HandleEmgArmband(JsonElement root)
Parameters
| Type | Name | Description |
|---|---|---|
| JsonElement | root |
HandleImu(JsonElement)
Declaration
private void HandleImu(JsonElement root)
Parameters
| Type | Name | Description |
|---|---|---|
| JsonElement | root |
HandlePpg(JsonElement)
Declaration
private void HandlePpg(JsonElement root)
Parameters
| Type | Name | Description |
|---|---|---|
| JsonElement | root |
HandleScanResults(JsonElement)
Declaration
private void HandleScanResults(JsonElement listElement)
Parameters
| Type | Name | Description |
|---|---|---|
| JsonElement | listElement |
HandleShow(JsonElement)
Declaration
private void HandleShow(JsonElement showElement)
Parameters
| Type | Name | Description |
|---|---|---|
| JsonElement | showElement |
HandleSingleEmg(JsonElement)
Declaration
private void HandleSingleEmg(JsonElement root)
Parameters
| Type | Name | Description |
|---|---|---|
| JsonElement | root |
HandleStatus(JsonElement)
Declaration
private void HandleStatus(JsonElement root)
Parameters
| Type | Name | Description |
|---|---|---|
| JsonElement | root |
HandleTaggedSensor(JsonElement, string, string, ScopeMonitor)
Declaration
private void HandleTaggedSensor(JsonElement root, string channelName, string tag, ScopeMonitor scope)
Parameters
| Type | Name | Description |
|---|---|---|
| JsonElement | root | |
| string | channelName | |
| string | tag | |
| ScopeMonitor | scope |
OnBatteryLevelChanged(int)
Executes the logic for when BatteryLevel just changed.
Declaration
private void OnBatteryLevelChanged(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 BatteryLevel is changed.
OnBatteryLevelChanged(int, int)
Executes the logic for when BatteryLevel just changed.
Declaration
private void OnBatteryLevelChanged(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 BatteryLevel is changed.
OnBatteryLevelChanging(int)
Executes the logic for when BatteryLevel is changing.
Declaration
private void OnBatteryLevelChanging(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The new property value being set. |
Remarks
This method is invoked right before the value of BatteryLevel is changed.
OnBatteryLevelChanging(int, int)
Executes the logic for when BatteryLevel is changing.
Declaration
private void OnBatteryLevelChanging(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 BatteryLevel is changed.
OnBridgeOutput(string)
Declaration
private void OnBridgeOutput(string line)
Parameters
| Type | Name | Description |
|---|---|---|
| string | line |
OnDeviceInfoChanged(string)
Executes the logic for when DeviceInfo just changed.
Declaration
private void OnDeviceInfoChanged(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 DeviceInfo is changed.
OnDeviceInfoChanged(string?, string)
Executes the logic for when DeviceInfo just changed.
Declaration
private void OnDeviceInfoChanged(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 DeviceInfo is changed.
OnDeviceInfoChanging(string)
Executes the logic for when DeviceInfo is changing.
Declaration
private void OnDeviceInfoChanging(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The new property value being set. |
Remarks
This method is invoked right before the value of DeviceInfo is changed.
OnDeviceInfoChanging(string?, string)
Executes the logic for when DeviceInfo is changing.
Declaration
private void OnDeviceInfoChanging(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 DeviceInfo is changed.
OnDeviceStatusChanged(string)
Executes the logic for when DeviceStatus just changed.
Declaration
private void OnDeviceStatusChanged(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 DeviceStatus is changed.
OnDeviceStatusChanged(string?, string)
Executes the logic for when DeviceStatus just changed.
Declaration
private void OnDeviceStatusChanged(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 DeviceStatus is changed.
OnDeviceStatusChanging(string)
Executes the logic for when DeviceStatus is changing.
Declaration
private void OnDeviceStatusChanging(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The new property value being set. |
Remarks
This method is invoked right before the value of DeviceStatus is changed.
OnDeviceStatusChanging(string?, string)
Executes the logic for when DeviceStatus is changing.
Declaration
private void OnDeviceStatusChanging(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 DeviceStatus is changed.
OnEnabledSensorsChanged(SensorFlags)
Executes the logic for when EnabledSensors just changed.
Declaration
private void OnEnabledSensorsChanged(SiFi.SensorFlags value)
Parameters
| Type | Name | Description |
|---|---|---|
| SiFi.SensorFlags | value | The new property value that was set. |
Remarks
This method is invoked right after the value of EnabledSensors is changed.
OnEnabledSensorsChanged(SensorFlags, SensorFlags)
Executes the logic for when EnabledSensors just changed.
Declaration
private void OnEnabledSensorsChanged(SiFi.SensorFlags oldValue, SiFi.SensorFlags newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| SiFi.SensorFlags | oldValue | The previous property value that was replaced. |
| SiFi.SensorFlags | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of EnabledSensors is changed.
OnEnabledSensorsChanging(SensorFlags)
Executes the logic for when EnabledSensors is changing.
Declaration
private void OnEnabledSensorsChanging(SiFi.SensorFlags value)
Parameters
| Type | Name | Description |
|---|---|---|
| SiFi.SensorFlags | value | The new property value being set. |
Remarks
This method is invoked right before the value of EnabledSensors is changed.
OnEnabledSensorsChanging(SensorFlags, SensorFlags)
Executes the logic for when EnabledSensors is changing.
Declaration
private void OnEnabledSensorsChanging(SiFi.SensorFlags oldValue, SiFi.SensorFlags newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| SiFi.SensorFlags | oldValue | The previous property value that is being replaced. |
| SiFi.SensorFlags | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of EnabledSensors 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.
OnIsStreamingChanged(bool)
Executes the logic for when IsStreaming just changed.
Declaration
private void OnIsStreamingChanged(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 IsStreaming is changed.
OnIsStreamingChanged(bool, bool)
Executes the logic for when IsStreaming just changed.
Declaration
private void OnIsStreamingChanged(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 IsStreaming is changed.
OnIsStreamingChanging(bool)
Executes the logic for when IsStreaming is changing.
Declaration
private void OnIsStreamingChanging(bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | value | The new property value being set. |
Remarks
This method is invoked right before the value of IsStreaming is changed.
OnIsStreamingChanging(bool, bool)
Executes the logic for when IsStreaming is changing.
Declaration
private void OnIsStreamingChanging(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 IsStreaming is changed.
OnReceive(object, object)
Source block — no upstream data processing.
Declaration
protected override void OnReceive(object sender, object data)
Parameters
| Type | Name | Description |
|---|---|---|
| object | sender | |
| object | data |
Overrides
OnTemperatureChanged(double)
Executes the logic for when Temperature just changed.
Declaration
private void OnTemperatureChanged(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The new property value that was set. |
Remarks
This method is invoked right after the value of Temperature is changed.
OnTemperatureChanged(double, double)
Executes the logic for when Temperature just changed.
Declaration
private void OnTemperatureChanged(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 Temperature is changed.
OnTemperatureChanging(double)
Executes the logic for when Temperature is changing.
Declaration
private void OnTemperatureChanging(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The new property value being set. |
Remarks
This method is invoked right before the value of Temperature is changed.
OnTemperatureChanging(double, double)
Executes the logic for when Temperature is changing.
Declaration
private void OnTemperatureChanging(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 Temperature is changed.
RequestStatusAsync()
Declaration
public Task RequestStatusAsync()
Returns
| Type | Description |
|---|---|
| Task |
ScanAsync(CancellationToken)
Declaration
public Task ScanAsync(CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | ct |
Returns
| Type | Description |
|---|---|
| Task |