Compare commits
2 Commits
action-upd
...
obj-manage
Author | SHA1 | Date | |
---|---|---|---|
50252e36ef
|
|||
f57db99954
|
11
CHANGELOG.md
11
CHANGELOG.md
@ -27,10 +27,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
- add CFDP subsystem ID
|
- add CFDP subsystem ID
|
||||||
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/742
|
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/742
|
||||||
- `EventManager`: Add function to print all listeners.
|
- Added object manager initialization printout failure for `printf` support.
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
|
|
||||||
- Bump ETL version to 20.35.14
|
- Bump ETL version to 20.35.14
|
||||||
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/748
|
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/748
|
||||||
- Renamed `PCDU_2` subsystem ID to `POWER_SWITCH_IF`.
|
- Renamed `PCDU_2` subsystem ID to `POWER_SWITCH_IF`.
|
||||||
@ -39,8 +38,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/743
|
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/743
|
||||||
- Assert that `FixedArrayList` is larger than 0 at compile time.
|
- Assert that `FixedArrayList` is larger than 0 at compile time.
|
||||||
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/740
|
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/740
|
||||||
|
|
||||||
|
## Added
|
||||||
|
|
||||||
|
- `EventManager`: Add function to print all listeners.
|
||||||
|
|
||||||
|
## Changed
|
||||||
|
|
||||||
- `EventManager`: Queue depth is configurable now
|
- `EventManager`: Queue depth is configurable now
|
||||||
- `ActionHelper`: Allow execution of actions without additional data
|
|
||||||
|
|
||||||
# [v6.0.0] 2023-02-10
|
# [v6.0.0] 2023-02-10
|
||||||
|
|
||||||
|
@ -59,24 +59,17 @@ void ActionHelper::setQueueToUse(MessageQueueIF* queue) { queueToUse = queue; }
|
|||||||
|
|
||||||
void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId,
|
void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId,
|
||||||
store_address_t dataAddress) {
|
store_address_t dataAddress) {
|
||||||
bool hasAdditionalData = false;
|
|
||||||
const uint8_t* dataPtr = nullptr;
|
const uint8_t* dataPtr = nullptr;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
ReturnValue_t result;
|
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
|
||||||
if (dataAddress != store_address_t::invalid()) {
|
if (result != returnvalue::OK) {
|
||||||
hasAdditionalData = true;
|
CommandMessage reply;
|
||||||
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
|
ActionMessage::setStepReply(&reply, actionId, 0, result);
|
||||||
if (result != returnvalue::OK) {
|
queueToUse->sendMessage(commandedBy, &reply);
|
||||||
CommandMessage reply;
|
return;
|
||||||
ActionMessage::setStepReply(&reply, actionId, 0, result);
|
|
||||||
queueToUse->sendMessage(commandedBy, &reply);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
result = owner->executeAction(actionId, commandedBy, dataPtr, size);
|
result = owner->executeAction(actionId, commandedBy, dataPtr, size);
|
||||||
if (hasAdditionalData) {
|
ipcStore->deleteData(dataAddress);
|
||||||
ipcStore->deleteData(dataAddress);
|
|
||||||
}
|
|
||||||
if (result == HasActionsIF::EXECUTION_FINISHED) {
|
if (result == HasActionsIF::EXECUTION_FINISHED) {
|
||||||
CommandMessage reply;
|
CommandMessage reply;
|
||||||
ActionMessage::setCompletionReply(&reply, actionId, true, result);
|
ActionMessage::setCompletionReply(&reply, actionId, true, result);
|
||||||
|
@ -16,8 +16,8 @@ class CommandActionHelper {
|
|||||||
public:
|
public:
|
||||||
explicit CommandActionHelper(CommandsActionsIF* owner);
|
explicit CommandActionHelper(CommandsActionsIF* owner);
|
||||||
virtual ~CommandActionHelper();
|
virtual ~CommandActionHelper();
|
||||||
ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId,
|
ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, const uint8_t* data,
|
||||||
const uint8_t* data = nullptr, uint32_t size = 0);
|
uint32_t size);
|
||||||
ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, SerializeIF* data);
|
ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, SerializeIF* data);
|
||||||
ReturnValue_t initialize();
|
ReturnValue_t initialize();
|
||||||
ReturnValue_t handleReply(CommandMessage* reply);
|
ReturnValue_t handleReply(CommandMessage* reply);
|
||||||
|
@ -109,13 +109,16 @@ void ObjectManager::initialize() {
|
|||||||
for (auto const& it : objectList) {
|
for (auto const& it : objectList) {
|
||||||
result = it.second->initialize();
|
result = it.second->initialize();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
object_id_t var = it.first;
|
|
||||||
sif::error << "ObjectManager::initialize: Object 0x" << std::hex << std::setw(8)
|
sif::error << "ObjectManager::initialize: Object 0x" << std::hex << std::setw(8)
|
||||||
<< std::setfill('0') << var
|
<< std::setfill('0') << it.first << " failed to initialize with code 0x" << result
|
||||||
<< " failed to "
|
<< std::dec << std::setfill(' ') << std::endl;
|
||||||
"initialize with code 0x"
|
#else
|
||||||
<< result << std::dec << std::setfill(' ') << std::endl;
|
sif::printError(
|
||||||
|
"ObjectManager::initialize: Object 0x%08x failed to initialize with code 0x%04x\n", var,
|
||||||
|
it.first);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
errorCount++;
|
errorCount++;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,12 @@ TEST_CASE("Action Helper", "[action]") {
|
|||||||
CHECK(not testDhMock.executeActionCalled);
|
CHECK(not testDhMock.executeActionCalled);
|
||||||
REQUIRE(actionHelper.handleActionMessage(&actionMessage) == returnvalue::OK);
|
REQUIRE(actionHelper.handleActionMessage(&actionMessage) == returnvalue::OK);
|
||||||
CHECK(testDhMock.executeActionCalled);
|
CHECK(testDhMock.executeActionCalled);
|
||||||
|
// No message is sent if everything is alright.
|
||||||
CHECK(not testMqMock.wasMessageSent());
|
CHECK(not testMqMock.wasMessageSent());
|
||||||
|
store_address_t invalidAddress;
|
||||||
|
ActionMessage::setCommand(&actionMessage, testActionId, invalidAddress);
|
||||||
|
actionHelper.handleActionMessage(&actionMessage);
|
||||||
|
CHECK(testMqMock.wasMessageSent());
|
||||||
const uint8_t* ptr = nullptr;
|
const uint8_t* ptr = nullptr;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
REQUIRE(ipcStore->getData(paramAddress, &ptr, &size) ==
|
REQUIRE(ipcStore->getData(paramAddress, &ptr, &size) ==
|
||||||
@ -39,10 +44,6 @@ TEST_CASE("Action Helper", "[action]") {
|
|||||||
for (uint8_t i = 0; i < 3; i++) {
|
for (uint8_t i = 0; i < 3; i++) {
|
||||||
REQUIRE(ptr[i] == (i + 1));
|
REQUIRE(ptr[i] == (i + 1));
|
||||||
}
|
}
|
||||||
// Action message without application data is also valid
|
|
||||||
store_address_t invalidAddress;
|
|
||||||
ActionMessage::setCommand(&actionMessage, testActionId, invalidAddress);
|
|
||||||
actionHelper.handleActionMessage(&actionMessage);
|
|
||||||
testDhMock.clearBuffer();
|
testDhMock.clearBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,5 +95,17 @@ TEST_CASE("Action Helper", "[action]") {
|
|||||||
REQUIRE(ActionMessage::getActionId(&testMessage) == testActionId);
|
REQUIRE(ActionMessage::getActionId(&testMessage) == testActionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("Missing IPC Data") {
|
||||||
|
ActionMessage::setCommand(&actionMessage, testActionId, store_address_t::invalid());
|
||||||
|
CHECK(not testDhMock.executeActionCalled);
|
||||||
|
REQUIRE(actionHelper.handleActionMessage(&actionMessage) == returnvalue::OK);
|
||||||
|
CommandMessage testMessage;
|
||||||
|
REQUIRE(testMqMock.getNextSentMessage(testMessage) == returnvalue::OK);
|
||||||
|
REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::STEP_FAILED));
|
||||||
|
REQUIRE(ActionMessage::getReturnCode(&testMessage) ==
|
||||||
|
static_cast<uint32_t>(StorageManagerIF::ILLEGAL_STORAGE_ID));
|
||||||
|
REQUIRE(ActionMessage::getStep(&testMessage) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("Data Reply") {}
|
SECTION("Data Reply") {}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user