File common.h
FileList > include > lsl > common.h
Go to the source code of this file
Global constants for liblsl.
#include <stdint.h>
Public Types
| Type | Name |
|---|---|
| enum | lsl_channel_format_t Data format of a channel (each transmitted sample holds an array of channels), 4 bytes wide. |
| enum | lsl_error_code_t Possible error codes. |
| enum | lsl_processing_options_t Post-processing options for stream inlets. |
| enum | lsl_transport_options_t Flags for outlet_ex and inlet_ex. |
Public Static Attributes
| Type | Name |
|---|---|
| char | _lsl_channel_format_size_check |
Public Functions
| Type | Name |
|---|---|
| LIBLSL_C_API const char * | lsl_base_version (void) |
| LIBLSL_C_API void | lsl_destroy_string (char * s) |
| LIBLSL_C_API const char * | lsl_full_version (void) |
| LIBLSL_C_API int32_t | lsl_is_secure_build (void) |
| LIBLSL_C_API const char * | lsl_last_error (void) Return an explanation for the last error. |
| LIBLSL_C_API const char * | lsl_library_info (void) |
| LIBLSL_C_API int32_t | lsl_library_version () |
| LIBLSL_C_API double | lsl_local_clock () |
| LIBLSL_C_API int32_t | lsl_local_security_enabled (void) |
| LIBLSL_C_API const char * | lsl_local_security_fingerprint (void) |
| LIBLSL_C_API int32_t | lsl_protocol_version () |
| LIBLSL_C_API int32_t | lsl_security_is_locked (void) |
| LIBLSL_C_API int32_t | lsl_security_unlock (const char * passphrase) |
| LIBLSL_C_API const char * | lsl_security_version (void) |
Macros
| Type | Name |
|---|---|
| define | LIBLSL_COMPILE_HEADER_VERSION 114 |
| define | LIBLSL_C_API \_\_attribute\_\_((visibility("default")))LIBLSL_C_API expands function attributes needed for the linker. |
| define | LSL_DEDUCED_TIMESTAMP -1.0 |
| define | LSL_FOREVER 32000000.0A very large time value (ca. 1 year); can be used in timeouts. |
| define | LSL_IRREGULAR_RATE 0.0Constant to indicate that a stream has variable sampling rate. |
| define | LSL_NO_PREFERENCE 0 |
Public Types Documentation
enum lsl_channel_format_t
Data format of a channel (each transmitted sample holds an array of channels), 4 bytes wide.
enum lsl_channel_format_t {
cft_float32 = 1,
cft_double64 = 2,
cft_string = 3,
cft_int32 = 4,
cft_int16 = 5,
cft_int8 = 6,
cft_int64 = 7,
cft_undefined = 0,
_cft_maxval = 0x7f000000
};
enum lsl_error_code_t
Possible error codes.
enum lsl_error_code_t {
lsl_no_error = 0,
lsl_timeout_error = -1,
lsl_lost_error = -2,
lsl_argument_error = -3,
lsl_internal_error = -4,
_lsl_error_code_maxval = 0x7f000000
};
enum lsl_processing_options_t
Post-processing options for stream inlets.
enum lsl_processing_options_t {
proc_none = 0,
proc_clocksync = 1,
proc_dejitter = 2,
proc_monotonize = 4,
proc_threadsafe = 8,
proc_ALL = 1 | 2 | 4 | 8,
_proc_maxval = 0x7f000000
};
enum lsl_transport_options_t
Flags for outlet_ex and inlet_ex.
enum lsl_transport_options_t {
transp_default = 0,
transp_bufsize_samples = 1,
transp_bufsize_thousandths = 2,
_lsl_transport_options_maxval = 0x7f000000
};
Public Static Attributes Documentation
variable _lsl_channel_format_size_check
Public Functions Documentation
function lsl_base_version
Get the base liblsl version string.
Returns the upstream liblsl version (e.g., "1.16.1"). This tracks the base library version independent of security features.
function lsl_destroy_string
Deallocate a string that has been transferred to the application.
Rarely used: the only use case is to deallocate the contents of string-valued samples received from LSL in an application where no free() method is available (e.g., in some scripting languages).
function lsl_full_version
Get the full version string.
Returns the combined version (e.g., "1.16.1-secure.1.0.0-alpha"). For non-secure builds, returns just the base version.
function lsl_is_secure_build
Check if this is a secure build of liblsl.
Returns 1 if this library was built with security features (LSL_SECURITY=ON), returns 0 otherwise.
Use this to verify you're using the correct library at runtime:
function lsl_last_error
Return an explanation for the last error.
function lsl_library_info
Get a string containing library information.
The format of the string shouldn't be used for anything important except giving a debugging person a good idea which exact library version is used.
function lsl_library_version
Version of the liblsl library.
The major version is library_version() / 100; The minor version is library_version() % 100;
function lsl_local_clock
Obtain a local system time stamp in seconds.
The resolution is better than a millisecond. This reading can be used to assign time stamps to samples as they are being acquired. If the "age" of a sample is known at a particular time (e.g., from USB transmission delays), it can be used as an offset to lsl_local_clock() to obtain a better estimate of when a sample was actually captured. See lsl_push_sample() for a use case.
function lsl_local_security_enabled
Check if local security is enabled (credentials loaded).
Returns 1 if security credentials have been loaded from the configuration, returns 0 if no credentials are loaded (either not a secure build, or no credentials found in lsl_api.cfg).
This is useful for detecting security mismatches before connecting:
if (stream.security_enabled() && !lsl_local_security_enabled()) {
fprintf(stderr, "ERROR: Stream requires security but no credentials loaded!\n");
}
function lsl_local_security_fingerprint
Get the local device's public key fingerprint.
Returns the SHA256 fingerprint of the local device's public key (e.g., "SHA256:79:8c:1d:7d:a6:b4:34:22..."). Returns empty string if security is not enabled or key is locked.
Useful for verifying device identity and debugging key mismatches.
function lsl_protocol_version
Protocol version.
The major version is protocol_version() / 100; The minor version is protocol_version() % 100;
Clients with different minor versions are protocol-compatible while clients with different major versions will refuse to work together.
function lsl_security_is_locked
Check if the local security key is locked (passphrase-protected).
Returns 1 if the key is encrypted and needs to be unlocked with a passphrase, returns 0 if the key is not locked (either unencrypted or already unlocked).
For language bindings that need to handle passphrase-protected keys:
function lsl_security_unlock
Unlock the passphrase-protected security key.
Parameters:
passphraseThe passphrase to unlock the key.
Returns:
1 on success, 0 on failure (wrong passphrase or not locked).
This is primarily for language bindings (Python, MATLAB, etc.) that need programmatic access to unlock passphrase-protected keys.
function lsl_security_version
Get the security layer version string.
Returns the security layer version (e.g., "1.0.0" or "1.0.0-alpha"). Returns "0.0.0" if this is not a secure build.
Security version follows semantic versioning: * Major: Breaking changes (API, protocol, config format) * Minor: New features (new API functions, new config options) * Patch: Bug fixes, security patches
Macro Definition Documentation
define LIBLSL_COMPILE_HEADER_VERSION
LSL version the binary was compiled against
Used either to check if the same version is used (if( lsl_protocol_version() !=LIBLSL_COMPILE_HEADER_VERSION) … or to require a certain set of features:
define LIBLSL_C_API
LIBLSL_C_API expands function attributes needed for the linker.
define LSL_DEDUCED_TIMESTAMP
Constant to indicate that a sample has the next successive time stamp.
This is an optional optimization to transmit less data per sample. The stamp is then deduced from the preceding one according to the stream's sampling rate (in the case of an irregular rate, the same time stamp as before will is assumed).
define LSL_FOREVER
A very large time value (ca. 1 year); can be used in timeouts.
define LSL_IRREGULAR_RATE
Constant to indicate that a stream has variable sampling rate.
define LSL_NO_PREFERENCE
Constant to indicate that there is no preference about how a data stream shall be chunked for transmission. (can be used for the chunking parameters in the inlet or the outlet).
The documentation for this class was generated from the following file liblsl/include/lsl/common.h