MCPcopy Create free account
hub / github.com/BatchDrake/SigDigger / registerTLE

Method registerTLE

Suscan/Library.cpp:849–885  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

847}
848
849bool
850Singleton::registerTLE(std::string const &tleData)
851{
852 Orbit newOrbit;
853 const char *userTLEDir;
854 QString fullTLEPath;
855
856 if (newOrbit.loadFromTLE(tleData)) {
857 // Valid TLE file, overwrite current TLE
858 if ((userTLEDir = suscan_confdb_get_local_tle_path()) == nullptr)
859 return false;
860
861 fullTLEPath =
862 userTLEDir + QString("/")
863 + normalizeTLEName(newOrbit.nameToQString()) + ".tle";
864
865 // Attempt to save it. If we could
866 QFile qFile(fullTLEPath);
867 if (qFile.open(QIODevice::WriteOnly)) {
868 bool ok;
869 QTextStream out(&qFile);
870 out << QString::fromStdString(tleData);
871 out.flush();
872
873 ok = !qFile.error();
874
875 qFile.close();
876
877 if (ok) {
878 this->satellites[newOrbit.nameToQString()] = newOrbit;
879 return true;
880 }
881 }
882 }
883
884 return false;
885}
886
887bool
888Singleton::registerTLESource(TLESource const& tleSrc)

Callers 1

extractTLEsMethod · 0.80

Calls 5

loadFromTLEMethod · 0.80
nameToQStringMethod · 0.80
openMethod · 0.80
flushMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected