Changeset 11123 in ntrip for trunk/BNC/src/bncantex.cpp
- Timestamp:
- Oct 23, 2026, 4:52:02 PM (6 hours ago)
- File:
-
- 1 edited
-
trunk/BNC/src/bncantex.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/bncantex.cpp
r11110 r11123 1110 1110 } 1111 1111 1112 // GPS week of the file from the SINEX code of the satellite entries 1113 // (e.g. IGS20_2437): the week occurring most often 1114 //////////////////////////////////////////////////////////////////////////// 1115 int bncAntex::gpsWeek() const { 1116 static const QRegularExpression re("_(\\d{4})$"); 1117 QMap<int, int> count; 1118 QMapIterator<QString, QVector<t_antMap*> > it(_satMaps); 1119 while (it.hasNext()) { 1120 it.next(); 1121 for (const t_antMap* map : it.value()) { 1122 QRegularExpressionMatch mm = re.match(map->snxCode.trimmed()); 1123 if (mm.hasMatch()) { 1124 count[mm.captured(1).toInt()] += 1; 1125 } 1126 } 1127 } 1128 int week = 0, num = 0; 1129 QMapIterator<int, int> itC(count); 1130 while (itC.hasNext()) { 1131 itC.next(); 1132 if (itC.value() > num) { 1133 week = itC.key(); 1134 num = itC.value(); 1135 } 1136 } 1137 return week; 1138 } 1139 1140 // Take over the attitude model states and warnings of another instance 1141 //////////////////////////////////////////////////////////////////////////// 1142 void bncAntex::takeStates(const bncAntex& other) { 1143 _glonassYaw = other._glonassYaw; 1144 _gpsYaw = other._gpsYaw; 1145 _onYaw = other._onYaw; 1146 _noSatEntryWarned = other._noSatEntryWarned; 1147 } 1148 1149 // Re-read the ANTEX file while running 1150 //////////////////////////////////////////////////////////////////////////// 1151 bncAntexReloader::bncAntexReloader() { 1152 _fileSize = 0; 1153 _init = false; 1154 _pending = 0; 1155 _pendingWeek = 0; 1156 } 1157 1158 bncAntexReloader::~bncAntexReloader() { 1159 delete _pending; 1160 } 1161 1162 QString bncAntexReloader::update(bncAntex*& antex, const bncTime& epoch) { 1163 if (!antex || antex->fileName().isEmpty()) { 1164 return QString(); 1165 } 1166 QString msg; 1167 QDateTime now = QDateTime::currentDateTimeUtc(); 1168 if (!_init) { 1169 QFileInfo fi(antex->fileName()); 1170 _fileTime = fi.lastModified(); 1171 _fileSize = fi.size(); 1172 _lastCheck = now; 1173 _init = true; 1174 } 1175 1176 // file changed? 1177 if (_lastCheck.secsTo(now) >= 60) { 1178 _lastCheck = now; 1179 QFileInfo fi(antex->fileName()); 1180 // read only once the file has not changed for 30 s (copy finished) 1181 if (fi.exists() && (fi.lastModified() != _fileTime || fi.size() != _fileSize) && 1182 fi.lastModified().secsTo(now) >= 30) { 1183 _fileTime = fi.lastModified(); 1184 _fileSize = fi.size(); 1185 bncAntex* newAntex = new bncAntex(); 1186 if (newAntex->readFile(antex->fileName()) != success || newAntex->numSatPrns() == 0) { 1187 delete newAntex; 1188 msg = "ANTEX file " + antex->fileName() + " changed but could not be read - previous file kept"; 1189 } 1190 else { 1191 int week = newAntex->gpsWeek(); 1192 delete _pending; 1193 _pending = newAntex; 1194 _pendingWeek = week; 1195 if (epoch.valid() && week > int(epoch.gpsw())) { 1196 msg = QString("ANTEX file %1 changed (GPS week %2) - used from GPS week %2 on") 1197 .arg(antex->fileName()).arg(week); 1198 } 1199 } 1200 } 1201 } 1202 1203 // pending file due? 1204 if (_pending && (!epoch.valid() || _pendingWeek <= int(epoch.gpsw()))) { 1205 _pending->takeStates(*antex); 1206 delete antex; 1207 antex = _pending; 1208 _pending = 0; 1209 if (!msg.isEmpty()) msg += "; "; 1210 msg += QString("ANTEX file re-read, used from now on (GPS week %1): ").arg(_pendingWeek) + antex->info(); 1211 } 1212 return msg; 1213 } 1214 1112 1215 // True if a missing satellite antenna entry has to be reported (at most once 1113 1216 // per hour and PRN)
Note:
See TracChangeset
for help on using the changeset viewer.
