labrecorder 1.0.0rc0__cp311-cp311-macosx_26_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of labrecorder might be problematic. Click here for more details.
- Frameworks/lsl.framework/Versions/A/Resources/CMake/LSLCMake.cmake +495 -0
- Frameworks/lsl.framework/Versions/A/Resources/CMake/LSLConfig-release.cmake +19 -0
- Frameworks/lsl.framework/Versions/A/Resources/CMake/LSLConfig.cmake +102 -0
- Frameworks/lsl.framework/Versions/A/Resources/CMake/LSLConfigVersion.cmake +43 -0
- Frameworks/lsl.framework/Versions/A/Resources/Info.plist +28 -0
- Frameworks/lsl.framework/Versions/A/_CodeSignature/CodeResources +240 -0
- Frameworks/lsl.framework/Versions/A/include/lsl/common.h +229 -0
- Frameworks/lsl.framework/Versions/A/include/lsl/inlet.h +309 -0
- Frameworks/lsl.framework/Versions/A/include/lsl/outlet.h +252 -0
- Frameworks/lsl.framework/Versions/A/include/lsl/resolver.h +156 -0
- Frameworks/lsl.framework/Versions/A/include/lsl/streaminfo.h +196 -0
- Frameworks/lsl.framework/Versions/A/include/lsl/types.h +60 -0
- Frameworks/lsl.framework/Versions/A/include/lsl/xml.h +103 -0
- Frameworks/lsl.framework/Versions/A/include/lsl_c.h +36 -0
- Frameworks/lsl.framework/Versions/A/include/lsl_cpp.h +1720 -0
- Frameworks/lsl.framework/Versions/A/lsl +0 -0
- Frameworks/lsl.framework/lsl +0 -0
- LICENSE +21 -0
- LabRecorder.cfg +69 -0
- LabRecorderCLI +0 -0
- README.md +184 -0
- labrecorder-1.0.0rc0.dist-info/METADATA +193 -0
- labrecorder-1.0.0rc0.dist-info/RECORD +27 -0
- labrecorder-1.0.0rc0.dist-info/WHEEL +5 -0
- labrecorder-1.0.0rc0.dist-info/licenses/LICENSE +21 -0
- labrecorder.cpython-311-darwin.so +0 -0
- libxdfwriter.a +0 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include "common.h"
|
|
3
|
+
#include "types.h"
|
|
4
|
+
|
|
5
|
+
/// @file resolver.h Stream resolution functions
|
|
6
|
+
|
|
7
|
+
/** @defgroup continuous_resolver The lsl_continuous_resolver
|
|
8
|
+
* @ingroup resolve
|
|
9
|
+
*
|
|
10
|
+
* Streams can be resolved at a single timepoint once (@ref resolve) or continuously in the
|
|
11
|
+
* background.
|
|
12
|
+
* @{
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Construct a new #lsl_continuous_resolver that resolves all streams on the network.
|
|
17
|
+
*
|
|
18
|
+
* This is analogous to the functionality offered by the free function lsl_resolve_all().
|
|
19
|
+
* @param forget_after When a stream is no longer visible on the network (e.g. because it was shut
|
|
20
|
+
* down), this is the time in seconds after which it is no longer reported by the resolver.
|
|
21
|
+
*
|
|
22
|
+
* The recommended default value is 5.0.
|
|
23
|
+
*/
|
|
24
|
+
extern LIBLSL_C_API lsl_continuous_resolver lsl_create_continuous_resolver(double forget_after);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Construct a new lsl_continuous_resolver that resolves all streams with a specific value for a given
|
|
28
|
+
* property.
|
|
29
|
+
*
|
|
30
|
+
* This is analogous to the functionality provided by the free function lsl_resolve_byprop()
|
|
31
|
+
* @param prop The #lsl_streaminfo property that should have a specific value (e.g., "name", "type",
|
|
32
|
+
* "source_id", or "desc/manufaturer").
|
|
33
|
+
* @param value The string value that the property should have (e.g., "EEG" as the type property).
|
|
34
|
+
* @param forget_after When a stream is no longer visible on the network (e.g., because it was shut
|
|
35
|
+
* down), this is the time in seconds after which it is no longer reported by the resolver.
|
|
36
|
+
* The recommended default value is 5.0.
|
|
37
|
+
*/
|
|
38
|
+
extern LIBLSL_C_API lsl_continuous_resolver lsl_create_continuous_resolver_byprop(const char *prop, const char *value, double forget_after);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Construct a new lsl_continuous_resolver that resolves all streams that match a given XPath 1.0
|
|
42
|
+
* predicate.
|
|
43
|
+
*
|
|
44
|
+
* This is analogous to the functionality provided by the free function lsl_resolve_bypred()
|
|
45
|
+
* @param pred The predicate string, e.g.
|
|
46
|
+
* `"name='BioSemi'" or "type='EEG' and starts-with(name,'BioSemi') and count(info/desc/channel)=32"`
|
|
47
|
+
* @param forget_after When a stream is no longer visible on the network (e.g., because it was shut
|
|
48
|
+
* down), this is the time in seconds after which it is no longer reported by the resolver.
|
|
49
|
+
* The recommended default value is 5.0.
|
|
50
|
+
*/
|
|
51
|
+
extern LIBLSL_C_API lsl_continuous_resolver lsl_create_continuous_resolver_bypred(const char *pred, double forget_after);
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Obtain the set of currently present streams on the network (i.e. resolve result).
|
|
55
|
+
*
|
|
56
|
+
* @param res A continuous resolver (previously created with one of the
|
|
57
|
+
* lsl_create_continuous_resolver() functions).
|
|
58
|
+
* @param buffer A user-allocated buffer to hold the current resolve results.<br>
|
|
59
|
+
* @attention It is the user's responsibility to either destroy the resulting streaminfo objects or
|
|
60
|
+
* to pass them back to the LSL during during creation of an inlet.
|
|
61
|
+
* @attention The stream_infos returned by the resolver are only short versions that do not include
|
|
62
|
+
* the lsl_get_desc() field (which can be arbitrarily big).
|
|
63
|
+
*
|
|
64
|
+
* To obtain the full stream information you need to call lsl_get_info() on the inlet after you have
|
|
65
|
+
* created one.
|
|
66
|
+
* @param buffer_elements The user-provided buffer length.
|
|
67
|
+
* @return The number of results written into the buffer (never more than the provided # of slots)
|
|
68
|
+
* or a negative number if an error has occurred (values corresponding to #lsl_error_code_t).
|
|
69
|
+
*/
|
|
70
|
+
extern LIBLSL_C_API int32_t lsl_resolver_results(lsl_continuous_resolver res, lsl_streaminfo *buffer, uint32_t buffer_elements);
|
|
71
|
+
|
|
72
|
+
/// Destructor for the continuous resolver.
|
|
73
|
+
extern LIBLSL_C_API void lsl_destroy_continuous_resolver(lsl_continuous_resolver res);
|
|
74
|
+
|
|
75
|
+
/// @}
|
|
76
|
+
|
|
77
|
+
/** @defgroup resolve Resolving streams on the network
|
|
78
|
+
* @{*/
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Resolve all streams on the network.
|
|
82
|
+
*
|
|
83
|
+
* This function returns all currently available streams from any outlet on the network.
|
|
84
|
+
* The network is usually the subnet specified at the local router, but may also include a multicast
|
|
85
|
+
* group of machines (given that the network supports it), or a list of hostnames.<br>
|
|
86
|
+
* These details may optionally be customized by the experimenter in a configuration file
|
|
87
|
+
* (see page Network Connectivity in the LSL wiki).
|
|
88
|
+
* This is the default mechanism used by the browsing programs and the recording program.
|
|
89
|
+
* @param[out] buffer A user-allocated buffer to hold the resolve results.
|
|
90
|
+
* @attention It is the user's responsibility to either destroy the resulting streaminfo objects or
|
|
91
|
+
* to pass them back to the LSL during during creation of an inlet.
|
|
92
|
+
*
|
|
93
|
+
* @attention The stream_info's returned by the resolver are only short versions that do not include
|
|
94
|
+
* the lsl_get_desc() field (which can be arbitrarily big).
|
|
95
|
+
* To obtain the full stream information you need to call lsl_get_info() on the inlet after you have
|
|
96
|
+
* created one.
|
|
97
|
+
* @param buffer_elements The user-provided buffer length.
|
|
98
|
+
* @param wait_time The waiting time for the operation, in seconds, to search for streams.
|
|
99
|
+
* The recommended wait time is 1 second (or 2 for a busy and large recording operation).
|
|
100
|
+
* @warning If this is too short (<0.5s) only a subset (or none) of the outlets that are present on
|
|
101
|
+
* the network may be returned.
|
|
102
|
+
* @return The number of results written into the buffer (never more than the provided # of slots)
|
|
103
|
+
* or a negative number if an error has occurred (values corresponding to lsl_error_code_t).
|
|
104
|
+
*/
|
|
105
|
+
extern LIBLSL_C_API int32_t lsl_resolve_all(lsl_streaminfo *buffer, uint32_t buffer_elements, double wait_time);
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Resolve all streams with a given value for a property.
|
|
109
|
+
*
|
|
110
|
+
* If the goal is to resolve a specific stream, this method is preferred over resolving all streams
|
|
111
|
+
* and then selecting the desired one.
|
|
112
|
+
* @param[out] buffer A user-allocated buffer to hold the resolve results.
|
|
113
|
+
* @attention It is the user's responsibility to either destroy the resulting streaminfo objects or
|
|
114
|
+
* to pass them back to the LSL during during creation of an inlet.
|
|
115
|
+
*
|
|
116
|
+
* @attention The stream_info's returned by the resolver are only short versions that do not include
|
|
117
|
+
* the lsl_get_desc() field (which can be arbitrarily big). To obtain the full stream information
|
|
118
|
+
* you need to call lsl_get_info() on the inlet after you have created one.
|
|
119
|
+
* @param buffer_elements The user-provided buffer length.
|
|
120
|
+
* @param prop The streaminfo property that should have a specific value (`"name"`, `"type"`,
|
|
121
|
+
* `"source_id"`, or, e.g., `"desc/manufaturer"` if present).
|
|
122
|
+
* @param value The string value that the property should have (e.g., "EEG" as the type).
|
|
123
|
+
* @param minimum Return at least this number of streams.
|
|
124
|
+
* @param timeout Optionally a timeout of the operation, in seconds (default: no timeout).
|
|
125
|
+
* If the timeout expires, less than the desired number of streams (possibly none) will be returned.
|
|
126
|
+
* @return The number of results written into the buffer (never more than the provided # of slots)
|
|
127
|
+
* or a negative number if an error has occurred (values corresponding to #lsl_error_code_t).
|
|
128
|
+
*/
|
|
129
|
+
extern LIBLSL_C_API int32_t lsl_resolve_byprop(lsl_streaminfo *buffer, uint32_t buffer_elements, const char *prop, const char *value, int32_t minimum, double timeout);
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Resolve all streams that match a given predicate.
|
|
133
|
+
*
|
|
134
|
+
* Advanced query that allows to impose more conditions on the retrieved streams;
|
|
135
|
+
* the given string is an [XPath 1.0 predicate](http://en.wikipedia.org/w/index.php?title=XPath_1.0)
|
|
136
|
+
* for the `<info>` node (omitting the surrounding []'s)
|
|
137
|
+
* @param[out] buffer A user-allocated buffer to hold the resolve results.
|
|
138
|
+
* @attention It is the user's responsibility to either destroy the resulting streaminfo objects or
|
|
139
|
+
* to pass them back to the LSL during during creation of an inlet.
|
|
140
|
+
*
|
|
141
|
+
* @attention The stream_info's returned by the resolver are only short versions that do not include
|
|
142
|
+
* the lsl_get_desc() field (which can be arbitrarily big). To obtain the full stream information
|
|
143
|
+
* you need to call lsl_get_info() on the inlet after you have created one.
|
|
144
|
+
* @param buffer_elements The user-provided buffer length.
|
|
145
|
+
* @param pred The predicate string, e.g.
|
|
146
|
+
* `name='BioSemi'` or `type='EEG' and starts-with(name,'BioSemi') and count(info/desc/channel)=32`
|
|
147
|
+
* @param minimum Return at least this number of streams.
|
|
148
|
+
* @param timeout Optionally a timeout of the operation, in seconds (default: no timeout).
|
|
149
|
+
* If the timeout expires, less than the desired number of streams (possibly none)
|
|
150
|
+
* will be returned.
|
|
151
|
+
* @return The number of results written into the buffer (never more than the provided # of slots)
|
|
152
|
+
* or a negative number if an error has occurred (values corresponding to lsl_error_code_t).
|
|
153
|
+
*/
|
|
154
|
+
extern LIBLSL_C_API int32_t lsl_resolve_bypred(lsl_streaminfo *buffer, uint32_t buffer_elements, const char *pred, int32_t minimum, double timeout);
|
|
155
|
+
|
|
156
|
+
/// @}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include "common.h"
|
|
3
|
+
#include "types.h"
|
|
4
|
+
|
|
5
|
+
/// @file streaminfo.h Stream info functions
|
|
6
|
+
|
|
7
|
+
/** @defgroup streaminfo The lsl_streaminfo object
|
|
8
|
+
*
|
|
9
|
+
* The #lsl_streaminfo object keeps a stream's meta data and connection settings.
|
|
10
|
+
* @{
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Construct a new streaminfo object.
|
|
15
|
+
*
|
|
16
|
+
* Core stream information is specified here. Any remaining meta-data can be added later.
|
|
17
|
+
* @param name Name of the stream.<br>
|
|
18
|
+
* Describes the device (or product series) that this stream makes available
|
|
19
|
+
* (for use by programs, experimenters or data analysts). Cannot be empty.
|
|
20
|
+
* @param type Content type of the stream. Please see https://github.com/sccn/xdf/wiki/Meta-Data (or
|
|
21
|
+
* web search for: XDF meta-data) for pre-defined content-type names, but you can also make up your
|
|
22
|
+
* own. The content type is the preferred way to find streams (as opposed to searching by name).
|
|
23
|
+
* @param channel_count Number of channels per sample.
|
|
24
|
+
* This stays constant for the lifetime of the stream.
|
|
25
|
+
* @param nominal_srate The sampling rate (in Hz) as advertised by the
|
|
26
|
+
* datasource, if regular (otherwise set to #LSL_IRREGULAR_RATE).
|
|
27
|
+
* @param channel_format Format/type of each channel.<br>
|
|
28
|
+
* If your channels have different formats, consider supplying multiple streams
|
|
29
|
+
* or use the largest type that can hold them all (such as #cft_double64).
|
|
30
|
+
*
|
|
31
|
+
* A good default is #cft_float32.
|
|
32
|
+
* @param source_id Unique identifier of the source or device, if available (e.g. a serial number).
|
|
33
|
+
* Allows recipients to recover from failure even after the serving app or device crashes.
|
|
34
|
+
* May in some cases also be constructed from device settings.
|
|
35
|
+
* @return A newly created streaminfo handle or NULL in the event that an error occurred.
|
|
36
|
+
*/
|
|
37
|
+
extern LIBLSL_C_API lsl_streaminfo lsl_create_streaminfo(const char *name, const char *type, int32_t channel_count, double nominal_srate, lsl_channel_format_t channel_format, const char *source_id);
|
|
38
|
+
|
|
39
|
+
/// Destroy a previously created streaminfo object.
|
|
40
|
+
extern LIBLSL_C_API void lsl_destroy_streaminfo(lsl_streaminfo info);
|
|
41
|
+
|
|
42
|
+
/// Copy an existing streaminfo object (rarely used).
|
|
43
|
+
extern LIBLSL_C_API lsl_streaminfo lsl_copy_streaminfo(lsl_streaminfo info);
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Name of the stream.
|
|
47
|
+
*
|
|
48
|
+
* This is a human-readable name.
|
|
49
|
+
* For streams offered by device modules, it refers to the type of device or product series that is
|
|
50
|
+
* generating the data of the stream. If the source is an application, the name may be a more
|
|
51
|
+
* generic or specific identifier. Multiple streams with the same name can coexist, though
|
|
52
|
+
* potentially at the cost of ambiguity (for the recording app or experimenter).
|
|
53
|
+
* @return An immutable library-owned pointer to the string value. @sa lsl_destroy_string()
|
|
54
|
+
*/
|
|
55
|
+
extern LIBLSL_C_API const char *lsl_get_name(lsl_streaminfo info);
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Content type of the stream.
|
|
59
|
+
*
|
|
60
|
+
* The content type is a short string such as "EEG", "Gaze" which describes the content carried by
|
|
61
|
+
* the channel (if known). If a stream contains mixed content this value need not be assigned but
|
|
62
|
+
* may instead be stored in the description of channel types. To be useful to applications and
|
|
63
|
+
* automated processing systems using the recommended content types is preferred. Content types
|
|
64
|
+
* usually follow those pre-defined in the [wiki](https://github.com/sccn/xdf/wiki/Meta-Data) (or
|
|
65
|
+
* web search for: XDF meta-data).
|
|
66
|
+
* @return An immutable library-owned pointer to the string value. @sa lsl_destroy_string()
|
|
67
|
+
*/
|
|
68
|
+
extern LIBLSL_C_API const char *lsl_get_type(lsl_streaminfo info);
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Number of channels of the stream.
|
|
72
|
+
* A stream has at least one channels; the channel count stays constant for all samples.
|
|
73
|
+
*/
|
|
74
|
+
extern LIBLSL_C_API int32_t lsl_get_channel_count(lsl_streaminfo info);
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Sampling rate of the stream, according to the source (in Hz).
|
|
78
|
+
*
|
|
79
|
+
* If a stream is irregularly sampled, this should be set to #LSL_IRREGULAR_RATE.
|
|
80
|
+
*
|
|
81
|
+
* Note that no data will be lost even if this sampling rate is incorrect or if a device has
|
|
82
|
+
* temporary hiccups, since all samples will be recorded anyway (except for those dropped by the
|
|
83
|
+
* device itself). However, when the recording is imported into an application, a good importer may
|
|
84
|
+
* correct such errors more accurately if the advertised sampling rate was close to the specs of the
|
|
85
|
+
* device.
|
|
86
|
+
*/
|
|
87
|
+
extern LIBLSL_C_API double lsl_get_nominal_srate(lsl_streaminfo info);
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Channel format of the stream.
|
|
91
|
+
* All channels in a stream have the same format.
|
|
92
|
+
* However, a device might offer multiple time-synched streams each with its own format.
|
|
93
|
+
*/
|
|
94
|
+
extern LIBLSL_C_API lsl_channel_format_t lsl_get_channel_format(lsl_streaminfo info);
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Unique identifier of the stream's source, if available.
|
|
98
|
+
*
|
|
99
|
+
* The unique source (or device) identifier is an optional piece of information that, if available,
|
|
100
|
+
* allows that endpoints (such as the recording program) can re-acquire a stream automatically once
|
|
101
|
+
* it is back online.
|
|
102
|
+
* @return An immutable library-owned pointer to the string value. @sa lsl_destroy_string()
|
|
103
|
+
*/
|
|
104
|
+
extern LIBLSL_C_API const char *lsl_get_source_id(lsl_streaminfo info);
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Protocol version used to deliver the stream.
|
|
108
|
+
*/
|
|
109
|
+
extern LIBLSL_C_API int32_t lsl_get_version(lsl_streaminfo info);
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Creation time stamp of the stream.
|
|
113
|
+
*
|
|
114
|
+
* This is the time stamp when the stream was first created
|
|
115
|
+
* (as determined via local_clock() on the providing machine).
|
|
116
|
+
*/
|
|
117
|
+
extern LIBLSL_C_API double lsl_get_created_at(lsl_streaminfo info);
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Unique ID of the stream outlet (once assigned).
|
|
121
|
+
*
|
|
122
|
+
* This is a unique identifier of the stream outlet, and is guaranteed to be different
|
|
123
|
+
* across multiple instantiations of the same outlet (e.g., after a re-start).
|
|
124
|
+
* @return An immutable library-owned pointer to the string value. @sa lsl_destroy_string()
|
|
125
|
+
*/
|
|
126
|
+
extern LIBLSL_C_API const char *lsl_get_uid(lsl_streaminfo info);
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Session ID for the given stream.
|
|
130
|
+
*
|
|
131
|
+
* The session id is an optional human-assigned identifier of the recording session.
|
|
132
|
+
* While it is rarely used, it can be used to prevent concurrent recording activitites
|
|
133
|
+
* on the same sub-network (e.g., in multiple experiment areas) from seeing each other's streams
|
|
134
|
+
* (assigned via a configuration file by the experimenter, see Network Connectivity on the LSL
|
|
135
|
+
* wiki).
|
|
136
|
+
* @return An immutable library-owned pointer to the string value. @sa lsl_destroy_string()
|
|
137
|
+
*/
|
|
138
|
+
extern LIBLSL_C_API const char *lsl_get_session_id(lsl_streaminfo info);
|
|
139
|
+
|
|
140
|
+
/// Hostname of the providing machine (once bound to an outlet). Modification is not permitted.
|
|
141
|
+
extern LIBLSL_C_API const char *lsl_get_hostname(lsl_streaminfo info);
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Extended description of the stream.
|
|
145
|
+
*
|
|
146
|
+
* It is highly recommended that at least the channel labels are described here.
|
|
147
|
+
* See code examples on the LSL wiki. Other information, such as amplifier settings,
|
|
148
|
+
* measurement units if deviating from defaults, setup information, subject information, etc.,
|
|
149
|
+
* can be specified here, as well. Meta-data recommendations follow the XDF file format project
|
|
150
|
+
* (github.com/sccn/xdf/wiki/Meta-Data or web search for: XDF meta-data).
|
|
151
|
+
*
|
|
152
|
+
* @attention if you use a stream content type for which meta-data recommendations exist, please
|
|
153
|
+
* try to lay out your meta-data in agreement with these recommendations for compatibility with other applications.
|
|
154
|
+
*/
|
|
155
|
+
extern LIBLSL_C_API lsl_xml_ptr lsl_get_desc(lsl_streaminfo info);
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Retrieve the entire streaminfo in XML format.
|
|
159
|
+
*
|
|
160
|
+
* This yields an XML document (in string form) whose top-level element is `<info>`. The info
|
|
161
|
+
* element contains one element for each field of the streaminfo class, including:
|
|
162
|
+
*
|
|
163
|
+
* - the core elements `<name>`, `<type>`, `<channel_count>`, `<nominal_srate>`,
|
|
164
|
+
* `<channel_format>`, `<source_id>`
|
|
165
|
+
* - the misc elements `<version>`, `<created_at>`, `<uid>`, `<session_id>`,
|
|
166
|
+
* `<v4address>`, `<v4data_port>`, `<v4service_port>`, `<v6address>`, `<v6data_port>`,
|
|
167
|
+
* `<v6service_port>`
|
|
168
|
+
* - the extended description element `<desc>` with user-defined sub-elements.
|
|
169
|
+
* @return A pointer to a copy of the XML text or NULL in the event that an error occurred.
|
|
170
|
+
* @note It is the user's responsibility to deallocate this string when it is no longer needed.
|
|
171
|
+
*/
|
|
172
|
+
extern LIBLSL_C_API char *lsl_get_xml(lsl_streaminfo info);
|
|
173
|
+
|
|
174
|
+
/// Number of bytes occupied by a channel (0 for string-typed channels).
|
|
175
|
+
extern LIBLSL_C_API int32_t lsl_get_channel_bytes(lsl_streaminfo info);
|
|
176
|
+
|
|
177
|
+
/// Number of bytes occupied by a sample (0 for string-typed channels).
|
|
178
|
+
extern LIBLSL_C_API int32_t lsl_get_sample_bytes(lsl_streaminfo info);
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Tries to match the stream info XML element @p info against an
|
|
182
|
+
* <a href="https://en.wikipedia.org/wiki/XPath#Syntax_and_semantics_(XPath_1.0)">XPath</a> query.
|
|
183
|
+
*
|
|
184
|
+
* Example query strings:
|
|
185
|
+
* @code
|
|
186
|
+
* channel_count>5 and type='EEG'
|
|
187
|
+
* type='TestStream' or contains(name,'Brain')
|
|
188
|
+
* name='ExampleStream'
|
|
189
|
+
* @endcode
|
|
190
|
+
*/
|
|
191
|
+
extern LIBLSL_C_API int32_t lsl_stream_info_matches_query(lsl_streaminfo info, const char *query);
|
|
192
|
+
|
|
193
|
+
/// Create a streaminfo object from an XML representation
|
|
194
|
+
extern LIBLSL_C_API lsl_streaminfo lsl_streaminfo_from_xml(const char *xml);
|
|
195
|
+
|
|
196
|
+
/// @}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#ifndef LSL_TYPES
|
|
2
|
+
#define LSL_TYPES
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @class lsl_streaminfo
|
|
6
|
+
* Handle to a stream info object.
|
|
7
|
+
*
|
|
8
|
+
* Stores the declaration of a data stream.
|
|
9
|
+
* Represents the following information:
|
|
10
|
+
*
|
|
11
|
+
* - stream data format (number of channels, channel format)
|
|
12
|
+
* - core information (stream name, content type, sampling rate)
|
|
13
|
+
* - optional meta-data about the stream content (channel labels, measurement units, etc.)
|
|
14
|
+
*
|
|
15
|
+
* Whenever a program wants to provide a new stream on the lab network it will typically first
|
|
16
|
+
* create an lsl_streaminfo to describe its properties and then construct an #lsl_outlet with it to
|
|
17
|
+
* create the stream on the network. Other parties who discover/resolve the outlet on the network
|
|
18
|
+
* can query the stream info; it is also written to disk when recording the stream (playing a
|
|
19
|
+
* similar role as a file header).
|
|
20
|
+
*/
|
|
21
|
+
typedef struct lsl_streaminfo_struct_ *lsl_streaminfo;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @class lsl_outlet
|
|
25
|
+
* A stream outlet handle.
|
|
26
|
+
* Outlets are used to make streaming data (and the meta-data) available on the lab network.
|
|
27
|
+
*/
|
|
28
|
+
typedef struct lsl_outlet_struct_ *lsl_outlet;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @class lsl_inlet
|
|
32
|
+
* A stream inlet handle.
|
|
33
|
+
* Inlets are used to receive streaming data (and meta-data) from the lab network.
|
|
34
|
+
*/
|
|
35
|
+
typedef struct lsl_inlet_struct_ *lsl_inlet;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @class lsl_xml_ptr
|
|
39
|
+
* A lightweight XML element tree handle; models the description of a streaminfo object.
|
|
40
|
+
* XML elements behave like advanced pointers into memory that is owned by some respective
|
|
41
|
+
* streaminfo.
|
|
42
|
+
* Has a name and can have multiple named children or have text content as value;
|
|
43
|
+
* attributes are omitted.
|
|
44
|
+
* @note The interface is modeled after a subset of pugixml's node type and is compatible with it.
|
|
45
|
+
* Type-casts between pugi::xml_node_struct* and #lsl_xml_ptr are permitted (in both directions)
|
|
46
|
+
* since the types are binary compatible.
|
|
47
|
+
* @sa [pugixml documentation](https://pugixml.org/docs/manual.html#access).
|
|
48
|
+
*/
|
|
49
|
+
typedef struct lsl_xml_ptr_struct_ *lsl_xml_ptr;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @class lsl_continuous_resolver
|
|
53
|
+
*
|
|
54
|
+
* Handle to a convenience object that resolves streams continuously in the background throughout
|
|
55
|
+
* its lifetime and which can be queried at any time for the set of streams that are currently
|
|
56
|
+
* visible on the network.
|
|
57
|
+
*/
|
|
58
|
+
typedef struct lsl_continuous_resolver_ *lsl_continuous_resolver;
|
|
59
|
+
|
|
60
|
+
#endif // LSL_TYPES
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include "common.h"
|
|
3
|
+
#include "types.h"
|
|
4
|
+
|
|
5
|
+
/// @file inlet.h XML functions
|
|
6
|
+
|
|
7
|
+
/** @defgroup xml_ptr The lsl_xml_ptr object
|
|
8
|
+
* @{
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// XML Tree Navigation
|
|
12
|
+
|
|
13
|
+
/** Get the first child of the element. */
|
|
14
|
+
extern LIBLSL_C_API lsl_xml_ptr lsl_first_child(lsl_xml_ptr e);
|
|
15
|
+
|
|
16
|
+
/** Get the last child of the element. */
|
|
17
|
+
extern LIBLSL_C_API lsl_xml_ptr lsl_last_child(lsl_xml_ptr e);
|
|
18
|
+
|
|
19
|
+
/** Get the next sibling in the children list of the parent node. */
|
|
20
|
+
extern LIBLSL_C_API lsl_xml_ptr lsl_next_sibling(lsl_xml_ptr e);
|
|
21
|
+
|
|
22
|
+
/** Get the previous sibling in the children list of the parent node. */
|
|
23
|
+
extern LIBLSL_C_API lsl_xml_ptr lsl_previous_sibling(lsl_xml_ptr e);
|
|
24
|
+
|
|
25
|
+
/** Get the parent node. */
|
|
26
|
+
extern LIBLSL_C_API lsl_xml_ptr lsl_parent(lsl_xml_ptr e);
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
// XML Tree Navigation by Name
|
|
30
|
+
|
|
31
|
+
/** Get a child with a specified name. */
|
|
32
|
+
extern LIBLSL_C_API lsl_xml_ptr lsl_child(lsl_xml_ptr e, const char *name);
|
|
33
|
+
|
|
34
|
+
/** Get the next sibling with the specified name. */
|
|
35
|
+
extern LIBLSL_C_API lsl_xml_ptr lsl_next_sibling_n(lsl_xml_ptr e, const char *name);
|
|
36
|
+
|
|
37
|
+
/** Get the previous sibling with the specified name. */
|
|
38
|
+
extern LIBLSL_C_API lsl_xml_ptr lsl_previous_sibling_n(lsl_xml_ptr e, const char *name);
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
// Content Queries
|
|
42
|
+
|
|
43
|
+
/** Whether this node is empty. */
|
|
44
|
+
extern LIBLSL_C_API int32_t lsl_empty(lsl_xml_ptr e);
|
|
45
|
+
|
|
46
|
+
/** Whether this is a text body (instead of an XML element). True both for plain char data and CData. */
|
|
47
|
+
extern LIBLSL_C_API int32_t lsl_is_text(lsl_xml_ptr e);
|
|
48
|
+
|
|
49
|
+
/** Name of the element. */
|
|
50
|
+
extern LIBLSL_C_API const char *lsl_name(lsl_xml_ptr e);
|
|
51
|
+
|
|
52
|
+
/** Value of the element. */
|
|
53
|
+
extern LIBLSL_C_API const char *lsl_value(lsl_xml_ptr e);
|
|
54
|
+
|
|
55
|
+
/** Get child value (value of the first child that is text). */
|
|
56
|
+
extern LIBLSL_C_API const char *lsl_child_value(lsl_xml_ptr e);
|
|
57
|
+
|
|
58
|
+
/** Get child value of a child with a specified name. */
|
|
59
|
+
extern LIBLSL_C_API const char *lsl_child_value_n(lsl_xml_ptr e, const char *name);
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
// Data Modification
|
|
63
|
+
|
|
64
|
+
/// Append a child node with a given name, which has a (nameless) plain-text child with the given text value.
|
|
65
|
+
extern LIBLSL_C_API lsl_xml_ptr lsl_append_child_value(lsl_xml_ptr e, const char *name, const char *value);
|
|
66
|
+
|
|
67
|
+
/// Prepend a child node with a given name, which has a (nameless) plain-text child with the given text value.
|
|
68
|
+
extern LIBLSL_C_API lsl_xml_ptr lsl_prepend_child_value(lsl_xml_ptr e, const char *name, const char *value);
|
|
69
|
+
|
|
70
|
+
/// Set the text value of the (nameless) plain-text child of a named child node.
|
|
71
|
+
extern LIBLSL_C_API int32_t lsl_set_child_value(lsl_xml_ptr e, const char *name, const char *value);
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Set the element's name.
|
|
75
|
+
* @return 0 if the node is empty (or if out of memory).
|
|
76
|
+
*/
|
|
77
|
+
extern LIBLSL_C_API int32_t lsl_set_name(lsl_xml_ptr e, const char *rhs);
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Set the element's value.
|
|
81
|
+
* @return 0 if the node is empty (or if out of memory).
|
|
82
|
+
*/
|
|
83
|
+
extern LIBLSL_C_API int32_t lsl_set_value(lsl_xml_ptr e, const char *rhs);
|
|
84
|
+
|
|
85
|
+
/** Append a child element with the specified name. */
|
|
86
|
+
extern LIBLSL_C_API lsl_xml_ptr lsl_append_child(lsl_xml_ptr e, const char *name);
|
|
87
|
+
|
|
88
|
+
/** Prepend a child element with the specified name. */
|
|
89
|
+
extern LIBLSL_C_API lsl_xml_ptr lsl_prepend_child(lsl_xml_ptr e, const char *name);
|
|
90
|
+
|
|
91
|
+
/** Append a copy of the specified element as a child. */
|
|
92
|
+
extern LIBLSL_C_API lsl_xml_ptr lsl_append_copy(lsl_xml_ptr e, lsl_xml_ptr e2);
|
|
93
|
+
|
|
94
|
+
/** Prepend a child element with the specified name. */
|
|
95
|
+
extern LIBLSL_C_API lsl_xml_ptr lsl_prepend_copy(lsl_xml_ptr e, lsl_xml_ptr e2);
|
|
96
|
+
|
|
97
|
+
/** Remove a child element with the specified name. */
|
|
98
|
+
extern LIBLSL_C_API void lsl_remove_child_n(lsl_xml_ptr e, const char *name);
|
|
99
|
+
|
|
100
|
+
/** Remove a specified child element. */
|
|
101
|
+
extern LIBLSL_C_API void lsl_remove_child(lsl_xml_ptr e, lsl_xml_ptr e2);
|
|
102
|
+
|
|
103
|
+
/// @}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#ifndef LSL_C_H
|
|
2
|
+
#define LSL_C_H
|
|
3
|
+
|
|
4
|
+
/** @file lsl_c.h LSL C API for the lab streaming layer
|
|
5
|
+
*
|
|
6
|
+
* The lab streaming layer provides a set of functions to make instrument data accessible
|
|
7
|
+
* in real time within a lab network. From there, streams can be picked up by recording programs,
|
|
8
|
+
* viewing programs or custom experiment applications that access data streams in real time.
|
|
9
|
+
*
|
|
10
|
+
* The API covers two areas:
|
|
11
|
+
* - The "push API" allows to create stream outlets and to push data (regular or irregular
|
|
12
|
+
* measurement time series, event data, coded audio/video frames, etc.) into them.
|
|
13
|
+
* - The "pull API" allows to create stream inlets and read time-synched experiment data from them
|
|
14
|
+
* (for recording, viewing or experiment control).
|
|
15
|
+
*
|
|
16
|
+
* To use this library you need to link to the liblsl library that comes with
|
|
17
|
+
* this header. Under Visual Studio the library is linked in automatically.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#ifdef __cplusplus
|
|
21
|
+
extern "C" {
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
#include "lsl/common.h"
|
|
25
|
+
#include "lsl/inlet.h"
|
|
26
|
+
#include "lsl/outlet.h"
|
|
27
|
+
#include "lsl/resolver.h"
|
|
28
|
+
#include "lsl/streaminfo.h"
|
|
29
|
+
#include "lsl/types.h"
|
|
30
|
+
#include "lsl/xml.h"
|
|
31
|
+
|
|
32
|
+
#ifdef __cplusplus
|
|
33
|
+
} /* end extern "C" */
|
|
34
|
+
#endif
|
|
35
|
+
|
|
36
|
+
#endif
|