Merge branch 'mueller/expand-retval-if' into mueller/refactor-tmtc-stack
This commit is contained in:
commit
4ed028000d
@ -16,27 +16,27 @@ static constexpr uint8_t VERSION_BITS = 0b00100000;
|
|||||||
static constexpr uint8_t CFDP_CLASS_ID = CLASS_ID::CFDP;
|
static constexpr uint8_t CFDP_CLASS_ID = CLASS_ID::CFDP;
|
||||||
|
|
||||||
static constexpr ReturnValue_t INVALID_TLV_TYPE =
|
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 =
|
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 =
|
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 =
|
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
|
//! Can not parse options. This can also occur because there are options
|
||||||
//! available but the user did not pass a valid options array
|
//! available but the user did not pass a valid options array
|
||||||
static constexpr ReturnValue_t METADATA_CANT_PARSE_OPTIONS =
|
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 =
|
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 =
|
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 =
|
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
|
//! Can not parse filestore response because user did not pass a valid instance
|
||||||
//! or remaining size is invalid
|
//! or remaining size is invalid
|
||||||
static constexpr ReturnValue_t FILESTORE_RESPONSE_CANT_PARSE_FS_MESSAGE =
|
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
|
//! Checksum types according to the SANA Checksum Types registry
|
||||||
//! https://sanaregistry.org/r/checksum_identifiers/
|
//! https://sanaregistry.org/r/checksum_identifiers/
|
||||||
|
@ -108,7 +108,7 @@ class TcpTmTcServer : public SystemObject, public TcpIpBase, public ExecutableOb
|
|||||||
StorageManagerIF* tmStore = nullptr;
|
StorageManagerIF* tmStore = nullptr;
|
||||||
|
|
||||||
private:
|
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.
|
//! TMTC bridge is cached.
|
||||||
object_id_t tmtcBridgeId = objects::NO_OBJECT;
|
object_id_t tmtcBridgeId = objects::NO_OBJECT;
|
||||||
TcpTmTcBridge* tmtcBridge = nullptr;
|
TcpTmTcBridge* tmtcBridge = nullptr;
|
||||||
|
@ -15,7 +15,7 @@ class FixedTimeslotTaskIF : public PeriodicTaskIF {
|
|||||||
~FixedTimeslotTaskIF() override = default;
|
~FixedTimeslotTaskIF() override = default;
|
||||||
|
|
||||||
static constexpr ReturnValue_t SLOT_LIST_EMPTY =
|
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.
|
* Add an object with a slot time and the execution step to the task.
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
#include "fsfw_tests/internal/UnittDefinitions.h"
|
#include "fsfw_tests/internal/UnittDefinitions.h"
|
||||||
|
|
||||||
using retval = HasReturnvaluesIF;
|
|
||||||
|
|
||||||
void testmq::testMq() {
|
void testmq::testMq() {
|
||||||
std::string id = "[testMq]";
|
std::string id = "[testMq]";
|
||||||
MessageQueueIF* testSenderMq = QueueFactory::instance()->createMessageQueue(1);
|
MessageQueueIF* testSenderMq = QueueFactory::instance()->createMessageQueue(1);
|
||||||
@ -22,22 +20,22 @@ void testmq::testMq() {
|
|||||||
testSenderMq->setDefaultDestination(testReceiverMqId);
|
testSenderMq->setDefaultDestination(testReceiverMqId);
|
||||||
|
|
||||||
auto result = testSenderMq->sendMessage(testReceiverMqId, &testMessage);
|
auto result = testSenderMq->sendMessage(testReceiverMqId, &testMessage);
|
||||||
if (result != retval::RETURN_OK) {
|
if (result != retval::OK) {
|
||||||
unitt::put_error(id);
|
unitt::put_error(id);
|
||||||
}
|
}
|
||||||
MessageQueueMessage recvMessage;
|
MessageQueueMessage recvMessage;
|
||||||
result = testReceiverMq->receiveMessage(&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);
|
unitt::put_error(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = testSenderMq->sendMessage(testReceiverMqId, &testMessage);
|
result = testSenderMq->sendMessage(testReceiverMqId, &testMessage);
|
||||||
if (result != retval::RETURN_OK) {
|
if (result != retval::OK) {
|
||||||
unitt::put_error(id);
|
unitt::put_error(id);
|
||||||
}
|
}
|
||||||
MessageQueueId_t senderId = 0;
|
MessageQueueId_t senderId = 0;
|
||||||
result = testReceiverMq->receiveMessage(&recvMessage, &senderId);
|
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);
|
unitt::put_error(id);
|
||||||
}
|
}
|
||||||
if (senderId != testSenderMqId) {
|
if (senderId != testSenderMqId) {
|
||||||
|
@ -8,24 +8,23 @@
|
|||||||
|
|
||||||
#include "fsfw_tests/internal/UnittDefinitions.h"
|
#include "fsfw_tests/internal/UnittDefinitions.h"
|
||||||
|
|
||||||
using retval = HasReturnvaluesIF;
|
|
||||||
std::array<uint8_t, 512> testserialize::test_array = {0};
|
std::array<uint8_t, 512> testserialize::test_array = {0};
|
||||||
|
|
||||||
ReturnValue_t testserialize::test_serialization() {
|
ReturnValue_t testserialize::test_serialization() {
|
||||||
// Here, we test all serialization tools. First test basic cases.
|
// Here, we test all serialization tools. First test basic cases.
|
||||||
ReturnValue_t result = test_endianness_tools();
|
ReturnValue_t result = test_endianness_tools();
|
||||||
if (result != retval::RETURN_OK) {
|
if (result != retval::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = test_autoserialization();
|
result = test_autoserialization();
|
||||||
if (result != retval::RETURN_OK) {
|
if (result != retval::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = test_serial_buffer_adapter();
|
result = test_serial_buffer_adapter();
|
||||||
if (result != retval::RETURN_OK) {
|
if (result != retval::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return retval::RETURN_OK;
|
return retval::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t testserialize::test_endianness_tools() {
|
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) {
|
if (test_array[0] != 0 and test_array[1] != 1) {
|
||||||
return unitt::put_error(id);
|
return unitt::put_error(id);
|
||||||
}
|
}
|
||||||
return retval::RETURN_OK;
|
return retval::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t testserialize::test_autoserialization() {
|
ReturnValue_t testserialize::test_autoserialization() {
|
||||||
@ -153,7 +152,7 @@ ReturnValue_t testserialize::test_autoserialization() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check overflow
|
// Check overflow
|
||||||
return retval::RETURN_OK;
|
return retval::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Also test for constant buffers.
|
// TODO: Also test for constant buffers.
|
||||||
@ -206,5 +205,5 @@ ReturnValue_t testserialize::test_serial_buffer_adapter() {
|
|||||||
if (testUint16 != 16) {
|
if (testUint16 != 16) {
|
||||||
return unitt::put_error(id);
|
return unitt::put_error(id);
|
||||||
}
|
}
|
||||||
return retval::RETURN_OK;
|
return retval::OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user