Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

openedf.c File Reference

#include <assert.h>
#include <time.h>
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stddef.h>
#include <openedf.h>
#include <unistd.h>
#include <edfmacros.h>
#include <nsutil.h>

Go to the source code of this file.

Defines

#define MAXERRORLEN   1024

Functions

void setLastError (const char *fmt,...)
int EDFUnpackInt (const char *inp, int fieldLen)
double EDFUnpackDouble (const char *inp, int fieldLen)
const char * EDFUnpackString (const char *inp, int fieldLen)
void storeEDFString (char *packet, size_t memsize, const char *str)
void storeEDFDouble (char *packet, size_t memsize, double d)
void storeEDFInt (char *packet, size_t memsize, int i)
int EDFEncodePacket (char *packet, const struct EDFDecodedConfig *cfg)
void EDFDecodeChannelHeader (struct EDFDecodedChannelHeader *result, const char *packet, int whichChannel, int totalChannels)
void EDFDecodeHeaderPreamble (struct EDFDecodedHeader *result, const char *packet)
int readEDFString (struct EDFDecodedConfig *cfg, const char *buf, int len)
int writeEDFString (const struct EDFDecodedConfig *cfg, char *buf, int *buflen)
int writeEDF (int fd, const struct EDFDecodedConfig *cfg)
int setEDFHeaderBytes (struct EDFDecodedConfig *cfg)
int readEDF (int fd, struct EDFDecodedConfig *cfg)
double getSecondsPerSample (const struct EDFDecodedConfig *cfg, int whichChan)
double getSamplesPerSecond (const struct EDFDecodedConfig *cfg, int whichChan)
int getDataRecordChunkSize (const struct EDFDecodedConfig *cfg)
EDFInputIteratornewEDFInputIterator (const struct EDFDecodedConfig *cfg)
void freeEDFInputIterator (struct EDFInputIterator *edfi)
int stepEDFInputIterator (struct EDFInputIterator *edfi)
int readDataRecord (const struct EDFInputIterator *edfi, FILE *fp)
int fetchSamples (const struct EDFInputIterator *edfi, short *samples, FILE *fp)
int isValidREDF (const struct EDFDecodedConfig *cfg)
const char * getDMY (void)
const char * getHMS (void)
int makeREDFConfig (struct EDFDecodedConfig *result, const struct EDFDecodedConfig *source)
const char * getLastError (void)


Define Documentation

#define MAXERRORLEN   1024
 

Definition at line 38 of file openedf.c.

Referenced by setLastError().


Function Documentation

void EDFDecodeChannelHeader struct EDFDecodedChannelHeader result,
const char *  packet,
int  whichChannel,
int  totalChannels
 

Definition at line 116 of file openedf.c.

References LOADCFD, LOADCFI, LOADCFS, and sampleCount.

Referenced by readEDF(), and readEDFString().

void EDFDecodeHeaderPreamble struct EDFDecodedHeader result,
const char *  packet
 

Definition at line 131 of file openedf.c.

References LOADHFD, LOADHFI, and LOADHFS.

Referenced by readEDF(), and readEDFString().

int EDFEncodePacket char *  packet,
const struct EDFDecodedConfig cfg
 

Definition at line 86 of file openedf.c.

References cfg, EDFDecodedConfig::chan, EDFDecodedHeader::dataFormat, EDFDecodedHeader::dataRecordChannels, EDFDecodedHeader::dataRecordCount, EDFDecodedHeader::dataRecordSeconds, EDFDecodedChannelHeader::digiMax, EDFDecodedChannelHeader::digiMin, EDFDecodedChannelHeader::dimUnit, EDFDecodedConfig::hdr, EDFDecodedHeader::headerRecordBytes, EDFDecodedChannelHeader::label, EDFDecodedHeader::localPatient, EDFDecodedHeader::localRecorder, EDFDecodedHeader::manufacturerID, EDFDecodedChannelHeader::physMax, EDFDecodedChannelHeader::physMin, EDFDecodedChannelHeader::prefiltering, EDFDecodedHeader::recordingStartDate, EDFDecodedHeader::recordingStartTime, EDFDecodedChannelHeader::reserved, sampleCount, EDFDecodedChannelHeader::sampleCount, STORECFD, STORECFI, STORECFS, STOREHFD, STOREHFI, STOREHFS, and EDFDecodedChannelHeader::transducer.

Referenced by writeEDF(), and writeEDFString().

double EDFUnpackDouble const char *  inp,
int  fieldLen
 

Definition at line 49 of file openedf.c.

References EDFUnpackString().

int EDFUnpackInt const char *  inp,
int  fieldLen
 

Definition at line 44 of file openedf.c.

References EDFUnpackString().

const char* EDFUnpackString const char *  inp,
int  fieldLen
 

Definition at line 54 of file openedf.c.

Referenced by EDFUnpackDouble(), and EDFUnpackInt().

int fetchSamples const struct EDFInputIterator edfi,
short *  samples,
FILE *  fp
 

Definition at line 294 of file openedf.c.

References BYTESPERSAMPLE, EDFInputIterator::cfg, EDFDecodedConfig::chan, EDFInputIterator::dataRecord, EDFDecodedHeader::dataRecordChannels, EDFDecodedConfig::hdr, readDataRecord(), sampleCount, EDFDecodedChannelHeader::sampleCount, EDFInputIterator::sampleNum, and samples.

Referenced by main().

void freeEDFInputIterator struct EDFInputIterator edfi  ) 
 

Definition at line 261 of file openedf.c.

References EDFInputIterator::dataRecord.

Referenced by main().

int getDataRecordChunkSize const struct EDFDecodedConfig cfg  ) 
 

Definition at line 240 of file openedf.c.

References BYTESPERSAMPLE, cfg, EDFDecodedConfig::chan, EDFDecodedHeader::dataRecordChannels, EDFDecodedConfig::hdr, and EDFDecodedChannelHeader::sampleCount.

Referenced by main(), newEDFInputIterator(), and readDataRecord().

const char* getDMY void   ) 
 

Definition at line 338 of file openedf.c.

References buf.

Referenced by main(), and makeREDFConfig().

const char* getHMS void   ) 
 

Definition at line 349 of file openedf.c.

References buf.

Referenced by main(), and makeREDFConfig().

const char* getLastError void   ) 
 

Definition at line 387 of file openedf.c.

double getSamplesPerSecond const struct EDFDecodedConfig cfg,
int  whichChan
 

Definition at line 235 of file openedf.c.

References cfg, EDFDecodedConfig::chan, EDFDecodedHeader::dataRecordSeconds, EDFDecodedConfig::hdr, and EDFDecodedChannelHeader::sampleCount.

Referenced by main().

double getSecondsPerSample const struct EDFDecodedConfig cfg,
int  whichChan
 

Definition at line 230 of file openedf.c.

References cfg, EDFDecodedConfig::chan, EDFDecodedHeader::dataRecordSeconds, EDFDecodedConfig::hdr, and EDFDecodedChannelHeader::sampleCount.

int isValidREDF const struct EDFDecodedConfig cfg  ) 
 

Definition at line 312 of file openedf.c.

References cfg, EDFDecodedConfig::chan, EDFDecodedHeader::dataRecordChannels, EDFDecodedConfig::hdr, EDFDecodedChannelHeader::sampleCount, and setLastError().

Referenced by makeREDFConfig().

int makeREDFConfig struct EDFDecodedConfig result,
const struct EDFDecodedConfig source
 

Definition at line 367 of file openedf.c.

References getDMY(), getHMS(), EDFDecodedConfig::hdr, isValidREDF(), EDFDecodedHeader::recordingStartDate, EDFDecodedHeader::recordingStartTime, and setEDFHeaderBytes().

Referenced by cmdSetHeader(), and main().

struct EDFInputIterator* newEDFInputIterator const struct EDFDecodedConfig cfg  ) 
 

Definition at line 248 of file openedf.c.

References cfg, and getDataRecordChunkSize().

Referenced by main().

int readDataRecord const struct EDFInputIterator edfi,
FILE *  fp
 

Definition at line 279 of file openedf.c.

References EDFInputIterator::cfg, EDFInputIterator::dataRecord, EDFInputIterator::dataRecordNum, getDataRecordChunkSize(), EDFDecodedConfig::hdr, and EDFDecodedHeader::headerRecordBytes.

Referenced by fetchSamples().

int readEDF int  fd,
struct EDFDecodedConfig cfg
 

Definition at line 204 of file openedf.c.

References cfg, EDFDecodedConfig::chan, EDFDecodedHeader::dataRecordChannels, EDFDecodeChannelHeader(), EDFDecodeHeaderPreamble(), EDFDecodedConfig::hdr, EDFDecodedHeader::headerRecordBytes, MAXCHANNELS, and setEDFHeaderBytes().

Referenced by main().

int readEDFString struct EDFDecodedConfig cfg,
const char *  buf,
int  len
 

Definition at line 145 of file openedf.c.

References buf, cfg, EDFDecodedConfig::chan, EDFDecodedHeader::dataRecordChannels, EDFDecodeChannelHeader(), EDFDecodeHeaderPreamble(), EDFDecodedConfig::hdr, EDFDecodedHeader::headerRecordBytes, MAXCHANNELS, rprintf(), and setEDFHeaderBytes().

Referenced by cmdSetHeader(), and main().

int setEDFHeaderBytes struct EDFDecodedConfig cfg  ) 
 

Definition at line 198 of file openedf.c.

References cfg, EDFDecodedHeader::dataRecordChannels, EDFDecodedConfig::hdr, and EDFDecodedHeader::headerRecordBytes.

Referenced by main(), makeREDFConfig(), readEDF(), and readEDFString().

void setLastError const char *  fmt,
... 
 

Definition at line 392 of file openedf.c.

References MAXERRORLEN.

Referenced by isValidREDF().

int stepEDFInputIterator struct EDFInputIterator edfi  ) 
 

Definition at line 268 of file openedf.c.

References EDFInputIterator::cfg, EDFDecodedConfig::chan, EDFInputIterator::dataRecordNum, EDFDecodedChannelHeader::sampleCount, and EDFInputIterator::sampleNum.

Referenced by main().

void storeEDFDouble char *  packet,
size_t  memsize,
double  d
 

Definition at line 72 of file openedf.c.

References buf, and storeEDFString().

void storeEDFInt char *  packet,
size_t  memsize,
int  i
 

Definition at line 79 of file openedf.c.

References buf, and storeEDFString().

void storeEDFString char *  packet,
size_t  memsize,
const char *  str
 

Definition at line 62 of file openedf.c.

References buf.

Referenced by storeEDFDouble(), and storeEDFInt().

int writeEDF int  fd,
const struct EDFDecodedConfig cfg
 

Definition at line 184 of file openedf.c.

References cfg, EDFEncodePacket(), EDFDecodedConfig::hdr, EDFDecodedHeader::headerRecordBytes, and MAXCHANNELS.

Referenced by main().

int writeEDFString const struct EDFDecodedConfig cfg,
char *  buf,
int *  buflen
 

Definition at line 167 of file openedf.c.

References buf, cfg, EDFEncodePacket(), EDFDecodedConfig::hdr, EDFDecodedHeader::headerRecordBytes, and MAXCHANNELS.

Referenced by cmdSetHeader(), and main().


Generated on Tue Feb 8 00:05:19 2005 for Neuroserver by doxygen 1.3.3