//tell DGPS to start or stop logging // args: [start,stop] filename // must be linked against serials.c // KM Sept 2003 // version 1.2 #include #include #include #include #include #include #define BYTE unsigned char #define SERIALPORT "/dev/ttyS0" #define LOGFILE "/home/km/incoming/gps.log" // GLOBAL variables for simplicity //int serialport; // serial port //FILE *logfd; // log file char mesg[512]; // somewhere to make logfile strings! //-------------------- MAIN------------------------ main (int argc, char **argv) { int n; BYTE byte; char command[512]; initialise_coms(SERIALPORT, B38400, LOGFILE); if( !strcmp(argv[1], "-start")){ // set the filename sprintf(command, "create,%s\n",argv[2]); logfile(command); putstring(command); // start logging sprintf(command, "em,/cur/log,def\n"); logfile(command); putstring(command); } else if(!strcmp(argv[1],"-stop")){ // stop logging sprintf(command, "dm,/cur/log\n"); putstring(command); logfile(command); } fclose(logfd); close(serialport); }