use result instead of retval

This commit is contained in:
2022-07-27 21:43:32 +02:00
parent 88ebb67c8d
commit 5355e63711
22 changed files with 298 additions and 303 deletions

View File

@ -16,27 +16,27 @@ static constexpr uint8_t VERSION_BITS = 0b00100000;
static constexpr uint8_t CFDP_CLASS_ID = CLASS_ID::CFDP;
static constexpr ReturnValue_t INVALID_TLV_TYPE =
retval::makeCode(CFDP_CLASS_ID, 1);
result::makeCode(CFDP_CLASS_ID, 1);
static constexpr ReturnValue_t INVALID_DIRECTIVE_FIELDS =
retval::makeCode(CFDP_CLASS_ID, 2);
result::makeCode(CFDP_CLASS_ID, 2);
static constexpr ReturnValue_t INVALID_PDU_DATAFIELD_LEN =
retval::makeCode(CFDP_CLASS_ID, 3);
result::makeCode(CFDP_CLASS_ID, 3);
static constexpr ReturnValue_t INVALID_ACK_DIRECTIVE_FIELDS =
retval::makeCode(CFDP_CLASS_ID, 4);
result::makeCode(CFDP_CLASS_ID, 4);
//! Can not parse options. This can also occur because there are options
//! available but the user did not pass a valid options array
static constexpr ReturnValue_t METADATA_CANT_PARSE_OPTIONS =
retval::makeCode(CFDP_CLASS_ID, 5);
result::makeCode(CFDP_CLASS_ID, 5);
static constexpr ReturnValue_t NAK_CANT_PARSE_OPTIONS =
retval::makeCode(CFDP_CLASS_ID, 6);
result::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t FINISHED_CANT_PARSE_FS_RESPONSES =
retval::makeCode(CFDP_CLASS_ID, 6);
result::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t FILESTORE_REQUIRES_SECOND_FILE =
retval::makeCode(CFDP_CLASS_ID, 8);
result::makeCode(CFDP_CLASS_ID, 8);
//! Can not parse filestore response because user did not pass a valid instance
//! or remaining size is invalid
static constexpr ReturnValue_t FILESTORE_RESPONSE_CANT_PARSE_FS_MESSAGE =
retval::makeCode(CFDP_CLASS_ID, 9);
result::makeCode(CFDP_CLASS_ID, 9);
//! Checksum types according to the SANA Checksum Types registry
//! https://sanaregistry.org/r/checksum_identifiers/

View File

@ -108,7 +108,7 @@ class TcpTmTcServer : public SystemObject, public TcpIpBase, public ExecutableOb
StorageManagerIF* tmStore = nullptr;
private:
static constexpr ReturnValue_t CONN_BROKEN = retval::makeCode(1, 0);
static constexpr ReturnValue_t CONN_BROKEN = result::makeCode(1, 0);
//! TMTC bridge is cached.
object_id_t tmtcBridgeId = objects::NO_OBJECT;
TcpTmTcBridge* tmtcBridge = nullptr;

View File

@ -10,19 +10,19 @@
#define MAKE_RETURN_CODE(number) ((INTERFACE_ID << 8) + (number))
typedef uint16_t ReturnValue_t;
namespace retval {
namespace result {
static constexpr ReturnValue_t OK = 0;
static constexpr ReturnValue_t FAILED = 1;
static constexpr ReturnValue_t makeCode(uint8_t classId, uint8_t number) {
return (static_cast<ReturnValue_t>(classId) << 8) + number;
}
} // namespace retval
} // namespace result
class HasReturnvaluesIF {
public:
static const ReturnValue_t RETURN_OK = retval::OK;
static const ReturnValue_t RETURN_FAILED = retval::FAILED;
static const ReturnValue_t RETURN_OK = result::OK;
static const ReturnValue_t RETURN_FAILED = result::FAILED;
virtual ~HasReturnvaluesIF() = default;
@ -33,9 +33,9 @@ class HasReturnvaluesIF {
* @param number
* @return
*/
[[deprecated("Use retval::makeCode instead")]] static constexpr ReturnValue_t makeReturnCode(
[[deprecated("Use result::makeCode instead")]] static constexpr ReturnValue_t makeReturnCode(
uint8_t classId, uint8_t number) {
return retval::makeCode(classId, number);
return result::makeCode(classId, number);
}
};

View File

@ -15,7 +15,7 @@ class FixedTimeslotTaskIF : public PeriodicTaskIF {
~FixedTimeslotTaskIF() override = default;
static constexpr ReturnValue_t SLOT_LIST_EMPTY =
retval::makeCode(CLASS_ID::FIXED_SLOT_TASK_IF, 0);
result::makeCode(CLASS_ID::FIXED_SLOT_TASK_IF, 0);
/**
* Add an object with a slot time and the execution step to the task.