add first CFDP events
Some checks failed
fsfw/fsfw/pipeline/head There was a failure building this commit

This commit is contained in:
Robin Müller 2022-10-17 12:19:31 +02:00
parent bdbe0cc9da
commit e893e73f86
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
7 changed files with 34 additions and 7 deletions

View File

@ -1,2 +1,3 @@
target_sources(${LIB_FSFW_NAME} PRIVATE SourceHandler.cpp DestHandler.cpp
FaultHandlerBase.cpp UserBase.cpp CfdpHandler.cpp)
target_sources(
${LIB_FSFW_NAME} PRIVATE SourceHandler.cpp DestHandler.cpp
FaultHandlerBase.cpp UserBase.cpp CfdpHandler.cpp)

View File

@ -17,7 +17,7 @@ CfdpHandler::CfdpHandler(const FsfwHandlerParams& fsfwParams, const CfdpHandlerC
cfdpCfg.userHandler, cfdpCfg.remoteCfgProvider, cfdpCfg.packetInfoList,
cfdpCfg.lostSegmentsList),
FsfwParams(fsfwParams.packetDest, nullptr, this, fsfwParams.tcStore,
fsfwParams.tmStore)) {
fsfwParams.tmStore)) {
destHandler.setMsgQueue(msgQueue);
}

View File

@ -12,7 +12,11 @@
struct FsfwHandlerParams {
FsfwHandlerParams(object_id_t objectId, HasFileSystemIF& vfs, AcceptsTelemetryIF& packetDest,
StorageManagerIF& tcStore, StorageManagerIF& tmStore, MessageQueueIF& msgQueue)
: objectId(objectId), vfs(vfs), packetDest(packetDest), tcStore(tcStore), tmStore(tmStore),
: objectId(objectId),
vfs(vfs),
packetDest(packetDest),
tcStore(tcStore),
tmStore(tmStore),
msgQueue(msgQueue) {}
object_id_t objectId{};
HasFileSystemIF& vfs;

View File

@ -427,22 +427,33 @@ ReturnValue_t cfdp::DestHandler::sendFinishedPdu() {
ReturnValue_t result =
fp.tcStore->getFreeElement(&storeId, finishedPdu.getSerializedSize(), &dataPtr);
if (result != OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "cfdp::DestHandler:sendFinishedPdu: Getting store slot failed" << std::endl;
#endif
// TODO: Error handling and event, this is a non CFDP specific error (most likely store is full)
return result;
}
size_t serLen = 0;
result = finishedPdu.serialize(dataPtr, serLen, finishedPdu.getSerializedSize());
if (result != OK) {
// TODO: Error printout, this really should not happen
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "cfdp::DestHandler::sendFinishedPdu: Serializing Finished PDU failed"
<< std::endl;
#endif
// TODO: Event, non CFDP specific error
return result;
}
TmTcMessage msg(storeId);
result = fp.msgQueue->sendMessage(fp.packetDest.getReportReceptionQueue(), &msg);
if (result != OK) {
// TODO: Error handling and event, this is a non CFDP specific error (most likely store is full)
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "cfdp::DestHandler::sendFinishedPdu: Sending PDU failed" << std::endl;
#endif
return result;
}
fsmRes.packetsSent++;
sif::info << "Sent finished PDU" << std::endl;
return OK;
}

View File

@ -5,5 +5,15 @@ namespace cfdp {
enum class CfdpStates { IDLE, BUSY_CLASS_1_NACKED, BUSY_CLASS_2_ACKED, SUSPENDED };
}
static constexpr uint8_t SSID = SUBSYSTEM_ID::CFDP;
namespace events {
static constexpr Event STORE_ERROR = event::makeEvent(SSID, 0, severity::LOW);
static constexpr Event MSG_QUEUE_ERROR = event::makeEvent(SSID, 1, severity::LOW);
static constexpr Event SERIALIZATION_ERROR = event::makeEvent(SSID, 2, severity::LOW);
} // namespace events
} // namespace cfdp
#endif // FSFW_CFDP_HANDLER_DEFS_H

View File

@ -33,6 +33,7 @@ enum : uint8_t {
PUS_SERVICE_23 = 103,
MGM_LIS3MDL = 106,
MGM_RM3100 = 107,
CFDP = 108,
FW_SUBSYSTEM_ID_RANGE
};

View File

@ -17,7 +17,7 @@ class FaultHandlerMock : public FaultHandlerBase {
void noticeOfSuspensionCb(TransactionId& id, ConditionCode code) override;
void noticeOfCancellationCb(TransactionId& id, ConditionCode code) override;
void abandonCb(TransactionId& id,ConditionCode code) override;
void abandonCb(TransactionId& id, ConditionCode code) override;
void ignoreCb(TransactionId& id, ConditionCode code) override;
FaultInfo& getFhInfo(FaultHandlerCode fhCode);