Class Stimulationbasic
Provides a Unity-facing API for the basic WSS stimulation core.
Inheritance
Namespace: WSS.Unity
Assembly: UnitySubmodule.Docs.dll
Syntax
public class Stimulationbasic : MonoBehaviour
Remarks
This component wraps WssStimulationCore and forwards calls to IStimulationCore
and IBasicStimulation.
Lifecycle: the device is initialized in Stimulationbasic.OnEnable(), ticked in Stimulationbasic.Update(), and shut down in Stimulationbasic.OnDisable().
When forcePort is false, the wrapper auto-selects a serial port. When
Stimulationbasic.testMode is true, it uses an in-memory test transport instead of hardware.
Fields
comPort
Target COM port to use when forcePort is enabled.
Declaration
[SerializeField]
public string comPort
Field Value
| Type | Description |
|---|---|
| string |
forcePort
Forces connection to a specific COM port instead of auto-detecting.
Declaration
[SerializeField]
public bool forcePort
Field Value
| Type | Description |
|---|---|
| bool |
started
Gets or sets a user-managed flag indicating whether stimulation is considered started.
Declaration
public bool started
Field Value
| Type | Description |
|---|---|
| bool |
Remarks
This wrapper does not update this field; use Started() to query device state.
Methods
Awake()
Creates the transport and configures the stimulation core controller. Uses test mode, a forced COM port, or default auto-detected connection.
Declaration
public void Awake()
Remarks
Uses UnityEngine.Application.streamingAssetsPath as the core configuration root.
GetCoreConfigCTRL()
Provides access to the core configuration controller.
Declaration
public CoreConfigController GetCoreConfigCTRL()
Returns
| Type | Description |
|---|---|
| CoreConfigController | The current core configuration controller owned by the wrapper. |
Ready()
Returns true if the device has completed setup and is ready.
Declaration
public bool Ready()
Returns
| Type | Description |
|---|---|
| bool |
|
Save()
Saves board settings to non-volatile memory. Implementations should pause streaming if needed, perform the save, then resume.
Declaration
public void Save()
Remarks
Broadcasts to all connected WSS units.
Save(int)
Saves board settings to non-volatile memory. Implementations should pause streaming if needed, perform the save, then resume.
Declaration
public void Save(int targetWSS)
Parameters
| Type | Name | Description |
|---|---|---|
| int | targetWSS | 0=broadcast, 1..3=unit index. Other values map to unit 1. |
Remarks
Values outside the documented range fall back to unit 1 through the wrapper mapping.
StartStimulation()
Starts stimulation on the target and launches streaming when ready.
Declaration
public void StartStimulation()
Remarks
Broadcasts to all connected WSS units.
Started()
Returns true if stimulation is currently active.
Declaration
public bool Started()
Returns
| Type | Description |
|---|---|
| bool |
|
StimulateAnalog(string, int, int, int)
Sends an analog stimulation command to a mapped channel.
Declaration
public void StimulateAnalog(string finger, int PW, int amp = 3, int IPI = 10)
Parameters
| Type | Name | Description |
|---|---|---|
| string | finger | Finger name or channel alias (e.g., "index" or "ch2"). |
| int | PW | Pulse width in microseconds. |
| int | amp | Amplitude in milliamps (default = 3). |
| int | IPI | Inter-pulse interval in milliseconds (default = 10). |
StopStimulation()
Stops stimulation on the target and, if streaming, stops the background loop.
Declaration
public void StopStimulation()
Remarks
Broadcasts to all connected WSS units.
UpdateIPD(int, int)
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)
Parameters
| Type | Name | Description |
|---|---|---|
| int | ipd | Inter-phase delay in microseconds (clamped internally). |
| int | eventID | Event slot to target. |
Remarks
Broadcasts to all connected WSS units.
UpdateIPD(int, int, int)
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 targetWSS, int ipd, int eventID)
Parameters
| Type | Name | Description |
|---|---|---|
| int | targetWSS | 0=broadcast, 1..3=unit index. Other values map to unit 1. |
| int | ipd | Inter-phase delay in microseconds (clamped internally). |
| int | eventID | Event slot to target. |
Remarks
Values outside the documented range fall back to unit 1 through the wrapper mapping.
WaveformSetup(int, WaveformBuilder, int)
Schedules the upload of custom waveform chunks and points
eventID at the uploaded shapes.
Declaration
public void WaveformSetup(int targetWSS, WaveformBuilder wave, int eventID)
Parameters
| Type | Name | Description |
|---|---|---|
| int | targetWSS | 0=broadcast, 1..3=unit index. Other values map to unit 1. |
| WaveformBuilder | wave | Waveform builder. |
| int | eventID | Event slot to target. |
Remarks
Values outside the documented range fall back to unit 1 through the wrapper mapping.
WaveformSetup(WaveformBuilder, int)
Schedules the upload of custom waveform chunks and points
eventID at the uploaded shapes.
Declaration
public void WaveformSetup(WaveformBuilder wave, int eventID)
Parameters
| Type | Name | Description |
|---|---|---|
| WaveformBuilder | wave | Waveform builder. |
| int | eventID | Event slot to target. |
Remarks
Broadcasts to all connected WSS units.
load()
Loads board settings from non-volatile memory. Implementations should pause streaming if needed, perform the load, then resume.
Declaration
public void load()
Remarks
Broadcasts to all connected WSS units.
load(int)
Loads board settings from non-volatile memory. Implementations should pause streaming if needed, perform the load, then resume.
Declaration
public void load(int targetWSS)
Parameters
| Type | Name | Description |
|---|---|---|
| int | targetWSS | 0=broadcast, 1..3=unit index. Other values map to unit 1. |
Remarks
Values outside the documented range fall back to unit 1 through the wrapper mapping.
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. |
releaseRadio()
Explicitly releases the radio connection.
Declaration
public void releaseRadio()
request_Configs(int, int, int)
Requests configuration blocks from the device.
Declaration
public void request_Configs(int targetWSS, int command, int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | targetWSS | 0=broadcast, 1..3=unit index. Other values map to unit 1. |
| int | command | Command group identifier. |
| int | id | Sub-id / selector. |
Remarks
Values outside the documented range fall back to unit 1 through the wrapper mapping.
resetRadio()
Performs a radio reset by shutting down and re-initializing the connection.
Declaration
public void resetRadio()
updateWaveform(int, int, int)
Sets event shape IDs directly for the given eventID.
Implementations should send setup edits with replies.
Declaration
public void updateWaveform(int cathodicWaveform, int anodicWaveform, int eventID)
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. |
Remarks
Broadcasts to all connected WSS units.
updateWaveform(int, int, int, int)
Sets event shape IDs directly for the given eventID.
Implementations should send setup edits with replies.
Declaration
public void updateWaveform(int targetWSS, int cathodicWaveform, int anodicWaveform, int eventID)
Parameters
| Type | Name | Description |
|---|---|---|
| int | targetWSS | 0=broadcast, 1..3=unit index. Other values map to unit 1. |
| int | cathodicWaveform | Shape ID for the standard phase. |
| int | anodicWaveform | Shape ID for the recharge phase. |
| int | eventID | Event slot to modify. |
Remarks
Values outside the documented range fall back to unit 1 through the wrapper mapping.
updateWaveform(int, int[], int)
Builds a custom waveform from raw points and schedules the upload
for the specified eventID.
Declaration
public void updateWaveform(int targetWSS, int[] waveform, int eventID)
Parameters
| Type | Name | Description |
|---|---|---|
| int | targetWSS | 0=broadcast, 1..3=unit index. Other values map to unit 1. |
| int[] | waveform | Concatenated waveform definition. |
| int | eventID | Event slot to target. |
Remarks
Values outside the documented range fall back to unit 1 through the wrapper mapping.
updateWaveform(int, WaveformBuilder, int)
Uploads a prepared waveform and assigns shapes for eventID.
Declaration
public void updateWaveform(int targetWSS, WaveformBuilder waveform, int eventID)
Parameters
| Type | Name | Description |
|---|---|---|
| int | targetWSS | 0=broadcast, 1..3=unit index. Other values map to unit 1. |
| WaveformBuilder | waveform | Prepared WaveformBuilder. |
| int | eventID | Event slot to target. |
Remarks
Values outside the documented range fall back to unit 1 through the wrapper mapping.
updateWaveform(int[], int)
Builds a custom waveform from raw points and schedules the upload
for the specified eventID.
Declaration
public void updateWaveform(int[] waveform, int eventID)
Parameters
| Type | Name | Description |
|---|---|---|
| int[] | waveform | Concatenated waveform definition. |
| int | eventID | Event slot to target. |
Remarks
Broadcasts to all connected WSS units.
updateWaveform(WaveformBuilder, int)
Uploads a prepared waveform and assigns shapes for eventID.
Declaration
public void updateWaveform(WaveformBuilder waveform, int eventID)
Parameters
| Type | Name | Description |
|---|---|---|
| WaveformBuilder | waveform | Prepared WaveformBuilder. |
| int | eventID | Event slot to target. |
Remarks
Broadcasts to all connected WSS units.