Class WssClient
Low-level protocol client. Frames commands using an IFrameCodec,
sends them over an ITransport, and correlates responses by
(target,msgId).
Inheritance
Namespace: Wss.CoreModule
Assembly: WSS_Core_Interface.dll
Syntax
public sealed class WssClient
Constructors
WssClient(ITransport, IFrameCodec, WSSVersionHandler, WssClientOptions)
Creates a low-level protocol client over a caller-provided transport and frame codec.
Declaration
public WssClient(ITransport transport, IFrameCodec codec, WSSVersionHandler versionHandler, WssClientOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| ITransport | transport | Underlying byte transport (for example, serial or BLE). |
| IFrameCodec | codec | Frame codec used for escaping/deframing and checksum validation. |
| WSSVersionHandler | versionHandler | Firmware version handler used for version-gated commands. |
| WssClientOptions | options | Client options including sender address, transport ownership, reply timeout, and logical target address mapping. |
Remarks
BytesReceived may be raised on a background thread depending on the transport implementation.
Reply correlation primarily matches responses by (target,msgId), with additional handling for
protocol error replies and firmware paths that answer ModuleQuery using
RequestAnalog.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| ArgumentOutOfRangeException | Thrown when the configured response timeout is not positive. |
Properties
Started
Indicates whether the WSS client connection has been started.
Declaration
public bool Started { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
AddEventToSchedule(int, int, WssTarget, CancellationToken)
Adds an event to a schedule.
Declaration
public Task<string> AddEventToSchedule(int eventId, int scheduleId, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | eventId | Event ID (0–255). |
| int | scheduleId | Schedule ID (0–255). |
| WssTarget | target | Target WSS device (default: Wss1). |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
ChangeGroupState(int, int, WssTarget, CancellationToken)
Changes a sync group's state: READY=1, ACTIVE=0, SUSPEND=2.
Declaration
public Task<string> ChangeGroupState(int syncSignal, int state, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | syncSignal | Sync group ID (0–255). |
| int | state | State (0=ACTIVE, 1=READY, 2=SUSPEND). |
| WssTarget | target | Target WSS device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
ChangeScheduleDuration(int, int, WssTarget, CancellationToken)
Changes a schedule's duration (8-bit variant). For 16-bit, prefer recreating the schedule.
Declaration
public Task<string> ChangeScheduleDuration(int scheduleId, int durationMs, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | scheduleId | Schedule ID (0–255). |
| int | durationMs | Duration in milliseconds (0–255 in this subcommand TODO expand this command to the full range od=f 0 to 1000). |
| WssTarget | target | Target WSS device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
ChangeScheduleGroup(int, int, WssTarget, CancellationToken)
Changes a schedule's sync group.
Declaration
public Task<string> ChangeScheduleGroup(int scheduleId, int syncSignal, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | scheduleId | Schedule ID (0–255). |
| int | syncSignal | Sync group ID (0–255). |
| WssTarget | target | Target WSS device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
ChangeScheduleState(int, int, WssTarget, CancellationToken)
Changes a schedule's state.
Declaration
public Task<string> ChangeScheduleState(int scheduleId, int state, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | scheduleId | Schedule ID (0–255). |
| int | state | State (0=ACTIVE, 1=READY, 2=SUSPEND). |
| WssTarget | target | Target WSS device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
Clear(int, WssTarget, CancellationToken)
Clears groups of resources (0x40): 0=All, 1=Events, 2=Schedules, 3=Contacts.
Declaration
public Task<string> Clear(int configIndex, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | configIndex | Clear events(1), schedules(2), contacts(3), all(0). |
| WssTarget | target | Target device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
ConnectAsync(CancellationToken)
Establishes a connection to the specified WSS device.
Declaration
public Task ConnectAsync(CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | ct | The cancellation token to observe. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous connection operation. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown if already connected to the target. |
| IOException | Thrown if the connection attempt fails. |
| OperationCanceledException | Thrown if the operation is canceled. |
CreateContactConfig(ContactConfigDefinition, WssTarget, CancellationToken)
Creates a contact configuration for the stimulator. Defines the sources and sinks for stimulation and recharge phases.
Declaration
public Task<string> CreateContactConfig(ContactConfigDefinition definition, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| ContactConfigDefinition | definition | Contact configuration values to encode and send, including the contact id, four-output stimulation setup, four-output recharge setup, and optional LED bitmask. |
| WssTarget | target | The WSS target device to send the configuration to. |
| CancellationToken | ct | Optional cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> | Processed response string from the WSS target. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| ArgumentException | Thrown when either setup array in |
CreateEvent(CreateEventRequest, WssTarget, CancellationToken)
Creates an event on the WSS device from a grouped request model. The request supports the same payload combinations as the previous overload set: basic, shape-only, amplitudes plus pulse widths, or shapes plus amplitudes plus pulse widths.
Declaration
public Task<string> CreateEvent(CreateEventRequest request, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CreateEventRequest | request | Grouped event request to encode and validate. |
| WssTarget | target | Target WSS device (default: Wss1). |
| CancellationToken | ct | Optional cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> | Processed response string from the WSS target. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| ArgumentException | Thrown when the request mixes incompatible combinations, such as only one shape ID, only one amplitude array, or pulse widths without both amplitude arrays. |
CreateSchedule(ScheduleDefinition, WssTarget, CancellationToken)
Creates a schedule from a grouped definition model.
Declaration
public Task<string> CreateSchedule(ScheduleDefinition definition, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| ScheduleDefinition | definition | Schedule ID, duration, and sync group values. |
| WssTarget | target | Target WSS device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> | Processed response string from the WSS target. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| ArgumentOutOfRangeException | Thrown when a value in |
DeleteContactConfig(int, WssTarget, CancellationToken)
Deletes an existing contact configuration on the WSS device by its ID.
Declaration
public Task<string> DeleteContactConfig(int contactId, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | contactId | The contact configuration ID to delete (0–255). |
| WssTarget | target | The WSS target device to send the request to (default: Wss1). |
| CancellationToken | ct | Optional cancellation token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<string> | Processed response string from the WSS target. |
DeleteEvent(int, WssTarget, CancellationToken)
Deletes an existing event on the WSS device by its ID.
Declaration
public Task<string> DeleteEvent(int eventId, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | eventId | Event ID (0–255). |
| WssTarget | target | Target WSS device (default: Wss1). |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
DeleteEventFromSchedule(int, WssTarget, CancellationToken)
Removes an event from its assigned schedule.
Declaration
public Task<string> DeleteEventFromSchedule(int eventId, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | eventId | Event ID (0–255). |
| WssTarget | target | Target WSS device (default: Wss1). |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
DeleteSchedule(int, WssTarget, CancellationToken)
Deletes a schedule by ID.
Declaration
public Task<string> DeleteSchedule(int scheduleId, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | scheduleId | Schedule ID (0–255). |
| WssTarget | target | Target WSS device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
DisconnectAsync(CancellationToken)
Closes the active connection to the specified WSS device.
Declaration
public Task DisconnectAsync(CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | ct | The cancellation token to observe. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous disconnection operation. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown if not connected to the target. |
| IOException | Thrown if the disconnection fails due to a transport error. |
| OperationCanceledException | Thrown if the operation is canceled. |
Dispose()
Unsubscribes from inbound bytes and releases client state.
Declaration
public void Dispose()
Remarks
Disposes the underlying transport only when this instance was constructed with
ownsTransport set to true. This method does not call
DisconnectAsync(CancellationToken) automatically.
Echo(int, int, WssTarget, CancellationToken)
Echo round-trip (0x07). Two opaque data bytes are echoed back. Untested, and reading from WSS devices is not yet implemented.
Declaration
public Task<string> Echo(int echoData1, int echoData2, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | echoData1 | |
| int | echoData2 | |
| WssTarget | target | |
| CancellationToken | ct |
Returns
| Type | Description |
|---|---|
| Task<string> |
EditEventAmp(int, int[], int[], WssTarget, CancellationToken)
Changes an event's amplitude configuration for standard and recharge phases.
Declaration
public Task<string> EditEventAmp(int eventId, int[] standardAmp, int[] rechargeAmp, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | eventId | Event ID (0–255). |
| int[] | standardAmp | Four amplitudes for the standard (stim) phase, 0–255 each. |
| int[] | rechargeAmp | Four amplitudes for the recharge phase, 0–255 each. |
| WssTarget | target | Target WSS device (default: Wss1). |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
EditEventContactConfig(int, int, WssTarget, CancellationToken)
Changes an event's output/contact configuration by ID.
Declaration
public Task<string> EditEventContactConfig(int eventId, int contactConfigId, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | eventId | Event ID (0–255). |
| int | contactConfigId | Output/contact configuration ID (0–255). |
| WssTarget | target | Target WSS device (default: Wss1). |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
EditEventDelay(int, int, WssTarget, CancellationToken)
Changes an event's delay (ms from schedule start).
Declaration
public Task<string> EditEventDelay(int eventId, int delayMs, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | eventId | Event ID (0–255). |
| int | delayMs | Delay in milliseconds (0–255 in this variant). |
| WssTarget | target | Target WSS device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
EditEventEnableBit(int, int, WssTarget, CancellationToken)
Changes an event's ratio (allowed: 1, 2, 4, 8).
Declaration
public Task<string> EditEventEnableBit(int eventId, int enable, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | eventId | Event ID (0–255). |
| int | enable | enable bit (0 or 1). |
| WssTarget | target | Target WSS device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
EditEventPw(int, int[], WssTarget, CancellationToken)
Changes an event's pulse widths: [standardPW, rechargePW, IPD] (μs). Uses 8-bit fields if all ≤ oneByte; otherwise encodes all three as 16-bit big-endian. Wire order matches firmware: [stdPW, IPD, rechPW].
Declaration
public Task<string> EditEventPw(int eventId, int[] pw, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | eventId | Event ID (0–255). |
| int[] | pw | Three PW values: [standardPW, rechargePW, IPD] in microseconds. |
| WssTarget | target | Target WSS device (default: Wss1). |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
EditEventRatio(int, int, WssTarget, CancellationToken)
Changes an event's ratio (allowed: 1, 2, 4, 8).
Declaration
public Task<string> EditEventRatio(int eventId, int ratio, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | eventId | Event ID (0–255). |
| int | ratio | Ratio value (must be one of 1, 2, 4, 8). |
| WssTarget | target | Target WSS device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
EditEventShape(int, int, int, WssTarget, CancellationToken)
Changes an event's shape configuration.
Declaration
public Task<string> EditEventShape(int eventId, int standardShapeId, int rechargeShapeId, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | eventId | Event ID (0–255). |
| int | standardShapeId | Shape ID used during the standard (stim) phase: 0=Rectangular (default), 1=Rectangular (DAC), 2=Sine, 3=Gaussian, 4=Exponential Increase, 5=Exponential Decrease, 6=Linear Increase, 7=Linear Decrease, 10=Trapezoid (setup required), 11=User Program 1 (setup required), 12=User Program 2 (setup required), 13=User Program 3 (setup required). |
| int | rechargeShapeId | Shape ID used during the recharge phase (same mapping as |
| WssTarget | target | Target WSS device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
EditSettings(int, int, WssTarget, CancellationToken)
Writes a single settings byte at address to value.
Declaration
public Task<string> EditSettings(int address, int value, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | address | Settings address (0–255). |
| int | value | Value to write (0–255). |
| WssTarget | target | Target WSS device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
EraseLog(WssTarget, CancellationToken)
Erases device log data.
Declaration
public Task<string> EraseLog(WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| WssTarget | target | Target WSS device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
GetLog(WssTarget, CancellationToken)
Requests device log data (raw read mode on device side) Untested TODO.
Declaration
public Task<string> GetLog(WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| WssTarget | target | Target WSS device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
IsModuleQueryAvailable()
Indicates whether ModuleQuery is available in this firmware (version J or later).
Declaration
public bool IsModuleQueryAvailable()
Returns
| Type | Description |
|---|---|
| bool |
ModuleQuery(int, WssTarget, CancellationToken)
Gets settings or information for the target WSS (opcode 0x01). Version-gated: on firmware that supports ModuleQuery (version J+), this sends the command and the reply is cached as data-only bytes per target. On older firmware, no command is sent; for index 1 (settings array) a default 16-byte payload is seeded in the cache so higher layers can decode default unit settings.
Declaration
public Task<string> ModuleQuery(int moduleIndex, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | moduleIndex | 0 = serial number, 1 = settings array. |
| WssTarget | target | Target device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> | A human-readable string summary. Cache side-effects are described above. |
Remarks
- When supported (J+): this method transmits the request and, upon reply, ProcessFrame caches the data-only slice under the sender's target address. Use TryGetModuleQueryData(WssTarget, out byte[]) to retrieve the last snapshot.
- When not supported: this method does not transmit. For
moduleIndex == 1, it seeds a default 16-byte zero array into the per-target cache, allowing the core to decode a default profile. The returned string indicates that defaults are being used.
MoveEventToSchedule(int, int, int, WssTarget, CancellationToken)
Moves an event to a different schedule with a new delay offset.
Fails on-device if delayMs exceeds the schedule period.
Declaration
public Task<string> MoveEventToSchedule(int eventId, int scheduleId, int delayMs, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | eventId | Event ID (0–255). |
| int | scheduleId | Destination schedule ID (0–255). |
| int | delayMs | Delay from schedule start in milliseconds (0–255 in this variant). |
| WssTarget | target | Target WSS device (default: Wss1). |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
PopulateBoardSettings(WssTarget, CancellationToken)
Loads settings from FRAM into the active board settings.
Declaration
public Task<string> PopulateBoardSettings(WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| WssTarget | target | Target WSS device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
PopulateFramSettings(WssTarget, CancellationToken)
Saves current board settings into FRAM.
Declaration
public Task<string> PopulateFramSettings(WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| WssTarget | target | Target WSS device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
RequestAnalog(WssTarget, CancellationToken)
Requests specific battery and impedance data from the WSS device. TODO Not implemented in firmware, and reading from WSS devices is not yet implemented.
Declaration
public Task<string> RequestAnalog(WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| WssTarget | target | |
| CancellationToken | ct |
Returns
| Type | Description |
|---|---|
| Task<string> |
RequestConfigs(int, int, WssTarget, CancellationToken)
Sends a request to the WSS target for a specific configuration type. This is a general-purpose request that can target output configs, events, schedules, and their various sub-configurations. Untested, and reading from WSS devices is not yet implemented.
Declaration
public Task<string> RequestConfigs(int command, int id, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | command | Integer code that selects which configuration to request: 0 = Output Configuration List 1 = Output Configuration details 2 = Event List 3 = Basic Event configuration 4 = Event output configuration 5 = Event stimulation configuration 6 = Event shape configuration 7 = Event burst configuration 8 = Schedule basic configuration 9 = Schedule listing |
| int | id | ID associated with the requested configuration (0–255). |
| WssTarget | target | Target WSS device to query (default: Wss1). |
| CancellationToken | ct | Optional cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> | Processed response string from the WSS target. |
Reset(WssTarget, CancellationToken)
Resets the microcontroller (0x04).
Declaration
public Task<string> Reset(WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| WssTarget | target | |
| CancellationToken | ct |
Returns
| Type | Description |
|---|---|
| Task<string> |
ResetSchedules(WssTarget, CancellationToken)
Resets all schedules.
Declaration
public Task<string> ResetSchedules(WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| WssTarget | target | Target WSS device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
SetCustomWaveform(int, int[], int, WssTarget, CancellationToken)
Uploads a custom waveform chunk (8 samples) into a slot. Call this 4 times (msgNumber 0..3) to send all 32 samples. Each sample is encoded as 16-bit big-endian.
Declaration
public Task<string> SetCustomWaveform(int slot, int[] waveformChunk8, int msgNumber, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | slot | Waveform slot (0–255). |
| int[] | waveformChunk8 | Exactly 8 sample values for this chunk (0..2000 each). |
| int | msgNumber | Chunk index (0..3) — send four chunks to fill 32 samples. |
| WssTarget | target | Target WSS device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
StartStim(WssTarget, CancellationToken)
Sends the "start stimulation". 0x01 = Start Ack expected. Broadcast is acceptable for a system-wide switch.
Declaration
public Task<string> StartStim(WssTarget target = WssTarget.Broadcast, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| WssTarget | target | Target device (often Broadcast). |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
StopStim(WssTarget, CancellationToken)
Sends the "stop stimulation" switch (opcode 0x0B). 0x00 = Stop Ack expected. Broadcast is acceptable for a system-wide switch.
Declaration
public Task<string> StopStim(WssTarget target = WssTarget.Broadcast, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| WssTarget | target | Target device (often Broadcast). |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
StreamChange(StreamChangeRequest, WssTarget, CancellationToken)
Streams changes to PA (amplitude), PW (pulse width), and IPI (period) for up to three schedules in one shot. The grouped request may omit at most one of the three data groups. Uses opcodes: 0x30 = PA+PW+IPI, 0x31 = PA+PW (no IPI), 0x32 = PA+IPI (no PW), 0x33 = PW+IPI (no PA). All elements are 0..255 in this streaming variant (one byte each).
Declaration
public Task StreamChange(StreamChangeRequest request, WssTarget target = WssTarget.Broadcast, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| StreamChangeRequest | request | Grouped PA/PW/IPI request. |
| WssTarget | target | Target WSS; streaming commonly uses Broadcast. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the outbound streaming send. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| NotSupportedException | Thrown when more than one data group is omitted. |
| ArgumentException | Thrown when a supplied group does not contain exactly 3 elements. |
SyncGroup(int, WssTarget, CancellationToken)
Sends a sync signal; starts schedules in the group from READY to ACTIVE.
Declaration
public Task<string> SyncGroup(int syncSignal, WssTarget target = WssTarget.Wss1, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | syncSignal | Sync group ID (0–255). |
| WssTarget | target | Target WSS device. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> |
TryGetModuleQueryData(WssTarget, out byte[])
Gets the last cached ModuleQuery data (data-only slice) for a target, if present.
Declaration
public bool TryGetModuleQueryData(WssTarget target, out byte[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| WssTarget | target | Target device that produced the ModuleQuery reply. |
| byte[] | data | The cached data bytes for the most recent reply from |
Returns
| Type | Description |
|---|---|
| bool | True if cached data exists; otherwise false. |
Remarks
The returned array is the cached in-memory instance for the latest reply, not a defensive copy.
ZeroOutStim(WssTarget, CancellationToken)
Convenience: streams zeros to PA, PW, and IPI (effectively stopping stimulation). Uses opcode 0x31 (PA+PW, no IPI) with trailing zeros to match the original layout.
Declaration
public Task ZeroOutStim(WssTarget target = WssTarget.Broadcast, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| WssTarget | target | Target WSS (default Broadcast). |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task |