Changeset 5524 in ntrip for trunk/BNC/src
- Timestamp:
- Nov 6, 2013, 2:01:59 PM (11 years ago)
- Location:
- trunk/BNC/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/bnccaster.cpp
r5070 r5524 175 175 // New Observations 176 176 //////////////////////////////////////////////////////////////////////////// 177 void bncCaster:: newObs(const QByteArray staID, bool firstObs, t_obs obs) {177 void bncCaster::slotNewObs(const QByteArray staID, QList<t_obs> obsList) { 178 178 179 179 QMutexLocker locker(&_mutex); 180 180 181 long iSec = long(floor(obs.GPSWeeks+0.5)); 182 long newTime = obs.GPSWeek * 7*24*3600 + iSec; 183 184 // Rename the Station 185 // ------------------ 186 strncpy(obs.StatID, staID.constData(),sizeof(obs.StatID)); 187 obs.StatID[sizeof(obs.StatID)-1] = '\0'; 188 189 // Output into the socket 190 // ---------------------- 191 if (_uSockets) { 192 193 ostringstream oStr; 194 oStr.setf(ios::showpoint | ios::fixed); 195 oStr << obs.StatID << " " 196 << obs.GPSWeek << " " 197 << setprecision(7) << obs.GPSWeeks << " " 198 << bncRinex::asciiSatLine(obs) << endl; 199 200 string hlpStr = oStr.str(); 201 202 QMutableListIterator<QTcpSocket*> is(*_uSockets); 203 while (is.hasNext()) { 204 QTcpSocket* sock = is.next(); 205 if (sock->state() == QAbstractSocket::ConnectedState) { 206 int numBytes = hlpStr.length(); 207 if (myWrite(sock, hlpStr.c_str(), numBytes) != numBytes) { 181 long newTime = 0; 182 QMutableListIterator<t_obs> it(obsList); 183 while (it.hasNext()) { 184 185 t_obs& obs = it.next(); 186 187 long iSec = long(floor(obs.GPSWeeks+0.5)); 188 newTime = obs.GPSWeek * 7*24*3600 + iSec; 189 190 // Rename the Station 191 // ------------------ 192 strncpy(obs.StatID, staID.constData(),sizeof(obs.StatID)); 193 obs.StatID[sizeof(obs.StatID)-1] = '\0'; 194 195 // Output into the socket 196 // ---------------------- 197 if (_uSockets) { 198 199 ostringstream oStr; 200 oStr.setf(ios::showpoint | ios::fixed); 201 oStr << obs.StatID << " " 202 << obs.GPSWeek << " " 203 << setprecision(7) << obs.GPSWeeks << " " 204 << bncRinex::asciiSatLine(obs) << endl; 205 206 string hlpStr = oStr.str(); 207 208 QMutableListIterator<QTcpSocket*> is(*_uSockets); 209 while (is.hasNext()) { 210 QTcpSocket* sock = is.next(); 211 if (sock->state() == QAbstractSocket::ConnectedState) { 212 int numBytes = hlpStr.length(); 213 if (myWrite(sock, hlpStr.c_str(), numBytes) != numBytes) { 214 delete sock; 215 is.remove(); 216 } 217 } 218 else if (sock->state() != QAbstractSocket::ConnectingState) { 208 219 delete sock; 209 220 is.remove(); 210 221 } 211 222 } 212 else if (sock->state() != QAbstractSocket::ConnectingState) { 213 delete sock; 214 is.remove(); 215 } 216 } 217 } 218 219 // First time, set the _lastDumpSec immediately 220 // -------------------------------------------- 221 if (_lastDumpSec == 0) { 222 _lastDumpSec = newTime - 1; 223 } 224 225 // An old observation - throw it away 226 // ---------------------------------- 227 if (newTime <= _lastDumpSec) { 228 if (firstObs) { 223 } 224 225 // First time, set the _lastDumpSec immediately 226 // -------------------------------------------- 227 if (_lastDumpSec == 0) { 228 _lastDumpSec = newTime - 1; 229 } 230 231 // An old observation - throw it away 232 // ---------------------------------- 233 if (newTime <= _lastDumpSec) { 229 234 bncSettings settings; 230 235 if ( !settings.value("outFile").toString().isEmpty() || 231 236 !settings.value("outPort").toString().isEmpty() ) { 232 233 234 237 238 QTime enomtime = QTime(0,0,0).addSecs(iSec); 239 235 240 emit( newMessage(QString("%1: Old epoch %2 (%3) thrown away") 236 237 238 239 } 240 }241 return;242 }243 244 // Save the observation245 // --------------------246 _epochs->insert(newTime, obs);241 .arg(staID.data()).arg(iSec) 242 .arg(enomtime.toString("HH:mm:ss")) 243 .toAscii(), true) ); 244 } 245 return; 246 } 247 248 // Save the observation 249 // -------------------- 250 _epochs->insert(newTime, obs); 251 } 247 252 248 253 // Dump Epochs … … 279 284 280 285 qRegisterMetaType<t_obs>("t_obs"); 286 qRegisterMetaType< QList<t_obs> >("QList<t_obs>"); 281 287 qRegisterMetaType<gpsephemeris>("gpsephemeris"); 282 288 qRegisterMetaType<glonassephemeris>("glonassephemeris"); 283 289 qRegisterMetaType<galileoephemeris>("galileoephemeris"); 284 290 285 connect(getThread, SIGNAL(newObs(QByteArray, bool, t_obs)),286 this, SLOT( newObs(QByteArray, bool, t_obs)));291 connect(getThread, SIGNAL(newObs(QByteArray, QList<t_obs>)), 292 this, SLOT(slotNewObs(QByteArray, QList<t_obs>))); 287 293 288 294 #ifdef RTROVER_INTERFACE 289 295 if (_bncRtrover) { 290 connect(getThread, SIGNAL(newObs(QByteArray, bool, t_obs)),291 _bncRtrover, SLOT(slotNewObs(QByteArray, bool, t_obs)));296 connect(getThread, SIGNAL(newObs(QByteArray, QList<t_obs>)), 297 _bncRtrover, SLOT(slotNewObs(QByteArray, QList<t_obs>))); 292 298 } 293 299 #endif -
trunk/BNC/src/bnccaster.h
r4763 r5524 48 48 49 49 public slots: 50 void newObs(QByteArray staID, bool firstObs, t_obs obs);50 void slotNewObs(QByteArray staID, QList<t_obs> obsList); 51 51 void slotNewNMEAstr(QByteArray str); 52 52 -
trunk/BNC/src/bncgetthread.cpp
r5364 r5524 45 45 #include <QFile> 46 46 #include <QTextStream> 47 #include <QMutex> 47 48 #include <QtNetwork> 48 49 #include <QTime> … … 498 499 // ------------------------------------------------ 499 500 QListIterator<t_obs> it(decoder()->_obsList); 500 bool firstObs = true; 501 502 QList<t_obs> obsListHlp; 503 501 504 while (it.hasNext()) { 502 505 const t_obs& obs = it.next(); … … 550 553 } 551 554 #endif 552 553 // Emit new observation signal 554 // --------------------------- 555 if (!_isToBeDeleted) { 556 emit newObs(_staID, firstObs, obs); 557 } 558 firstObs = false; 559 } 555 // Save observations 556 // ----------------- 557 obsListHlp.append(obs); 558 } 559 560 // Emit signal 561 // ----------- 562 if (!_isToBeDeleted && obsListHlp.size() > 0) { 563 emit newObs(_staID, obsListHlp); 564 } 565 560 566 decoder()->_obsList.clear(); 561 567 } -
trunk/BNC/src/bncgetthread.h
r4763 r5524 78 78 void newBytes(QByteArray staID, double nbyte); 79 79 void newLatency(QByteArray staID, double clate); 80 void newObs(QByteArray staID, bool firstObs, t_obs obs);80 void newObs(QByteArray staID, QList<t_obs> obsList); 81 81 void newAntCrd(QByteArray staID, double xx, double yy, double zz, 82 82 double hh, QByteArray antType);
Note:
See TracChangeset
for help on using the changeset viewer.