Show / Hide Table of Contents

    Class liblsl.StreamInfo

    The stream_info object stores the declaration of a data stream.

    Represents the following information:

    1. stream data format (#channels, channel format)
    2. core information (stream name, content type, sampling rate)
    3. optional meta-data about the stream content (channel labels, measurement units, etc.)

    Whenever a program wants to provide a new stream on the lab network, it will typically first create a stream_info to describe its properties and then construct a stream_outlet with it to create the stream on the network. Recipients who discover the outlet can query the stream_info; it is also written to disk when recording the stream (playing a similar role as a file header).

    Inheritance
    Object
    liblsl.StreamInfo
    Namespace: LSL4Unity
    Assembly: cs.temp.dll.dll
    Syntax
    public class StreamInfo

    Constructors

    StreamInfo(IntPtr)

    Initializes a new instance of the liblsl.StreamInfo class.

    Declaration
    public StreamInfo(IntPtr handle)
    Parameters
    Type Name Description
    IntPtr handle

    The handle.

    StreamInfo(String, String, Int32, Double, liblsl.channel_format_t, String)

    Initializes a new instance of the liblsl.StreamInfo object.

    Core stream information is specified here. Any remaining meta-data can be added later.

    Declaration
    public StreamInfo(string name, string type, int channelCount = 1, double sampling = 0, liblsl.channel_format_t channelFormat = liblsl.channel_format_t.cf_float32, string sourceId = "")
    Parameters
    Type Name Description
    String name

    Name of the stream. Describes the device (or product series) that this stream makes available (for use by programs, experimenters or data analysts). Cannot be empty.

    String type

    Content type of the stream. Please see https://github.com/sccn/xdf/wiki/Meta-Data (or web search for: meta-data) for pre-defined content-type names, but you can also make up your own. The content type is the preferred way to find streams (as opposed to searching by name).

    Int32 channelCount

    Number of channels per sample. This stays constant for the lifetime of the stream.

    Double sampling

    The sampling rate (in Hz) as advertised by the data source, if regular (otherwise set to IRREGULAR_RATE).

    liblsl.channel_format_t channelFormat

    Format/type of each channel. If your channels have different formats, consider supplying multiple streams or use the largest type that can hold them all (such as cf_double64).

    String sourceId

    Unique identifier of the device or source of the data, if available (such as the serial number). This is critical for system robustness since it allows recipients to recover from failure even after the serving app, device or computer crashes (just by finding a stream with the same source id on the network again). Therefore, it is highly recommended to always try to provide whatever information can uniquely identify the data source itself.

    Methods

    AsXML()

    Retrieve the entire liblsl.StreamInfo in XML format.

    This yields an XML document (in string form) whose top-level element is <info>. The info element contains one element for each field of the stream_info class, including: a) the core elements Name, Type, ChannelCount, Sampling, ChannelFormat, SourceId b) the misc elements Version, CreatedAt, Uid, SessionId, v4address, v4data_port, v4service_port, v6address, v6data_port, v6service_port c) the extended description element desc with user-defined sub-elements.

    Declaration
    public string AsXML()
    Returns
    Type Description
    String

    A string with the entire liblsl.StreamInfo.

    ChannelCount()

    Number of channels of the stream. A stream has at least one channel; the channel count stays constant for all samples.

    Declaration
    public int ChannelCount()
    Returns
    Type Description
    Int32

    The Number of channels of the stream.

    ChannelFormat()

    Channel format of the stream.

    All channels in a stream have the same format. However, a device might offer multiple time-synched streams each with its own format.

    Declaration
    public liblsl.channel_format_t ChannelFormat()
    Returns
    Type Description
    liblsl.channel_format_t

    The hannel format of the stream (in liblsl.channel_format_t enum)

    CreatedAt()

    Creation time stamp of the stream.

    This is the time stamp when the stream was first created (as determined via LocalClock() on the providing machine).

    Declaration
    public double CreatedAt()
    Returns
    Type Description
    Double

    The Time Stamp (in double).

    Desc()

    Extended description of the stream.

    It is highly recommended that at least the channel labels are described here. See code examples on the LSL wiki. Other information, such as amplifier settings, measurement units if deviating from defaults, setup information, subject information, etc., can be specified here, as well. Meta-data recommendations follow the XDF file format project (https://github.com/sccn/xdf/wiki/Meta-Data or web search for: XDF meta-data).

    Declaration
    public liblsl.XMLElement Desc()
    Returns
    Type Description
    liblsl.XMLElement

    A liblsl.XMLElement containing the description.

    Remarks

    if you use a stream content type for which meta-data recommendations exist, please try to lay out your meta-data in agreement with these recommendations for compatibility with other applications.

    Finalize()

    Finalizes an instance of the liblsl.StreamInfo object.

    Declaration
    protected void Finalize()

    Handle()

    Get access to the underlying handle.

    Declaration
    public IntPtr Handle()
    Returns
    Type Description
    IntPtr

    the Handle.

    Hostname()

    Hostname of the providing machine.

    Declaration
    public string Hostname()
    Returns
    Type Description
    String

    The Hostname (in string).

    Name()

    Name of the stream.

    This is a human-readable name. For streams offered by device modules, it refers to the type of device or product series that is generating the data of the stream. If the source is an application, the name may be a more generic or specific identifier. Multiple streams with the same name can coexist, though potentially at the cost of ambiguity (for the recording app or experimenter).

    Declaration
    public string Name()
    Returns
    Type Description
    String

    The name of the stream.

    Sampling()

    Sampling rate of the stream, according to the source (in Hz).

    If a stream is irregularly sampled, this should be set to IRREGULAR_RATE. Note that no data will be lost even if this sampling rate is incorrect or if a device has temporary hiccups, since all samples will be recorded anyway (except for those dropped by the device itself). However, when the recording is imported into an application, a good importer may correct such errors more accurately if the advertised sampling rate was close to the specs of the device.

    Declaration
    public double Sampling()
    Returns
    Type Description
    Double

    The Sampling rate of the stream (in double).

    SessionId()

    Session ID for the given stream.

    The session id is an optional human-assigned identifier of the recording session. While it is rarely used, it can be used to prevent concurrent recording activitites on the same sub-network (e.g., in multiple experiment areas) from seeing each other's streams (assigned via a configuration file by the experimenter, see Network Connectivity in the LSL wiki).

    Declaration
    public string SessionId()
    Returns
    Type Description
    String

    The Session Identifier (in string).

    SourceId()

    Unique identifier of the stream's source, if available.

    The unique source (or device) identifier is an optional piece of information that, if available, allows that endpoints(such as the recording program) can re-acquire a stream automatically once it is back online.

    Declaration
    public string SourceId()
    Returns
    Type Description
    String

    The Identifier (in string).

    Type()

    Content type of the stream.

    The content type is a short string such as "EEG", "Gaze" which describes the content carried by the channel (if known). If a stream contains mixed content this value need not be assigned but may instead be stored in the description of channel types. To be useful to applications and automated processing systems using the recommended content types is preferred. Content types usually follow those pre-defined in https://github.com/sccn/xdf/wiki/Meta-Data (or web search for: XDF meta-data).

    Declaration
    public string Type()
    Returns
    Type Description
    String

    The content type of the stream (in string).

    Uid()

    Unique ID of the stream outlet instance (once assigned).

    This is a unique identifier of the stream outlet, and is guaranteed to be different across multiple instantiations of the same outlet (e.g., after a re-start).

    Declaration
    public string Uid()
    Returns
    Type Description
    String

    The Unique Identifier (in string).

    Version()

    Protocol version used to deliver the stream.

    Declaration
    public int Version()
    Returns
    Type Description
    Int32

    The protocol version (in int).

    Back to top LSL 4 Unity documentation