Changeset 7889 in ntrip for trunk/BNC/src/upload
- Timestamp:
- Apr 28, 2016, 1:04:18 PM (9 years ago)
- Location:
- trunk/BNC/src/upload
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/upload/bncephuploadcaster.cpp
r7717 r7889 27 27 bncEphUploadCaster::bncEphUploadCaster() : bncEphUser(true) { 28 28 bncSettings settings; 29 int sampl = settings.value("uploadSamplRtcmEph").toInt(); 29 30 30 QString mountpoint = settings.value("uploadEphMountpoint").toString(); 31 if (mountpoint.isEmpty()) { 32 _ephUploadCaster = 0; 33 } 34 else { 35 QString outHost = settings.value("uploadEphHost").toString(); 36 int outPort = settings.value("uploadEphPort").toInt(); 37 QString password = settings.value("uploadEphPassword").toString(); 38 int sampl = settings.value("uploadEphSample").toInt(); 31 // List of upload casters 32 // ---------------------- 33 int iRow = -1; 34 QListIterator<QString> it(settings.value("uploadEphMountpointsOut").toStringList()); 35 while (it.hasNext()) { 36 QStringList hlp = it.next().split(","); 37 if (hlp.size() > 3) { 38 ++iRow; 39 int outPort = hlp[1].toInt(); 40 bncUploadCaster* newCaster = new bncUploadCaster(hlp[2], hlp[0], outPort, 41 hlp[3], iRow, sampl); 39 42 40 _ephUploadCaster = new bncUploadCaster(mountpoint, outHost, outPort,41 password, -1, sampl);43 connect(newCaster, SIGNAL(newBytes(QByteArray,double)), 44 this, SIGNAL(newBytes(QByteArray,double))); 42 45 43 connect(_ephUploadCaster, SIGNAL(newBytes(QByteArray,double)), 44 this, SIGNAL(newBytes(QByteArray,double))); 45 46 _ephUploadCaster->start(); 46 newCaster->start(); 47 _casters.push_back(newCaster); 48 } 47 49 } 48 50 } … … 51 53 //////////////////////////////////////////////////////////////////////////// 52 54 bncEphUploadCaster::~bncEphUploadCaster() { 53 if (_ephUploadCaster) {54 _ ephUploadCaster->deleteSafely();55 for (int ic = 0; ic < _casters.size(); ic++) { 56 _casters[ic]->deleteSafely(); 55 57 } 56 58 } … … 59 61 //////////////////////////////////////////////////////////////////////////// 60 62 void bncEphUploadCaster::ephBufferChanged() { 61 if (_ephUploadCaster) { 62 QByteArray outBuffer; 63 bncSettings settings; 64 int iRow = -1; 65 QListIterator<QString> it(settings.value("uploadEphMountpointsOut").toStringList()); 66 while (it.hasNext()) { 67 QStringList hlp = it.next().split(","); 68 if (hlp.size() > 3) { 69 ++iRow; 70 QString system = hlp[4]; 71 QByteArray outBuffer; 63 72 64 QDateTime now = currentDateAndTimeGPS();65 bncTime currentTime(now.toString(Qt::ISODate).toStdString());73 QDateTime now = currentDateAndTimeGPS(); 74 bncTime currentTime(now.toString(Qt::ISODate).toStdString()); 66 75 67 QListIterator<QString> it(prnList());68 while (it.hasNext()) {69 const t_eph* eph = ephLast(it.next());76 QListIterator<QString> it(prnList()); 77 while (it.hasNext()) { 78 const t_eph* eph = ephLast(it.next()); 70 79 71 bncTime toc = eph->TOC();72 double timeDiff = fabs(toc - currentTime);80 bncTime toc = eph->TOC(); 81 double timeDiff = fabs(toc - currentTime); 73 82 74 const t_ephGPS* ephGPS = dynamic_cast<const t_ephGPS*>(eph);75 const t_ephGlo* ephGlo = dynamic_cast<const t_ephGlo*>(eph);76 const t_ephGal* ephGal = dynamic_cast<const t_ephGal*>(eph);77 const t_ephSBAS* ephSBAS = dynamic_cast<const t_ephSBAS*>(eph);78 const t_ephBDS* ephBDS = dynamic_cast<const t_ephBDS*>(eph);83 const t_ephGPS* ephGPS = dynamic_cast<const t_ephGPS*>(eph); 84 const t_ephGlo* ephGlo = dynamic_cast<const t_ephGlo*>(eph); 85 const t_ephGal* ephGal = dynamic_cast<const t_ephGal*>(eph); 86 const t_ephSBAS* ephSBAS = dynamic_cast<const t_ephSBAS*>(eph); 87 const t_ephBDS* ephBDS = dynamic_cast<const t_ephBDS*>(eph); 79 88 80 unsigned char Array[80];81 int size = 0;89 unsigned char Array[80]; 90 int size = 0; 82 91 83 if (ephGPS) { 84 if (timeDiff <= 4*3600) { 85 size = t_ephEncoder::RTCM3(*ephGPS, Array); 92 if (ephGPS && ephGPS->type() == t_eph::GPS && 93 (system == "ALL" || system == "GPS")) { 94 if (timeDiff <= 4*3600) { 95 size = t_ephEncoder::RTCM3(*ephGPS, Array); 96 } 97 } 98 else if (ephGPS && ephGPS->type() == t_eph::QZSS && 99 (system == "ALL" || system == "QZSS")) { 100 if (timeDiff <= 4*3600) { 101 size = t_ephEncoder::RTCM3(*ephGPS, Array); 102 } 103 } 104 else if (ephGlo && (system == "ALL" || system == "GLONASS")) { 105 if (timeDiff <= 1*3600) { 106 size = t_ephEncoder::RTCM3(*ephGlo, Array); 107 } 108 } 109 else if (ephGal && (system == "ALL" || system == "Galileo")) { 110 if (timeDiff <= 4*3600) { 111 size = t_ephEncoder::RTCM3(*ephGal, Array); 112 } 113 } 114 else if (ephSBAS && (system == "ALL" || system == "SBAS")) { 115 if (timeDiff <= 600) { 116 size = t_ephEncoder::RTCM3(*ephSBAS, Array); 117 } 118 } 119 else if (ephBDS && (system == "ALL" || system == "BDS")) { 120 if (timeDiff <= 6*3600) { 121 size = t_ephEncoder::RTCM3(*ephBDS, Array); 122 } 123 } 124 if (size > 0) { 125 outBuffer += QByteArray((char*) Array, size); 86 126 } 87 127 } 88 else if (ephGlo) { 89 if (timeDiff <= 1*3600) { 90 size = t_ephEncoder::RTCM3(*ephGlo, Array); 91 } 128 if (outBuffer.size() > 0) { 129 _casters.at(iRow)->setOutBuffer(outBuffer); 92 130 } 93 else if (ephGal) {94 if (timeDiff <= 4*3600) {95 size = t_ephEncoder::RTCM3(*ephGal, Array);96 }97 }98 else if (ephSBAS) {99 if (timeDiff <= 600) {100 size = t_ephEncoder::RTCM3(*ephSBAS, Array);101 }102 }103 else if (ephBDS) {104 if (timeDiff <= 6*3600) {105 size = t_ephEncoder::RTCM3(*ephBDS, Array);106 }107 }108 if (size > 0) {109 outBuffer += QByteArray((char*) Array, size);110 }111 }112 if (outBuffer.size() > 0) {113 _ephUploadCaster->setOutBuffer(outBuffer);114 131 } 115 132 } -
trunk/BNC/src/upload/bncephuploadcaster.h
r3254 r7889 16 16 virtual void ephBufferChanged(); 17 17 private: 18 bncUploadCaster* _ephUploadCaster; 18 // bncUploadCaster* _ephUploadCaster; 19 QVector<bncUploadCaster*> _casters; 19 20 }; 20 21
Note:
See TracChangeset
for help on using the changeset viewer.