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

main.c File Reference

#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <openedf.h>
#include <sys/time.h>
#include <pctimer.h>
#include <ctype.h>
#include <nsutil.h>
#include <nsnet.h>
#include <gtk/gtk.h>

Go to the source code of this file.

Data Structures

struct  Options
 Command line options will be decoded into this structure. More...


Defines

#define MINLINELENGTH   4
#define DELIMS   " \r\n"
#define VIEWWIDTH   768
#define VIEWHEIGHT   128
#define TOPMARGIN   80
#define MARGIN   160
#define DRAWINGAREAHEIGHT   (TOPMARGIN + VIEWHEIGHT*2 + MARGIN)
#define UPDATEINTERVAL   64

Functions

void idleHandler (void)
void initGTKSystem (void)
int isANumber (const char *str)
 check, if data is a number

void serverDied (void)
 action to take if server died

int main (int argc, char **argv)
void handleSample (int channel, int val)
gboolean readHandler (GIOChannel *source, GIOCondition cond, gpointer data)

Variables

sock_t sock_fd
char EDFPacket [MAXHEADERLEN]
GIOChannel * neuroserver
const char * helpText
InputBuffer ib
char lineBuf [MAXLEN]
int linePos = 0
Options opts
GtkWidget * window
GtkWidget * onscreen
GdkPixmap * offscreen = NULL


Define Documentation

#define DELIMS   " \r\n"
 

Definition at line 53 of file main.c.

Referenced by idleHandler(), and main().

#define DRAWINGAREAHEIGHT   (TOPMARGIN + VIEWHEIGHT*2 + MARGIN)
 

Definition at line 172 of file main.c.

Referenced by initGTKSystem().

#define MARGIN   160
 

Definition at line 170 of file main.c.

#define MINLINELENGTH   4
 

Definition at line 52 of file main.c.

Referenced by idleHandler(), and main().

#define TOPMARGIN   80
 

Definition at line 169 of file main.c.

#define UPDATEINTERVAL   64
 

Definition at line 174 of file main.c.

Referenced by handleSample().

#define VIEWHEIGHT   128
 

Definition at line 168 of file main.c.

#define VIEWWIDTH   768
 

Definition at line 167 of file main.c.

Referenced by handleSample(), and initGTKSystem().


Function Documentation

void handleSample int  channel,
int  val
 

Definition at line 183 of file main.c.

References onscreen, UPDATEINTERVAL, and VIEWWIDTH.

Referenced by idleHandler().

void idleHandler void   ) 
 

Definition at line 233 of file main.c.

References cur, DELIMS, EDFPacket, handleSample(), ib, isANumber(), isEOF(), lineBuf, linePos, max_fd, MAXCHANNELS, MINLINELENGTH, readline(), rprintf(), rselect(), samples, sock_fd, and updateMaxFd().

Referenced by readHandler().

void initGTKSystem void   ) 
 

Definition at line 287 of file main.c.

References DRAWINGAREAHEIGHT, neuroserver, onscreen, readHandler(), sock_fd, VIEWWIDTH, and window.

Referenced by main().

int isANumber const char *  str  ) 
 

check, if data is a number

Definition at line 75 of file main.c.

int main int  argc,
char **  argv
 

buffer for reading from serial port

DEFAULTHOST;

DEFAULTPORT;

process command line inputs

Definition at line 89 of file main.c.

References cfg, DEFAULTHOST, DEFAULTPORT, EDFPacket, Options::eegNum, getOK(), helpText, Options::hostname, ib, initGTKSystem(), isEOF(), MAXHEADERLEN, opts, pctimer(), Options::port, rconnectName(), readEDFString(), readline(), rexit(), rinitNetworking(), rprintf(), rsocket(), serverDied(), sock_fd, and writeString().

gboolean readHandler GIOChannel *  source,
GIOCondition  cond,
gpointer  data
 

Definition at line 281 of file main.c.

References idleHandler().

Referenced by initGTKSystem().

void serverDied void   ) 
 

action to take if server died

Definition at line 83 of file main.c.

References rprintf().

Referenced by main().


Variable Documentation

char EDFPacket[MAXHEADERLEN]
 

Definition at line 38 of file main.c.

Referenced by idleHandler(), and main().

const char* helpText
 

Initial value:

"sampleClient   v 0.34 by Rudi Cilibrasi\n"
"\n"
"Usage:  sampleClient [options]\n"
"\n"
"        -p port          Port number to use (default 8336)\n"
"        -n hostname      Host name of the NeuroCaster server to connect to\n"
"                         (this defaults to 'localhost')\n"
"        -e <intnum>      Integer ID specifying which EEG to log (default: 0)\n"
"The filename specifies the new EDF file to create.\n"

Definition at line 40 of file main.c.

Referenced by main().

struct InputBuffer ib
 

Definition at line 66 of file main.c.

Referenced by getOK(), getResponseCode(), handleSamples(), idleHandler(), initInputBuffer(), inputBufferEmpty(), isEOF(), main(), makeNewClient(), my_read(), readline(), and readlinebuf().

char lineBuf[MAXLEN]
 

Definition at line 67 of file main.c.

Referenced by getLineBuf(), idleHandler(), and main().

int linePos = 0
 

Definition at line 68 of file main.c.

Referenced by idleHandler(), and main().

GIOChannel* neuroserver
 

Definition at line 39 of file main.c.

Referenced by initGTKSystem().

GdkPixmap* offscreen = NULL
 

Definition at line 178 of file main.c.

GtkWidget* onscreen
 

Definition at line 177 of file main.c.

Referenced by handleSample(), and initGTKSystem().

struct Options opts
 

Definition at line 70 of file main.c.

Referenced by handleSamples(), initSampleBuffer(), main(), writeBuffers(), writeBufferToFile(), and writeSampleBuffer().

sock_t sock_fd
 

Definition at line 37 of file main.c.

Referenced by attemptBind(), getOK(), getResponseCode(), handleSamples(), idleHandler(), initGTKSystem(), main(), raccept(), rbindAll(), rconnectName(), rsocket(), setblocking(), setnonblocking(), and setNSnonblocking().

GtkWidget* window
 

Definition at line 176 of file main.c.

Referenced by initGTKSystem().


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