SYNOPSIS

#include <xdfio.h>

int xdf_set_conf(struct xdf* xdf, enum xdffield field, ...);

int xdf_get_conf(const struct xdf* xdf, enum xdffield field, ...);

DESCRIPTION

xdf_set_conf() sets the configuration (usually one of the field file header) of a xDF file referenced by xdf according to the variable list of arguments. 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_conf() gets the configuration of the channel referenced by xdf according to the variable list of argument. The variable list is the same list terminated by XDF_NOF as for xdf_set_conf() 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_F_REC_NSAMPLE or XDF_F_SAMPLING_FREQ).

The functions accepts two types of field value. The first one are file configuration field (XDF_F_*) which set different aspects of the general configuration of the file. The second type are the channel configuration fields (XDF_CF_*). When used in xdf_set_conf(), those fields set the default values that will be used for the creation of the next channel (see xdf_add_channel(3)). The list of channel configuration fields and their meaning are specified in the documentation of xdf_set_chconf(3).

If the file is opened for writing, each field is initialized to sensible or non-informative values in case of optional field or incorrect values in the case of "must be set" field (only XDF_F_REC_NSAMPLE or XDF_F_SAMPLING_FREQ). The default value are specified in squared bracked in the list.

Here is the list of file configuration field value. The type of value expected is provided in the parenthesis (the expected type of the value for xdf_set_conf(), or a pointer to this type for xdf_get_conf()). 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):

XDF_F_REC_DURATION (double) [1]

Specify the duration of one record. The value should be positive.

XDF_F_REC_NSAMPLE (int) [0]

Specify the number of time points contained in each record. The value should be positive. Setting the number of sample per record modifies the sampling frequency (field XDF_SAMPLING_FREQ).

XDF_F_SAMPLING_FREQ (int) [0]

Get or set the sampling frequency of the recording. Setting the sampling frequency modifies the number of sample per record (field XDF_F_REC_NSAMPLE).

XDF_F_NCHANNEL (int) (get function only)

Get the number of channel in the file.

XDF_F_NEVTTYPE (int) (get function only)

Get the number of different event types.

XDF_F_NEVENT (int) (get function only)

Get the number of events.

XDF_F_FILEFMT (int) (get function only)

Get the file format type (one of the value defined by the enumeration xdffiletype other than XDF_ANY)

XDF_F_RECTIME (double) [current time] {EDF BDF GDF}

Date and time of recording. It is expressed as number of seconds elapsed since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). This number is the convertion to double of the value returned by the function time(3) of the standard C library. On file creation, this field is initialized to the current time.

XDF_F_SUBJ_DESC (const char*) [""] {EDF BDF GDF}

Specify the string describing the subject.

XDF_F_SESS_DESC (const char*) [""] {EDF BDF GDF}

Specify the string describing the session of recording.

XDF_F_ADDICTION (unsigned int) [0] {GDF}

XDF_F_BIRTHDAY (double) [0] {GDF}

Birthday of the patient using the same format as specified for field XDF_F_RECTIME.

XDF_F_HEIGHT (double) [0] {GDF}

Height of the subject in centimeters.

XDF_F_WEIGHT (double) [0] {GDF}

Weight of the subject in kilograms.

XDF_F_GENDER (unsigned int) [0] {GDF}

Sex of the subject. Use 1 for male, 2 for female and 0 if unknown.

XDF_F_HANDNESS (unsigned int) [0] {GDF}

Handness of the subject. Use 0 if unknown, 1 if right, 2 if left and 3 if ambidextrious.

XDF_F_VISUAL_IMP (unsigned int) [0] {GDF}

Visual impairment. Use 0 if unknown, 1 if no impairment, 2 if impaired and 3 if impaired but corrected.

XDF_F_HEART_IMP (unsigned int) [0] {GDF}

Heart impairment. Use 0 if unknown, 1 if no impairment, 2 if impaired and 3 if the subject wear a pacemaker.

XDF_F_LOCATION (double[3]) [0,0,0] {GDF}

Location of the recording. The first 2 component specify the latitude and longitude in degrees, the third specifies the altitude in meters.

XDF_F_ICD_CLASS (char[6]) [0x000000000000] {GDF}

Patient classification according to the International Statistical Classification of Diseases and Related Health Problems (ICD).

XDF_F_HEADSIZE (double[3]) [0,0,0] {GDF}

Size of the subject's head (circumference, distance nasion – inion, left to right mastoid) expressed in millimeters.

XDF_F_REF_POS (double[3]) [0,0,0] {GDF}

X, Y, Z coordinates of the reference electrode.

XDF_F_GND_POS (double[3]) [0,0,0] {GDF}

X, Y, Z coordinates of the ground electrode.

RETURN VALUE

The two functions returns 0 in case of success. Otherwise -1 is returned and errno is set appropriately.

ERROR

EINVAL

xdf is NULL or field is not a proper value of the enumeration xdffield accepted by the function (for example XDF_F_NCHANNEL and xdf_set_conf() )

EPERM

The request submitted to xdf_set_conf() is not allowed for this type of xDF file or is not supported with the mode XDF_READ.

EXAMPLES

Example of usage of xdf_set_conf() and xdf_get_conf():


/* Assume xdfr and xdfw reference 2 XDF files opened respectively
 * for reading and for writing */
const char *subjstr, *sessstr;

xdf_get_conf(xdfr, XDF_F_SUBJ_DESC, &subjstr,
                   XDF_F_SESS_DESC, &sessstr,
                   XDF_NOF);

printf("subject: %s\nrecording: %s\n", subjstr, sessstr);

xdf_set_conf(xdfw, XDF_F_SUBJ_DESC, subjstr,
                   XDF_F_SESS_DESC, sessstr,
                   XDF_NOF);

RELATED TO xdf_get_conf…