Search Results for

    Show / Hide Table of Contents

    Class WssStimulationCore

    Stimulation core that manages connection, setup (via a queued step runner), and a background streaming loop. Public mutator methods enqueue device edits and return immediately.

    Inheritance
    object
    WssStimulationCore
    Implements
    IStimulationCore
    IBasicStimulation
    Namespace: Wss.CoreModule
    Assembly: WSS_Core_Interface.dll
    Syntax
    public sealed class WssStimulationCore : IStimulationCore, IBasicStimulation

    Constructors

    WssStimulationCore(ITransport, WssStimulationCoreOptions)

    Initializes a stimulation core over a caller-provided transport.

    Declaration
    public WssStimulationCore(ITransport transport, WssStimulationCoreOptions options)
    Parameters
    Type Name Description
    ITransport transport

    Transport used to communicate with the WSS device(s).

    WssStimulationCoreOptions options

    Core configuration path, setup retry behavior, and default stimulation values used during initial setup.

    Remarks

    The core owns the lifetime of transport and disposes it when the core is disposed. Call Shutdown() to stop streaming/disconnect without disposing the transport.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when transport or options is null.

    ArgumentException

    Thrown when ConfigPath is null, empty, or whitespace.

    ArgumentOutOfRangeException

    Thrown when MaxSetupTries is less than 1.

    Methods

    Dispose()

    Declaration
    public void Dispose()
    Remarks

    Calls Shutdown() and then disposes the transport instance provided at construction time. Safe to call multiple times.

    GetCoreConfigController()

    Gets the JSON-backed stimulation configuration controller currently used by this core.

    Declaration
    public CoreConfigController GetCoreConfigController()
    Returns
    Type Description
    CoreConfigController

    The active CoreConfigController instance that provides read/write access to stimulation parameters and constants loaded from the configuration file.

    Remarks

    Returned reference is live, not a copy and thread safe.

    Initialize()

    Initializes the core: loads JSON config, prepares buffers, and begins connecting to the transport. Non-blocking; call Tick() to advance state.

    Declaration
    public void Initialize()
    Exceptions
    Type Condition
    ObjectDisposedException

    Thrown when the core has been disposed.

    IsChannelInRange(int)

    Returns true if ch is within the valid channel range.

    Declaration
    public bool IsChannelInRange(int ch)
    Parameters
    Type Name Description
    int ch

    1-based channel to check.

    Returns
    Type Description
    bool

    Load(WssTarget)

    Loads board settings from non-volatile memory. Implementations should pause streaming if needed, perform the load, then resume.

    Declaration
    public void Load(WssTarget targetWSS = WssTarget.Broadcast)
    Parameters
    Type Name Description
    WssTarget targetWSS

    LoadConfigFile()

    Reloads the stimulation JSON configuration from disk into memory.

    Declaration
    public void LoadConfigFile()

    LoadWaveform(string, int)

    Loads a waveform JSON file (…WF.json), builds it, and enqueues an upload.

    Declaration
    public void LoadWaveform(string fileName, int eventID)
    Parameters
    Type Name Description
    string fileName

    File name or path; “WF.json” suffix is enforced.

    int eventID

    Event slot to target.

    NormalSetup()

    Seeds the per-target setup step lists for a full initial configuration and starts the setup runner. Used once after connect.

    Declaration
    public void NormalSetup()

    Ready()

    True when the core is ready to accept start stimulation.

    Declaration
    public bool Ready()
    Returns
    Type Description
    bool

    Request_Configs(int, int, WssTarget)

    Requests configuration blocks from the device.

    Declaration
    public void Request_Configs(int command, int id, WssTarget targetWSS = WssTarget.Broadcast)
    Parameters
    Type Name Description
    int command

    Command group identifier.

    int id

    Sub-id / selector.

    WssTarget targetWSS

    Save(WssTarget)

    Saves board settings to non-volatile memory. Implementations should pause streaming if needed, perform the save, then resume.

    Declaration
    public void Save(WssTarget targetWSS = WssTarget.Broadcast)
    Parameters
    Type Name Description
    WssTarget targetWSS

    Shutdown()

    Stops streaming, attempts to zero outputs, disconnects transport, and releases resources. Safe to call multiple times.

    Declaration
    public void Shutdown()

    StartStim(WssTarget)

    Starts stimulation on the target and launches streaming when ready.

    Declaration
    public void StartStim(WssTarget targetWSS = WssTarget.Broadcast)
    Parameters
    Type Name Description
    WssTarget targetWSS

    Started()

    True when device transport is started or streaming.

    Declaration
    public bool Started()
    Returns
    Type Description
    bool

    StimulateAnalog(int, int, float, int)

    Caches per-channel amplitude, pulse width, and IPI. No I/O here; the streaming loop pushes cached values to the device.

    Declaration
    public void StimulateAnalog(int channel, int PW, float amp, int IPI)
    Parameters
    Type Name Description
    int channel

    1-based logical channel.

    int PW

    Pulse width (µs).

    float amp

    Amplitude (mA domain; mapped to device scale during streaming).

    int IPI

    Inter-pulse interval (ms).

    StopStim(WssTarget)

    Stops stimulation on the target and, if streaming, stops the background loop.

    Declaration
    public void StopStim(WssTarget targetWSS = WssTarget.Broadcast)
    Parameters
    Type Name Description
    WssTarget targetWSS

    Tick()

    Advances the internal state machine (e.g., Connecting → SettingUp → Ready → Streaming). Call regularly from the main loop.

    Declaration
    public void Tick()

    TryGetModuleSettings(WssTarget, out ModuleSettings)

    Tries to obtain the last decoded ModuleSettings for a target by reading the client's cached ModuleQuery data and decoding it. Returns false if no data is cached or the payload is incomplete; when false, 'settings' may still be non-null but marked as partial.

    Declaration
    public bool TryGetModuleSettings(WssTarget target, out ModuleSettings settings)
    Parameters
    Type Name Description
    WssTarget target
    ModuleSettings settings
    Returns
    Type Description
    bool

    UpdateEventShape(int, int, int, WssTarget)

    Sets event shape IDs directly for the given eventID. Implementations should send setup edits with replies.

    Declaration
    public void UpdateEventShape(int cathodicWaveform, int anodicWaveform, int eventID, WssTarget targetWSS = WssTarget.Broadcast)
    Parameters
    Type Name Description
    int cathodicWaveform

    Shape ID for the standard phase.

    int anodicWaveform

    Shape ID for the recharge phase.

    int eventID

    Event slot to modify.

    WssTarget targetWSS

    UpdateIPD(int, int, WssTarget)

    Updates inter-phase delay (IPD) for a specific eventID via setup commands (with replies). If currently Streaming, the core pauses streaming, sends the edit, and resumes when done.

    Declaration
    public void UpdateIPD(int IPD, int eventID, WssTarget targetWSS = WssTarget.Broadcast)
    Parameters
    Type Name Description
    int IPD
    int eventID

    Event slot to target.

    WssTarget targetWSS

    UpdateIPD(int, WssTarget)

    Updates inter-phase delay (IPD) for events 1–3 via setup commands (with replies). If currently Streaming, the core pauses streaming, sends edits, and resumes when done.

    Declaration
    public void UpdateIPD(int IPD, WssTarget targetWSS = WssTarget.Broadcast)
    Parameters
    Type Name Description
    int IPD
    WssTarget targetWSS

    UpdateWaveform(int[], int, WssTarget)

    Builds a custom waveform from raw points and schedules the upload for the specified eventID.

    Declaration
    public void UpdateWaveform(int[] waveform, int eventID, WssTarget targetWSS = WssTarget.Broadcast)
    Parameters
    Type Name Description
    int[] waveform

    Concatenated waveform definition.

    int eventID

    Event slot to target.

    WssTarget targetWSS

    UpdateWaveform(WaveformBuilder, int, WssTarget)

    Uploads a prepared waveform and assigns shapes for eventID.

    Declaration
    public void UpdateWaveform(WaveformBuilder waveform, int eventID, WssTarget targetWSS = WssTarget.Broadcast)
    Parameters
    Type Name Description
    WaveformBuilder waveform

    Prepared WaveformBuilder.

    int eventID

    Event slot to target.

    WssTarget targetWSS

    WaveformSetup(WaveformBuilder, int, WssTarget)

    Schedules the upload of custom waveform chunks and points eventID at the uploaded shapes.

    Declaration
    public void WaveformSetup(WaveformBuilder wave, int eventID, WssTarget targetWSS = WssTarget.Broadcast)
    Parameters
    Type Name Description
    WaveformBuilder wave

    Waveform builder.

    int eventID

    Event slot to target.

    WssTarget targetWSS

    ZeroOutStim(WssTarget)

    Sends a zero-out command. Does not alter cached values.

    Declaration
    public void ZeroOutStim(WssTarget wsstarget = WssTarget.Broadcast)
    Parameters
    Type Name Description
    WssTarget wsstarget

    Implements

    IStimulationCore
    IBasicStimulation
    In this article
    Back to top Generated by DocFX