File common.h
File List > include > lsl > common.h
Go to the documentation of this file
#pragma once
#if defined(LIBLSL_FFI)
// Skip any typedefs that might confuse a FFI header parser, e.g. cffi
#elif defined(_MSC_VER) && _MSC_VER < 1600
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef signed long long int64_t;
typedef unsigned int uint32_t;
#else
#include <stdint.h>
#endif
#if defined(_MSC_VER) && _MSC_VER < 1900
#define __func__ __FUNCTION__
#endif
#if defined(LIBLSL_STATIC) || defined(LIBLSL_FFI)
#define LIBLSL_C_API
#elif defined _WIN32 || defined __CYGWIN__
#if defined LIBLSL_EXPORTS
#define LIBLSL_C_API __declspec(dllexport)
#else
#define LIBLSL_C_API __declspec(dllimport)
#ifndef LSLNOAUTOLINK
#pragma comment(lib, "lsl.lib")
#endif
#endif
#pragma warning(disable : 4275)
#else // Linux / OS X
#define LIBLSL_C_API __attribute__((visibility("default")))
#endif
#define LSL_IRREGULAR_RATE 0.0
#define LSL_DEDUCED_TIMESTAMP -1.0
#define LSL_FOREVER 32000000.0
#define LSL_NO_PREFERENCE 0
typedef enum {
cft_float32 = 1,
cft_double64 = 2,
cft_string = 3,
cft_int32 = 4,
cft_int16 = 5,
cft_int8 = 6,
cft_int64 = 7,
cft_undefined = 0,
// prevent compilers from assuming an instance fits in a single byte
_cft_maxval = 0x7f000000
} lsl_channel_format_t;
// Abort compilation if lsl_channel_format_t isn't exactly 4 bytes wide
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
_Static_assert(sizeof(lsl_channel_format_t) == 4, "lsl_channel_format_t size breaks the LSL ABI");
#elif defined(__cplusplus) && __cplusplus >= 201103L
static_assert (sizeof(lsl_channel_format_t) == 4, "lsl_channel_format_t size breaks the LSL ABI");
#elif !defined(LIBLSL_FFI)
static char _lsl_channel_format_size_check[1 - 2*!(sizeof(lsl_channel_format_t)==4)];
#endif
typedef enum {
proc_none = 0,
proc_clocksync = 1,
proc_dejitter = 2,
proc_monotonize = 4,
proc_threadsafe = 8,
proc_ALL = 1 | 2 | 4 | 8,
// prevent compilers from assuming an instance fits in a single byte
_proc_maxval = 0x7f000000
} lsl_processing_options_t;
typedef enum {
lsl_no_error = 0,
lsl_timeout_error = -1,
lsl_lost_error = -2,
lsl_argument_error = -3,
lsl_internal_error = -4,
// prevent compilers from assuming an instance fits in a single byte
_lsl_error_code_maxval = 0x7f000000
} lsl_error_code_t;
typedef enum {
transp_default = 0,
transp_bufsize_samples = 1,
transp_bufsize_thousandths = 2,
// prevent compilers from assuming an instance fits in a single byte
_lsl_transport_options_maxval = 0x7f000000
} lsl_transport_options_t;
extern LIBLSL_C_API const char *lsl_last_error(void);
#define LIBLSL_COMPILE_HEADER_VERSION 114
extern LIBLSL_C_API int32_t lsl_protocol_version();
extern LIBLSL_C_API int32_t lsl_library_version();
extern LIBLSL_C_API const char *lsl_library_info(void);
extern LIBLSL_C_API double lsl_local_clock();
extern LIBLSL_C_API void lsl_destroy_string(char *s);
extern LIBLSL_C_API const char *lsl_base_version(void);
extern LIBLSL_C_API const char *lsl_security_version(void);
extern LIBLSL_C_API const char *lsl_full_version(void);
extern LIBLSL_C_API int32_t lsl_is_secure_build(void);
extern LIBLSL_C_API int32_t lsl_local_security_enabled(void);
extern LIBLSL_C_API int32_t lsl_security_is_locked(void);
extern LIBLSL_C_API int32_t lsl_security_unlock(const char *passphrase);
extern LIBLSL_C_API const char *lsl_local_security_fingerprint(void);