Signals | Public Member Functions | Protected Member Functions
GpsLink Class Reference

Brief description of class still missing. More...

#include <GpsLink.h>

Inheritance diagram for GpsLink:
DaemonLink

List of all members.

Signals

void rawFileError ()
void rawFileReady ()
void rawFileSize (int size)

Public Member Functions

void abortRaw ()
 GpsLink (Station *station)
void highRateRefresh ()
void navigation ()
void raw ()
void start ()
void stop ()

Protected Member Functions

virtual int bytesAvailable (const char *buffer, int bytesCount)
virtual void connected ()

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

GpsLink::GpsLink ( Station station)

Description of constructor still missing

References DaemonLink::setPort(), and TRACE.

  : DaemonLink(station)
{
  TRACE;
  setPort(2974);
  _refresh.setInterval(2000);
  QObject::connect(&_refresh, SIGNAL(timeout()), this, SLOT(refreshVariableParameters()));
  _refresh.start();
  _rawMode=false;
}

Member Function Documentation

References TRACE.

Referenced by Station::abortDownloadGps().

{
  TRACE;
  _rawFile.close();
  _rawFile.setFileName(QString::null);
}
int GpsLink::bytesAvailable ( const char *  buffer,
int  bytesCount 
) [protected, virtual]

Implements DaemonLink.

References bytesAvailable(), DaemonLink::match(), and TRACE.

Referenced by bytesAvailable().

{
  TRACE;
  if(_rawMode) {
    return saveRaw(buffer, bytesCount);
  }
  int bytesRead=0;
  while(bytesRead<bytesCount) {
    // Scan for a line
    int newBytesRead;
    for(newBytesRead=bytesRead; newBytesRead<bytesCount && buffer[newBytesRead]!='\n'; newBytesRead++) {}
    if(newBytesRead==bytesCount) {
      return bytesRead; // partial line
    }
    switch(buffer[bytesRead]) {
    case 's':
      if(match(buffer, bytesRead, bytesCount, "state=")) {
        state(buffer, bytesRead, newBytesRead);
      }
      break;
    case 'r':
      if(match(buffer, bytesRead, bytesCount, "raw begin")) {
        _rawMode=true;
        newBytesRead++;
        return newBytesRead+saveRaw(buffer+newBytesRead, bytesCount-newBytesRead);
      }
      break;
    default:
      break;
    }
    bytesRead=newBytesRead+1;
    // Skip blanks and additionnal end of line characters
    while(bytesRead<bytesCount && isspace(buffer[bytesRead])) {bytesRead++;}
  }
  return bytesRead;
}
void GpsLink::connected ( ) [protected, virtual]

Reimplemented from DaemonLink.

References TRACE.

{
  TRACE;
  DaemonLink::connected();
  refreshVariableParameters();
}
{
  _refresh.setInterval(2000); // 2 s during startup
}

References DaemonLink::send(), and TRACE.

Referenced by Station::navigationGps().

{
  TRACE;
  send("navigation\n");
}
void GpsLink::raw ( )

References QGpCoreTools::endl(), fileName, Station::gpsFileName(), QGpCoreTools::FletcherChecksum::reset(), DaemonLink::send(), DaemonLink::station(), QGpCoreTools::tr(), and TRACE.

Referenced by Station::downloadGps().

{
  TRACE;
  QString fileName=station()->gpsFileName();
  fileName+="ubx";
  _rawFile.setFileName(fileName);
  _rawFileSize=0;
  _rawChecksum.reset();
  if(_rawFile.open(QIODevice::WriteOnly)) {
    send("raw\n");
  } else {
    App::stream() << tr("Cannot open file %1 for writing").arg(fileName) << endl;
  }
}
void GpsLink::rawFileError ( ) [signal]
void GpsLink::rawFileReady ( ) [signal]
void GpsLink::rawFileSize ( int  size) [signal]
void GpsLink::start ( )

References DaemonLink::send(), and TRACE.

Referenced by Station::startGps().

{
  TRACE;
  send("start\n");
}
void GpsLink::stop ( )

References DaemonLink::send(), and TRACE.

Referenced by Station::stopGps().

{
  TRACE;
  send("stop\n");
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines