EIVE upstream #29
@ -1,5 +1,5 @@
|
||||
target_sources(${LIB_FSFW_NAME} PRIVATE CfdpMessage.cpp CfdpDistributor.cpp
|
||||
VarLenFields.cpp)
|
||||
VarLenFields.cpp helpers.cpp)
|
||||
|
||||
add_subdirectory(pdu)
|
||||
add_subdirectory(tlv)
|
||||
|
@ -82,7 +82,7 @@ enum FileDirectives : uint8_t {
|
||||
KEEP_ALIVE = 0x0c
|
||||
};
|
||||
|
||||
enum ConditionCode : uint8_t {
|
||||
enum ConditionCodes : uint8_t {
|
||||
NO_CONDITION_FIELD = 0xff,
|
||||
NO_ERROR = 0b0000,
|
||||
POSITIVE_ACK_LIMIT_REACHED = 0b0001,
|
||||
@ -99,6 +99,7 @@ enum ConditionCode : uint8_t {
|
||||
CANCEL_REQUEST_RECEIVED = 0b1111
|
||||
};
|
||||
|
||||
|
||||
enum FaultHandlerCodes {
|
||||
RESERVED = 0b0000,
|
||||
NOTICE_OF_CANCELLATION = 0b0001,
|
||||
|
@ -5,7 +5,7 @@ namespace cfdp {
|
||||
FaultHandlerBase::FaultHandlerBase() = default;
|
||||
FaultHandlerBase::~FaultHandlerBase() = default;
|
||||
|
||||
bool FaultHandlerBase::getFaultHandler(cfdp::ConditionCode code,
|
||||
bool FaultHandlerBase::getFaultHandler(cfdp::ConditionCodes code,
|
||||
cfdp::FaultHandlerCodes& handler) const {
|
||||
auto iter = faultHandlerMap.find(code);
|
||||
if (iter == faultHandlerMap.end()) {
|
||||
@ -15,7 +15,7 @@ bool FaultHandlerBase::getFaultHandler(cfdp::ConditionCode code,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FaultHandlerBase::setFaultHandler(cfdp::ConditionCode code, cfdp::FaultHandlerCodes handler) {
|
||||
bool FaultHandlerBase::setFaultHandler(cfdp::ConditionCodes code, cfdp::FaultHandlerCodes handler) {
|
||||
if (not faultHandlerMap.contains(code)) {
|
||||
return false;
|
||||
}
|
||||
@ -29,19 +29,19 @@ bool FaultHandlerBase::setFaultHandler(cfdp::ConditionCode code, cfdp::FaultHand
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FaultHandlerBase::reportFault(cfdp::ConditionCode code) {
|
||||
bool FaultHandlerBase::reportFault(cfdp::TransactionId& id, cfdp::ConditionCodes code) {
|
||||
if (not faultHandlerMap.contains(code)) {
|
||||
return false;
|
||||
}
|
||||
cfdp::FaultHandlerCodes fh = faultHandlerMap[code];
|
||||
if (fh == cfdp::FaultHandlerCodes::IGNORE_ERROR) {
|
||||
ignoreCb(code);
|
||||
ignoreCb(id, code);
|
||||
} else if (fh == cfdp::FaultHandlerCodes::ABANDON_TRANSACTION) {
|
||||
abandonCb(code);
|
||||
abandonCb(id, code);
|
||||
} else if (fh == cfdp::FaultHandlerCodes::NOTICE_OF_CANCELLATION) {
|
||||
noticeOfCancellationCb(code);
|
||||
noticeOfCancellationCb(id, code);
|
||||
} else if (fh == cfdp::FaultHandlerCodes::NOTICE_OF_SUSPENSION) {
|
||||
noticeOfSuspensionCb(code);
|
||||
noticeOfSuspensionCb(id, code);
|
||||
} else {
|
||||
// Should never happen, but use defensive programming
|
||||
return false;
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <etl/flat_map.h>
|
||||
|
||||
#include "fsfw/cfdp/VarLenFields.h"
|
||||
#include "fsfw/cfdp/definitions.h"
|
||||
|
||||
namespace cfdp {
|
||||
@ -42,33 +43,33 @@ class FaultHandlerBase {
|
||||
* - true if the condition code is valid
|
||||
* - false otherwise
|
||||
*/
|
||||
bool getFaultHandler(cfdp::ConditionCode code, cfdp::FaultHandlerCodes& handler) const;
|
||||
bool getFaultHandler(cfdp::ConditionCodes code, cfdp::FaultHandlerCodes& handler) const;
|
||||
|
||||
bool setFaultHandler(cfdp::ConditionCode code, cfdp::FaultHandlerCodes handler);
|
||||
bool setFaultHandler(cfdp::ConditionCodes code, cfdp::FaultHandlerCodes handler);
|
||||
|
||||
bool reportFault(cfdp::ConditionCode code);
|
||||
bool reportFault(cfdp::TransactionId& id, cfdp::ConditionCodes code);
|
||||
|
||||
virtual void noticeOfSuspensionCb(cfdp::ConditionCode code) = 0;
|
||||
virtual void noticeOfCancellationCb(cfdp::ConditionCode code) = 0;
|
||||
virtual void abandonCb(cfdp::ConditionCode code) = 0;
|
||||
virtual void ignoreCb(cfdp::ConditionCode code) = 0;
|
||||
virtual void noticeOfSuspensionCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0;
|
||||
virtual void noticeOfCancellationCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0;
|
||||
virtual void abandonCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0;
|
||||
virtual void ignoreCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0;
|
||||
|
||||
private:
|
||||
etl::flat_map<cfdp::ConditionCode, cfdp::FaultHandlerCodes, 10> faultHandlerMap = {
|
||||
etl::pair{cfdp::ConditionCode::POSITIVE_ACK_LIMIT_REACHED,
|
||||
etl::flat_map<cfdp::ConditionCodes, cfdp::FaultHandlerCodes, 10> faultHandlerMap = {
|
||||
etl::pair{cfdp::ConditionCodes::POSITIVE_ACK_LIMIT_REACHED,
|
||||
cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCode::KEEP_ALIVE_LIMIT_REACHED,
|
||||
etl::pair{cfdp::ConditionCodes::KEEP_ALIVE_LIMIT_REACHED,
|
||||
cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCode::INVALID_TRANSMISSION_MODE,
|
||||
etl::pair{cfdp::ConditionCodes::INVALID_TRANSMISSION_MODE,
|
||||
cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCode::FILE_CHECKSUM_FAILURE, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCode::FILE_SIZE_ERROR, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCode::NAK_LIMIT_REACHED, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCode::INACTIVITY_DETECTED, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCode::UNSUPPORTED_CHECKSUM_TYPE,
|
||||
etl::pair{cfdp::ConditionCodes::FILE_CHECKSUM_FAILURE, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCodes::FILE_SIZE_ERROR, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCodes::NAK_LIMIT_REACHED, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCodes::INACTIVITY_DETECTED, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCodes::UNSUPPORTED_CHECKSUM_TYPE,
|
||||
cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCode::FILESTORE_REJECTION, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCode::CHECK_LIMIT_REACHED, cfdp::FaultHandlerCodes::IGNORE_ERROR}};
|
||||
etl::pair{cfdp::ConditionCodes::FILESTORE_REJECTION, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCodes::CHECK_LIMIT_REACHED, cfdp::FaultHandlerCodes::IGNORE_ERROR}};
|
||||
};
|
||||
|
||||
} // namespace cfdp
|
||||
|
@ -14,12 +14,12 @@
|
||||
namespace cfdp {
|
||||
|
||||
struct TransactionFinishedParams {
|
||||
TransactionFinishedParams(const TransactionId& id, ConditionCode code, FileDeliveryCode delivCode,
|
||||
TransactionFinishedParams(const TransactionId& id, ConditionCodes code, FileDeliveryCode delivCode,
|
||||
FileDeliveryStatus status)
|
||||
: id(id), condCode(code), status(status), deliveryCode(delivCode) {}
|
||||
|
||||
const TransactionId& id;
|
||||
ConditionCode condCode;
|
||||
ConditionCodes condCode;
|
||||
FileDeliveryStatus status;
|
||||
FileDeliveryCode deliveryCode;
|
||||
std::vector<FilestoreResponseTlv*> fsResponses;
|
||||
@ -85,10 +85,10 @@ class UserBase {
|
||||
virtual void metadataRecvdIndication(const MetadataRecvdParams& params) = 0;
|
||||
virtual void fileSegmentRecvdIndication(const FileSegmentRecvdParams& params) = 0;
|
||||
virtual void reportIndication(const TransactionId& id, StatusReportIF& report) = 0;
|
||||
virtual void suspendedIndication(const TransactionId& id, ConditionCode code) = 0;
|
||||
virtual void suspendedIndication(const TransactionId& id, ConditionCodes code) = 0;
|
||||
virtual void resumedIndication(const TransactionId& id, size_t progress) = 0;
|
||||
virtual void faultIndication(const TransactionId& id, ConditionCode code, size_t progress) = 0;
|
||||
virtual void abandonedIndication(const TransactionId& id, ConditionCode code,
|
||||
virtual void faultIndication(const TransactionId& id, ConditionCodes code, size_t progress) = 0;
|
||||
virtual void abandonedIndication(const TransactionId& id, ConditionCodes code,
|
||||
size_t progress) = 0;
|
||||
virtual void eofRecvIndication(const TransactionId& id) = 0;
|
||||
|
||||
|
52
src/fsfw/cfdp/helpers.cpp
Normal file
52
src/fsfw/cfdp/helpers.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
#include "helpers.h"
|
||||
|
||||
const char* COND_CODE_STRINGS[14] = {
|
||||
"Unknown",
|
||||
"No Error",
|
||||
"Positive ACK Limit Reached",
|
||||
"Keep Alive Limit Reached",
|
||||
"Invalid Transmission Mode",
|
||||
"Filestore Rejection",
|
||||
"File Checksum Failure",
|
||||
"File Size Error",
|
||||
"NAK limit reached",
|
||||
"Inactivity Detected",
|
||||
"Check Limit Reached",
|
||||
"Unsupported Checksum Type",
|
||||
"Suspend Request Received",
|
||||
"Cancel Request Received"
|
||||
};
|
||||
|
||||
const char* cfdp::getConditionCodeString(cfdp::ConditionCodes code) {
|
||||
switch (code) {
|
||||
case NO_CONDITION_FIELD:
|
||||
return COND_CODE_STRINGS[0];
|
||||
case NO_ERROR:
|
||||
return COND_CODE_STRINGS[1];
|
||||
case POSITIVE_ACK_LIMIT_REACHED:
|
||||
return COND_CODE_STRINGS[2];
|
||||
case KEEP_ALIVE_LIMIT_REACHED:
|
||||
return COND_CODE_STRINGS[3];
|
||||
case INVALID_TRANSMISSION_MODE:
|
||||
return COND_CODE_STRINGS[4];
|
||||
case FILESTORE_REJECTION:
|
||||
return COND_CODE_STRINGS[5];
|
||||
case FILE_CHECKSUM_FAILURE:
|
||||
return COND_CODE_STRINGS[6];
|
||||
case FILE_SIZE_ERROR:
|
||||
return COND_CODE_STRINGS[7];
|
||||
case NAK_LIMIT_REACHED:
|
||||
return COND_CODE_STRINGS[8];
|
||||
case INACTIVITY_DETECTED:
|
||||
return COND_CODE_STRINGS[9];
|
||||
case CHECK_LIMIT_REACHED:
|
||||
return COND_CODE_STRINGS[10];
|
||||
case UNSUPPORTED_CHECKSUM_TYPE:
|
||||
return COND_CODE_STRINGS[11];
|
||||
case SUSPEND_REQUEST_RECEIVED:
|
||||
return COND_CODE_STRINGS[12];
|
||||
case CANCEL_REQUEST_RECEIVED:
|
||||
return COND_CODE_STRINGS[13];
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
11
src/fsfw/cfdp/helpers.h
Normal file
11
src/fsfw/cfdp/helpers.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef FSFW_EXAMPLE_HOSTED_HELPER_H
|
||||
#define FSFW_EXAMPLE_HOSTED_HELPER_H
|
||||
|
||||
#include "definitions.h"
|
||||
|
||||
namespace cfdp {
|
||||
|
||||
const char* getConditionCodeString(cfdp::ConditionCodes code);
|
||||
|
||||
}
|
||||
#endif // FSFW_EXAMPLE_HOSTED_HELPER_H
|
@ -1,6 +1,6 @@
|
||||
#include "AckInfo.h"
|
||||
|
||||
AckInfo::AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCode ackedConditionCode,
|
||||
AckInfo::AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCodes ackedConditionCode,
|
||||
cfdp::AckTransactionStatus transactionStatus, uint8_t directiveSubtypeCode)
|
||||
: ackedDirective(ackedDirective),
|
||||
ackedConditionCode(ackedConditionCode),
|
||||
@ -13,9 +13,9 @@ AckInfo::AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCode ackedC
|
||||
}
|
||||
}
|
||||
|
||||
cfdp::ConditionCode AckInfo::getAckedConditionCode() const { return ackedConditionCode; }
|
||||
cfdp::ConditionCodes AckInfo::getAckedConditionCode() const { return ackedConditionCode; }
|
||||
|
||||
void AckInfo::setAckedConditionCode(cfdp::ConditionCode ackedConditionCode) {
|
||||
void AckInfo::setAckedConditionCode(cfdp::ConditionCodes ackedConditionCode) {
|
||||
this->ackedConditionCode = ackedConditionCode;
|
||||
if (ackedDirective == cfdp::FileDirectives::FINISH) {
|
||||
this->directiveSubtypeCode = 0b0001;
|
||||
|
@ -6,11 +6,11 @@
|
||||
class AckInfo {
|
||||
public:
|
||||
AckInfo();
|
||||
AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCode ackedConditionCode,
|
||||
AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCodes ackedConditionCode,
|
||||
cfdp::AckTransactionStatus transactionStatus, uint8_t directiveSubtypeCode = 0);
|
||||
|
||||
cfdp::ConditionCode getAckedConditionCode() const;
|
||||
void setAckedConditionCode(cfdp::ConditionCode ackedConditionCode);
|
||||
cfdp::ConditionCodes getAckedConditionCode() const;
|
||||
void setAckedConditionCode(cfdp::ConditionCodes ackedConditionCode);
|
||||
|
||||
cfdp::FileDirectives getAckedDirective() const;
|
||||
void setAckedDirective(cfdp::FileDirectives ackedDirective);
|
||||
@ -23,7 +23,7 @@ class AckInfo {
|
||||
|
||||
private:
|
||||
cfdp::FileDirectives ackedDirective = cfdp::FileDirectives::INVALID_DIRECTIVE;
|
||||
cfdp::ConditionCode ackedConditionCode = cfdp::ConditionCode::NO_CONDITION_FIELD;
|
||||
cfdp::ConditionCodes ackedConditionCode = cfdp::ConditionCodes::NO_CONDITION_FIELD;
|
||||
cfdp::AckTransactionStatus transactionStatus = cfdp::AckTransactionStatus::UNDEFINED;
|
||||
uint8_t directiveSubtypeCode = 0;
|
||||
};
|
||||
|
@ -13,7 +13,7 @@ ReturnValue_t AckPduCreator::serialize(uint8_t **buffer, size_t *size, size_t ma
|
||||
}
|
||||
cfdp::FileDirectives ackedDirective = ackInfo.getAckedDirective();
|
||||
uint8_t directiveSubtypeCode = ackInfo.getDirectiveSubtypeCode();
|
||||
cfdp::ConditionCode ackedConditionCode = ackInfo.getAckedConditionCode();
|
||||
cfdp::ConditionCodes ackedConditionCode = ackInfo.getAckedConditionCode();
|
||||
cfdp::AckTransactionStatus transactionStatus = ackInfo.getTransactionStatus();
|
||||
if (ackedDirective != cfdp::FileDirectives::FINISH and
|
||||
ackedDirective != cfdp::FileDirectives::EOF_DIRECTIVE) {
|
||||
|
@ -29,7 +29,7 @@ bool AckPduReader::checkAndSetCodes(uint8_t firstByte, uint8_t secondByte) {
|
||||
return false;
|
||||
}
|
||||
this->info.setDirectiveSubtypeCode(directiveSubtypeCode);
|
||||
this->info.setAckedConditionCode(static_cast<cfdp::ConditionCode>(secondByte >> 4));
|
||||
this->info.setAckedConditionCode(static_cast<cfdp::ConditionCodes>(secondByte >> 4));
|
||||
this->info.setTransactionStatus(static_cast<cfdp::AckTransactionStatus>(secondByte & 0x0f));
|
||||
return true;
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
#include "EofInfo.h"
|
||||
|
||||
EofInfo::EofInfo(cfdp::ConditionCode conditionCode, uint32_t checksum, cfdp::FileSize fileSize,
|
||||
EofInfo::EofInfo(cfdp::ConditionCodes conditionCode, uint32_t checksum, cfdp::FileSize fileSize,
|
||||
EntityIdTlv* faultLoc)
|
||||
: conditionCode(conditionCode), checksum(checksum), fileSize(fileSize), faultLoc(faultLoc) {}
|
||||
|
||||
EofInfo::EofInfo(EntityIdTlv* faultLoc)
|
||||
: conditionCode(cfdp::ConditionCode::NO_CONDITION_FIELD),
|
||||
: conditionCode(cfdp::ConditionCodes::NO_CONDITION_FIELD),
|
||||
checksum(0),
|
||||
fileSize(0),
|
||||
faultLoc(faultLoc) {}
|
||||
|
||||
uint32_t EofInfo::getChecksum() const { return checksum; }
|
||||
|
||||
cfdp::ConditionCode EofInfo::getConditionCode() const { return conditionCode; }
|
||||
cfdp::ConditionCodes EofInfo::getConditionCode() const { return conditionCode; }
|
||||
|
||||
EntityIdTlv* EofInfo::getFaultLoc() const { return faultLoc; }
|
||||
|
||||
@ -20,7 +20,7 @@ cfdp::FileSize& EofInfo::getFileSize() { return fileSize; }
|
||||
|
||||
void EofInfo::setChecksum(uint32_t checksum) { this->checksum = checksum; }
|
||||
|
||||
void EofInfo::setConditionCode(cfdp::ConditionCode conditionCode) {
|
||||
void EofInfo::setConditionCode(cfdp::ConditionCodes conditionCode) {
|
||||
this->conditionCode = conditionCode;
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ size_t EofInfo::getSerializedSize(bool fssLarge) {
|
||||
}
|
||||
// Do not account for fault location if the condition code is NO_ERROR. We assume that
|
||||
// a serializer will not serialize the fault location here.
|
||||
if (getFaultLoc() != nullptr and getConditionCode() != cfdp::ConditionCode::NO_ERROR) {
|
||||
if (getFaultLoc() != nullptr and getConditionCode() != cfdp::ConditionCodes::NO_ERROR) {
|
||||
size += faultLoc->getSerializedSize();
|
||||
}
|
||||
return size;
|
||||
|
@ -8,23 +8,23 @@
|
||||
struct EofInfo {
|
||||
public:
|
||||
explicit EofInfo(EntityIdTlv* faultLoc = nullptr);
|
||||
EofInfo(cfdp::ConditionCode conditionCode, uint32_t checksum, cfdp::FileSize fileSize,
|
||||
EofInfo(cfdp::ConditionCodes conditionCode, uint32_t checksum, cfdp::FileSize fileSize,
|
||||
EntityIdTlv* faultLoc = nullptr);
|
||||
|
||||
size_t getSerializedSize(bool fssLarge = false);
|
||||
|
||||
[[nodiscard]] uint32_t getChecksum() const;
|
||||
[[nodiscard]] cfdp::ConditionCode getConditionCode() const;
|
||||
[[nodiscard]] cfdp::ConditionCodes getConditionCode() const;
|
||||
|
||||
[[nodiscard]] EntityIdTlv* getFaultLoc() const;
|
||||
cfdp::FileSize& getFileSize();
|
||||
void setChecksum(uint32_t checksum);
|
||||
void setConditionCode(cfdp::ConditionCode conditionCode);
|
||||
void setConditionCode(cfdp::ConditionCodes conditionCode);
|
||||
void setFaultLoc(EntityIdTlv* faultLoc);
|
||||
ReturnValue_t setFileSize(size_t size, bool isLarge);
|
||||
|
||||
private:
|
||||
cfdp::ConditionCode conditionCode;
|
||||
cfdp::ConditionCodes conditionCode;
|
||||
uint32_t checksum;
|
||||
cfdp::FileSize fileSize;
|
||||
EntityIdTlv* faultLoc = nullptr;
|
||||
|
@ -33,7 +33,7 @@ ReturnValue_t EofPduCreator::serialize(uint8_t **buffer, size_t *size, size_t ma
|
||||
uint32_t fileSizeValue = info.getFileSize().getSize();
|
||||
result = SerializeAdapter::serialize(&fileSizeValue, buffer, size, maxSize, streamEndianness);
|
||||
}
|
||||
if (info.getFaultLoc() != nullptr and info.getConditionCode() != cfdp::ConditionCode::NO_ERROR) {
|
||||
if (info.getFaultLoc() != nullptr and info.getConditionCode() != cfdp::ConditionCodes::NO_ERROR) {
|
||||
result = info.getFaultLoc()->serialize(buffer, size, maxSize, streamEndianness);
|
||||
}
|
||||
return result;
|
||||
|
@ -25,7 +25,7 @@ ReturnValue_t EofPduReader::parseData() {
|
||||
|
||||
bufPtr += currentIdx;
|
||||
deserLen -= currentIdx;
|
||||
info.setConditionCode(static_cast<cfdp::ConditionCode>(*bufPtr >> 4));
|
||||
info.setConditionCode(static_cast<cfdp::ConditionCodes>(*bufPtr >> 4));
|
||||
bufPtr += 1;
|
||||
deserLen -= 1;
|
||||
uint32_t checksum = 0;
|
||||
@ -47,7 +47,7 @@ ReturnValue_t EofPduReader::parseData() {
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
if (info.getConditionCode() != cfdp::ConditionCode::NO_ERROR) {
|
||||
if (info.getConditionCode() != cfdp::ConditionCodes::NO_ERROR) {
|
||||
EntityIdTlv* tlvPtr = info.getFaultLoc();
|
||||
if (tlvPtr == nullptr) {
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
FinishedInfo::FinishedInfo() {}
|
||||
|
||||
FinishedInfo::FinishedInfo(cfdp::ConditionCode conditionCode, cfdp::FileDeliveryCode deliveryCode,
|
||||
FinishedInfo::FinishedInfo(cfdp::ConditionCodes conditionCode, cfdp::FileDeliveryCode deliveryCode,
|
||||
cfdp::FileDeliveryStatus fileStatus)
|
||||
: conditionCode(conditionCode), deliveryCode(deliveryCode), fileStatus(fileStatus) {}
|
||||
|
||||
@ -76,9 +76,9 @@ ReturnValue_t FinishedInfo::getFaultLocation(EntityIdTlv** faultLocation) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
cfdp::ConditionCode FinishedInfo::getConditionCode() const { return conditionCode; }
|
||||
cfdp::ConditionCodes FinishedInfo::getConditionCode() const { return conditionCode; }
|
||||
|
||||
void FinishedInfo::setConditionCode(cfdp::ConditionCode conditionCode) {
|
||||
void FinishedInfo::setConditionCode(cfdp::ConditionCodes conditionCode) {
|
||||
this->conditionCode = conditionCode;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
class FinishedInfo {
|
||||
public:
|
||||
FinishedInfo();
|
||||
FinishedInfo(cfdp::ConditionCode conditionCode, cfdp::FileDeliveryCode deliveryCode,
|
||||
FinishedInfo(cfdp::ConditionCodes conditionCode, cfdp::FileDeliveryCode deliveryCode,
|
||||
cfdp::FileDeliveryStatus fileStatus);
|
||||
|
||||
[[nodiscard]] size_t getSerializedSize() const;
|
||||
@ -25,15 +25,15 @@ class FinishedInfo {
|
||||
[[nodiscard]] size_t getFsResponsesLen() const;
|
||||
void setFilestoreResponsesArrayLen(size_t fsResponsesLen);
|
||||
ReturnValue_t getFaultLocation(EntityIdTlv** entityId);
|
||||
[[nodiscard]] cfdp::ConditionCode getConditionCode() const;
|
||||
void setConditionCode(cfdp::ConditionCode conditionCode);
|
||||
[[nodiscard]] cfdp::ConditionCodes getConditionCode() const;
|
||||
void setConditionCode(cfdp::ConditionCodes conditionCode);
|
||||
[[nodiscard]] cfdp::FileDeliveryCode getDeliveryCode() const;
|
||||
void setDeliveryCode(cfdp::FileDeliveryCode deliveryCode);
|
||||
[[nodiscard]] cfdp::FileDeliveryStatus getFileStatus() const;
|
||||
void setFileStatus(cfdp::FileDeliveryStatus fileStatus);
|
||||
|
||||
private:
|
||||
cfdp::ConditionCode conditionCode = cfdp::ConditionCode::NO_CONDITION_FIELD;
|
||||
cfdp::ConditionCodes conditionCode = cfdp::ConditionCodes::NO_CONDITION_FIELD;
|
||||
cfdp::FileDeliveryCode deliveryCode = cfdp::FileDeliveryCode::DATA_COMPLETE;
|
||||
cfdp::FileDeliveryStatus fileStatus = cfdp::FileDeliveryStatus::DISCARDED_DELIBERATELY;
|
||||
FilestoreResponseTlv** fsResponses = nullptr;
|
||||
|
@ -15,7 +15,7 @@ ReturnValue_t FinishPduReader::parseData() {
|
||||
return SerializeIF::STREAM_TOO_SHORT;
|
||||
}
|
||||
uint8_t firstByte = *buf;
|
||||
auto condCode = static_cast<cfdp::ConditionCode>((firstByte >> 4) & 0x0f);
|
||||
auto condCode = static_cast<cfdp::ConditionCodes>((firstByte >> 4) & 0x0f);
|
||||
finishedInfo.setConditionCode(condCode);
|
||||
finishedInfo.setDeliveryCode(static_cast<cfdp::FileDeliveryCode>(firstByte >> 2 & 0b1));
|
||||
finishedInfo.setFileStatus(static_cast<cfdp::FileDeliveryStatus>(firstByte & 0b11));
|
||||
@ -31,7 +31,7 @@ ReturnValue_t FinishPduReader::parseData() {
|
||||
FinishedInfo& FinishPduReader::getInfo() { return finishedInfo; }
|
||||
|
||||
ReturnValue_t FinishPduReader::parseTlvs(size_t remLen, size_t currentIdx, const uint8_t* buf,
|
||||
cfdp::ConditionCode conditionCode) {
|
||||
cfdp::ConditionCodes conditionCode) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
size_t fsResponsesIdx = 0;
|
||||
auto endianness = getEndianness();
|
||||
@ -66,8 +66,8 @@ ReturnValue_t FinishPduReader::parseTlvs(size_t remLen, size_t currentIdx, const
|
||||
} else if (nextTlv == cfdp::TlvTypes::ENTITY_ID) {
|
||||
// This needs to be the last TLV and it should not be here if the condition code
|
||||
// is "No Error" or "Unsupported Checksum Type"
|
||||
if (conditionCode == cfdp::ConditionCode::NO_ERROR or
|
||||
conditionCode == cfdp::ConditionCode::UNSUPPORTED_CHECKSUM_TYPE) {
|
||||
if (conditionCode == cfdp::ConditionCodes::NO_ERROR or
|
||||
conditionCode == cfdp::ConditionCodes::UNSUPPORTED_CHECKSUM_TYPE) {
|
||||
return cfdp::INVALID_TLV_TYPE;
|
||||
}
|
||||
result = finishedInfo.getFaultLocation(&faultLocation);
|
||||
|
@ -16,7 +16,7 @@ class FinishPduReader : public FileDirectiveReader {
|
||||
FinishedInfo& finishedInfo;
|
||||
|
||||
ReturnValue_t parseTlvs(size_t remLen, size_t currentIdx, const uint8_t* buf,
|
||||
cfdp::ConditionCode conditionCode);
|
||||
cfdp::ConditionCodes conditionCode);
|
||||
};
|
||||
|
||||
#endif /* FSFW_CFDP_PDU_FINISHEDPDUDESERIALIZER_H_ */
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "FaultHandlerOverrideTlv.h"
|
||||
|
||||
FaultHandlerOverrideTlv::FaultHandlerOverrideTlv(cfdp::ConditionCode conditionCode,
|
||||
FaultHandlerOverrideTlv::FaultHandlerOverrideTlv(cfdp::ConditionCodes conditionCode,
|
||||
cfdp::FaultHandlerCodes handlerCode)
|
||||
: conditionCode(conditionCode), handlerCode(handlerCode) {}
|
||||
|
||||
@ -44,7 +44,7 @@ ReturnValue_t FaultHandlerOverrideTlv::deSerialize(const uint8_t **buffer, size_
|
||||
}
|
||||
*buffer += 1;
|
||||
*size += 1;
|
||||
this->conditionCode = static_cast<cfdp::ConditionCode>((**buffer >> 4) & 0x0f);
|
||||
this->conditionCode = static_cast<cfdp::ConditionCodes>((**buffer >> 4) & 0x0f);
|
||||
this->handlerCode = static_cast<cfdp::FaultHandlerCodes>(**buffer & 0x0f);
|
||||
*buffer += 1;
|
||||
*size += 1;
|
||||
|
@ -6,7 +6,7 @@
|
||||
class FaultHandlerOverrideTlv : public TlvIF {
|
||||
public:
|
||||
FaultHandlerOverrideTlv();
|
||||
FaultHandlerOverrideTlv(cfdp::ConditionCode conditionCode, cfdp::FaultHandlerCodes handlerCode);
|
||||
FaultHandlerOverrideTlv(cfdp::ConditionCodes conditionCode, cfdp::FaultHandlerCodes handlerCode);
|
||||
|
||||
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||
Endianness streamEndianness) const override;
|
||||
@ -19,7 +19,7 @@ class FaultHandlerOverrideTlv : public TlvIF {
|
||||
[[nodiscard]] cfdp::TlvTypes getType() const override;
|
||||
|
||||
private:
|
||||
cfdp::ConditionCode conditionCode = cfdp::ConditionCode::NO_CONDITION_FIELD;
|
||||
cfdp::ConditionCodes conditionCode = cfdp::ConditionCodes::NO_CONDITION_FIELD;
|
||||
cfdp::FaultHandlerCodes handlerCode = cfdp::FaultHandlerCodes::RESERVED;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user