Merge branch 'mueller/expand-retval-if' into mueller/refactor-tmtc-stack

This commit is contained in:
Robin Müller 2022-07-26 10:29:51 +02:00
commit 4ed028000d
5 changed files with 22 additions and 25 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 =
HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 1);
retval::makeCode(CFDP_CLASS_ID, 1);
static constexpr ReturnValue_t INVALID_DIRECTIVE_FIELDS =
HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 2);
retval::makeCode(CFDP_CLASS_ID, 2);
static constexpr ReturnValue_t INVALID_PDU_DATAFIELD_LEN =
HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 3);
retval::makeCode(CFDP_CLASS_ID, 3);
static constexpr ReturnValue_t INVALID_ACK_DIRECTIVE_FIELDS =
HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 4);
retval::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 =
HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 5);
retval::makeCode(CFDP_CLASS_ID, 5);
static constexpr ReturnValue_t NAK_CANT_PARSE_OPTIONS =
HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 6);
retval::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t FINISHED_CANT_PARSE_FS_RESPONSES =
HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 6);
retval::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t FILESTORE_REQUIRES_SECOND_FILE =
HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 8);
retval::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 =
HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 9);
retval::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 = HasReturnvaluesIF::makeReturnCode(1, 0);
static constexpr ReturnValue_t CONN_BROKEN = retval::makeCode(1, 0);
//! TMTC bridge is cached.
object_id_t tmtcBridgeId = objects::NO_OBJECT;
TcpTmTcBridge* tmtcBridge = nullptr;

View File

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

View File

@ -7,8 +7,6 @@
#include "fsfw_tests/internal/UnittDefinitions.h"
using retval = HasReturnvaluesIF;
void testmq::testMq() {
std::string id = "[testMq]";
MessageQueueIF* testSenderMq = QueueFactory::instance()->createMessageQueue(1);
@ -22,22 +20,22 @@ void testmq::testMq() {
testSenderMq->setDefaultDestination(testReceiverMqId);
auto result = testSenderMq->sendMessage(testReceiverMqId, &testMessage);
if (result != retval::RETURN_OK) {
if (result != retval::OK) {
unitt::put_error(id);
}
MessageQueueMessage recvMessage;
result = testReceiverMq->receiveMessage(&recvMessage);
if (result != retval::RETURN_OK or recvMessage.getData()[0] != 42) {
if (result != retval::OK or recvMessage.getData()[0] != 42) {
unitt::put_error(id);
}
result = testSenderMq->sendMessage(testReceiverMqId, &testMessage);
if (result != retval::RETURN_OK) {
if (result != retval::OK) {
unitt::put_error(id);
}
MessageQueueId_t senderId = 0;
result = testReceiverMq->receiveMessage(&recvMessage, &senderId);
if (result != retval::RETURN_OK or recvMessage.getData()[0] != 42) {
if (result != retval::OK or recvMessage.getData()[0] != 42) {
unitt::put_error(id);
}
if (senderId != testSenderMqId) {

View File

@ -8,24 +8,23 @@
#include "fsfw_tests/internal/UnittDefinitions.h"
using retval = HasReturnvaluesIF;
std::array<uint8_t, 512> testserialize::test_array = {0};
ReturnValue_t testserialize::test_serialization() {
// Here, we test all serialization tools. First test basic cases.
ReturnValue_t result = test_endianness_tools();
if (result != retval::RETURN_OK) {
if (result != retval::OK) {
return result;
}
result = test_autoserialization();
if (result != retval::RETURN_OK) {
if (result != retval::OK) {
return result;
}
result = test_serial_buffer_adapter();
if (result != retval::RETURN_OK) {
if (result != retval::OK) {
return result;
}
return retval::RETURN_OK;
return retval::OK;
}
ReturnValue_t testserialize::test_endianness_tools() {
@ -49,7 +48,7 @@ ReturnValue_t testserialize::test_endianness_tools() {
if (test_array[0] != 0 and test_array[1] != 1) {
return unitt::put_error(id);
}
return retval::RETURN_OK;
return retval::OK;
}
ReturnValue_t testserialize::test_autoserialization() {
@ -153,7 +152,7 @@ ReturnValue_t testserialize::test_autoserialization() {
}
// Check overflow
return retval::RETURN_OK;
return retval::OK;
}
// TODO: Also test for constant buffers.
@ -206,5 +205,5 @@ ReturnValue_t testserialize::test_serial_buffer_adapter() {
if (testUint16 != 16) {
return unitt::put_error(id);
}
return retval::RETURN_OK;
return retval::OK;
}