Changeset 5066 in ntrip for trunk/BNC/src/bncapp.cpp


Ignore:
Timestamp:
Mar 30, 2013, 11:31:00 AM (11 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bncapp.cpp

    r4904 r5066  
    2727 * -------------------------------------------------------------------------
    2828 *
    29  * Class:      bncApp
     29 * Class:      t_pgmCore
    3030 *
    3131 * Purpose:    This class implements the main application
     
    5858// Constructor
    5959////////////////////////////////////////////////////////////////////////////
    60 bncApp::bncApp(int& argc, char* argv[], bool GUIenabled) :
    61   QApplication(argc, argv, GUIenabled) {
    62 
     60t_pgmCore::t_pgmCore(int& argc, char* argv[], bool GUIenabled) {
    6361  _GUIenabled  = GUIenabled;
    6462  _logFileFlag = 0;
     
    127125// Destructor
    128126////////////////////////////////////////////////////////////////////////////
    129 bncApp::~bncApp() {
     127t_pgmCore::~t_pgmCore() {
    130128  delete _logStream;
    131129  delete _logFile;
     
    163161// Write a Program Message
    164162////////////////////////////////////////////////////////////////////////////
    165 void bncApp::slotMessage(QByteArray msg, bool showOnScreen) {
     163void t_pgmCore::slotMessage(QByteArray msg, bool showOnScreen) {
    166164
    167165  QMutexLocker locker(&_mutexMessage);
     
    173171// Write a Program Message (private, no lock)
    174172////////////////////////////////////////////////////////////////////////////
    175 void bncApp::messagePrivate(const QByteArray& msg) {
     173void t_pgmCore::messagePrivate(const QByteArray& msg) {
    176174
    177175  // First time resolve the log file name
     
    215213// New GPS Ephemeris
    216214////////////////////////////////////////////////////////////////////////////
    217 void bncApp::slotNewGPSEph(gpsephemeris* gpseph) {
     215void t_pgmCore::slotNewGPSEph(gpsephemeris* gpseph) {
    218216
    219217  QMutexLocker locker(&_mutex);
     
    246244// New Glonass Ephemeris
    247245////////////////////////////////////////////////////////////////////////////
    248 void bncApp::slotNewGlonassEph(glonassephemeris* glonasseph) {
     246void t_pgmCore::slotNewGlonassEph(glonassephemeris* glonasseph) {
    249247
    250248  QMutexLocker locker(&_mutex);
     
    292290// New Galileo Ephemeris
    293291////////////////////////////////////////////////////////////////////////////
    294 void bncApp::slotNewGalileoEph(galileoephemeris* galileoeph) {
     292void t_pgmCore::slotNewGalileoEph(galileoephemeris* galileoeph) {
    295293
    296294  QMutexLocker locker(&_mutex);
     
    327325// Print Header of the output File(s)
    328326////////////////////////////////////////////////////////////////////////////
    329 void bncApp::printEphHeader() {
     327void t_pgmCore::printEphHeader() {
    330328
    331329  bncSettings settings;
     
    499497// Print One GPS Ephemeris
    500498////////////////////////////////////////////////////////////////////////////
    501 void bncApp::printGPSEph(gpsephemeris* ep, bool printFile) {
     499void t_pgmCore::printGPSEph(gpsephemeris* ep, bool printFile) {
    502500
    503501  t_ephGPS eph;
     
    512510// Print One Glonass Ephemeris
    513511////////////////////////////////////////////////////////////////////////////
    514 void bncApp::printGlonassEph(glonassephemeris* ep, bool printFile) {
     512void t_pgmCore::printGlonassEph(glonassephemeris* ep, bool printFile) {
    515513
    516514  t_ephGlo eph;
     
    526524// Print One Galileo Ephemeris
    527525////////////////////////////////////////////////////////////////////////////
    528 void bncApp::printGalileoEph(galileoephemeris* ep, bool printFile) {
     526void t_pgmCore::printGalileoEph(galileoephemeris* ep, bool printFile) {
    529527
    530528  t_ephGal eph;
     
    539537// Output
    540538////////////////////////////////////////////////////////////////////////////
    541 void bncApp::printOutput(bool printFile, QTextStream* stream,
     539void t_pgmCore::printOutput(bool printFile, QTextStream* stream,
    542540                         const QString& strV2, const QString& strV3) {
    543541
     
    576574// Set Port Number
    577575////////////////////////////////////////////////////////////////////////////
    578 void bncApp::setPort(int port) {
     576void t_pgmCore::setPort(int port) {
    579577  _port = port;
    580578  if (_port != 0) {
     
    582580    _server = new QTcpServer;
    583581    if ( !_server->listen(QHostAddress::Any, _port) ) {
    584       slotMessage("bncApp: Cannot listen on ephemeris port", true);
     582      slotMessage("t_pgmCore: Cannot listen on ephemeris port", true);
    585583    }
    586584    connect(_server, SIGNAL(newConnection()), this, SLOT(slotNewConnection()));
     
    592590// Set Port Number
    593591////////////////////////////////////////////////////////////////////////////
    594 void bncApp::setPortCorr(int port) {
     592void t_pgmCore::setPortCorr(int port) {
    595593  _portCorr = port;
    596594  if (_portCorr != 0) {
     
    598596    _serverCorr = new QTcpServer;
    599597    if ( !_serverCorr->listen(QHostAddress::Any, _portCorr) ) {
    600       slotMessage("bncApp: Cannot listen on correction port", true);
     598      slotMessage("t_pgmCore: Cannot listen on correction port", true);
    601599    }
    602600    connect(_serverCorr, SIGNAL(newConnection()), this, SLOT(slotNewConnectionCorr()));
     
    608606// New Connection
    609607////////////////////////////////////////////////////////////////////////////
    610 void bncApp::slotNewConnection() {
     608void t_pgmCore::slotNewConnection() {
    611609  _sockets->push_back( _server->nextPendingConnection() );
    612610}
     
    614612// New Connection
    615613////////////////////////////////////////////////////////////////////////////
    616 void bncApp::slotNewConnectionCorr() {
     614void t_pgmCore::slotNewConnectionCorr() {
    617615  _socketsCorr->push_back( _serverCorr->nextPendingConnection() );
    618616}
     
    620618//
    621619////////////////////////////////////////////////////////////////////////////
    622 void bncApp::slotQuit() {
    623   cout << "bncApp::slotQuit" << endl;
     620void t_pgmCore::slotQuit() {
     621  cout << "t_pgmCore::slotQuit" << endl;
    624622  delete _caster;
    625   quit();
     623  qApp->quit();
    626624}
    627625
    628626//
    629627////////////////////////////////////////////////////////////////////////////
    630 void bncApp::slotNewCorrLine(QString line, QString staID, long coTime) {
     628void t_pgmCore::slotNewCorrLine(QString line, QString staID, long coTime) {
    631629
    632630  QMutexLocker locker(&_mutex);
     
    680678// Dump Complete Correction Epochs
    681679////////////////////////////////////////////////////////////////////////////
    682 void bncApp::dumpCorrs(long minTime, long maxTime) {
     680void t_pgmCore::dumpCorrs(long minTime, long maxTime) {
    683681  for (long sec = minTime; sec <= maxTime; sec++) {
    684682    QList<QString> allCorrs = _corrs->values(sec);
     
    690688// Dump all corrections
    691689////////////////////////////////////////////////////////////////////////////
    692 void bncApp::dumpCorrs() {
     690void t_pgmCore::dumpCorrs() {
    693691  QList<QString> allCorrs;
    694692  QMutableMapIterator<long, QString> it(*_corrs);
     
    702700// Dump List of Corrections
    703701////////////////////////////////////////////////////////////////////////////
    704 void bncApp::dumpCorrs(const QList<QString>& allCorrs) {
     702void t_pgmCore::dumpCorrs(const QList<QString>& allCorrs) {
    705703  emit newCorrections(allCorrs);
    706704  if (_socketsCorr) {
     
    729727//
    730728////////////////////////////////////////////////////////////////////////////
    731 void bncApp::setConfFileName(const QString& confFileName) {
     729void t_pgmCore::setConfFileName(const QString& confFileName) {
    732730  if (confFileName.isEmpty()) {
    733731    _confFileName = QDir::homePath() + QDir::separator()
    734732                  + ".config" + QDir::separator()
    735                   + organizationName() + QDir::separator()
    736                   + applicationName() + ".bnc";
     733                  + qApp->organizationName() + QDir::separator()
     734                  + qApp->applicationName() + ".bnc";
    737735  }
    738736  else {
     
    743741// Raw Output
    744742////////////////////////////////////////////////////////////////////////////
    745 void bncApp::writeRawData(const QByteArray& data, const QByteArray& staID,
     743void t_pgmCore::writeRawData(const QByteArray& data, const QByteArray& staID,
    746744                          const QByteArray& format) {
    747745
     
    763761// Get Glonass Slot Numbers from Global Array
    764762////////////////////////////////////////////////////////////////////////////
    765 void bncApp::getGlonassSlotNums(int GLOFreq[]) {
     763void t_pgmCore::getGlonassSlotNums(int GLOFreq[]) {
    766764
    767765  QMutexLocker locker(&_mutex);
     
    776774// Store Glonass Slot Numbers to Global Array
    777775////////////////////////////////////////////////////////////////////////////
    778 void bncApp::storeGlonassSlotNums(const int GLOFreq[]) {
     776void t_pgmCore::storeGlonassSlotNums(const int GLOFreq[]) {
    779777
    780778  QMutexLocker locker(&_mutex);
     
    789787//
    790788////////////////////////////////////////////////////////////////////////////
    791 void bncApp::initCombination() {
     789void t_pgmCore::initCombination() {
    792790#ifdef USE_COMBINATION
    793791  _bncComb = new bncComb();
     
    801799//
    802800////////////////////////////////////////////////////////////////////////////
    803 void bncApp::stopCombination() {
     801void t_pgmCore::stopCombination() {
    804802#ifdef USE_COMBINATION
    805803  delete _bncComb;
     
    808806}
    809807
    810 // Handling Events (virtual)
    811 ////////////////////////////////////////////////////////////////////////////
    812 bool bncApp::event(QEvent* ev) {
    813 
    814   if (ev->type() == QEvent::FileOpen) {  // currently happens on Mac only
    815     QString fileName = static_cast<QFileOpenEvent*>(ev)->file();
    816     setConfFileName(fileName);
    817     return true;
    818   }
    819    
    820   return QApplication::event(ev);
    821 }
    822 
    823808// Check Ephemeris Consistency
    824809////////////////////////////////////////////////////////////////////////////
    825 void bncApp::checkEphemeris(gpsephemeris* oldEph, gpsephemeris* newEph) {
     810void t_pgmCore::checkEphemeris(gpsephemeris* oldEph, gpsephemeris* newEph) {
    826811  if (oldEph->clock_bias      != newEph->clock_bias      ||
    827812      oldEph->clock_drift     != newEph->clock_drift     ||
Note: See TracChangeset for help on using the changeset viewer.