1XDF_SET_CHCONF(3) xdffileio library manual XDF_SET_CHCONF(3)
2
3
4
6 xdf_set_chconf, xdf_get_chconf - set or get the configuration of a
7 channel descriptor handle
8
10 #include <xdfio.h>
11
12 int xdf_set_chconf(struct xdfch* ch, enum xdffield field, ...);
13 int xdf_get_chconf(const struct xdfch* ch, enum xdffield field, ...);
14
16 xdf_set_chconf() sets the configuration of the channel referenced by ch
17 according to the variable list of argument. This list is composed of
18 successive couple grouping one variable of type enum xdffield defining
19 the feature to be set and a value whose type depends on the previous
20 field type. The list must finish by XDF_NOF.
21
22 xdf_get_chconf() gets the configuration of the channel referenced by ch
23 according to the variable list of argument. The variable list is the
24 same list terminated by XDF_NOF as for xdf_set_chconf() excepting that
25 the second part of the couple is not that value but a pointer to the
26 value.
27
28 Both functions process the argument list from left to right. This means
29 that if a particular field request provokes an error, none of the field
30 requests on its right will be processed. The order of processing is
31 also important for field requests that influences the value of other
32 fields (like XDF_CF_STOTYPE).
33
34 Here is the list of admissible value. The expected type of value is
35 provided in the parenthesis (the expected type of the value for
36 xdf_set_chconf(), or a pointer to this type for xdf_get_chconf()). The
37 default value of each field is provided in squared brackets (however
38 these defaults can be overridden by a call to xdf_set_conf(3) if the
39 file is open for writing. If the file is opened for reading, the
40 default are meaningful only for the fields XDF_CF_ARR*). If a list of
41 data formats is specified in curl brackets, it means that the field is
42 supported only in those formats (no list means that all formats support
43 the field):
44
45 XDF_CF_ARRINDEX (int) [0]
46 Specify the array from/to which the channel value should be
47 transfered. If the mode of the file is XDF_READ and the value is
48 negative, the channel will not be read. If the mode is XDF_WRITE
49 and the value is negative, the function will fail.
50
51 XDF_CF_ARROFFSET (int) [0 for channel 0, packed channels for the rest]
52 Specify the offset in the array from/to which the channel value
53 should be transfered.
54
55 XDF_CF_ARRDIGITAL (int) [0 if writing, 1 if reading]
56 Indicate that the data in the array from/to which the channel
57 value should be transfered is provided in digital unit. This
58 means in practice that no scaling is performed during the trans‐
59 fer from/to the disk (non zero indicate no scaling).
60
61 XDF_CF_ARRTYPE (enum xdftype) [same as XDF_CF_STOTYPE]
62 specify the type in the channel should casted to/from when
63 accessed in the array.
64
65 XDF_CF_PMIN (double) [min of XDF_CF_ARRTYPE]
66 Set/get the minimal value that a physical value can get. Cannot
67 be set if XDF_READ.
68
69 XDF_CF_PMAX (double) [max of XDF_CF_ARRTYPE]
70 Set/get the maximal value that a physical value can get. Cannot
71 be set if XDF_READ.
72
73 XDF_CF_STOTYPE (enum xdftype) [any datatype supported by file type]
74 Specify the type stored in the file of the channel value. If the
75 XDF file has been opened in XDF_READ, this field cannot be set.
76 If this field is successfully set, it will set as well the digi‐
77 tal minimum (XDF_CF_DMIN) and the digital maximum (XDF_CF_MAX)
78 to the minimum and maximum values allowed by the data type.
79
80 XDF_CF_DMIN (double) [min of XDF_CF_STOTYPE]
81 Set/get the minimal value that a digital value can get. Cannot
82 be set if XDF_READ. This is also automatically set by
83 XDF_CF_STOTYPE.
84
85 XDF_CF_DMAX (double) [min of XDF_CF_STOTYPE]
86 Set/get the maximal value that a digital value can get. Cannot
87 be set if XDF_READ. This is also automatically set by
88 XDF_CF_STOTYPE.
89
90 XDF_CF_LABEL (const char*) [""]
91 Set/get the label of the channel. Cannot be set if XDF_READ.
92
93 XDF_CF_UNIT (const char*) [""] {EDF BDF GDF}
94 Set/get the unit of the channel. Cannot be set if XDF_READ.
95
96 XDF_CF_TRANSDUCTER (const char*) [""] {EDF BDF GDF}
97 Set/get the type of sensor used for this channel. Cannot be set
98 if XDF_READ.
99
100 XDF_CF_PREFILTERING (const char*) [""] {EDF BDF GDF}
101 Set/get the information about the filters already applied on
102 channel data. Cannot be set if XDF_READ.
103
104 XDF_CF_ELECPOS (double[3]) [0,0,0] {GDF}
105 Position of the sensor/electrode expressed in X,Y,Z components
106 Cannot be set if XDF_READ.
107
108 XDF_CF_IMPEDANCE (double) [0] {GDF}
109 Impedance of the sensor/electrode. Cannot be set if XDF_READ.
110
112 The two functions returns 0 in case of success. Otherwise -1 is
113 returned and errno is set appropriately.
114
116 EINVAL ch is NULL or field is not a proper value of the enumeration
117 xdffield
118
119 EPERM The request submitted to xdf_set_chconf() is not allowed for
120 this channel or is forbidden for file opened with the mode
121 XDF_READ.
122
123 EDOM The value set in xdf_set_chconf() as digital or physical min/max
124 (fields XDF_CF_{D/P}{MIN/MAX}) goes beyond the limits of respec‐
125 tively the stored or array data type.
126
128 Example of usage of xdf_set_chconf():
129
130 /* Assume xdf referenced an XDF file opened for writing */
131 unsigned int iarray = 2, offset = 0;
132 const char label[] = "Channel EEG";
133
134 hchxdf ch = xdf_add_channel(xdf);
135 xdf_set_chconf(ch, XDF_CF_ARRINDEX, iarray,
136 XDF_CF_ARROFFSET, offset,
137 XDF_CF_LABEL, label,
138 XDF_NOF);
139
140 Example of usage of xdf_get_chconf():
141
142 /* Assume xdf referenced an XDF file opened for reading */
143 unsigned int iarray, offset;
144 const char label[128];
145
146 hchxdf ch = xdf_get_channel(xdf, 1);
147 xdf_get_chconf(ch, XDF_CF_ARRINDEX, &iarray,
148 XDF_CF_ARROFFSET, &offset,
149 XDF_CF_LABEL, &label,
150 XDF_NOF);
151
152 printf("iarray = %u\n", iarray);
153 printf("offset = %u\n", offset);
154 printf("label = %s\n", label);
155
156
158 xdf_copy_chconf(3)
159
160
161
162
163EPFL 2010 XDF_SET_CHCONF(3)