Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

GPS/gpsTest.c

Go to the documentation of this file.
00001 #include <iostream>
00002 #include "GPS.h"
00003 
00004 using namespace std;
00005 
00006 
00007 
00008 
00019 void recvData(GPS &gps) {
00020   int i = 1; 
00021   int j = 0;
00022 
00023   while (j < 5) {
00024     
00025     if (gps.Read() ) {
00026       if (gps.getNumSat() >= 3) {
00027         cout << endl << "got good data, delay=" << i << " sec" << endl;
00028         gps.printData();
00029         ++j;
00030         i = 0;
00031       } else {
00032         cerr << '*';
00033       }
00034     }
00035 
00036     sleep(1);
00037     ++i;    
00038   }
00039 
00040 }
00041 
00042 
00043 
00044 
00045 int main(int argc, char *argv[]) {
00046 
00047   GPS gps("/dev/ttyS0");
00048         if (gps.init(2.0)) {
00049                 cerr << "Error initializing GPS" << endl;
00050                 return -1;
00051         }
00052 
00053   recvData(gps);
00054 
00055   return 0;
00056 }
00057 
00058 
00059 
00060 

Generated on Fri Sep 1 14:25:44 2006 for Raptor by  doxygen 1.4.4