| XDF_SET_CHCONF(3) | xdffileio library manual | XDF_SET_CHCONF(3) |
xdf_set_chconf, xdf_get_chconf - set or get the configuration of a channel descriptor handle
#include <xdfio.h>
int xdf_set_chconf(struct xdfch* ch, enum
xdffield field, ...);
int xdf_get_chconf(const struct xdfch* ch, enum xdffield
field, ...);
xdf_set_chconf() sets the configuration of the channel referenced by ch according to the variable list of argument. This list is composed of successive couple grouping one variable of type enum xdffield defining the feature to be set and a value whose type depends on the previous field type. The list must finish by XDF_NOF.
xdf_get_chconf() gets the configuration of the channel referenced by ch according to the variable list of argument. The variable list is the same list terminated by XDF_NOF as for xdf_set_chconf() excepting that the second part of the couple is not that value but a pointer to the value.
Both functions process the argument list from left to right. This means that if a particular field request provokes an error, none of the field requests on its right will be processed. The order of processing is also important for field requests that influences the value of other fields (like XDF_CF_STOTYPE).
Here is the list of admissible value. The expected type of value is provided in the parenthesis (the expected type of the value for xdf_set_chconf(), or a pointer to this type for xdf_get_chconf()). The default value of each field is provided in squared 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 default are meaningful only for the fields XDF_CF_ARR*). If a list of data formats is specified in curl brackets, it means that the field is supported only in those formats (no list means that all formats support the field):
The two functions returns 0 in case of success. Otherwise -1 is returned and errno is set appropriately.
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);
xdf_copy_chconf(3)
| 2010 | EPFL |