|
From: <rus...@us...> - 2008-08-10 02:31:48
|
Revision: 303
http://gearbox.svn.sourceforge.net/gearbox/?rev=303&view=rev
Author: russo2503v
Date: 2008-08-10 02:31:56 +0000 (Sun, 10 Aug 2008)
Log Message:
-----------
turned off debug messages, added quiet option to the test program
Modified Paths:
--------------
gearbox/trunk/src/gbxgarminacfr/driver.cpp
gearbox/trunk/src/gbxgarminacfr/nmea.cpp
gearbox/trunk/src/gbxgarminacfr/test/test.cpp
Modified: gearbox/trunk/src/gbxgarminacfr/driver.cpp
===================================================================
--- gearbox/trunk/src/gbxgarminacfr/driver.cpp 2008-08-08 05:41:39 UTC (rev 302)
+++ gearbox/trunk/src/gbxgarminacfr/driver.cpp 2008-08-10 02:31:56 UTC (rev 303)
@@ -344,8 +344,8 @@
nmeaExceptionCount = 0;
// debug
- if ( nmeaFailChecksumCount>0 )
- cout<<now.tv_sec<<" "<<now.tv_usec<<" "<<nmeaFailChecksumCount<<" the sentence AFTER, raw='"<<serialData<<"'"<<endl<<endl;
+// if ( nmeaFailChecksumCount>0 )
+// cout<<now.tv_sec<<" "<<now.tv_usec<<" "<<nmeaFailChecksumCount<<" the sentence AFTER, raw='"<<serialData<<"'"<<endl<<endl;
// Only populate the data structures if our message passes the checksum!
const int nmeaFailChecksumMaxCount = 10;
@@ -354,7 +354,8 @@
if ( nmeaFailChecksumCount++ < nmeaFailChecksumMaxCount ) {
// tracer_.warning("Gps driver: Single message failed checksum. Not throwing an exception yet!" );
// debug
- cout<<now.tv_sec<<" "<<now.tv_usec<<" "<<nmeaFailChecksumCount<<" sentence='"<<nmeaMessage.sentence()<<"' raw='"<<serialData<<"'"<<endl;
+ cout<<now.tv_sec<<" "<<now.tv_usec<<" "<<nmeaFailChecksumCount<<endl;
+// <<" sentence='"<<nmeaMessage.sentence()<<"' raw='"<<serialData<<"'"<<endl;
continue;
}
else {
Modified: gearbox/trunk/src/gbxgarminacfr/nmea.cpp
===================================================================
--- gearbox/trunk/src/gbxgarminacfr/nmea.cpp 2008-08-08 05:41:39 UTC (rev 302)
+++ gearbox/trunk/src/gbxgarminacfr/nmea.cpp 2008-08-10 02:31:56 UTC (rev 303)
@@ -124,7 +124,7 @@
//These are straight after the '*' character
ptr = strchr(sentence_, NMEAChecksumDelim);
if ( !ptr ) {
- cout<<"device: no checksum delimiter"<<endl;
+// cout<<"device: no checksum delimiter"<<endl;
return false;
}
@@ -150,8 +150,8 @@
}
//failed the checksum!
- cout<<"device: '"<<chksum_HIB<<chksum_LOB <<"' ("<<std::hex<<(unsigned int)chksum_HIB<<","<<(unsigned int)chksum_LOB<<std::dec<<") "
- <<"driver: '"<<*ptr<<*(ptr+1)<<"'" <<"' ("<<std::hex<<(unsigned int)*ptr<<","<<(unsigned int)*(ptr+1)<<std::dec<<") "<<endl;
+// cout<<"device: '"<<chksum_HIB<<chksum_LOB <<"' ("<<std::hex<<(unsigned int)chksum_HIB<<","<<(unsigned int)chksum_LOB<<std::dec<<") "
+// <<"driver: '"<<*ptr<<*(ptr+1)<<"'" <<"' ("<<std::hex<<(unsigned int)*ptr<<","<<(unsigned int)*(ptr+1)<<std::dec<<") "<<endl;
return false;
}
Modified: gearbox/trunk/src/gbxgarminacfr/test/test.cpp
===================================================================
--- gearbox/trunk/src/gbxgarminacfr/test/test.cpp 2008-08-08 05:41:39 UTC (rev 302)
+++ gearbox/trunk/src/gbxgarminacfr/test/test.cpp 2008-08-10 02:31:56 UTC (rev 303)
@@ -31,18 +31,23 @@
int opt;
// defaults
string port = "/dev/ttyS0";
+ bool quiet = false;
// Get some options from the command line
- while ((opt = getopt(argc, argv, "p:")) != -1)
+ while ((opt = getopt(argc, argv, "p:q")) != -1)
{
switch ( opt )
{
case 'p':
port = optarg;
break;
+ case 'q':
+ quiet = true;
+ break;
default:
cout << "Usage: " << argv[0] << " [-p port]" << endl << endl
- << "-p port\tPort the device is connected to. E.g. /dev/ttyS0" << endl;
+ << "-p port\tPort the device is connected to. E.g. /dev/ttyS0"
+ << "-q \tMakes normal operation quiet, only errors are traced." << endl;
return 1;
}
}
@@ -61,7 +66,9 @@
cout << "Using configuration: " << config.toString() << endl;
// Instantiate objects to handle messages from the driver
- const bool debug = true;
+ bool debug = true;
+ if ( quiet )
+ debug = false;
gbxutilacfr::TrivialTracer tracer( debug );
gbxutilacfr::TrivialStatus status( tracer );
@@ -81,7 +88,7 @@
std::auto_ptr<gbxgarminacfr::GenericData> data;
// Read a few times
- const int numReads = 30;
+ const int numReads = 30 + 10000000;
for ( int i=0; i < numReads; i++ )
{
try
@@ -94,25 +101,31 @@
case gbxgarminacfr::GpGga :
{
gbxgarminacfr::GgaData* d = (gbxgarminacfr::GgaData*)data.get();
- cout<<"GPGGA:"<<endl
- <<" satellites = "<<d->satellites<<endl
- <<" fix type = "<<d->fixType<<endl
- <<" longitude = "<<d->longitude<<endl
- <<" latitude = "<<d->latitude<<endl;
+ if ( !quiet ) {
+ cout<<"GPGGA:"<<endl
+ <<" satellites = "<<d->satellites<<endl
+ <<" fix type = "<<d->fixType<<endl
+ <<" longitude = "<<d->longitude<<endl
+ <<" latitude = "<<d->latitude<<endl;
+ }
break;
}
case gbxgarminacfr::GpVtg :
{
gbxgarminacfr::VtgData* d = (gbxgarminacfr::VtgData*)data.get();
- cout<<"GPVTG:"<<endl
- <<" speed = "<<d->speed<<endl;
+ if ( !quiet ) {
+ cout<<"GPVTG:"<<endl
+ <<" speed = "<<d->speed<<endl;
+ }
break;
}
case gbxgarminacfr::PgRme :
{
gbxgarminacfr::RmeData* d = (gbxgarminacfr::RmeData*)data.get();
- cout<<"PGRME:"<<endl
- <<" horiz error = "<<d->horizontalPositionError<<endl;
+ if ( !quiet ) {
+ cout<<"PGRME:"<<endl
+ <<" horiz error = "<<d->horizontalPositionError<<endl;
+ }
break;
}
default :
@@ -121,7 +134,8 @@
// no need to delete the data object, the auto pointer will delete it automatically
- cout<<"Test: Got data "<<i+1<<" of "<<numReads<<endl;
+ if ( !quiet )
+ cout<<"Test: Got data "<<i+1<<" of "<<numReads<<endl;
}
catch ( const std::exception& e )
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|