XDF_SET_CHCONF(3)
β¨ XDF_SET_CHCONF(3) β¨
xdffileio library manual π¦ β yes bestie, it's the page for xdf_set_chconf and xdf_get_chconf, aka the two functions that let you set and get the configuration of a channel descriptor handle. let's get into it π
π NAME π
xdf_set_chconf, xdf_get_chconf β set or get the configuration of a channel descriptor handle π
πΈ SYNOPSIS πΈ
#include <xdfio.h>
int xdf_set_chconf(struct xdfch* ch, enum xdffield field, ...);
int xdf_get_chconf(const struct xdfch* ch, enum xdffield field, ...);
π DESCRIPTION π
okay so xdf_set_chconf() sets the configuration of the channel that ch points at, according to the variable list of arguments you hand it. and the way that list works is so specific: it's made of successive couples, and each couple is one variable of type enum xdffield (that's the feature you wanna set) plus a value whose type depends on the field type that came right before it. and bestie, the list must finish with XDF_NOF. no exceptions, that's the vibe check π€
xdf_get_chconf() gets the configuration of the channel referenced by ch, same deal with the variable list β literally the same list terminated by XDF_NOF as for xdf_set_chconf(), except the second part of the couple isn't the value itself, it's a pointer to the value. that's it, that's the difference π«Ά
both functions process the argument list from left to right. which means: if some field request throws an error, none of the field requests to its right get processed. and the order of processing lowkey matters for field requests that influence the value of other fields β like XDF_CF_STOTYPE. so, order = main character energy here π
here's the list of admissible values. the expected type of value is in parentheses (that's the expected type for xdf_set_chconf(), or a pointer to that type for xdf_get_chconf()). the default value of each field is in square brackets β however, these defaults can be overridden by a call to xdf_set_conf(3) if the file is open for writing. if the file is opened for reading, the defaults are meaningful only for the XDF_CF_ARR* fields. and if a list of data formats shows up in curly brackets, that field is supported only in those formats (no list = all formats support it) β¨
π the field menu (every single XDF_CF_*, no skips) π
XDF_CF_ARRINDEX(int) [0] β specify the array from/to which the channel value should be transfered. if the mode of the file isXDF_READand the value is negative, the channel will not be read. if the mode isXDF_WRITEand the value is negative, the function will fail. πXDF_CF_ARROFFSET(int) [0 for channel 0, packed channels for the rest] β specify the offset in the array from/to which the channel value should be transfered.XDF_CF_ARRDIGITAL(int) [0 if writing, 1 if reading] β indicate that the data in the array from/to which the channel value should be transfered is provided in digital unit. in practice this means no scaling is performed during the transfer from/to the disk (non zero indicates no scaling).XDF_CF_ARRTYPE(enum xdftype) [same as XDF_CF_STOTYPE] β specify the type in the channel should casted to/from when accessed in the array.XDF_CF_PMIN(double) [min of XDF_CF_ARRTYPE] β set/get the minimal value that a physical value can get. cannot be set ifXDF_READ.XDF_CF_PMAX(double) [max of XDF_CF_ARRTYPE] β set/get the maximal value that a physical value can get. cannot be set ifXDF_READ.XDF_CF_STOTYPE(enum xdftype) [any datatype supported by file type] β specify the type stored in the file of the channel value. if the XDF file has been opened inXDF_READ, this field cannot be set. and if this field is successfully set, it will set as well the digital minimum (XDF_CF_DMIN) and the digital maximum (XDF_CF_MAX) to the minimum and maximum values allowed by the data type. icon of setting three things at once, honestly πXDF_CF_DMIN(double) [min of XDF_CF_STOTYPE] β set/get the minimal value that a digital value can get. cannot be set ifXDF_READ. this is also automatically set byXDF_CF_STOTYPE.XDF_CF_DMAX(double) [min of XDF_CF_STOTYPE] β set/get the maximal value that a digital value can get. cannot be set ifXDF_READ. this is also automatically set byXDF_CF_STOTYPE.XDF_CF_LABEL(const char*) [""] β set/get the label of the channel. cannot be set ifXDF_READ.XDF_CF_UNIT(const char*) [""] {EDFBDFGDF} β set/get the unit of the channel. cannot be set ifXDF_READ.XDF_CF_TRANSDUCTER(const char*) [""] {EDFBDFGDF} β set/get the type of sensor used for this channel. cannot be set ifXDF_READ.XDF_CF_PREFILTERING(const char*) [""] {EDFBDFGDF} β set/get the information about the filters already applied on channel data. cannot be set ifXDF_READ.XDF_CF_ELECPOS(double[3]) [0,0,0] {GDF} β position of the sensor/electrode expressed in X,Y,Z components. cannot be set ifXDF_READ.XDF_CF_IMPEDANCE(double) [0] {GDF} β impedance of the sensor/electrode. cannot be set ifXDF_READ.
π«Ά RETURN VALUE π«Ά
the two functions return 0 in case of success. otherwise -1 is returned and errno is set appropriately. that's the whole story π
π ERROR π
EINVALβchisNULLorfieldis not a proper value of the enumerationxdffield.EPERMβ the request submitted toxdf_set_chconf()is not allowed for this channel, or is forbidden for a file opened with the modeXDF_READ.EDOMβ the value set inxdf_set_chconf()as digital or physical min/max (fieldsXDF_CF_{D/P}{MIN/MAX}) goes beyond the limits of, respectively, the stored or array data type.
π₯ EXAMPLES π₯
example of usage of xdf_set_chconf():
/* Assume xdf referenced an XDF file opened for writing */
unsigned int iarray = 2, offset = 0;
const char label[] = "Channel EEG";
hchxdf ch = xdf_add_channel(xdf);
xdf_set_chconf(ch, XDF_CF_ARRINDEX, iarray,
XDF_CF_ARROFFSET, offset,
XDF_CF_LABEL, label,
XDF_NOF);
example of usage of xdf_get_chconf():
/* Assume xdf referenced an XDF file opened for reading */
unsigned int iarray, offset;
const char label[128];
hchxdf ch = xdf_get_channel(xdf, 1);
xdf_get_chconf(ch, XDF_CF_ARRINDEX, &iarray,
XDF_CF_ARROFFSET, &offset,
XDF_CF_LABEL, &label,
XDF_NOF);
printf("iarray = %u\n", iarray);
printf("offset = %u\n", offset);
printf("label = %s\n", label);
see how the set one passes the values raw and the get one passes &-pointers? that's the couple rule in action, bestie, no cap π§
π SEE ALSO π
and that's the page!! this one came from the fine folks at EPFL, dated 2010, and it lives in the xdffileio library manual. mwah, slay, go configure some channels π β¨π
π¦ where this page comes from
- debian bookworm: libxdffileio-dev 0.3-4 Β· LGPL-3.0-or-later
- debian trixie: libxdffileio-dev 0.3-4+b2 Β· LGPL-3.0-or-later
- fedora 43: xdffileio-devel 0.3-23.fc43 Β· LGPL-3.0-or-later
- fedora 43: xdffileio-devel 0.3-23.fc43 Β· LGPL-3.0-or-later
- fedora 44: xdffileio-devel 0.3-24.fc44 Β· LGPL-3.0-or-later
- fedora 44: xdffileio-devel 0.3-24.fc44 Β· LGPL-3.0-or-later
- ubuntu jammy: libxdffileio-dev 0.3-4 Β· LGPL-3.0-or-later
- ubuntu noble: libxdffileio-dev 0.3-4ubuntu3 Β· LGPL-3.0-or-later
- ubuntu questing: libxdffileio-dev 0.3-4ubuntu3
- ubuntu resolute: libxdffileio-dev 0.3-4ubuntu4 Β· LGPL-3.0-or-later
- ubuntu stonking: libxdffileio-dev 0.3-4ubuntu4 Β· LGPL-3.0-or-later
- Copyright 2010 (c) EPFL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms