source: ntrip/trunk/BNC/bncmain.cpp@ 499

Last change on this file since 499 was 464, checked in by weber, 17 years ago

* empty log message *

File size: 4.1 KB
RevLine 
[280]1// Part of BNC, a utility for retrieving decoding and
[464]2// converting GNSS data streams from NTRIP broadcasters.
[280]3//
[464]4// Copyright (C) 2007
[280]5// German Federal Agency for Cartography and Geodesy (BKG)
6// http://www.bkg.bund.de
[464]7// Czech Technical University Prague, Department of Geodesy
[280]8// http://www.fsv.cvut.cz
9//
10// Email: euref-ip@bkg.bund.de
11//
12// This program is free software; you can redistribute it and/or
13// modify it under the terms of the GNU General Public License
14// as published by the Free Software Foundation, version 2.
15//
16// This program is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program; if not, write to the Free Software
23// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
[35]24
25/* -------------------------------------------------------------------------
[93]26 * BKG NTRIP Client
[35]27 * -------------------------------------------------------------------------
28 *
29 * Class: main
30 *
31 * Purpose: Application starts here
32 *
33 * Author: L. Mervart
34 *
35 * Created: 24-Dec-2005
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
[274]41#include <unistd.h>
[35]42#include <QApplication>
43#include <QFile>
44#include <iostream>
45
[82]46#include "bncapp.h"
[35]47#include "bncwindow.h"
48
49using namespace std;
50
[82]51// Main Program
52/////////////////////////////////////////////////////////////////////////////
[35]53int main(int argc, char *argv[]) {
54
55 bool GUIenabled = true;
[100]56 for (int ii = 1; ii < argc; ii++) {
57 if (QString(argv[ii]) == "-nw") {
58 GUIenabled = false;
59 break;
60 }
[35]61 }
62
[82]63 bncApp app(argc, argv, GUIenabled);
[35]64
[93]65 QCoreApplication::setOrganizationName("BKG");
66 QCoreApplication::setOrganizationDomain("www.ifag.de");
67 QCoreApplication::setApplicationName("BKG_NTRIP_Client");
[35]68
[180]69 // Default Settings
70 // ----------------
[113]71 QSettings settings;
[180]72 if (settings.allKeys().size() == 0) {
73 settings.setValue("casterHost", "www.euref-ip.net");
74 settings.setValue("casterPort", 80);
75 settings.setValue("rnxIntr", "15 min");
76 settings.setValue("rnxSkel", "SKL");
77 settings.setValue("waitTime", 2);
78 }
[114]79
[180]80 // Interactive Mode - open the main window
81 // ---------------------------------------
[35]82 if (GUIenabled) {
[113]83
84 QString fontString = settings.value("font").toString();
85 if ( !fontString.isEmpty() ) {
86 QFont newFont;
87 if (newFont.fromString(fontString)) {
88 QApplication::setFont(newFont);
89 }
90 }
[142]91
[173]92 app.setWindowIcon(QPixmap(":ntrip-logo.png"));
[113]93
[82]94 bncWindow* bncWin = new bncWindow();
[35]95 bncWin->show();
96 }
[180]97
98 // Non-Interactive (Batch) Mode
99 // ----------------------------
[35]100 else {
[463]101 bncCaster* caster = new bncCaster(settings.value("outFile").toString(),
102 settings.value("outPort").toInt());
[35]103
[463]104 app.connect(caster, SIGNAL(getThreadErrors()), &app, SLOT(quit()));
105 app.connect(caster, SIGNAL(newMessage(const QByteArray&)),
[82]106 &app, SLOT(slotMessage(const QByteArray&)));
[295]107
108 ((bncApp*)qApp)->slotMessage("============ Start BNC ============");
[35]109
[278]110 int iMount = -1;
[35]111 QListIterator<QString> it(settings.value("mountPoints").toStringList());
112 while (it.hasNext()) {
[278]113 ++iMount;
[59]114 QStringList hlp = it.next().split(" ");
[82]115 if (hlp.size() <= 1) continue;
[59]116 QUrl url(hlp[0]);
[88]117 QByteArray format = hlp[1].toAscii();
[366]118 QByteArray latitude = hlp[2].toAscii();
119 QByteArray longitude = hlp[3].toAscii();
120 QByteArray nmea = hlp[4].toAscii();
121 bncGetThread* getThread = new bncGetThread(url, format, latitude, longitude, nmea, iMount);
[82]122 app.connect(getThread, SIGNAL(newMessage(const QByteArray&)),
123 &app, SLOT(slotMessage(const QByteArray&)));
124
[463]125 caster->addGetThread(getThread);
[35]126
127 getThread->start();
128 }
[463]129 if (caster->numStations() == 0) {
[82]130 return 0;
131 }
[35]132 }
[180]133
134 // Start the application
135 // ---------------------
[35]136 return app.exec();
137}
Note: See TracBrowser for help on using the repository browser.