www.pudn.com > opengpssim.zip > ogsrcvr.c


/* ************************************************************************  
   *                                                                      * 
   *                          GPS Simulation                              * 
   *                                                                      * 
   * -------------------------------------------------------------------- * 
   *                                                                      * 
   *    Module:   ogsrcvr.cpp                                             * 
   *                                                                      * 
   *   Version:   0.1                                                     * 
   *      Date:   17.02.02                                                * 
   *                                                                      * 
   *    Author:   G. Beyerle                                              * 
   *                                                                      * 
   * -------------------------------------------------------------------- * 
   *                                                                      * 
   * Copyright (C) 2002-2006  Georg Beyerle                               * 
   *                                                                      * 
   * This program is free software; you can redistribute it and/or modify * 
   * it under the terms of the GNU General Public License as published by * 
   * the Free Software Foundation; either version 2 of the License, or    * 
   * (at your option) any later version.                                  * 
   *                                                                      * 
   * This program is distributed in the hope that it will be useful,      * 
   * but WITHOUT ANY WARRANTY; without even the implied warranty of       * 
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        * 
   * GNU General Public License for more details.                         * 
   *                                                                      * 
   * You should have received a copy of the GNU General Public License    * 
   * along with this program; if not, write to the Free Software          * 
   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            * 
   *                                                                      * 
   * -------------------------------------------------------------------- * 
   *                                                                      * 
   * The files 'gpsfuncs.cpp', 'gpsrcvr.cpp' are modified versions of     * 
   * the files with the same name from Clifford Kelley's OpenSourceGPS    * 
   * distribution. The unmodified files can be obtained from              * 
   *   http://www.home.earthlink.net/~cwkelley                            * 
   *                                                                      * 
   * -------------------------------------------------------------------- * 
   *                                                                      * 
   *                              Procedures                              * 
   *                                                                      * 
   ************************************************************************ */ 
 
/* ******************************* changes ******************************** 
 
   dd.mm.yy - 
 
   ************************************************************************ */ 
 
// to do: 
// - fill struct iono_data und struct UTC_data   / 17.2.02 
// - parity bits 
 
/* ------------------------------- includes ------------------------------- */ 
 
#include  
#include  
#include  
#include  
#include  
#include  
 
#define MAIN 
 
#include "ogsdefine.h" 
#include "ogsstructs.h" 
#include "ogsextern.h" 
#include "ogsprototypes.h" 
#include "ogslibrary.h" 
 
#undef MAIN 
 
/* ------------------------------- defines -------------------------------- */ 
 
/* ------------------------------- globals -------------------------------- */ 
 
char ProgramName[] = "ogsrcvr"; 
static char Version[] = "0.1.1"; 
 
/* -------------------------- prototypen (global) ------------------------- */ 
 
void getargs( int argc, char *argv[]); 
void close_open_files( void); 
 
/* ------------------------------ procedures ------------------------------ */ 
 
void usage( void) 
{ 
  printf( "usage: %s [options]\n", ProgramName); 
  printf( "version %s (compiled %s %s) \n", Version, __DATE__, __TIME__); 
  printf( " options:\n"); 
  printf( "   -h        : print this message                       \n"); 
  printf( "   -v        : verbose                                      \n"); 
  printf( "   -f        : overwrite existing files                     \n"); 
  printf( "   -x  : read data from 'data/'  ['ogsraw.dat'] \n"); 
  printf( "   -r        : write carrier frq to file 'carfrq-out-PRN.dat'\n"); 
  printf( "   -i        : write I,Q to file 'iq-out-PRN.dat'\n"); 
//  printf( "   -g          : Genauigkeit (nur Octave)     [D:6]       \n"); 
//  printf( "   -l          : ueberspringe ersten n Zeilen [D:0]       \n"); 
//  printf( "   -l-      : lies von Zeile n bis m                   \n"); 
  exit(0); 
} 
 
// 
//  main - receiver simulation 
// 
int main( int argc, char *argv[]) 
{   
  set_directories( argv[0]); 
 
//  process options 
  getargs( argc, argv); 
 
//  welcome 
  printf("-------------------------------- OpenGPSSim ---------------------------------\n"); 
  printf("ogsrcvr   version %s\n", Version); 
  printf("Copyright (C) 2001-2006 G. Beyerle, A. Tabernero, C. Kelley and others.      \n"); 
  printf("ogsrcvr comes with ABSOLUTELY NO WARRANTY; for details see file 'warranty'.\n"); 
  printf("This is free software, and you are welcome to redistribute it under          \n"); 
  printf("certain conditions; see file 'copying' for details.                          \n"); 
  printf("-----------------------------------------------------------------------------\n"); 
 
//  printf("sizeof(chan) = %d\n", sizeof(chan)); 
//  getchar(); 
 
// 
//  read first n samples from file and store in 'Buffer' 
// 
  init_inputbuffer(); 
 
//  pre-calculate C/A code and store in global CACode[][] 
  calc_cacode(); 
 
//  init_software_correlator(); 
 
  main_gpsrcvr(); 
   
  close_open_files(); 
 
  exit(0); 
 
} 
 
/* ------------------------------ end of file ----------------------------- */