pass HK and not ok packets as well
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-02-20 15:42:04 +01:00
parent fd0da7379a
commit a3f2219f9b
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
3 changed files with 61 additions and 49 deletions

View File

@ -53,54 +53,9 @@ ReturnValue_t PusTmFunnel::performOperation(uint8_t) {
CommandMessage cmdMessage;
ReturnValue_t status = tcQueue->receiveMessage(&cmdMessage);
if (status == returnvalue::OK) {
if (cmdMessage.getMessageType() == messagetypes::TM_STORE) {
Command_t cmd = cmdMessage.getCommand();
object_id_t objectId = TmStoreMessage::getObjectId(&cmdMessage);
TmStore *tmStore = nullptr;
switch (objectId) {
case (objects::HK_TM_STORE): {
tmStore = &hkStore;
break;
}
case (objects::OK_TM_STORE): {
tmStore = &okStore;
break;
}
case (objects::NOT_OK_TM_STORE): {
tmStore = &notOkStore;
break;
}
case (objects::MISC_TM_STORE): {
tmStore = &miscStore;
break;
}
default: {
}
}
if (tmStore == nullptr) {
continue;
}
if (cmd == TmStoreMessage::DELETE_STORE_CONTENT_TIME) {
store_address_t storeId = TmStoreMessage::getStoreId(&cmdMessage);
auto accessor = ipcStore.getData(storeId);
uint32_t deleteUpToUnixSeconds = 0;
size_t size = accessor.second.size();
SerializeAdapter::deSerialize(&deleteUpToUnixSeconds, accessor.second.data(), &size,
SerializeIF::Endianness::NETWORK);
tmStore->deleteUpTo(deleteUpToUnixSeconds);
} else if (cmd == TmStoreMessage::DOWNLINK_STORE_CONTENT_TIME) {
store_address_t storeId = TmStoreMessage::getStoreId(&cmdMessage);
auto accessor = ipcStore.getData(storeId);
uint32_t dumpFromUnixSeconds;
uint32_t dumpUntilUnixSeconds;
size_t size = accessor.second.size();
SerializeAdapter::deSerialize(&dumpFromUnixSeconds, accessor.second.data(), &size,
SerializeIF::Endianness::NETWORK);
SerializeAdapter::deSerialize(&dumpUntilUnixSeconds, accessor.second.data(), &size,
SerializeIF::Endianness::NETWORK);
// TODO: TM store missing, and maybe there is a better way to do this?
tmStore->dumpFromUpTo(dumpFromUnixSeconds, dumpUntilUnixSeconds, *this);
}
ReturnValue_t result = handleTcRequest(cmdMessage);
if(result != returnvalue::OK) {
sif::error << "PusTmFunnel::performOperation: Error handling TC request" << std::endl;
}
}
TmTcMessage tmMessage;
@ -153,6 +108,8 @@ ReturnValue_t PusTmFunnel::handleTmPacket(TmTcMessage &message) {
if (sdcUsable) {
miscStore.passPacket(packet);
okStore.passPacket(packet);
notOkStore.passPacket(packet);
hkStore.passPacket(packet);
}
return sendPacketToDestinations(origStoreId, message, packetData, size);
}
@ -173,3 +130,56 @@ ReturnValue_t PusTmFunnel::initialize() {
initStoresIfPossible(sdcMan.isSdCardUsable(std::nullopt));
return returnvalue::OK;
}
ReturnValue_t PusTmFunnel::handleTcRequest(CommandMessage &cmdMessage) {
if (cmdMessage.getMessageType() == messagetypes::TM_STORE) {
Command_t cmd = cmdMessage.getCommand();
object_id_t objectId = TmStoreMessage::getObjectId(&cmdMessage);
TmStore *tmStore = nullptr;
switch (objectId) {
case (objects::HK_TM_STORE): {
tmStore = &hkStore;
break;
}
case (objects::OK_TM_STORE): {
tmStore = &okStore;
break;
}
case (objects::NOT_OK_TM_STORE): {
tmStore = &notOkStore;
break;
}
case (objects::MISC_TM_STORE): {
tmStore = &miscStore;
break;
}
default: {
}
}
if (tmStore == nullptr) {
return returnvalue::FAILED;
}
if (cmd == TmStoreMessage::DELETE_STORE_CONTENT_TIME) {
store_address_t storeId = TmStoreMessage::getStoreId(&cmdMessage);
auto accessor = ipcStore.getData(storeId);
uint32_t deleteUpToUnixSeconds = 0;
size_t size = accessor.second.size();
SerializeAdapter::deSerialize(&deleteUpToUnixSeconds, accessor.second.data(), &size,
SerializeIF::Endianness::NETWORK);
tmStore->deleteUpTo(deleteUpToUnixSeconds);
} else if (cmd == TmStoreMessage::DOWNLINK_STORE_CONTENT_TIME) {
store_address_t storeId = TmStoreMessage::getStoreId(&cmdMessage);
auto accessor = ipcStore.getData(storeId);
uint32_t dumpFromUnixSeconds;
uint32_t dumpUntilUnixSeconds;
size_t size = accessor.second.size();
SerializeAdapter::deSerialize(&dumpFromUnixSeconds, accessor.second.data(), &size,
SerializeIF::Endianness::NETWORK);
SerializeAdapter::deSerialize(&dumpUntilUnixSeconds, accessor.second.data(), &size,
SerializeIF::Endianness::NETWORK);
// TODO: TM store missing, and maybe there is a better way to do this?
tmStore->dumpFromUpTo(dumpFromUnixSeconds, dumpUntilUnixSeconds, *this);
}
}
return returnvalue::OK;
}

View File

@ -6,6 +6,7 @@
#include <fsfw/tasks/ExecutableObjectIF.h>
#include <fsfw/tmtcservices/AcceptsTelemetryIF.h>
#include <fsfw/tmtcservices/TmTcMessage.h>
#include "fsfw/ipc/CommandMessage.h"
#include <mission/tmtc/TmFunnelBase.h>
#include <vector>
@ -43,6 +44,7 @@ class PusTmFunnel : public TmFunnelBase {
TmStore hkStore;
SdCardMountedIF &sdcMan;
ReturnValue_t handleTcRequest(CommandMessage& msg);
ReturnValue_t handleTmPacket(TmTcMessage &message);
void initStoresIfPossible(bool sdCardUsable);
ReturnValue_t initialize() override;

2
tmtc

@ -1 +1 @@
Subproject commit db1dbe9661653cd566229e3b0da4666a76f3392c
Subproject commit 6a6d9c0a7a6342c23aa4c602ef33b5950f54409c