Theory of Operation

The SDS Framework enables recording and playback of one or more data streams for an application under development, as shown in the diagram below. With the SDSIO interface, the data streams are connected to SDS data files. The file storage can be either embedded within the system and accessed via a file system, or external (on a host computer) and accessed via a communication interface such as Ethernet or USB.

The DSP or ML algorithms under test operate on blocks and are executed periodically. This documentation uses the term Data Block to refer to a block of input or output data that is processed in one step by a DSP or ML compute node.

SDSIO Interface for Player and Recorder

Using the SDS Stream Interface functions (sds.c/h), the data stream under development may read and write as shown above. The Stream Interface functions store data streams in a circular buffer (sds_buffer.c/h). This circular buffer is the I/O queue for the SDSIO-Client (sdsio_x.c/h).

Implementation Files of SDS

Usage

The following diagram shows the usage of the SDS Stream Interface functions (executed in sdsThread). The sdsControlThread controls the overall execution. AlgorithmThread is the thread that executes Signal Conditioning (SC) and the ML Model.

When AlgorithmThread starts, it first calls the InitInputData function, which initializes the input interfaces (camera, microphone or sensor interfaces). It then calls InitAlgorithm, which is responsible for initializing the ML algorithm.

After initialization, AlgorithmThread enters a loop in which it repeatedly calls GetInputData. This function provides a block of input data used for a single inference. The inference itself is executed by the ExecuteAlgorithm function.

Two additional functions are also provided:

  • DiscardInputData: used during playback to discard incoming live input data, since the actual input is read from the SDS file.
  • ResetAlgorithm: called before each playback run to reset internal states, memory buffers, and results from previous inferences, ensuring a clean start for the new playback session.
sequenceDiagram participant sdsControlThread participant sdsThread participant AlgorithmThread Note over sdsControlThread: sdsInit activate sdsThread Note over sdsControlThread: Open data streams Note over sdsThread: Read content for<br/>'play' data streams activate AlgorithmThread loop periodic Note over AlgorithmThread: GetInputData<br/>(physical input or sdsRead) Note over AlgorithmThread: Execute algorithm Note over AlgorithmThread: sdsWrite data streams Note over sdsThread: Read/write data streams. end sdsControlThread-->>AlgorithmThread: Stop Algorithm AlgorithmThread-->>sdsControlThread: Stopped Note over sdsControlThread: Close data streams Note over sdsThread: Flush and close<br/> data streams

SDS Data Files

Each data stream is stored in a separate SDS data file. In the diagram below SCinput.0.sds is the input to Signal Conditioning, SCoutput.0.sds is the output of Signal Conditioning, and MLoutput.0.sds is the output of the ML Model. Each execution of the algorithm is represented by a data block with a timeslot. The timeslot allows correlating blocks from different streams.

All data blocks of one algorithm execution have the same timeslot value as shown below:

SDS Files

  • Each call to the function sdsWrite writes one complete data block.
  • Each call to the function sdsRead reads one complete data block.

For the metadata, data-tag, and configuration files associated with SDS data streams, see SDS YAML Files.

File Format

Each SDS file contains a sequence of variable-size data blocks. Every data block has the following information:

  1. timeslot: data block timeslot measured at the tick-frequency rate (32-bit unsigned integer, little endian).
  2. block size: number of bytes in the following data block (32-bit unsigned integer, little endian).
  3. data block: SDS stream content (little endian, no padding) as described by the corresponding *.sds.yml metadata file.

This structure supports recording and playback of multiple data streams that may have jitter. The timeslot information allows correlating data blocks from different data streams and enables sensor fusion applications where multiple data streams are combined as training input to one machine learning algorithm.

A data block with size=0 is valid and can mark an operation that produced no data output and is used for alignment with other data streams.

Filenames

SDS data streams are stored in *.sds files with the following naming convention:

<stream-name>.<label>[.p].sds

The .p is added when the SDS data stream is recorded during playback.

The sdsOpen function takes <stream-name> for the stream and the opening mode as input parameters. Opening a stream in sdsModeRead mode is used for playback and opening a stream in sdsModeWrite is used for recording.

The SDSIO-Server adds .<label>[.p].sds to compose a filename as explained below:

Recording:

<label> is a sequential number starting at 0. The number is incremented until no file exists with the corresponding name, at which point a new file is created.

Each subsequent recording session uses the next <label> number in the sequence. If a file with the selected name already exists, it is preserved by renaming it with a .bak extension before a new file is created with the original name.

Playback:

When an SDSIO configuration file is used and contains a play: node, the <label> is specified in the corresponding step:.

When an SDSIO configuration file is not used, the <label> is a sequential number starting at 0. If the corresponding file does not exist, the open operation fails.

Note

  • Files recorded during playback include an additional .p before the .sds extension to distinguish them from originally recorded files (e.g., ML_Out.0.p.sds).
  • If a recording filename already exists, any existing .bak file with the same name is deleted, the current file is renamed by appending .bak.

Timeslot

The timeslot is a 32-bit unsigned value and is used for:

  • Alignment of different data streams that have the same timeslot value.
  • Order of the SDS data files captured during execution.
  • Combining multiple SDS file records with the same timeslot value.

The same timeslot connects different SDS file data blocks. It is useful to use the same timeslot for the recording of data blocks in different data streams for one iteration of a DSP or ML algorithm. In most cases the granularity of an RTOS tick (typically 1ms) is a good choice for a timeslot resolution.

Classes

An integer value may represent an index into a set of class labels, for example the result of an image classifier or keyword-spotting model. SDS metadata can define a named class that maps the stored integer indices to human-readable labels. Class names are global within the scope of one SDSIO configuration file so that the metadata of its streams and their applicable data tags can refer to the same class.

The stored SDS data contains the integer index and is not changed by the class definition. A viewer may show both representations, for example 2 (car). Class mappings may contain negative or sparse indices. If an index is not in the mapping, the stored value remains valid and a viewer displays ? in place of a label.

Each class may define its selection behavior. one-of, which is the default, permits at most one active label from the class. multiple permits several labels to be active at the same time.

Every definition with the same class name within that configuration scope must have the same effective selection behavior and index-to-label mapping. An omitted selection: is equivalent to selection: one-of. This permits values from different streams and labels from *.sds-tag.yml files to be aligned by their global class name.

For example, the following class maps three stored object indices to their labels:

classes:
  - class: object
    selection: multiple
    values:
      0: person
      1: bicycle
      2: car

Describe and Configure SDS Data

To interpret recorded data, tools need an SDS metadata file that describes each stream's binary layout. Optional data-tag files add labels and annotations, while an SDSIO configuration file defines interfaces, playback, streams, and viewer settings.

See SDS YAML Files for the supported files, properties, and examples.

Code Example

The following code snippets show how to use SDS for recording sensor data. In this case an accelerometer data stream is recorded.

#include "sds.h"

// variable definitions
struct {                        // sensor data stream format
  uint16_t x;
  uint16_t y;
  uint16_t z;
} accelerometer [30];           // number of samples in one data stream record

sdsId_t *accel_id;              // data stream id
uint8_t  accel_buf[(sizeof(accelerometer)*2)+2048];     // data stream buffer for circular buffer handling
uint32_t timeslot;
int32_t  n;                     // number of bytes written to data stream
     :
// *** function calls ***
   sdsInit(NULL);               // init SDS
     :
   // open data stream for writing (recording)
   accel_id = sdsOpen("Accel", sdsModeWrite, accel_buf, sizeof(accel_buf));
     :
   // write data in accelerometer buffer with a timeslot from the RTOS kernel.
   timeslot = osKernelGetTickCount();
   n = sdsWrite(accel_id, timeslot, accelerometer, sizeof(accelerometer));
   if (n != sizeof(accelerometer)) {
     ... // unexpected size returned, error handling
   }
     :
  sdsClose(accel_id);           // close data stream

Buffer Size

The size of the data stream buffer depends on several factors such as:

  • the communication interface technology that may impose specific buffer size requirements to maximize data transfer rates.
  • the frequency of the algorithm execution. Fast execution speeds may require a larger buffer.

As a guideline, the buffer size should be at least (2 × block size) + 2 KB. The minimum recommended buffer size is 4 KB.

SDSIO-Server Protocols

The SDSIO-Server communicates with the firmware using the SDSIO-Server Firmware Protocol over supported physical interfaces, including Ethernet, Wi-Fi, USB, debugger, and serial (USART) connections. It communicates with the monitor program through the Monitor Interface over a network connection, typically via the loopback (localhost) interface.

SDSIO-Server Protocols

SDSIO-Server Firmware Protocol

The SDSIO-Server uses a simple protocol for data exchange between a host computer and the embedded target that integrates an SDSIO Interface. The protocol assumes that communication to the SDSIO-Server is ensured by the underlying transport technology (TCP/IP or USB); therefore, no additional checks are implemented.

The following conventions describe the command semantics used in the following documentation:

Symbol Description
> Prefix indicating the direction: Command from target firmware to SDSIO-Server on the host computer.
< Prefix indicating the direction: Response from SDSIO-Server to target firmware.
WORD 32-bit value (low byte first).
**** The field above has exactly one occurrence.
++++ The field above has a variable length.

Commands:

Commands are sent from the embedded target to the host computer running the SDSIO-Server.

ID Name Description
1 SDSIO_CMD_OPEN Open an SDS data file
2 SDSIO_CMD_CLOSE Close an SDS data file
3 SDSIO_CMD_WRITE Write to an SDS data file
4 SDSIO_CMD_READ Read from an SDS data file
5 SDSIO_CMD_PING Ping SDSIO-Server
6 SDSIO_CMD_FLAGS SDS control flags update request from host
7 SDSIO_CMD_INFO Send control information to host

Each Command starts with a Header (4 Words = 16 bytes) followed by optional data of variable length. Depending on the Command, the SDSIO-Server replies with a Response that includes a Header with the same ID as the Command and may contain additional data.

Note

  • The SDSIO_CMD_FLAGS Response is not a reply to the SDSIO_CMD_FLAGS Command; rather, it is an asynchronous Response sent by the host.

SDSIO_CMD_OPEN

The Command with ID = 1 (SDSIO_CMD_OPEN) opens an SDS data file on the host computer. Mode defines read (value = 0) or write (value = 1) operation. Len of Stream Name is the size of the string in bytes.

SDS data filenames use the following file format: <name>.<label>.sds, where <name> is the stream name used as the base filename of the SDS data file and <label> is a user label or index depending on usage (for details see section Filenames).

| WORD |  WORD  | WORD | WORD **************|+++++++++++++|
>  1   |   0    | Mode | Len of Stream Name | Stream Name |
|******|********|******|********************|+++++++++++++|

The Response with ID = 1 (SDSIO_CMD_OPEN) provides a Handle that is used to identify the file in subsequent Commands.

| WORD |  WORD  | WORD | WORD *******|
<  1   | Handle | Mode | 0           |
|******|********|******|*************|

SDSIO_CMD_CLOSE

The Command with ID = 2 (SDSIO_CMD_CLOSE) closes an SDS data file on the host computer. The Handle is the identifier obtained with SDSIO_CMD_OPEN. There is no Response from the SDSIO-Server to this Command.

| WORD |  WORD  | WORD | WORD |
>  2   | Handle |  0   |  0   |
|******|********|******|******|

SDSIO_CMD_WRITE

The Command with ID = 3 (SDSIO_CMD_WRITE) writes data to an SDS data file on the host computer. The Handle is the identifier obtained with SDSIO_CMD_OPEN. Size specifies the size of Data in bytes. There is no Response from the SDSIO-Server to this Command.

| WORD |  WORD  | WORD | WORD |++++++|
>  3   | Handle |  0   | Size | Data |
|******|********|******|******|++++++|

SDSIO_CMD_READ

The Command with ID = 4 (SDSIO_CMD_READ) reads data from an SDS data file on the host computer. The Handle is the identifier obtained with SDSIO_CMD_OPEN. Size specifies the number of bytes to read.

| WORD |  WORD  | WORD | WORD |
>  4   | Handle | Size |  0   |
|******|********|******|******|

The Response with ID = 4 (SDSIO_CMD_READ) provides the data read from an SDS data file on the host computer. Size specifies the size of Data in bytes that was read and Status with nonzero = end of stream, else 0.

| WORD |  WORD  |  WORD  | WORD |++++++|
<  4   | Handle | Status | Size | Data |
|******|********|********|******|++++++|

SDSIO_CMD_PING

The Command with ID = 5 (SDSIO_CMD_PING) verifies if the SDSIO-Server is active and reachable on the host.

| WORD | WORD | WORD | WORD |
>  5   |  0   |  0   |  0   |
|******|******|******|******|

The Response with ID = 5 (SDSIO_CMD_PING) returns the Status with nonzero = server active, else 0.

| WORD | WORD |  WORD  | WORD |
<  5   |  0   | Status |  0   |
|******|******|********|******|

SDSIO_CMD_FLAGS

The asynchronous Response with ID = 6 (SDSIO_CMD_FLAGS) contains the SDS control flags update information from the host. This Response can arrive at any time when the host wants to update the SDS control flags. It can also precede a Response to any other command (e.g., SDSIO_CMD_OPEN or SDSIO_CMD_READ), but it cannot be sent by the host while a Response to another Command is in progress. The Set Mask specifies the bits to set in the sdsFlags and the Clear Mask specifies the bits to clear in the sdsFlags.

| WORD | WORD     | WORD       | WORD |
<  6   | Set Mask | Clear Mask |  0   |
|******|**********|************|******|

SDSIO_CMD_INFO

The Command with ID = 7 (SDSIO_CMD_INFO) sends control information (sdsFlags, sdsIdleRate and error information) to the host. There is no Response from the SDSIO-Server to this Command.

  • sdsFlags is the current value of that global variable.
  • sdsIdleRate is the current value of that global variable, value 0xFFFFFFFF indicates that idle rate information is not valid.
  • Error Len specifies the size of the Error Data, value 0 indicates that no error occurred.
| WORD | WORD     | WORD        | WORD      |++++++++++++|
>  7   | sdsFlags | sdsIdleRate | Error Len | Error Data |
|******|**********|*************|***********|++++++++++++|

Error Data contains the information from sdsError global structure and has the following format.

| WORD   | WORD |+++++++++++++++++++|
| Status | Line | Filename (string) |
|********|******|+++++++++++++++++++|

SDSIO-Server Monitor Interface

The SDSIO-Server provides an additional TCP socket that may be used by a monitor program to observe SDS file activity and control sdsFlags in the firmware. The monitor interface is enabled with command line option --mon-port <port>.

The following conventions describe the command and message semantics used in the following documentation:

Symbol Description
> Prefix indicating the direction: Command sent from the Monitor program to the SDSIO-Server.
< Prefix indicating the direction: Response or asynchronous message sent from the SDSIO-Server to the Monitor program.
WORD 32-bit value (low byte first).
**** The field above has exactly one occurrence.
++++ The field above has a variable length.

Commands and Messages:

Commands are sent to the SDSIO-Server which replies with a response (depending on command). SDSIO-Server can also send asynchronous messages at any time when not processing a command.

ID Name Description
1 SDSIO_MON_OPEN Information about the SDS file open operation (message)
2 SDSIO_MON_CLOSE Information about the SDS file close operation (message)
6 SDSIO_MON_FLAGS Monitor program request to the SDSIO-Server to update SDS control flags in the firmware and optionally select a play step
7 SDSIO_MON_INFO Information update received from the firmware and forwarded to the Monitor program (message)
8 SDSIO_MON_SHUTDOWN Monitor program request to the SDSIO-Server to complete current tasks and shut down gracefully

Each Command or Message starts with a Header (4 Words = 16 bytes) followed by optional data of variable length. Depending on the Command, the SDSIO-Server replies with a Response that includes a Header with the same ID as the Command and may contain additional data.

SDSIO_MON_OPEN

The Message with ID = 1 (SDSIO_MON_OPEN) is sent whenever an SDS data file is opened by the SDSIO-Server. Mode defines read (value = 0) or write (value = 1) operation. Filename Len is the size of the string in bytes and Filename is the name of the file (including path).

| WORD | WORD | WORD | WORD | WORD ********|++++++++++|
<  1   |  0   | Mode |  0   | Filename Len | Filename |
|******|******|******|******|**************|++++++++++|

SDSIO_MON_CLOSE

The Message with ID = 2 (SDSIO_MON_CLOSE) is sent whenever an SDS data file is closed by the SDSIO-Server. Filename Len is the size of the string in bytes and Filename is the name of the file (including path).

| WORD | WORD | WORD | WORD | WORD ********|++++++++++|
<  2   |  0   |  0   |  0   | Filename Len | Filename |
|******|******|******|******|**************|++++++++++|

SDSIO_MON_FLAGS

The Command with ID = 6 (SDSIO_MON_FLAGS) is used by the Monitor program to request an update of the SDS control flags in the firmware. The Set Mask specifies the bits to set in the sdsFlags and the Clear Mask specifies the bits to clear in the sdsFlags. The Play Step value selects a play: step from the *.sdsio.yml file before the flag update is applied. This command does not generate a response from the SDSIO-Server.

| WORD | WORD     | WORD       | WORD      |
>  6   | Set Mask | Clear Mask | Play Step |
|******|**********|************|***********|

The Play Step field accepts a zero-based step number or the special all-steps value:

  • 0 to N - 1: select one of the N configured play: steps (0 selects the first step).
  • 0xFFFFFFFF: select all configured play: steps.

Selecting a Play Step does not start playback by itself. To select and start a play step, set the SDS_FLAG_START and SDS_FLAG_PLAYBACK bits in Set Mask together with the desired Play Step value. When Play Step is 0xFFFFFFFF, the SDSIO-Server automatically starts each subsequent step after the previous step completes.

SDSIO_MON_INFO

The Message with ID = 7 (SDSIO_MON_INFO) contains status information received by the SDSIO-Server from the firmware, including sdsFlags, sdsIdleRate, and error information. The message is sent to the Monitor program whenever the SDSIO-Server receives updated information from the firmware, as well as upon the initial connection to the Monitor program.

  • sdsFlags is the current value of that global variable in the firmware.
  • sdsIdleRate is the current value of that global variable in the firmware, value 0xFFFFFFFF indicates that idle rate information is not valid.
  • Error Len specifies the size of the Error Data, value 0 indicates that no error occurred in the firmware.
| WORD | WORD     | WORD        | WORD      |++++++++++++|
<  7   | sdsFlags | sdsIdleRate | Error Len | Error Data |
|******|**********|*************|***********|++++++++++++|

Error Data contains the information from sdsError global structure and has the following format.

| WORD   | WORD |+++++++++++++++++++|
| Status | Line | Filename (string) |
|********|******|+++++++++++++++++++|

SDSIO_MON_SHUTDOWN

The Command with ID = 8 (SDSIO_MON_SHUTDOWN) is used by the Monitor program to request the SDSIO-Server to complete any ongoing operations, signal to the firmware that it will stop operating, and shut down gracefully.

| WORD | WORD | WORD | WORD |
>  8   |  0   |  0   |  0   |
|******|******|******|******|

Note

When shutdown is initiated, all data streams will be closed by the SDSIO-Server. Ideally it should be initiated when the user application has completed playback or recording and closed all data streams.

SDSIO Message Sequence

This section describes the states and the message sequence of the SDS framework when using the SDSIO-Server. It contains the following threads that execute on the target.

  • sdsControlThread: Control thread that organizes the overall execution.
  • AlgorithmThread: Executes the algorithm under test.
  • sdsThread: SDS worker thread.
  • SDSIO-Server: SDSIO-Server running on the host computer.

Note

  • The command SDSIO_CMD_FLAGS is sent asynchronously by the SDSIO-Server.

The sdsControlThread handles a state machine with the following states:

States Description
SDS_STATE_INACTIVE Streaming is not active; waiting for flag info from SDSIO-Server
SDS_STATE_CONNECTED Device (client) is connected to SDSIO-Server (host), but streaming is not active
SDS_STATE_START Request to start streaming, open streams and get ready for read/write operations
SDS_STATE_ACTIVE Streaming is active
SDS_STATE_STOP_REQ Request to stop streaming and close open streams
SDS_STATE_STOP_DONE Streaming has stopped
SDS_STATE_END Request to end streaming (e.g., no more playback data is available)
SDS_STATE_RESET Request to reset the device

The following flowcharts show the state transition in context with the messages that are exchanged with the SDSIO-Server.

Connect flowchart

sequenceDiagram participant sdsControlThread activate sdsControlThread participant Server as SDSIO-Server<br/>(host) Note over sdsControlThread: sdsInit Note right of sdsControlThread: SDS_STATE_INACTIVE loop every 100 ms Note over sdsControlThread: sdsExchange activate Server Server-->>sdsControlThread: SDSIO_CMD_FLAGS: set SDS_FLAG_ALIVE sdsControlThread-->>Server: SDSIO_CMD_INFO end Note right of sdsControlThread: SDS_STATE_CONNECTED deactivate sdsControlThread deactivate Server

Note

  • When the command SDSIO_CMD_FLAGS sets SDS_FLAG_ALIVE, the sdsControlThread transitions to SDS_STATE_CONNECTED.
  • When SDSIO_CMD_INFO is sent more than 10 times without a SDSIO_CMD_FLAGS response, the sdsControlThread transitions into the SDS_STATE_INACTIVE.

Recording start flowchart

sequenceDiagram participant sdsControlThread activate sdsControlThread participant AlgorithmThread activate AlgorithmThread participant SDSIO as sdsThread activate SDSIO participant Server as SDSIO-Server<br/>(host) activate Server Note right of sdsControlThread: SDS_STATE_CONNECTED loop every 100 ms Note over sdsControlThread: sdsExchange Server->>sdsControlThread: SDSIO_CMD_FLAGS sdsControlThread->>Server: SDSIO_CMD_INFO end Server-->>sdsControlThread: SDSIO_CMD_FLAGS: set SDS_FLAG_START Note right of sdsControlThread: SDS_STATE_START Note over sdsControlThread: sdsOpen<br/>(all streams) sdsControlThread->>Server: SDSIO_CMD_OPEN Server->>sdsControlThread: Response Note right of sdsControlThread: SDS_STATE_ACTIVE loop periodic Note over AlgorithmThread: sdsWrite AlgorithmThread->>SDSIO: Buffered data reached or crossed threshold loop send all data from buffer SDSIO->>Server: SDSIO_CMD_WRITE end end deactivate sdsControlThread deactivate AlgorithmThread deactivate SDSIO deactivate Server

Recording stop flowchart

sequenceDiagram participant sdsControlThread activate sdsControlThread participant AlgorithmThread activate AlgorithmThread participant SDSIO as sdsThread activate SDSIO participant Server as SDSIO-Server<br/>(host) activate Server Note right of sdsControlThread: SDS_STATE_ACTIVE loop every 100 ms Note over sdsControlThread: sdsExchange Server->>sdsControlThread: SDSIO_CMD_FLAGS sdsControlThread->>Server: SDSIO_CMD_INFO end Server-->>sdsControlThread: SDSIO_CMD_FLAGS: clear SDS_FLAG_START Note right of sdsControlThread: SDS_STATE_STOP_REQ loop send all data from buffer SDSIO->>Server: SDSIO_CMD_WRITE end Note right of sdsControlThread: SDS_STATE_STOP_DONE Note over sdsControlThread: sdsClose<br/>(all streams) sdsControlThread->>Server: SDSIO_CMD_CLOSE Note right of sdsControlThread: SDS_STATE_CONNECTED deactivate AlgorithmThread deactivate SDSIO deactivate Server deactivate sdsControlThread

Playback flowchart

sequenceDiagram participant sdsControlThread activate sdsControlThread participant AlgorithmThread activate AlgorithmThread participant SDSIO as sdsThread activate SDSIO participant Server as SDSIO-Server<br/>(host) activate Server Note right of sdsControlThread: SDS_STATE_CONNECTED loop every 100 ms Note over sdsControlThread: sdsExchange Server->>sdsControlThread: SDSIO_CMD_FLAGS sdsControlThread->>Server: SDSIO_CMD_INFO end Server-->>sdsControlThread: SDSIO_CMD_FLAGS: set SDS_FLAG_START and SDS_FLAG_PLAYBACK Note right of sdsControlThread: SDS_STATE_START Note over sdsControlThread: sdsOpen<br/>(all streams) sdsControlThread->>Server: SDSIO_CMD_OPEN Server->>sdsControlThread: Response loop read data until threshold is reached sdsControlThread->>Server: SDSIO_CMD_READ Server->>sdsControlThread: Data end Note right of sdsControlThread: SDS_STATE_ACTIVE loop periodic Note over AlgorithmThread: sdsRead AlgorithmThread->>SDSIO: Buffer data falls below threshold loop read data to fill the buffer SDSIO->>Server: SDSIO_CMD_READ Server-->>SDSIO: Data end end Server-->>SDSIO: No more data Server->>AlgorithmThread: End of Stream (EOS) Note over AlgorithmThread: sdsRead = SDS_EOS AlgorithmThread->>sdsControlThread: End of Stream (EOS) Note right of sdsControlThread: SDS_STATE_STOP_REQ Note right of sdsControlThread: SDS_STATE_STOP_DONE Note over sdsControlThread: sdsClose<br/>(all streams) sdsControlThread->>Server: SDSIO_CMD_CLOSE Note right of sdsControlThread: SDS_STATE_CONNECTED deactivate sdsControlThread deactivate AlgorithmThread deactivate SDSIO deactivate Server