.\"Copyright 2010 (c) EPFL .TH EGD_ACQ_SETUP 3 2010 "EPFL" "EEGDEV library manual" .SH NAME egd_acq_setup - specify which and how channel data should be obtained .SH SYNOPSIS .LP .B #include .sp .BI "int egd_acq_setup(struct eegdev* " dev "," .br .BI " unsigned int " narr ", const size_t *" strides "," .br .BI " unsigned int " ngrp ", const struct grpconf *" grp ");" .br .SH DESCRIPTION .LP \fBegd_acq_setup\fP() configures the way data is provided by the device referenced by \fIdev\fP for the next calls to \fBegd_get_data\fP(3). .LP The \fInarr\fP argument specifies the number of buffers that will be supplied in the argument list of \fBegd_get_data\fP(3). \fIstrides\fP should points to an array of \fInarr\fP values specifying respectively for each buffers its stride, i.e. the size in bytes between the data of two successive samples in this buffer. .LP The channels data that must be returns in those buffers are defined by \fIngrp\fP groups of consecutive channels. The groups definition are passed by \fIgrp\fP which points to an array of \fIngrp\fP structures, defined as follows: .sp .in +4n .nf struct grpconf { unsigned int sensortype; /* type of channel */ unsigned int index; /* index of the first channel */ unsigned int nch; /* number of channels */ unsigned int iarray; /* index of the array */ unsigned int arr_offset; /* offset in the array */ unsigned int datatype; /* type in the array */ }; .fi .in .LP The different fields in the structure defines the properties of the group: .LP .IP " *" 3 \fIsensortype\fP specifies the type of channel. it must one of the following values returned by \fBegd_sensor_type\fP(3). .LP .IP " *" 3 \fIindex\fP indicates the index of the first channel in the group. Note that channel index i refers the i-th channel of the type specified previously, i.e. the channel index i refers to two differents channels if \fIsensortype\fP differs. .LP .IP " *" 3 \fInch\fP specifies the number of consecutive channels that should be in the group. .LP .IP " *" 3 \fIiarray\fP indicates which buffer the data of the channel group must be written to. .LP .IP " *" 3 \fIarr_offset\fP defines the offset of the memory location of the data in the buffers relatively to the beginning of each sample. .LP .IP " *" 3 \fIdatatype\fP specifies the type of data that must be written to the buffer. It must be one of the following value: \fBEGD_INT32\fP, \fBEGD_FLOAT\fP or \fBEGD_DOUBLE\fP .SH "RETURN VALUE" .LP The function returns 0 in case of succes. Otherwise, \-1 is returned and \fIerrno\fP is set accordingly. .SH ERRORS .LP \fBegd_acq_setup\fP() will fail if: .TP .B EINVAL \fIdev\fP is NULL. .TP .B EPERM The acquisition is running .SH THREAD SAFETY .LP \fBegd_acq_setup\fP() is thread-safe. .SH EXAMPLE .LP See \fBegd_get_data\fP(3) for a example .SH "SEE ALSO" .BR egd_get_data (3), .BR egd_start (3), .BR egd_sensor_type (3)