CFDP source handler #776

Merged
muellerr merged 96 commits from cfdp-source-handler into main 2023-10-19 11:11:31 +02:00
3 changed files with 36 additions and 4 deletions
Showing only changes of commit 98e1beafdf - Show all commits

View File

@ -116,14 +116,44 @@ void LiveTmTask::readCommandQueue(void) {
} }
} }
ReturnValue_t LiveTmTask::handleRegularTmQueue() { return returnvalue::OK; } ReturnValue_t LiveTmTask::handleRegularTmQueue() { return handleGenericTmQueue(*regularTmQueue); }
ReturnValue_t LiveTmTask::handleCfdpTmQueue() { return returnvalue::OK; } ReturnValue_t LiveTmTask::handleCfdpTmQueue() { return handleGenericTmQueue(*cfdpTmQueue); }
ReturnValue_t LiveTmTask::handleGenericTmQueue(MessageQueueIF& queue) {
TmTcMessage message;
ReturnValue_t result = queue.receiveMessage(&message);
if (result == MessageQueueIF::EMPTY) {
return result;
}
store_address_t storeId = message.getStorageId();
const uint8_t* data = nullptr;
size_t size = 0;
result = tmStore->getData(storeId, &data, &size);
if (result != returnvalue::OK) {
sif::warning << "VirtualChannel::performOperation: Failed to read data from TM store"
<< std::endl;
tmStore->deleteData(storeId);
return result;
}
if (ptmeLocked) {
result = channel.write(data, size);
}
// Try delete in any case, ignore failures (which should not happen), it is more important to
// propagate write errors.
tmStore->deleteData(storeId);
return result;
}
ModeTreeChildIF& LiveTmTask::getModeTreeChildIF() { return *this; } ModeTreeChildIF& LiveTmTask::getModeTreeChildIF() { return *this; }
ReturnValue_t LiveTmTask::initialize() { ReturnValue_t LiveTmTask::initialize() {
modeHelper.initialize(); modeHelper.initialize();
tmStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TM_STORE);
if (tmStore == nullptr) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
return returnvalue::OK; return returnvalue::OK;
} }

View File

@ -31,6 +31,7 @@ class LiveTmTask : public SystemObject,
MessageQueueIF* requestQueue; MessageQueueIF* requestQueue;
MessageQueueIF* cfdpTmQueue; MessageQueueIF* cfdpTmQueue;
MessageQueueIF* regularTmQueue; MessageQueueIF* regularTmQueue;
StorageManagerIF* tmStore = nullptr;
ModeHelper modeHelper; ModeHelper modeHelper;
Mode_t mode = HasModesIF::MODE_OFF; Mode_t mode = HasModesIF::MODE_OFF;
Countdown tmFunnelCd = Countdown(100); Countdown tmFunnelCd = Countdown(100);
@ -44,6 +45,7 @@ class LiveTmTask : public SystemObject,
ReturnValue_t handleRegularTmQueue(); ReturnValue_t handleRegularTmQueue();
ReturnValue_t handleCfdpTmQueue(); ReturnValue_t handleCfdpTmQueue();
ReturnValue_t handleGenericTmQueue(MessageQueueIF& queue);
MessageQueueId_t getCommandQueue() const override; MessageQueueId_t getCommandQueue() const override;

View File

@ -1,8 +1,6 @@
#ifndef MISSION_SYSDEFS_H_ #ifndef MISSION_SYSDEFS_H_
#define MISSION_SYSDEFS_H_ #define MISSION_SYSDEFS_H_
#include "eive/eventSubsystemIds.h"
#include <fsfw/action/ActionMessage.h> #include <fsfw/action/ActionMessage.h>
#include <fsfw/action/HasActionsIF.h> #include <fsfw/action/HasActionsIF.h>
#include <fsfw/modes/ModeMessage.h> #include <fsfw/modes/ModeMessage.h>
@ -11,6 +9,8 @@
#include <atomic> #include <atomic>
#include <cstring> #include <cstring>
#include "eive/eventSubsystemIds.h"
namespace signals { namespace signals {
extern std::atomic_bool CFDP_CHANNEL_THROTTLE_SIGNAL; extern std::atomic_bool CFDP_CHANNEL_THROTTLE_SIGNAL;