#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <nsnet.h>
#include <nsutil.h>
#include <nsser.h>
#include <openedf.h>
#include <config.h>
Go to the source code of this file.
Defines | |
#define | PROTOWINDOW 12 |
neuroserver network support neuroserver serial port support european data format support (e.g. header structures) release number support size of a serial packet | |
#define | MINGOOD 6 |
Functions | |
int | isValidPacket (unsigned short nchan, long *samples) |
checks data packet for validity (range) | |
int | doesMatchOpenCNV (unsigned char c, long *vals) |
function for frame decoding | |
int | mGetOK (sock_t fd, struct InputBuffer *ib) |
get neuroserver response | |
void | eatCharacter (unsigned char c) |
this function does the real data processing of serial input data | |
void | handleSamples (int packetCounter, int chan, long *vals) |
sends sample values to the nsd daemon. | |
void | printHelp () |
prints command line options / brief description of the program | |
void | decodeCommand (char command[MAXLEN], ser_t serport) |
int | main (int argc, char **argv) |
Variables | |
char | buf [PROTOWINDOW] |
serial port input buffer | |
sock_t | sock_fd |
handler for network socket | |
int | bufCount |
int | hasMatchedProtocol |
protocol detection | |
int | isOpenCNV |
eeg device detection | |
int | isPseudoEDF |
if the -m switch is set, isPseudoEDF is set to 1 and 24bit data is splitted into 2 16bit channels |
Definition in file opencnvdriver.c.
|
|
|
neuroserver network support neuroserver serial port support european data format support (e.g. header structures) release number support size of a serial packet
Definition at line 48 of file opencnvdriver.c. |
|
Definition at line 314 of file opencnvdriver.c. References rprintf(), and writeSerial(). Referenced by main(). |
|
function for frame decoding state machine for serial protocol decoding, get's called with every new character that has been received returns 1 if everything is fine, 0 if there has been some problem (e.g. data lost, frame not aligned right) < don't check ADC Ch1 status < don't check ADC Ch2 status < get stimulus value Definition at line 233 of file opencnvdriver.c. References handleSamples(), PROTOWINDOW, rexit(), and rprintf(). Referenced by eatCharacter(). |
|
this function does the real data processing of serial input data number of frames until protocol is locked in place to store eeg data has the protocol been detected and validated ? not yet, or error previously now it detected the frame, from now on the protocol is fixed check packet for validity ok, didmatch is 0, so it didn't match so far Definition at line 146 of file opencnvdriver.c. References doesMatchOpenCNV(), hasMatchedProtocol, MAXCHANNELS, PROTOWINDOW, and rprintf(). Referenced by main(). |
|
sends sample values to the nsd daemon. chan Samples, stored in the long array *vals, will be send. The packetCounter information can be used by the application software to check for lost packets. < network socket buffer Definition at line 210 of file opencnvdriver.c. References buf, ib, MAXLEN, mGetOK(), sock_fd, and writeString(). |
|
checks data packet for validity (range)
Definition at line 133 of file opencnvdriver.c. Referenced by eatCharacter(). |
|
DEFAULTHOST DEFAULTPORT now start talking with the nsd send header process serial port input data code to get commands from server Definition at line 339 of file opencnvdriver.c. References EDFDecodedConfig::chan, current, EDFDecodedHeader::dataRecordSeconds, decodeCommand(), DEFAULTDEVICE, DEFAULTHOST, DEFAULTPORT, eatCharacter(), EDFPacket, getDMY(), getHMS(), EDFDecodedConfig::hdr, ib, isEOF(), isPseudoEDF, max_fd, MAXHEADERLEN, MAXLEN, mGetOK(), my_read(), openSerialPort(), OSTYPESTR, printHelp(), PROTOWINDOW, rconnectName(), InputBuffer::read_buf, InputBuffer::read_cnt, readSerial(), EDFDecodedHeader::recordingStartDate, EDFDecodedHeader::recordingStartTime, rexit(), rinitNetworking(), rprintf(), rselect_timed(), rsocket(), EDFDecodedChannelHeader::sampleCount, ser_t, setblocking(), setEDFHeaderBytes(), sock_fd, updateMaxFd(), writeBytes(), writeEDFString(), and writeString(). |
|
get neuroserver response
Referenced by handleSamples(), and main(). |
|
prints command line options / brief description of the program
Definition at line 301 of file opencnvdriver.c. References DEFAULTDEVICE, DEFAULTHOST, DEFAULTPORT, and rprintf(). |
|
serial port input buffer
Definition at line 52 of file opencnvdriver.c. |
|
Definition at line 55 of file opencnvdriver.c. |
|
protocol detection
Definition at line 62 of file opencnvdriver.c. |
|
eeg device detection
Definition at line 64 of file opencnvdriver.c. |
|
if the -m switch is set, isPseudoEDF is set to 1 and 24bit data is splitted into 2 16bit channels
Definition at line 66 of file opencnvdriver.c. Referenced by main(). |
|
handler for network socket
Definition at line 54 of file opencnvdriver.c. |