fix for host build

This commit is contained in:
2023-02-21 21:37:30 +01:00
parent e416d94224
commit a1cb4fb549
5 changed files with 40 additions and 29 deletions

View File

@ -14,9 +14,10 @@
using namespace returnvalue;
TmStore::TmStore(object_id_t objectId, const char* baseDir, std::string baseName,
RolloverInterval intervalUnit, uint32_t intervalCount, timeval& currentTv,
StorageManagerIF& tmStore, SdCardMountedIF& sdcMan)
PersistentTmStore::PersistentTmStore(object_id_t objectId, const char* baseDir,
std::string baseName, RolloverInterval intervalUnit,
uint32_t intervalCount, timeval& currentTv,
StorageManagerIF& tmStore, SdCardMountedIF& sdcMan)
: SystemObject(objectId),
baseDir(baseDir),
baseName(std::move(baseName)),
@ -27,7 +28,8 @@ TmStore::TmStore(object_id_t objectId, const char* baseDir, std::string baseName
calcDiffSeconds(intervalUnit, intervalCount);
}
ReturnValue_t TmStore::handleCommandQueue(StorageManagerIF& ipcStore, TmFunnelBase& tmFunnel) {
ReturnValue_t PersistentTmStore::handleCommandQueue(StorageManagerIF& ipcStore,
TmFunnelBase& tmFunnel) {
CommandMessage cmdMessage;
ReturnValue_t result = tcQueue->receiveMessage(&cmdMessage);
if (result == MessageQueueIF::EMPTY) {
@ -63,7 +65,7 @@ ReturnValue_t TmStore::handleCommandQueue(StorageManagerIF& ipcStore, TmFunnelBa
return returnvalue::OK;
}
ReturnValue_t TmStore::passPacket(PusTmReader& reader) {
ReturnValue_t PersistentTmStore::passPacket(PusTmReader& reader) {
bool inApidList = false;
if (filter.apid) {
auto& apidFilter = filter.apid.value();
@ -98,11 +100,11 @@ ReturnValue_t TmStore::passPacket(PusTmReader& reader) {
return returnvalue::OK;
}
void TmStore::dumpFrom(uint32_t fromUnixSeconds, TmFunnelBase& tmFunnel) {
void PersistentTmStore::dumpFrom(uint32_t fromUnixSeconds, TmFunnelBase& tmFunnel) {
return dumpFromUpTo(fromUnixSeconds, currentTv.tv_sec, tmFunnel);
}
ReturnValue_t TmStore::storePacket(PusTmReader& reader) {
ReturnValue_t PersistentTmStore::storePacket(PusTmReader& reader) {
using namespace std::filesystem;
if (baseDirUninitialized) {
updateBaseDir();
@ -137,9 +139,9 @@ ReturnValue_t TmStore::storePacket(PusTmReader& reader) {
return returnvalue::OK;
}
MessageQueueId_t TmStore::getCommandQueue() const { return tcQueue->getId(); }
MessageQueueId_t PersistentTmStore::getCommandQueue() const { return tcQueue->getId(); }
void TmStore::calcDiffSeconds(RolloverInterval intervalUnit, uint32_t intervalCount) {
void PersistentTmStore::calcDiffSeconds(RolloverInterval intervalUnit, uint32_t intervalCount) {
if (intervalUnit == RolloverInterval::MINUTELY) {
rolloverDiffSeconds = 60 * intervalCount;
} else if (intervalUnit == RolloverInterval::HOURLY) {
@ -149,7 +151,7 @@ void TmStore::calcDiffSeconds(RolloverInterval intervalUnit, uint32_t intervalCo
}
}
void TmStore::updateBaseDir() {
void PersistentTmStore::updateBaseDir() {
using namespace std::filesystem;
std::string currentPrefix = sdcMan.getCurrentMountPrefix();
basePath = path(currentPrefix) / baseDir / baseName;
@ -159,7 +161,7 @@ void TmStore::updateBaseDir() {
baseDirUninitialized = false;
}
void TmStore::assignAndOrCreateMostRecentFile() {
void PersistentTmStore::assignAndOrCreateMostRecentFile() {
using namespace std::filesystem;
for (auto const& file : directory_iterator(basePath)) {
if (file.is_directory()) {
@ -204,7 +206,7 @@ void TmStore::assignAndOrCreateMostRecentFile() {
}
}
void TmStore::addApid(uint16_t apid) {
void PersistentTmStore::addApid(uint16_t apid) {
if (not filter.apid) {
filter.apid = std::vector<uint16_t>({apid});
return;
@ -212,7 +214,7 @@ void TmStore::addApid(uint16_t apid) {
filter.apid.value().push_back(apid);
}
void TmStore::addService(uint8_t service) {
void PersistentTmStore::addService(uint8_t service) {
if (not filter.services) {
filter.services = std::vector<uint8_t>({service});
return;
@ -220,7 +222,7 @@ void TmStore::addService(uint8_t service) {
filter.services.value().push_back(service);
}
void TmStore::addServiceSubservice(uint8_t service, uint8_t subservice) {
void PersistentTmStore::addServiceSubservice(uint8_t service, uint8_t subservice) {
if (not filter.serviceSubservices) {
filter.serviceSubservices =
std::vector<std::pair<uint8_t, uint8_t>>({std::pair(service, subservice)});
@ -229,7 +231,7 @@ void TmStore::addServiceSubservice(uint8_t service, uint8_t subservice) {
filter.serviceSubservices.value().emplace_back(service, subservice);
}
void TmStore::deleteUpTo(uint32_t unixSeconds) {
void PersistentTmStore::deleteUpTo(uint32_t unixSeconds) {
using namespace std::filesystem;
for (auto const& file : directory_iterator(basePath)) {
if (file.is_directory() or
@ -250,8 +252,8 @@ void TmStore::deleteUpTo(uint32_t unixSeconds) {
}
}
void TmStore::dumpFromUpTo(uint32_t fromUnixSeconds, uint32_t upToUnixSeconds,
TmFunnelBase& funnel) {
void PersistentTmStore::dumpFromUpTo(uint32_t fromUnixSeconds, uint32_t upToUnixSeconds,
TmFunnelBase& funnel) {
using namespace std::filesystem;
for (auto const& file : directory_iterator(basePath)) {
if (file.is_directory()) {
@ -277,7 +279,7 @@ void TmStore::dumpFromUpTo(uint32_t fromUnixSeconds, uint32_t upToUnixSeconds,
}
}
void TmStore::pathToTod(const std::filesystem::path& path, Clock::TimeOfDay_t& tod) {
void PersistentTmStore::pathToTod(const std::filesystem::path& path, Clock::TimeOfDay_t& tod) {
auto pathStr = path.string();
size_t splitChar = pathStr.find('_');
auto timeOnlyStr = pathStr.substr(splitChar);
@ -286,8 +288,8 @@ void TmStore::pathToTod(const std::filesystem::path& path, Clock::TimeOfDay_t& t
&tod.year, &tod.month, &tod.day, &tod.hour, &tod.minute, &tod.second);
}
void TmStore::fileToPackets(const std::filesystem::path& path, uint32_t unixStamp,
TmFunnelBase& funnel) {
void PersistentTmStore::fileToPackets(const std::filesystem::path& path, uint32_t unixStamp,
TmFunnelBase& funnel) {
store_address_t storeId;
TmTcMessage message;
size_t size = std::filesystem::file_size(path);