Search Results for

    Show / Hide Table of Contents

    Class CoreConfigController

    Controls loading, validating, reading, and writing a configuration JSON file. Thread-safe. Ensures a valid default config exists on disk.

    Inheritance
    object
    CoreConfigController
    Implements
    ICoreConfig
    Namespace: Wss.CoreModule
    Assembly: WSS_Core_Interface.dll
    Syntax
    public sealed class CoreConfigController : ICoreConfig

    Constructors

    CoreConfigController()

    Initializes a controller that reads/writes "stimConfig.json" in the current directory.

    Declaration
    public CoreConfigController()

    CoreConfigController(string)

    Initializes a controller pointing to a custom path. If a directory path is provided, "stimConfig.json" is created inside it.

    Declaration
    public CoreConfigController(string path)
    Parameters
    Type Name Description
    string path

    Absolute or relative file path, or a directory path.

    Exceptions
    Type Condition
    ArgumentException

    Thrown when path is null, empty, or whitespace.

    Properties

    AmpCurves

    Returns the configured amplitude curve parameters per WSS (index 0..2 maps to Wss1..Wss3).

    Declaration
    public AmpCurveParams[] AmpCurves { get; }
    Property Value
    Type Description
    AmpCurveParams[]
    Remarks

    The returned array is the live in-memory configuration array, not a defensive copy. Mutating the returned array or its entries changes the loaded configuration until it is reloaded. Call SaveJson() to persist those changes.

    BroadcastTarget

    Gets the configured on-wire broadcast receiver address.

    Declaration
    public byte BroadcastTarget { get; }
    Property Value
    Type Description
    byte
    Remarks

    The value is read from the persisted hexadecimal string in broadcastTarget. If the stored value is missing or invalid, the historical default 0x8F is returned and the normalized value is immediately persisted back to disk.

    Firmware

    Gets the firmware version saved on config. Thread safe get.

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

    IsLoaded

    Indicates whether the JSON configuration has been loaded into memory.

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

    MaxWss

    Gets max number of WSS supported by this app. Thread safe get.

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

    UseConfigAmpCurves

    When true, the core should use per-WSS amplitude curves from the config file.

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

    WssTargets

    Gets the configured on-wire receiver addresses for logical Wss1..Wss3. A normalized three-entry copy is returned.

    Declaration
    public byte[] WssTargets { get; }
    Property Value
    Type Description
    byte[]
    Remarks

    Missing entries are backfilled with the historical defaults 0x81, 0x82, and 0x83. When normalization changes the in-memory configuration, the updated values are immediately persisted.

    _configPath

    Resolved file path to the configuration JSON.

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

    Methods

    LoadJson()

    Loads the configuration from disk. Creates and saves a default config if missing or invalid. Safe to call multiple times.

    Declaration
    public void LoadJson()

    LoadJson(string)

    Loads the core configuration from disk at the specified path. If path is a directory, the file name stimConfig.json is appended. If the file does not exist or is invalid, a default configuration is created and saved. Safe to call multiple times; the operation is thread-safe.

    Declaration
    public void LoadJson(string path)
    Parameters
    Type Name Description
    string path

    Absolute or relative file path, or a directory path ending with a path separator.

    SaveJson()

    Threads safe, persists the current configuration to disk. No-op if not loaded yet.

    Declaration
    public void SaveJson()

    SetFirmware(string, WSSVersionHandler)

    Updates the firmware version recorded in the configuration and immediately saves it to disk. Thread safe.

    Declaration
    public void SetFirmware(string v, WSSVersionHandler verHandler)
    Parameters
    Type Name Description
    string v

    Firmware version string to record (for example, "H03").

    WSSVersionHandler verHandler

    Version handler used to validate whether the supplied firmware string is supported.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when verHandler is null.

    ArgumentException

    Thrown when v is not supported by verHandler.

    SetMaxWss(int)

    Updates the maximum number of supported WSS devices in the loaded configuration and immediately persists the change to disk. Thread safe.

    Declaration
    public void SetMaxWss(int v)
    Parameters
    Type Name Description
    int v

    New maximum WSS count. Must be greater than zero.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown when v is less than or equal to zero.

    Implements

    ICoreConfig
    In this article
    Back to top Generated by DocFX