source: ntrip/trunk/BNC/bncapp.cpp@ 2375

Last change on this file since 2375 was 2257, checked in by mervart, 15 years ago

* empty log message *

File size: 20.3 KB
Line 
1// Part of BNC, a utility for retrieving decoding and
2// converting GNSS data streams from NTRIP broadcasters.
3//
4// Copyright (C) 2007
5// German Federal Agency for Cartography and Geodesy (BKG)
6// http://www.bkg.bund.de
7// Czech Technical University Prague, Department of Geodesy
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.
24
25/* -------------------------------------------------------------------------
26 * BKG NTRIP Client
27 * -------------------------------------------------------------------------
28 *
29 * Class: bncApp
30 *
31 * Purpose: This class implements the main application
32 *
33 * Author: L. Mervart
34 *
35 * Created: 29-Aug-2006
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
41#include <iostream>
42#include <QMessageBox>
43#include <cmath>
44#include <unistd.h>
45
46#include "bncapp.h"
47#include "bncutils.h"
48#include "bncrinex.h"
49#include "bncsettings.h"
50#include "bncversion.h"
51
52using namespace std;
53
54// Constructor
55////////////////////////////////////////////////////////////////////////////
56bncApp::bncApp(int& argc, char* argv[], bool GUIenabled) :
57 QApplication(argc, argv, GUIenabled) {
58
59 _logFileFlag = 0;
60 _logFile = 0;
61 _logStream = 0;
62 _caster = 0;
63
64 // Lists of Ephemeris
65 // ------------------
66 for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
67 _gpsEph[ii-PRN_GPS_START] = 0;
68 }
69 for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
70 _glonassEph[ii-PRN_GLONASS_START] = 0;
71 }
72
73 // Eph file(s)
74 // -----------
75 _rinexVers = 0;
76 _ephFileGPS = 0;
77 _ephStreamGPS = 0;
78 _ephFileGlonass = 0;
79 _ephStreamGlonass = 0;
80
81 _port = 0;
82 _server = 0;
83 _sockets = 0;
84
85 _portCorr = 0;
86 _serverCorr = 0;
87 _socketsCorr = 0;
88
89 _pgmName = QString(BNCPGMNAME).leftJustified(20, ' ', true);
90#ifdef WIN32
91 _userName = QString("${USERNAME}");
92#else
93 _userName = QString("${USER}");
94#endif
95 expandEnvVar(_userName);
96 _userName = _userName.leftJustified(20, ' ', true);
97
98 _lastDumpCoSec = 0;
99
100 _corrs = new QMultiMap<long, QString>;
101
102 _currentDateAndTimeGPS = 0;
103}
104
105// Destructor
106////////////////////////////////////////////////////////////////////////////
107bncApp::~bncApp() {
108 delete _logStream;
109 delete _logFile;
110 delete _ephStreamGPS;
111 delete _ephFileGPS;
112 delete _server;
113 delete _sockets;
114 delete _serverCorr;
115 delete _socketsCorr;
116 if (_rinexVers == 2) {
117 delete _ephStreamGlonass;
118 delete _ephFileGlonass;
119 }
120 for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
121 delete _gpsEph[ii-PRN_GPS_START];
122 }
123 for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
124 delete _glonassEph[ii-PRN_GLONASS_START];
125 }
126
127 delete _corrs;
128
129 delete _currentDateAndTimeGPS;
130}
131
132// Write a Program Message
133////////////////////////////////////////////////////////////////////////////
134void bncApp::slotMessage(QByteArray msg, bool showOnScreen) {
135
136 QMutexLocker locker(&_mutexMessage);
137
138 messagePrivate(msg);
139 emit newMessage(msg, showOnScreen);
140}
141
142// Write a Program Message (private, no lock)
143////////////////////////////////////////////////////////////////////////////
144void bncApp::messagePrivate(const QByteArray& msg) {
145
146 // First time resolve the log file name
147 // ------------------------------------
148 QDate currDate = currentDateAndTimeGPS().date();
149 if (_logFileFlag == 0 || _fileDate != currDate) {
150 delete _logFile;
151 _logFileFlag = 1;
152 bncSettings settings;
153 QString logFileName = settings.value("logFile").toString();
154 if ( !logFileName.isEmpty() ) {
155 expandEnvVar(logFileName);
156 _logFile = new QFile(logFileName + "_" +
157 currDate.toString("yyMMdd").toAscii().data());
158 _fileDate = currDate;
159 if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
160 _logFile->open(QIODevice::WriteOnly | QIODevice::Append);
161 }
162 else {
163 _logFile->open(QIODevice::WriteOnly);
164 }
165 _logStream = new QTextStream();
166 _logStream->setDevice(_logFile);
167 }
168 }
169
170 if (_logStream) {
171 *_logStream << currentDateAndTimeGPS().toString("yy-MM-dd hh:mm:ss ").toAscii().data();
172 *_logStream << msg.data() << endl;
173 _logStream->flush();
174 }
175}
176
177// New GPS Ephemeris
178////////////////////////////////////////////////////////////////////////////
179void bncApp::slotNewGPSEph(gpsephemeris* gpseph) {
180
181 QMutexLocker locker(&_mutex);
182
183 gpsephemeris copy_gpseph = *gpseph;
184 emit newEphGPS(copy_gpseph);
185
186 printEphHeader();
187
188 gpsephemeris** ee = &_gpsEph[gpseph->satellite-1];
189
190 if ( *ee == 0 ||
191 gpseph->GPSweek > (*ee)->GPSweek ||
192 (gpseph->GPSweek == (*ee)->GPSweek && gpseph->TOC > (*ee)->TOC) ) {
193 delete *ee;
194 *ee = gpseph;
195 printGPSEph(gpseph, true);
196 }
197 else {
198 printGPSEph(gpseph, false);
199 delete gpseph;
200 }
201}
202
203// New Glonass Ephemeris
204////////////////////////////////////////////////////////////////////////////
205void bncApp::slotNewGlonassEph(glonassephemeris* glonasseph) {
206
207 QMutexLocker locker(&_mutex);
208
209 glonassephemeris copy_glonasseph = *glonasseph;
210 emit newEphGlonass(copy_glonasseph);
211
212 printEphHeader();
213
214 glonassephemeris** ee = &_glonassEph[glonasseph->almanac_number-1];
215
216 int wwOld, towOld, wwNew, towNew;
217 if (*ee != 0) {
218 wwOld = (*ee)->GPSWeek;
219 towOld = (*ee)->GPSTOW;
220 updatetime(&wwOld, &towOld, (*ee)->tb*1000, 0); // Moscow -> GPS
221
222 wwNew = glonasseph->GPSWeek;
223 towNew = glonasseph->GPSTOW;
224 updatetime(&wwNew, &towNew, glonasseph->tb*1000, 0); // Moscow -> GPS
225 }
226
227 if ( *ee == 0 ||
228 wwNew > wwOld ||
229 (wwNew == wwOld && towNew > towOld) ) {
230 delete *ee;
231 *ee = glonasseph;
232 printGlonassEph(glonasseph, true);
233 }
234 else {
235 printGlonassEph(glonasseph, false);
236 delete glonasseph;
237 }
238}
239
240// Print Header of the output File(s)
241////////////////////////////////////////////////////////////////////////////
242void bncApp::printEphHeader() {
243
244 bncSettings settings;
245
246 // Initialization
247 // --------------
248 if (_rinexVers == 0) {
249
250 if ( Qt::CheckState(settings.value("ephV3").toInt()) == Qt::Checked) {
251 _rinexVers = 3;
252 }
253 else {
254 _rinexVers = 2;
255 }
256
257 _ephPath = settings.value("ephPath").toString();
258
259 if ( !_ephPath.isEmpty() ) {
260 if ( _ephPath[_ephPath.length()-1] != QDir::separator() ) {
261 _ephPath += QDir::separator();
262 }
263 expandEnvVar(_ephPath);
264 }
265 }
266
267 // (Re-)Open output File(s)
268 // ------------------------
269 if (!_ephPath.isEmpty()) {
270
271 QDateTime datTim = currentDateAndTimeGPS();
272
273 QString ephFileNameGPS = _ephPath + "BRDC" +
274 QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0'));
275
276 QString hlpStr = bncRinex::nextEpochStr(datTim,
277 settings.value("ephIntr").toString());
278
279 if (_rinexVers == 3) {
280 ephFileNameGPS += hlpStr + datTim.toString(".yyP");
281 }
282 else {
283 ephFileNameGPS += hlpStr + datTim.toString(".yyN");
284 }
285
286 if (_ephFileNameGPS == ephFileNameGPS) {
287 return;
288 }
289 else {
290 _ephFileNameGPS = ephFileNameGPS;
291 }
292
293 for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
294 delete _gpsEph[ii-PRN_GPS_START];
295 _gpsEph[ii-PRN_GPS_START] = 0;
296 }
297 for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
298 delete _glonassEph[ii-PRN_GLONASS_START];
299 _glonassEph[ii-PRN_GLONASS_START] = 0;
300 }
301
302 delete _ephStreamGPS;
303 delete _ephFileGPS;
304
305 QFlags<QIODevice::OpenModeFlag> appendFlagGPS;
306 QFlags<QIODevice::OpenModeFlag> appendFlagGlonass;
307
308 if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
309 QFile::exists(ephFileNameGPS) ) {
310 appendFlagGPS = QIODevice::Append;
311 }
312
313 _ephFileGPS = new QFile(ephFileNameGPS);
314 _ephFileGPS->open(QIODevice::WriteOnly | appendFlagGPS);
315 _ephStreamGPS = new QTextStream();
316 _ephStreamGPS->setDevice(_ephFileGPS);
317
318 if (_rinexVers == 3) {
319 _ephFileGlonass = _ephFileGPS;
320 _ephStreamGlonass = _ephStreamGPS;
321 }
322 else if (_rinexVers == 2) {
323 QString ephFileNameGlonass = _ephPath + "BRDC" +
324 QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0')) +
325 hlpStr + datTim.toString(".yyG");
326
327 delete _ephStreamGlonass;
328 delete _ephFileGlonass;
329
330 if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
331 QFile::exists(ephFileNameGlonass) ) {
332 appendFlagGlonass = QIODevice::Append;
333 }
334
335 _ephFileGlonass = new QFile(ephFileNameGlonass);
336 _ephFileGlonass->open(QIODevice::WriteOnly | appendFlagGlonass);
337 _ephStreamGlonass = new QTextStream();
338 _ephStreamGlonass->setDevice(_ephFileGlonass);
339 }
340
341 // Header - RINEX Version 3
342 // ------------------------
343 if (_rinexVers == 3) {
344 if ( ! (appendFlagGPS & QIODevice::Append)) {
345 QString line;
346 line.sprintf(
347 "%9.2f%11sN: GNSS NAV DATA M: Mixed%12sRINEX VERSION / TYPE\n",
348 3.0, "", "");
349 *_ephStreamGPS << line;
350
351 QString hlp = currentDateAndTimeGPS().toString("yyyyMMdd hhmmss UTC").leftJustified(20, ' ', true);
352 *_ephStreamGPS << _pgmName.toAscii().data()
353 << _userName.toAscii().data()
354 << hlp.toAscii().data()
355 << "PGM / RUN BY / DATE" << endl;
356
357 line.sprintf("%60sEND OF HEADER\n", "");
358 *_ephStreamGPS << line;
359
360 _ephStreamGPS->flush();
361 }
362 }
363
364 // Headers - RINEX Version 2
365 // -------------------------
366 else if (_rinexVers == 2) {
367 if (! (appendFlagGPS & QIODevice::Append)) {
368 QString line;
369 line.sprintf(
370 "%9.2f%11sN: GPS NAV DATA%25sRINEX VERSION / TYPE\n", 2.11, "", "");
371 *_ephStreamGPS << line;
372
373 QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
374 *_ephStreamGPS << _pgmName.toAscii().data()
375 << _userName.toAscii().data()
376 << hlp.toAscii().data()
377 << "PGM / RUN BY / DATE" << endl;
378
379 line.sprintf("%60sEND OF HEADER\n", "");
380 *_ephStreamGPS << line;
381
382 _ephStreamGPS->flush();
383 }
384 if (! (appendFlagGlonass & QIODevice::Append)) {
385 QString line;
386 line.sprintf(
387 "%9.2f%11sG: GLONASS NAV DATA%21sRINEX VERSION / TYPE\n",2.11,"","");
388 *_ephStreamGlonass << line;
389
390 QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
391 *_ephStreamGlonass << _pgmName.toAscii().data()
392 << _userName.toAscii().data()
393 << hlp.toAscii().data()
394 << "PGM / RUN BY / DATE" << endl;
395
396 line.sprintf("%60sEND OF HEADER\n", "");
397 *_ephStreamGlonass << line;
398
399 _ephStreamGlonass->flush();
400 }
401 }
402 }
403}
404
405// Print One GPS Ephemeris
406////////////////////////////////////////////////////////////////////////////
407void bncApp::printGPSEph(gpsephemeris* ep, bool printFile) {
408
409 QString lineV2;
410 QString lineV3;
411
412 struct converttimeinfo cti;
413 converttime(&cti, ep->GPSweek, ep->TOC);
414
415 lineV3.sprintf("G%02d %04d %02d %02d %02d %02d %02d %18.11e %18.11e %18.11e\n",
416 ep->satellite, cti.year, cti.month, cti.day, cti.hour,
417 cti.minute, cti.second, ep->clock_bias, ep->clock_drift,
418 ep->clock_driftrate);
419
420 lineV2.sprintf("%02d %02d %02d %02d %02d %02d%5.1f %18.11e %18.11e %18.11e\n",
421 ep->satellite, cti.year%100, cti.month, cti.day, cti.hour,
422 cti.minute, (double) cti.second, ep->clock_bias,
423 ep->clock_drift, ep->clock_driftrate);
424
425 QString line;
426 QByteArray allLines;
427
428 QByteArray fmt;
429 QByteArray fmt2;
430 if (_rinexVers == 2) {
431 fmt = " %18.11e %18.11e %18.11e %18.11e\n";
432 fmt2 = " %18.11e %18.11e\n";
433 }
434 else {
435 fmt = " %18.11e %18.11e %18.11e %18.11e\n";
436 fmt2 = " %18.11e %18.11e\n";
437 }
438
439 line.sprintf(fmt.data(), (double)ep->IODE, ep->Crs, ep->Delta_n, ep->M0);
440 allLines += line;
441
442 line.sprintf(fmt.data(), ep->Cuc, ep->e, ep->Cus, ep->sqrt_A);
443 allLines += line;
444
445 line.sprintf(fmt.data(), (double) ep->TOE, ep->Cic, ep->OMEGA0, ep->Cis);
446 allLines += line;
447
448 line.sprintf(fmt.data(), ep->i0, ep->Crc, ep->omega, ep->OMEGADOT);
449 allLines += line;
450
451 double dd = 0;
452 unsigned long ii = ep->flags;
453 if(ii & GPSEPHF_L2CACODE)
454 dd += 2.0;
455 if(ii & GPSEPHF_L2PCODE)
456 dd += 1.0;
457 line.sprintf(fmt.data(), ep->IDOT, dd, (double) ep->GPSweek,
458 ii & GPSEPHF_L2PCODEDATA ? 1.0 : 0.0);
459 allLines += line;
460
461 if(ep->URAindex <= 6) /* URA index */
462 dd = ceil(10.0*pow(2.0, 1.0+((double)ep->URAindex)/2.0))/10.0;
463 else
464 dd = ceil(10.0*pow(2.0, ((double)ep->URAindex)/2.0))/10.0;
465 line.sprintf(fmt.data(), dd, ((double) ep->SVhealth), ep->TGD,
466 ((double) ep->IODC));
467 allLines += line;
468
469 line.sprintf(fmt2.data(), ((double)ep->TOW), 0.0);
470 allLines += line;
471
472 printOutput(printFile, _ephStreamGPS, lineV2, lineV3, allLines);
473}
474
475// Print One Glonass Ephemeris
476////////////////////////////////////////////////////////////////////////////
477void bncApp::printGlonassEph(glonassephemeris* ep, bool printFile) {
478
479 int ww = ep->GPSWeek;
480 int tow = ep->GPSTOW;
481 struct converttimeinfo cti;
482
483 updatetime(&ww, &tow, ep->tb*1000, 1); // Moscow -> UTC
484 converttime(&cti, ww, tow);
485
486 int tk = ep->tk-3*60*60;
487 if (tk < 0) {
488 tk += 86400;
489 }
490
491 QString lineV2;
492 QString lineV3;
493
494 lineV3.sprintf("R%02d %04d %02d %02d %02d %02d %02d %18.11e %18.11e %18.11e\n",
495 ep->almanac_number, cti.year, cti.month, cti.day, cti.hour,
496 cti.minute, cti.second, -ep->tau, ep->gamma, (double) tk);
497
498 lineV2.sprintf("%02d %02d %02d %02d %02d %02d%5.1f %18.11e %18.11e %18.11e\n",
499 ep->almanac_number, cti.year%100, cti.month, cti.day,
500 cti.hour, cti.minute, (double) cti.second, -ep->tau,
501 ep->gamma, (double) tk);
502
503 QString line;
504 QByteArray allLines;
505
506 QByteArray fmt;
507 if (_rinexVers == 2) {
508 fmt = " %18.11e %18.11e %18.11e %18.11e\n";
509 }
510 else {
511 fmt = " %18.11e %18.11e %18.11e %18.11e\n";
512 }
513
514 line.sprintf(fmt.data(), ep->x_pos, ep->x_velocity, ep->x_acceleration,
515 (ep->flags & GLOEPHF_UNHEALTHY) ? 1.0 : 0.0);
516 allLines += line;
517
518 line.sprintf(fmt.data(), ep->y_pos, ep->y_velocity, ep->y_acceleration,
519 (double) ep->frequency_number);
520 allLines += line;
521
522 line.sprintf(fmt.data(), ep->z_pos, ep->z_velocity, ep->z_acceleration,
523 (double) ep->E);
524 allLines += line;
525
526 printOutput(printFile, _ephStreamGlonass, lineV2, lineV3, allLines);
527}
528
529// Output
530////////////////////////////////////////////////////////////////////////////
531void bncApp::printOutput(bool printFile, QTextStream* stream,
532 const QString& lineV2,
533 const QString& lineV3,
534 const QByteArray& allLines) {
535 // Output into file
536 // ----------------
537 if (printFile && stream) {
538 if (_rinexVers == 2) {
539 *stream << lineV2.toAscii();
540 }
541 else {
542 *stream << lineV3.toAscii();
543 }
544 *stream << allLines;
545 stream->flush();
546 }
547
548 // Output into the socket
549 // ----------------------
550 if (_sockets) {
551 QMutableListIterator<QTcpSocket*> is(*_sockets);
552 while (is.hasNext()) {
553 QTcpSocket* sock = is.next();
554 if (sock->state() == QAbstractSocket::ConnectedState) {
555 if (sock->write(lineV3.toAscii()) == -1 ||
556 sock->write(allLines) == -1) {
557 delete sock;
558 is.remove();
559 }
560 }
561 else if (sock->state() != QAbstractSocket::ConnectingState) {
562 delete sock;
563 is.remove();
564 }
565 }
566 }
567}
568
569// Set Port Number
570////////////////////////////////////////////////////////////////////////////
571void bncApp::setPort(int port) {
572 _port = port;
573 if (_port != 0) {
574 delete _server;
575 _server = new QTcpServer;
576 if ( !_server->listen(QHostAddress::Any, _port) ) {
577 slotMessage("bncApp: Cannot listen on ephemeris port", true);
578 }
579 connect(_server, SIGNAL(newConnection()), this, SLOT(slotNewConnection()));
580 delete _sockets;
581 _sockets = new QList<QTcpSocket*>;
582 }
583}
584
585// Set Port Number
586////////////////////////////////////////////////////////////////////////////
587void bncApp::setPortCorr(int port) {
588 _portCorr = port;
589 if (_portCorr != 0) {
590 delete _serverCorr;
591 _serverCorr = new QTcpServer;
592 if ( !_serverCorr->listen(QHostAddress::Any, _portCorr) ) {
593 slotMessage("bncApp: Cannot listen on correction port", true);
594 }
595 connect(_serverCorr, SIGNAL(newConnection()), this, SLOT(slotNewConnectionCorr()));
596 delete _socketsCorr;
597 _socketsCorr = new QList<QTcpSocket*>;
598 }
599}
600
601// New Connection
602////////////////////////////////////////////////////////////////////////////
603void bncApp::slotNewConnection() {
604 _sockets->push_back( _server->nextPendingConnection() );
605}
606
607// New Connection
608////////////////////////////////////////////////////////////////////////////
609void bncApp::slotNewConnectionCorr() {
610 _socketsCorr->push_back( _serverCorr->nextPendingConnection() );
611}
612
613//
614////////////////////////////////////////////////////////////////////////////
615void bncApp::slotQuit() {
616 cout << "bncApp::slotQuit" << endl;
617 delete _caster;
618 quit();
619}
620
621//
622////////////////////////////////////////////////////////////////////////////
623void bncApp::slotNewCorrLine(QString line, QString staID, long coTime) {
624
625 QMutexLocker locker(&_mutex);
626
627 bncSettings settings;
628 _waitCoTime = settings.value("corrTime").toInt();
629 if (_waitCoTime < 1) {
630 _waitCoTime = 1;
631 }
632
633 // First time, set the _lastDumpSec immediately
634 // --------------------------------------------
635 if (_lastDumpCoSec == 0) {
636 _lastDumpCoSec = coTime - 1;
637 }
638
639 // An old correction - throw it away
640 // ---------------------------------
641 if (coTime <= _lastDumpCoSec) {
642 QString line = staID + ": Correction for one sat neglected because overaged by " +
643 QString().sprintf(" %ld sec",
644 _lastDumpCoSec - coTime + _waitCoTime);
645 messagePrivate(line.toAscii());
646 emit( newMessage(line.toAscii(), true) );
647 return;
648 }
649
650 _corrs->insert(coTime, QString(line + " " + staID));
651
652 // Dump Corrections
653 // ----------------
654 if (coTime - _waitCoTime > _lastDumpCoSec) {
655 dumpCorrs(_lastDumpCoSec + 1, coTime - _waitCoTime);
656 _lastDumpCoSec = coTime - _waitCoTime;
657 }
658}
659
660// Dump Complete Correction Epochs
661////////////////////////////////////////////////////////////////////////////
662void bncApp::dumpCorrs(long minTime, long maxTime) {
663
664 for (long sec = minTime; sec <= maxTime; sec++) {
665 QList<QString> allCorrs = _corrs->values(sec);
666 emit newCorrections(allCorrs);
667 if (_socketsCorr) {
668 QListIterator<QString> it(allCorrs);
669 while (it.hasNext()) {
670 QString corrLine = it.next() + "\n";
671
672 QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
673 while (is.hasNext()) {
674 QTcpSocket* sock = is.next();
675 if (sock->state() == QAbstractSocket::ConnectedState) {
676 if (sock->write(corrLine.toAscii()) == -1) {
677 delete sock;
678 is.remove();
679 }
680 }
681 else if (sock->state() != QAbstractSocket::ConnectingState) {
682 delete sock;
683 is.remove();
684 }
685 }
686 }
687 }
688 _corrs->remove(sec);
689 }
690}
691
692//
693////////////////////////////////////////////////////////////////////////////
694void bncApp::setConfFileName(const QString& confFileName) {
695 if (confFileName.isEmpty()) {
696 _confFileName = QDir::homePath() + QDir::separator()
697 + ".config" + QDir::separator()
698 + organizationName() + QDir::separator()
699 + applicationName() + ".ini";
700 }
701 else {
702 _confFileName = confFileName;
703 }
704}
Note: See TracBrowser for help on using the repository browser.