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

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