source: ntrip/trunk/BNC/bncmodel.cpp@ 2180

Last change on this file since 2180 was 2180, checked in by mervart, 14 years ago

* empty log message *

File size: 19.8 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: bncParam, bncModel
30 *
31 * Purpose: Model for PPP
32 *
33 * Author: L. Mervart
34 *
35 * Created: 01-Dec-2009
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
41#include <iomanip>
42#include <cmath>
43#include <newmatio.h>
44#include <sstream>
45
46#include "bncmodel.h"
47#include "bncapp.h"
48#include "bncpppclient.h"
49#include "bancroft.h"
50#include "bncutils.h"
51#include "bncsettings.h"
52
53using namespace std;
54
55const unsigned MINOBS = 4;
56const double MINELE = 10.0 * M_PI / 180.0;
57const double MAXRES_CODE = 10.0;
58const double MAXRES_PHASE = 0.10;
59const double sig_crd_0 = 100.0;
60const double sig_crd_p = 100.0;
61const double sig_clk_0 = 1000.0;
62const double sig_trp_0 = 0.01;
63const double sig_trp_p = 1e-6;
64const double sig_amb_0 = 100.0;
65const double sig_P3 = 1.0;
66const double sig_L3 = 0.01;
67
68// Constructor
69////////////////////////////////////////////////////////////////////////////
70bncParam::bncParam(bncParam::parType typeIn, int indexIn,
71 const QString& prnIn) {
72 type = typeIn;
73 index = indexIn;
74 prn = prnIn;
75 index_old = 0;
76 xx = 0.0;
77}
78
79// Destructor
80////////////////////////////////////////////////////////////////////////////
81bncParam::~bncParam() {
82}
83
84// Partial
85////////////////////////////////////////////////////////////////////////////
86double bncParam::partial(t_satData* satData, const QString& prnIn) {
87 if (type == CRD_X) {
88 return (xx - satData->xx(1)) / satData->rho;
89 }
90 else if (type == CRD_Y) {
91 return (xx - satData->xx(2)) / satData->rho;
92 }
93 else if (type == CRD_Z) {
94 return (xx - satData->xx(3)) / satData->rho;
95 }
96 else if (type == RECCLK) {
97 return 1.0;
98 }
99 else if (type == TROPO) {
100 return 1.0 / sin(satData->eleSat);
101 }
102 else if (type == AMB_L3) {
103 if (prnIn == prn) {
104 return 1.0;
105 }
106 else {
107 return 0.0;
108 }
109 }
110 return 0.0;
111}
112
113// Constructor
114////////////////////////////////////////////////////////////////////////////
115bncModel::bncModel(QByteArray staID) {
116
117 _staID = staID;
118
119 connect(this, SIGNAL(newMessage(QByteArray,bool)),
120 ((bncApp*)qApp), SLOT(slotMessage(const QByteArray,bool)));
121
122 bncSettings settings;
123
124 _static = false;
125 if ( Qt::CheckState(settings.value("pppStatic").toInt()) == Qt::Checked) {
126 _static = true;
127 }
128
129 _usePhase = false;
130 if ( Qt::CheckState(settings.value("pppUsePhase").toInt()) == Qt::Checked) {
131 _usePhase = true;
132 }
133
134 _estTropo = false;
135 if ( Qt::CheckState(settings.value("pppEstTropo").toInt()) == Qt::Checked) {
136 _estTropo = true;
137 }
138
139 _xcBanc.ReSize(4); _xcBanc = 0.0;
140 _ellBanc.ReSize(3); _ellBanc = 0.0;
141
142 _params.push_back(new bncParam(bncParam::CRD_X, 1, ""));
143 _params.push_back(new bncParam(bncParam::CRD_Y, 2, ""));
144 _params.push_back(new bncParam(bncParam::CRD_Z, 3, ""));
145 _params.push_back(new bncParam(bncParam::RECCLK, 4, ""));
146 if (_estTropo) {
147 _params.push_back(new bncParam(bncParam::TROPO, 5, ""));
148 }
149
150 unsigned nPar = _params.size();
151
152 _QQ.ReSize(nPar);
153 _QQ = 0.0;
154
155 _QQ(1,1) = sig_crd_0 * sig_crd_0;
156 _QQ(2,2) = sig_crd_0 * sig_crd_0;
157 _QQ(3,3) = sig_crd_0 * sig_crd_0;
158 _QQ(4,4) = sig_clk_0 * sig_clk_0;
159 if (_estTropo) {
160 _QQ(5,5) = sig_trp_0 * sig_trp_0;
161 }
162
163 // NMEA Output
164 // -----------
165 int port = 0; // 7777;
166
167 if (port != 0) {
168 _server = new QTcpServer;
169 if ( !_server->listen(QHostAddress::Any, port) ) {
170 emit newMessage("bncModel: Cannot listen on sync port", true);
171 }
172 connect(_server, SIGNAL(newConnection()), this, SLOT(slotNewConnection()));
173 _sockets = new QList<QTcpSocket*>;
174 }
175 else {
176 _server = 0;
177 _sockets = 0;
178 }
179
180
181 QString nmeaFileName = settings.value("nmeaFile").toString();
182 if (nmeaFileName.isEmpty()) {
183 _nmeaFile = 0;
184 _nmeaStream = 0;
185 }
186 else {
187 expandEnvVar(nmeaFileName);
188 _nmeaFile = new QFile(nmeaFileName);
189 if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
190 _nmeaFile->open(QIODevice::WriteOnly | QIODevice::Append);
191 }
192 else {
193 _nmeaFile->open(QIODevice::WriteOnly);
194 }
195 _nmeaStream = new QTextStream();
196 _nmeaStream->setDevice(_nmeaFile);
197 QDateTime dateTime = QDateTime::currentDateTime().toUTC();
198 QString nmStr = "GPRMC," + dateTime.time().toString("hhmmss")
199 + ",A,,,,,,,"
200 + dateTime.date().toString("ddMMyy")
201 + ",,";
202
203 writeNMEAstr(nmStr);
204 }
205}
206
207// Destructor
208////////////////////////////////////////////////////////////////////////////
209bncModel::~bncModel() {
210 delete _nmeaStream;
211 delete _nmeaFile;
212 delete _server;
213 delete _sockets;
214}
215
216// New Connection
217////////////////////////////////////////////////////////////////////////////
218void bncModel::slotNewConnection() {
219 _sockets->push_back( _server->nextPendingConnection() );
220 emit( newMessage(QString("PPP: new connection on port: # %1")
221 .arg(_sockets->size()).toAscii(), true) );
222}
223
224// Bancroft Solution
225////////////////////////////////////////////////////////////////////////////
226t_irc bncModel::cmpBancroft(t_epoData* epoData) {
227
228 if (epoData->size() < MINOBS) {
229 _log += "\nNot enough data";
230 return failure;
231 }
232
233 Matrix BB(epoData->size(), 4);
234
235 QMapIterator<QString, t_satData*> it(epoData->satData);
236 int iObs = 0;
237 while (it.hasNext()) {
238 ++iObs;
239 it.next();
240 QString prn = it.key();
241 t_satData* satData = it.value();
242 BB(iObs, 1) = satData->xx(1);
243 BB(iObs, 2) = satData->xx(2);
244 BB(iObs, 3) = satData->xx(3);
245 BB(iObs, 4) = satData->P3 + satData->clk;
246 }
247
248 bancroft(BB, _xcBanc);
249
250 // Ellipsoidal Coordinates
251 // ------------------------
252 xyz2ell(_xcBanc.data(), _ellBanc.data());
253
254 // Compute Satellite Elevations
255 // ----------------------------
256 QMutableMapIterator<QString, t_satData*> it2(epoData->satData);
257 while (it2.hasNext()) {
258 it2.next();
259 QString prn = it2.key();
260 t_satData* satData = it2.value();
261
262 ColumnVector rr = satData->xx - _xcBanc.Rows(1,3);
263 double rho = rr.norm_Frobenius();
264
265 double neu[3];
266 xyz2neu(_ellBanc.data(), rr.data(), neu);
267
268 satData->eleSat = acos( sqrt(neu[0]*neu[0] + neu[1]*neu[1]) / rho );
269 if (neu[2] < 0) {
270 satData->eleSat *= -1.0;
271 }
272 satData->azSat = atan2(neu[1], neu[0]);
273
274 if (satData->eleSat < MINELE) {
275 delete satData;
276 it2.remove();
277 }
278 }
279
280 return success;
281}
282
283// Computed Value
284////////////////////////////////////////////////////////////////////////////
285double bncModel::cmpValue(t_satData* satData) {
286
287 ColumnVector xRec(3);
288 xRec(1) = x();
289 xRec(2) = y();
290 xRec(3) = z();
291
292 double rho0 = (satData->xx - xRec).norm_Frobenius();
293 double dPhi = t_CST::omega * rho0 / t_CST::c;
294
295 xRec(1) = x() * cos(dPhi) - y() * sin(dPhi);
296 xRec(2) = y() * cos(dPhi) + x() * sin(dPhi);
297 xRec(3) = z();
298
299 satData->rho = (satData->xx - xRec).norm_Frobenius();
300
301 double tropDelay = delay_saast(satData->eleSat) +
302 trp() / sin(satData->eleSat);
303
304 return satData->rho + clk() - satData->clk + tropDelay;
305}
306
307// Tropospheric Model (Saastamoinen)
308////////////////////////////////////////////////////////////////////////////
309double bncModel::delay_saast(double Ele) {
310
311 double height = _ellBanc(3);
312
313 double pp = 1013.25 * pow(1.0 - 2.26e-5 * height, 5.225);
314 double TT = 18.0 - height * 0.0065 + 273.15;
315 double hh = 50.0 * exp(-6.396e-4 * height);
316 double ee = hh / 100.0 * exp(-37.2465 + 0.213166*TT - 0.000256908*TT*TT);
317
318 double h_km = height / 1000.0;
319
320 if (h_km < 0.0) h_km = 0.0;
321 if (h_km > 5.0) h_km = 5.0;
322 int ii = int(h_km + 1);
323 double href = ii - 1;
324
325 double bCor[6];
326 bCor[0] = 1.156;
327 bCor[1] = 1.006;
328 bCor[2] = 0.874;
329 bCor[3] = 0.757;
330 bCor[4] = 0.654;
331 bCor[5] = 0.563;
332
333 double BB = bCor[ii-1] + (bCor[ii]-bCor[ii-1]) * (h_km - href);
334
335 double zen = M_PI/2.0 - Ele;
336
337 return (0.002277/cos(zen)) * (pp + ((1255.0/TT)+0.05)*ee - BB*(tan(zen)*tan(zen)));
338}
339
340// Prediction Step of the Filter
341////////////////////////////////////////////////////////////////////////////
342void bncModel::predict(t_epoData* epoData) {
343
344 if (_usePhase) {
345
346 // Make a copy of QQ and xx, set parameter indices
347 // -----------------------------------------------
348 SymmetricMatrix QQ_old = _QQ;
349
350 for (int iPar = 1; iPar <= _params.size(); iPar++) {
351 _params[iPar-1]->index_old = _params[iPar-1]->index;
352 _params[iPar-1]->index = 0;
353 }
354
355 // Remove Ambiguity Parameters without observations
356 // ------------------------------------------------
357 int iPar = 0;
358 QMutableVectorIterator<bncParam*> it(_params);
359 while (it.hasNext()) {
360 bncParam* par = it.next();
361 bool removed = false;
362 if (par->type == bncParam::AMB_L3) {
363 if (epoData->satData.find(par->prn) == epoData->satData.end()) {
364 removed = true;
365 delete par;
366 it.remove();
367 }
368 }
369 if (! removed) {
370 ++iPar;
371 par->index = iPar;
372 }
373 }
374
375 // Add new ambiguity parameters
376 // ----------------------------
377 QMapIterator<QString, t_satData*> itObs(epoData->satData);
378 while (itObs.hasNext()) {
379 itObs.next();
380 QString prn = itObs.key();
381 bool found = false;
382 for (int iPar = 1; iPar <= _params.size(); iPar++) {
383 if (_params[iPar-1]->type == bncParam::AMB_L3 &&
384 _params[iPar-1]->prn == prn) {
385 found = true;
386 break;
387 }
388 }
389 if (!found) {
390 bncParam* par = new bncParam(bncParam::AMB_L3, _params.size()+1, prn);
391 _params.push_back(par);
392 }
393 }
394
395 int nPar = _params.size();
396 _QQ.ReSize(nPar); _QQ = 0.0;
397 for (int i1 = 1; i1 <= nPar; i1++) {
398 bncParam* p1 = _params[i1-1];
399 if (p1->index_old != 0) {
400 _QQ(p1->index, p1->index) = QQ_old(p1->index_old, p1->index_old);
401 for (int i2 = 1; i2 <= nPar; i2++) {
402 bncParam* p2 = _params[i2-1];
403 if (p2->index_old != 0) {
404 _QQ(p1->index, p2->index) = QQ_old(p1->index_old, p2->index_old);
405 }
406 }
407 }
408 }
409
410 for (int ii = 1; ii <= nPar; ii++) {
411 bncParam* par = _params[ii-1];
412 if (par->index_old == 0) {
413 _QQ(par->index, par->index) = sig_amb_0 * sig_amb_0;
414 }
415 par->index_old = par->index;
416 }
417 }
418
419 // Coordinates
420 // -----------
421 if (_static) {
422 if (x() == 0.0 && y() == 0.0 && z() == 0.0) {
423 _params[0]->xx = _xcBanc(1);
424 _params[1]->xx = _xcBanc(2);
425 _params[2]->xx = _xcBanc(3);
426 }
427 }
428 else {
429 _params[0]->xx = _xcBanc(1);
430 _params[1]->xx = _xcBanc(2);
431 _params[2]->xx = _xcBanc(3);
432
433 _QQ(1,1) += sig_crd_p * sig_crd_p;
434 _QQ(2,2) += sig_crd_p * sig_crd_p;
435 _QQ(3,3) += sig_crd_p * sig_crd_p;
436 }
437
438 // Receiver Clocks
439 // ---------------
440 _params[3]->xx = _xcBanc(4);
441 for (int iPar = 1; iPar <= _params.size(); iPar++) {
442 _QQ(iPar, 4) = 0.0;
443 }
444 _QQ(4,4) = sig_clk_0 * sig_clk_0;
445
446 // Tropospheric Delay
447 // ------------------
448 if (_estTropo) {
449 _QQ(5,5) += sig_trp_p * sig_trp_p;
450 }
451}
452
453// Update Step of the Filter (currently just a single-epoch solution)
454////////////////////////////////////////////////////////////////////////////
455t_irc bncModel::update(t_epoData* epoData) {
456
457 _log = "Precise Point Positioning";
458
459 _time = epoData->tt;
460
461 SymmetricMatrix QQsav;
462 ColumnVector dx;
463 ColumnVector vv;
464
465 // Loop over all outliers
466 // ----------------------
467 do {
468
469 // Bancroft Solution
470 // -----------------
471 if (cmpBancroft(epoData) != success) {
472 _log += "\nBancroft failed";
473 emit newMessage(_log, false);
474 return failure;
475 }
476
477 if (epoData->size() < MINOBS) {
478 _log += "\nNot enough data";
479 emit newMessage(_log, false);
480 return failure;
481 }
482
483 // Status Prediction
484 // -----------------
485 predict(epoData);
486
487 // Create First-Design Matrix
488 // --------------------------
489 unsigned nPar = _params.size();
490 unsigned nObs = _usePhase ? 2 * epoData->size() : epoData->size();
491
492 Matrix AA(nObs, nPar); // first design matrix
493 ColumnVector ll(nObs); // tems observed-computed
494 SymmetricMatrix PP(nObs); PP = 0.0;
495
496 unsigned iObs = 0;
497 QMapIterator<QString, t_satData*> itObs(epoData->satData);
498 while (itObs.hasNext()) {
499 ++iObs;
500 itObs.next();
501 QString prn = itObs.key();
502 t_satData* satData = itObs.value();
503
504 double rhoCmp = cmpValue(satData);
505
506 double ellWgtCoeff = 1.0;
507 //// double eleD = satData->eleSat * 180.0 / M_PI;
508 //// if (eleD < 25.0) {
509 //// ellWgtCoeff = 2.5 - (eleD - 10.0) * 0.1;
510 //// ellWgtCoeff *= ellWgtCoeff;
511 //// }
512
513 ll(iObs) = satData->P3 - rhoCmp;
514 PP(iObs,iObs) = 1.0 / (sig_P3 * sig_P3) / ellWgtCoeff;
515 for (int iPar = 1; iPar <= _params.size(); iPar++) {
516 AA(iObs, iPar) = _params[iPar-1]->partial(satData, "");
517 }
518
519 if (_usePhase) {
520 ++iObs;
521 ll(iObs) = satData->L3 - rhoCmp;
522 PP(iObs,iObs) = 1.0 / (sig_L3 * sig_L3) / ellWgtCoeff;
523 for (int iPar = 1; iPar <= _params.size(); iPar++) {
524 if (_params[iPar-1]->type == bncParam::AMB_L3 &&
525 _params[iPar-1]->prn == prn) {
526 ll(iObs) -= _params[iPar-1]->xx;
527 }
528 AA(iObs, iPar) = _params[iPar-1]->partial(satData, prn);
529 }
530 }
531 }
532
533 // Compute Filter Update
534 // ---------------------
535 QQsav = _QQ;
536
537 Matrix ATP = AA.t() * PP;
538 SymmetricMatrix NN = _QQ.i();
539 NN << NN + ATP * AA;
540 _QQ = NN.i();
541 dx = _QQ * ATP * ll;
542 vv = ll - AA * dx;
543
544 } while (outlierDetection(QQsav, vv, epoData->satData) != 0);
545
546 // Set Solution Vector
547 // -------------------
548 ostringstream str1;
549 str1.setf(ios::fixed);
550 QVectorIterator<bncParam*> itPar(_params);
551 while (itPar.hasNext()) {
552 bncParam* par = itPar.next();
553 par->xx += dx(par->index);
554 if (par->type == bncParam::RECCLK) {
555 str1 << "\n clk = " << setw(6) << setprecision(3) << par->xx
556 << " +- " << setw(6) << setprecision(3)
557 << sqrt(_QQ(par->index,par->index));
558 }
559 else if (par->type == bncParam::AMB_L3) {
560 str1 << "\n amb " << par->prn.toAscii().data() << " = "
561 << setw(6) << setprecision(3) << par->xx
562 << " +- " << setw(6) << setprecision(3)
563 << sqrt(_QQ(par->index,par->index));
564 }
565 }
566 _log += str1.str().c_str();
567
568 // Message (both log file and screen)
569 // ----------------------------------
570 ostringstream str2;
571 str2.setf(ios::fixed);
572 str2 << _staID.data() << ": PPP "
573 << epoData->tt.timestr(1) << " " << epoData->size() << " "
574 << setw(14) << setprecision(3) << x() << " +- "
575 << setw(6) << setprecision(3) << sqrt(_QQ(1,1)) << " "
576 << setw(14) << setprecision(3) << y() << " +- "
577 << setw(6) << setprecision(3) << sqrt(_QQ(2,2)) << " "
578 << setw(14) << setprecision(3) << z() << " +- "
579 << setw(6) << setprecision(3) << sqrt(_QQ(3,3));
580 if (_estTropo) {
581 str2 << " " << setw(6) << setprecision(3) << trp() << " +- "
582 << setw(6) << setprecision(3) << sqrt(_QQ(5,5));
583 }
584
585 emit newMessage(_log, false);
586 emit newMessage(QByteArray(str2.str().c_str()), true);
587
588 // NMEA Output
589 // -----------
590 if (_nmeaStream || _sockets) {
591 double xyz[3];
592 xyz[0] = x();
593 xyz[1] = y();
594 xyz[2] = z();
595 double ell[3];
596 xyz2ell(xyz, ell);
597 double phiDeg = ell[0] * 180 / M_PI;
598 double lamDeg = ell[1] * 180 / M_PI;
599
600 char phiCh = 'N';
601 if (phiDeg < 0) {
602 phiDeg = -phiDeg;
603 phiCh = 'S';
604 }
605 char lamCh = 'E';
606 if (lamDeg < 0) {
607 lamDeg = -lamDeg;
608 lamCh = 'W';
609 }
610
611 double dop = 2.0; // TODO
612
613 ostringstream str3;
614 str3.setf(ios::fixed);
615 str3 << "GPGGA,"
616 << epoData->tt.timestr(0,0) << ','
617 << setw(2) << setfill('0') << int(phiDeg)
618 << setw(10) << setprecision(7) << setfill('0')
619 << fmod(60*phiDeg,60) << ',' << phiCh << ','
620 << setw(2) << setfill('0') << int(lamDeg)
621 << setw(10) << setprecision(7) << setfill('0')
622 << fmod(60*lamDeg,60) << ',' << lamCh
623 << ",1," << setw(2) << setfill('0') << epoData->size() << ','
624 << setw(3) << setprecision(1) << dop << ','
625 << setprecision(3) << ell[2] << ",M,0.0,M,,,";
626
627 writeNMEAstr(QString(str3.str().c_str()));
628 }
629
630 return success;
631}
632
633// Outlier Detection
634////////////////////////////////////////////////////////////////////////////
635int bncModel::outlierDetection(const SymmetricMatrix& QQsav,
636 const ColumnVector& vv,
637 QMap<QString, t_satData*>& satData) {
638
639 double vvMaxCode = 0.0;
640 double vvMaxPhase = 0.0;
641 QMutableMapIterator<QString, t_satData*> itMaxCode(satData);
642 QMutableMapIterator<QString, t_satData*> itMaxPhase(satData);
643
644 int ii = 0;
645 QMutableMapIterator<QString, t_satData*> it(satData);
646 while (it.hasNext()) {
647 it.next();
648 ++ii;
649
650 if (vvMaxCode == 0.0 || fabs(vv(ii)) > vvMaxCode) {
651 vvMaxCode = fabs(vv(ii));
652 itMaxCode = it;
653 }
654
655 if (_usePhase) {
656 ++ii;
657 if (vvMaxPhase == 0.0 || fabs(vv(ii)) > vvMaxPhase) {
658 vvMaxPhase = fabs(vv(ii));
659 itMaxPhase = it;
660 }
661 }
662 }
663
664 if (vvMaxCode > MAXRES_CODE) {
665 QString prn = itMaxCode.key();
666 t_satData* satData = itMaxCode.value();
667 delete satData;
668 itMaxCode.remove();
669 _QQ = QQsav;
670
671 _log += "\nOutlier Code " + prn.toAscii() + " "
672 + QByteArray::number(vvMaxCode, 'f', 3);
673
674 return 1;
675 }
676 else if (vvMaxPhase > MAXRES_PHASE) {
677 QString prn = itMaxPhase.key();
678 t_satData* satData = itMaxPhase.value();
679 delete satData;
680 itMaxPhase.remove();
681 _QQ = QQsav;
682
683 _log += "\nOutlier Phase " + prn.toAscii() + " "
684 + QByteArray::number(vvMaxPhase, 'f', 3);
685
686 return 1;
687 }
688
689 return 0;
690}
691
692//
693////////////////////////////////////////////////////////////////////////////
694void bncModel::writeNMEAstr(const QString& nmStr) {
695
696 unsigned char XOR = 0;
697 for (int ii = 0; ii < nmStr.length(); ii++) {
698 XOR ^= (unsigned char) nmStr[ii].toAscii();
699 }
700
701 if (_nmeaStream) {
702 *_nmeaStream << '$' << nmStr << '*' << hex << (int) XOR << endl;
703 _nmeaStream->flush();
704 }
705
706 if (_sockets) {
707 QMutableListIterator<QTcpSocket*> is(*_sockets);
708 while (is.hasNext()) {
709 QTcpSocket* sock = is.next();
710 if (sock->state() == QAbstractSocket::ConnectedState) {
711 QTextStream ts(sock);
712 ts << '$' << nmStr << '*' << hex << (int) XOR << endl;
713 ts.flush();
714 }
715 else if (sock->state() != QAbstractSocket::ConnectingState) {
716 delete sock;
717 is.remove();
718 }
719 }
720 }
721}
Note: See TracBrowser for help on using the repository browser.