retval refactoring
This commit is contained in:
parent
2b6a046983
commit
4ae9f5c746
@ -24,15 +24,15 @@ ReturnValue_t pst::pollingSequenceExamples(FixedTimeslotTaskIF *thisSequence) {
|
||||
thisSequence->addSlot(objects::TEST_DUMMY_2, length * 0.5, FsfwExampleTask::OpCodes::DELAY_SHORT);
|
||||
thisSequence->addSlot(objects::TEST_DUMMY_3, length * 0.5, FsfwExampleTask::OpCodes::DELAY_SHORT);
|
||||
|
||||
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
if (thisSequence->checkSequence() == returnvalue::OK) {
|
||||
return returnvalue::OK;
|
||||
} else {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "pst::pollingSequenceInitFunction: Initialization errors!" << std::endl;
|
||||
#else
|
||||
sif::printError("pst::pollingSequenceInitFunction: Initialization errors!\n");
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,14 +54,14 @@ ReturnValue_t pst::pollingSequenceDevices(FixedTimeslotTaskIF *thisSequence) {
|
||||
thisSequence->addSlot(objects::TEST_DEVICE_HANDLER_0, 0.8 * length, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::TEST_DEVICE_HANDLER_1, 0.8 * length, DeviceHandlerIF::GET_READ);
|
||||
|
||||
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
if (thisSequence->checkSequence() == returnvalue::OK) {
|
||||
return returnvalue::OK;
|
||||
} else {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "pst::pollingSequenceTestFunction: Initialization errors!" << std::endl;
|
||||
#else
|
||||
sif::printError("pst::pollingSequenceTestFunction: Initialization errors!\n");
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
}
|
||||
|
@ -10,15 +10,15 @@ FsfwTestController::FsfwTestController(object_id_t objectId, object_id_t device0
|
||||
deviceDataset0(device0),
|
||||
deviceDataset1(device1) {}
|
||||
|
||||
FsfwTestController::~FsfwTestController() {}
|
||||
FsfwTestController::~FsfwTestController() = default;
|
||||
|
||||
ReturnValue_t FsfwTestController::handleCommandMessage(CommandMessage *message) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t FsfwTestController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||
LocalDataPoolManager &poolManager) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
void FsfwTestController::performControlOperation() {
|
||||
@ -64,11 +64,10 @@ void FsfwTestController::performControlOperation() {
|
||||
ReturnValue_t FsfwTestController::initializeAfterTaskCreation() {
|
||||
namespace td = testdevice;
|
||||
ReturnValue_t result = TestController::initializeAfterTaskCreation();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
HasLocalDataPoolIF *device0 =
|
||||
ObjectManager::instance()->get<HasLocalDataPoolIF>(deviceDataset0.getCreatorObjectId());
|
||||
auto *device0 = ObjectManager::instance()->get<HasLocalDataPoolIF>(deviceDataset0.getCreatorObjectId());
|
||||
if (device0 == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "TestController::initializeAfterTaskCreation: Test device handler 0 "
|
||||
@ -90,8 +89,7 @@ ReturnValue_t FsfwTestController::initializeAfterTaskCreation() {
|
||||
getCommandQueue(), false);
|
||||
}
|
||||
|
||||
HasLocalDataPoolIF *device1 =
|
||||
ObjectManager::instance()->get<HasLocalDataPoolIF>(deviceDataset0.getCreatorObjectId());
|
||||
auto *device1 = ObjectManager::instance()->get<HasLocalDataPoolIF>(deviceDataset0.getCreatorObjectId());
|
||||
if (device1 == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "TestController::initializeAfterTaskCreation: Test device handler 1 "
|
||||
@ -119,7 +117,7 @@ LocalPoolDataSetBase *FsfwTestController::getDataSetHandle(sid_t sid) { return n
|
||||
|
||||
ReturnValue_t FsfwTestController::checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
uint32_t *msToReachTheMode) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
void FsfwTestController::handleChangedDataset(sid_t sid, store_address_t storeId,
|
||||
|
@ -27,13 +27,13 @@ ReturnValue_t FsfwExampleTask::performOperation(uint8_t operationCode) {
|
||||
|
||||
// TODO: Move this to new test controller?
|
||||
ReturnValue_t result = performMonitoringDemo();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (operationCode == OpCodes::SEND_RAND_NUM) {
|
||||
result = performSendOperation();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -80,14 +80,14 @@ object_id_t FsfwExampleTask::getSender() {
|
||||
ReturnValue_t FsfwExampleTask::initialize() {
|
||||
// Get the dataset of the sender. Will be cached for later checks.
|
||||
object_id_t sender = getSender();
|
||||
HasLocalDataPoolIF *senderIF = ObjectManager::instance()->get<HasLocalDataPoolIF>(sender);
|
||||
auto *senderIF = ObjectManager::instance()->get<HasLocalDataPoolIF>(sender);
|
||||
if (senderIF == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "FsfwDemoTask::initialize: Sender object invalid!" << std::endl;
|
||||
#else
|
||||
sif::printError("FsfwDemoTask::initialize: Sender object invalid!\n");
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
|
||||
// we need a private copy of the previous dataset.. or we use the shared
|
||||
@ -99,7 +99,7 @@ ReturnValue_t FsfwExampleTask::initialize() {
|
||||
#else
|
||||
sif::printError("FsfwDemoTask::initialize: Sender dataset invalid!\n");
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
return poolManager.initialize(commandQueue);
|
||||
}
|
||||
@ -122,12 +122,12 @@ ReturnValue_t FsfwExampleTask::initializeLocalDataPool(localpool::DataPool &loca
|
||||
LocalDataPoolManager &poolManager) {
|
||||
localDataPoolMap.emplace(FsfwDemoSet::PoolIds::VARIABLE, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(FsfwDemoSet::PoolIds::VARIABLE_LIMIT, new PoolEntry<uint16_t>({0}));
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t FsfwExampleTask::performMonitoringDemo() {
|
||||
ReturnValue_t result = demoSet.variableLimit.read(MutexIF::TimeoutType::WAITING, 20);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (result != returnvalue::OK) {
|
||||
/* Configuration error */
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "DummyObject::performOperation: Could not read variableLimit!" << std::endl;
|
||||
@ -144,12 +144,12 @@ ReturnValue_t FsfwExampleTask::performMonitoringDemo() {
|
||||
demoSet.variableLimit.commit(20);
|
||||
monitor.check();
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t FsfwExampleTask::performSendOperation() {
|
||||
object_id_t nextRecipient = getNextRecipient();
|
||||
FsfwExampleTask *target = ObjectManager::instance()->get<FsfwExampleTask>(nextRecipient);
|
||||
auto *target = ObjectManager::instance()->get<FsfwExampleTask>(nextRecipient);
|
||||
if (target == nullptr) {
|
||||
/* Configuration error */
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
@ -157,7 +157,7 @@ ReturnValue_t FsfwExampleTask::performSendOperation() {
|
||||
#else
|
||||
sif::printError("DummyObject::performOperation: Next recipient does not exist!\n");
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
|
||||
uint32_t randomNumber = rand() % 100;
|
||||
@ -167,7 +167,7 @@ ReturnValue_t FsfwExampleTask::performSendOperation() {
|
||||
|
||||
/* Send message using own message queue */
|
||||
ReturnValue_t result = commandQueue->sendMessage(target->getMessageQueueId(), &message);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK && result != MessageQueueIF::FULL) {
|
||||
if (result != returnvalue::OK && result != MessageQueueIF::FULL) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "FsfwDemoTask::performSendOperation: Send failed with " << result << std::endl;
|
||||
#else
|
||||
@ -178,7 +178,7 @@ ReturnValue_t FsfwExampleTask::performSendOperation() {
|
||||
/* Send message without via MessageQueueSenderIF */
|
||||
result = MessageQueueSenderIF::sendMessage(target->getMessageQueueId(), &message,
|
||||
commandQueue->getId());
|
||||
if (result != HasReturnvaluesIF::RETURN_OK && result != MessageQueueIF::FULL) {
|
||||
if (result != returnvalue::OK && result != MessageQueueIF::FULL) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "FsfwDemoTask::performSendOperation: Send failed with " << result << std::endl;
|
||||
#else
|
||||
@ -193,11 +193,11 @@ ReturnValue_t FsfwExampleTask::performSendOperation() {
|
||||
}
|
||||
|
||||
ReturnValue_t FsfwExampleTask::performReceiveOperation() {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
while (result != MessageQueueIF::EMPTY) {
|
||||
CommandMessage receivedMessage;
|
||||
result = commandQueue->receiveMessage(&receivedMessage);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK && result != MessageQueueIF::EMPTY) {
|
||||
if (result != returnvalue::OK && result != MessageQueueIF::EMPTY) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "Receive failed with " << result << std::endl;
|
||||
#endif
|
||||
@ -213,11 +213,11 @@ ReturnValue_t FsfwExampleTask::performReceiveOperation() {
|
||||
#endif
|
||||
|
||||
if (senderSet == nullptr) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
|
||||
result = senderSet->variableRead.read(MutexIF::TimeoutType::WAITING, 20);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
if (senderSet->variableRead.value != receivedMessage.getParameter()) {
|
||||
|
@ -18,12 +18,12 @@ FsfwReaderTask::FsfwReaderTask(object_id_t objectId, bool enablePrintout)
|
||||
readSet.setReadCommitProtectionBehaviour(true);
|
||||
}
|
||||
|
||||
FsfwReaderTask::~FsfwReaderTask() {}
|
||||
FsfwReaderTask::~FsfwReaderTask() = default;
|
||||
|
||||
ReturnValue_t FsfwReaderTask::initializeAfterTaskCreation() {
|
||||
/* Give other task some time to set up local data pools. */
|
||||
TaskFactory::delayTask(20);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t FsfwReaderTask::performOperation(uint8_t operationCode) {
|
||||
@ -51,5 +51,5 @@ ReturnValue_t FsfwReaderTask::performOperation(uint8_t operationCode) {
|
||||
if (variable1 and variable2 and variable3) {
|
||||
};
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
@ -17,5 +17,5 @@ ReturnValue_t FsfwTestTask::performPeriodicAction() {
|
||||
if (periodicEvent) {
|
||||
triggerEvent(TEST_EVENT, 0x1234, 0x4321);
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ void MutexExample::example() {
|
||||
MutexIF *mutex2 = MutexFactory::instance()->createMutex();
|
||||
|
||||
ReturnValue_t result = mutex->lockMutex(MutexIF::TimeoutType::WAITING, 2 * 60 * 1000);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (result != returnvalue::OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "MutexExample::example: Lock Failed with " << result << std::endl;
|
||||
#else
|
||||
@ -17,7 +17,7 @@ void MutexExample::example() {
|
||||
}
|
||||
|
||||
result = mutex2->lockMutex(MutexIF::TimeoutType::BLOCKING);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (result != returnvalue::OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "MutexExample::example: Lock Failed with " << result << std::endl;
|
||||
#else
|
||||
@ -26,7 +26,7 @@ void MutexExample::example() {
|
||||
}
|
||||
|
||||
result = mutex->unlockMutex();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (result != returnvalue::OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "MutexExample::example: Unlock Failed with " << result << std::endl;
|
||||
#else
|
||||
@ -35,7 +35,7 @@ void MutexExample::example() {
|
||||
}
|
||||
|
||||
result = mutex2->unlockMutex();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (result != returnvalue::OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "MutexExample::example: Unlock Failed with " << result << std::endl;
|
||||
#else
|
||||
|
@ -27,9 +27,9 @@ MessageQueueId_t TmFunnel::getReportReceptionQueue(uint8_t virtualChannel) {
|
||||
ReturnValue_t TmFunnel::performOperation(uint8_t operationCode) {
|
||||
TmTcMessage currentMessage;
|
||||
ReturnValue_t status = tmQueue->receiveMessage(¤tMessage);
|
||||
while (status == HasReturnvaluesIF::RETURN_OK) {
|
||||
while (status == returnvalue::OK) {
|
||||
status = handlePacket(¤tMessage);
|
||||
if (status != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (status != returnvalue::OK) {
|
||||
sif::warning << "TmFunnel packet handling failed" << std::endl;
|
||||
break;
|
||||
}
|
||||
@ -37,7 +37,7 @@ ReturnValue_t TmFunnel::performOperation(uint8_t operationCode) {
|
||||
}
|
||||
|
||||
if (status == MessageQueueIF::EMPTY) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
return returnvalue::OK;
|
||||
} else {
|
||||
return status;
|
||||
}
|
||||
@ -47,12 +47,12 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage *message) {
|
||||
uint8_t *packetData = nullptr;
|
||||
size_t size = 0;
|
||||
ReturnValue_t result = tmPool->modifyData(message->getStorageId(), &packetData, &size);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
PusTmZeroCopyWriter packet(timeReader, packetData, size);
|
||||
result = packet.parseDataWithoutCrcCheck();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
packet.setSequenceCount(sourceSequenceCount++);
|
||||
@ -60,7 +60,7 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage *message) {
|
||||
packet.updateErrorControl();
|
||||
|
||||
result = tmQueue->sendToDefault(message);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (result != returnvalue::OK) {
|
||||
tmPool->deleteData(message->getStorageId());
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "TmFunnel::handlePacket: Error sending TM to downlink handler" << std::endl;
|
||||
@ -70,7 +70,7 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage *message) {
|
||||
|
||||
if (storageDestination != objects::NO_OBJECT) {
|
||||
result = storageQueue->sendToDefault(message);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (result != returnvalue::OK) {
|
||||
tmPool->deleteData(message->getStorageId());
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "TmFunnel::handlePacket: Error sending to storage handler" << std::endl;
|
||||
@ -93,8 +93,7 @@ ReturnValue_t TmFunnel::initialize() {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
AcceptsTelemetryIF *tmTarget =
|
||||
ObjectManager::instance()->get<AcceptsTelemetryIF>(downlinkDestination);
|
||||
auto *tmTarget = ObjectManager::instance()->get<AcceptsTelemetryIF>(downlinkDestination);
|
||||
if (tmTarget == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "TmFunnel::initialize: Downlink Destination not set." << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user