Esempio n. 1
0
static
int print_cap(struct eegdev* dev)
{
	unsigned int sampling_freq, eeg_nmax, sensor_nmax, trigger_nmax;
	char *device_type, *device_id;
	char prefiltering[128];
	int retval;

	egd_get_cap(dev, EGD_CAP_DEVTYPE, &device_type);
	egd_get_cap(dev, EGD_CAP_DEVID, &device_id);
	egd_get_cap(dev, EGD_CAP_FS, &sampling_freq);
	eeg_nmax = egd_get_numch(dev, egd_sensor_type("eeg"));
	sensor_nmax = egd_get_numch(dev, egd_sensor_type("undefined"));
	trigger_nmax = egd_get_numch(dev, egd_sensor_type("trigger"));
	egd_channel_info(dev, egd_sensor_type("eeg"), 0,
				EGD_PREFILTERING, prefiltering, EGD_EOL);
	retval = (int)sampling_freq;

	if (!verbose)
		return retval;

	printf("\tVersion : %s\n"
	       "\tsystem capabilities:\n"
	       "\t\tdevice type: %s\n"
	       "\t\tdevice model: %s\n"
	       "\t\tsampling frequency: %u Hz\n"
	       "\t\tnum EEG channels: %u\n"
	       "\t\tnum sensor channels: %u\n"
	       "\t\tnum trigger channels: %u\n"
	       "\t\tprefiltering: %s\n",
	       egd_get_string(),
	       device_type, device_id, sampling_freq,
	       eeg_nmax, sensor_nmax, trigger_nmax, prefiltering);

	return retval;
}
Esempio n. 2
0
int acq_get_info(struct acq* acq, int type)
{
	int retval;

	if (!acq)
		return -EINVAL;

	if (type == ACQ_FS)
		retval = egd_get_cap(acq->dev, EGD_CAP_FS, NULL);
	else if (type == ACQ_NEEG)
		retval = acq->grp[0].nch;
	else if (type == ACQ_NSENS)
		retval = acq->grp[1].nch;
	else if (type == ACQ_NTRI)
		retval = acq->grp[2].nch;
	else
		retval = -EINVAL;
	
	return retval;
}
Esempio n. 3
0
int acq_prepare_rec(struct acq* acq, const char* filename)
{
	struct xdf* xdf;
	int j, fs;

	if (!acq || !filename)
		return 0;

	// Create the BDF file
	xdf = xdf_open(filename, XDF_WRITE, XDF_BDF);
	if (!xdf) 
		goto abort;

	// Configuration file general header
	fs = egd_get_cap(acq->dev, EGD_CAP_FS, NULL);
	xdf_set_conf(xdf, XDF_F_REC_DURATION, 1.0,
	                  XDF_F_REC_NSAMPLE, fs,
		          XDF_NOF);

	// Set up the file recording channels
	for (j=0; j<3; j++)	
		if (setup_xdf_channel_group(acq, j, xdf))
			goto abort;

	// Make the file ready for recording
	xdf_define_arrays(xdf, 3, acq->strides);
	if (xdf_prepare_transfer(xdf))
		goto abort;

	acq->xdf = xdf;
	return 0;
	
abort:
	fprintf(stderr, "Preparing recording file: %s\n", strerror(errno));
	xdf_close(xdf);
	return -1;
}