Compare commits
15 Commits
master
...
mueller/cl
Author | SHA1 | Date | |
---|---|---|---|
a7eb165f34 | |||
dd1e26e719 | |||
a2c024b24c | |||
e90960a7b6 | |||
e2b3cdd6c4 | |||
1e7a39a8e1 | |||
28380deab0 | |||
c361751751 | |||
17a153485d | |||
fffe1f812f | |||
2a9300e947 | |||
13f3a312be | |||
9705bf5d40 | |||
5425360876 | |||
b904d33cfe |
@ -1,5 +1,5 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="fsfw-tests_coverage" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="fsfw-tests" TARGET_NAME="fsfw-tests_coverage" CONFIG_NAME="Debug Unittest" RUN_TARGET_PROJECT_NAME="fsfw-tests" RUN_TARGET_NAME="fsfw-tests">
|
<configuration default="false" name="fsfw-tests_coverage" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="fsfw-example-hosted" TARGET_NAME="fsfw-tests_coverage" CONFIG_NAME="Debug Unittest" RUN_TARGET_PROJECT_NAME="fsfw-example-hosted" RUN_TARGET_NAME="fsfw-tests">
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
|
@ -17,8 +17,6 @@ MgmLIS3MDLHandler::MgmLIS3MDLHandler(object_id_t objectId, object_id_t deviceCom
|
|||||||
registers[4] = MGMLIS3MDL::CTRL_REG5_DEFAULT;
|
registers[4] = MGMLIS3MDL::CTRL_REG5_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
MgmLIS3MDLHandler::~MgmLIS3MDLHandler() {}
|
|
||||||
|
|
||||||
void MgmLIS3MDLHandler::doStartUp() {
|
void MgmLIS3MDLHandler::doStartUp() {
|
||||||
switch (internalState) {
|
switch (internalState) {
|
||||||
case (InternalState::STATE_NONE): {
|
case (InternalState::STATE_NONE): {
|
||||||
@ -90,7 +88,7 @@ ReturnValue_t MgmLIS3MDLHandler::buildTransitionDeviceCommand(DeviceCommandId_t
|
|||||||
|
|
||||||
uint8_t MgmLIS3MDLHandler::readCommand(uint8_t command, bool continuousCom) {
|
uint8_t MgmLIS3MDLHandler::readCommand(uint8_t command, bool continuousCom) {
|
||||||
command |= (1 << MGMLIS3MDL::RW_BIT);
|
command |= (1 << MGMLIS3MDL::RW_BIT);
|
||||||
if (continuousCom == true) {
|
if (continuousCom) {
|
||||||
command |= (1 << MGMLIS3MDL::MS_BIT);
|
command |= (1 << MGMLIS3MDL::MS_BIT);
|
||||||
}
|
}
|
||||||
return command;
|
return command;
|
||||||
@ -98,7 +96,7 @@ uint8_t MgmLIS3MDLHandler::readCommand(uint8_t command, bool continuousCom) {
|
|||||||
|
|
||||||
uint8_t MgmLIS3MDLHandler::writeCommand(uint8_t command, bool continuousCom) {
|
uint8_t MgmLIS3MDLHandler::writeCommand(uint8_t command, bool continuousCom) {
|
||||||
command &= ~(1 << MGMLIS3MDL::RW_BIT);
|
command &= ~(1 << MGMLIS3MDL::RW_BIT);
|
||||||
if (continuousCom == true) {
|
if (continuousCom) {
|
||||||
command |= (1 << MGMLIS3MDL::MS_BIT);
|
command |= (1 << MGMLIS3MDL::MS_BIT);
|
||||||
}
|
}
|
||||||
return command;
|
return command;
|
||||||
|
@ -28,7 +28,7 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
|
|||||||
|
|
||||||
MgmLIS3MDLHandler(uint32_t objectId, object_id_t deviceCommunication, CookieIF *comCookie,
|
MgmLIS3MDLHandler(uint32_t objectId, object_id_t deviceCommunication, CookieIF *comCookie,
|
||||||
uint32_t transitionDelay);
|
uint32_t transitionDelay);
|
||||||
virtual ~MgmLIS3MDLHandler();
|
~MgmLIS3MDLHandler() override = default;
|
||||||
|
|
||||||
void enablePeriodicPrintouts(bool enable, uint8_t divider);
|
void enablePeriodicPrintouts(bool enable, uint8_t divider);
|
||||||
/**
|
/**
|
||||||
@ -46,7 +46,7 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
|
|||||||
void doShutDown() override;
|
void doShutDown() override;
|
||||||
void doStartUp() override;
|
void doStartUp() override;
|
||||||
void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override;
|
void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override;
|
||||||
virtual uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override;
|
uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override;
|
||||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData,
|
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData,
|
||||||
size_t commandDataLen) override;
|
size_t commandDataLen) override;
|
||||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
|
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
|
||||||
@ -60,9 +60,9 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
|
|||||||
* @param packet
|
* @param packet
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
|
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
|
||||||
void fillCommandAndReplyMap() override;
|
void fillCommandAndReplyMap() override;
|
||||||
void modeChanged(void) override;
|
void modeChanged() override;
|
||||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
LocalDataPoolManager &poolManager) override;
|
LocalDataPoolManager &poolManager) override;
|
||||||
|
|
||||||
@ -72,8 +72,6 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
|
|||||||
static const uint8_t SINGLE_COMMAND_ANSWER_LEN = 2;
|
static const uint8_t SINGLE_COMMAND_ANSWER_LEN = 2;
|
||||||
|
|
||||||
uint32_t transitionDelay;
|
uint32_t transitionDelay;
|
||||||
// Single SPI command has 2 bytes, first for adress, second for content
|
|
||||||
size_t singleComandSize = 2;
|
|
||||||
// Has the size for all adresses of the lis3mdl + the continous write bit
|
// Has the size for all adresses of the lis3mdl + the continous write bit
|
||||||
uint8_t commandBuffer[MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1];
|
uint8_t commandBuffer[MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1];
|
||||||
|
|
||||||
@ -88,7 +86,6 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
|
|||||||
*/
|
*/
|
||||||
uint8_t registers[MGMLIS3MDL::NR_OF_CTRL_REGISTERS];
|
uint8_t registers[MGMLIS3MDL::NR_OF_CTRL_REGISTERS];
|
||||||
|
|
||||||
uint8_t statusRegister = 0;
|
|
||||||
bool goToNormalMode = false;
|
bool goToNormalMode = false;
|
||||||
|
|
||||||
enum class InternalState {
|
enum class InternalState {
|
||||||
@ -111,14 +108,14 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
|
|||||||
* @param single command to set the read-bit at
|
* @param single command to set the read-bit at
|
||||||
* @param boolean to select a continuous read bit, default = false
|
* @param boolean to select a continuous read bit, default = false
|
||||||
*/
|
*/
|
||||||
uint8_t readCommand(uint8_t command, bool continuousCom = false);
|
static uint8_t readCommand(uint8_t command, bool continuousCom = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the write bit for the command
|
* Sets the write bit for the command
|
||||||
* @param single command to set the write-bit at
|
* @param single command to set the write-bit at
|
||||||
* @param boolean to select a continuous write bit, default = false
|
* @param boolean to select a continuous write bit, default = false
|
||||||
*/
|
*/
|
||||||
uint8_t writeCommand(uint8_t command, bool continuousCom = false);
|
static uint8_t writeCommand(uint8_t command, bool continuousCom = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This Method gets the full scale for the measurement range
|
* This Method gets the full scale for the measurement range
|
||||||
|
@ -329,9 +329,9 @@ ReturnValue_t MgmRM3100Handler::handleDataReadout(const uint8_t *packet) {
|
|||||||
int32_t fieldStrengthRawZ = ((packet[7] << 24) | (packet[8] << 16) | (packet[3] << 8)) >> 8;
|
int32_t fieldStrengthRawZ = ((packet[7] << 24) | (packet[8] << 16) | (packet[3] << 8)) >> 8;
|
||||||
|
|
||||||
// Now scale to physical value in microtesla
|
// Now scale to physical value in microtesla
|
||||||
float fieldStrengthX = fieldStrengthRawX * scaleFactorX;
|
float fieldStrengthX = static_cast<float>(fieldStrengthRawX) * scaleFactorX;
|
||||||
float fieldStrengthY = fieldStrengthRawY * scaleFactorX;
|
float fieldStrengthY = static_cast<float>(fieldStrengthRawY) * scaleFactorY;
|
||||||
float fieldStrengthZ = fieldStrengthRawZ * scaleFactorX;
|
float fieldStrengthZ = static_cast<float>(fieldStrengthRawZ) * scaleFactorZ;
|
||||||
|
|
||||||
if (periodicPrintout) {
|
if (periodicPrintout) {
|
||||||
if (debugDivider.checkAndIncrement()) {
|
if (debugDivider.checkAndIncrement()) {
|
||||||
|
@ -72,7 +72,6 @@ class MgmRM3100Handler : public DeviceHandlerBase {
|
|||||||
RM3100::Rm3100PrimaryDataset primaryDataset;
|
RM3100::Rm3100PrimaryDataset primaryDataset;
|
||||||
|
|
||||||
uint8_t commandBuffer[10];
|
uint8_t commandBuffer[10];
|
||||||
uint8_t commandBufferLen = 0;
|
|
||||||
|
|
||||||
uint8_t cmmRegValue = RM3100::CMM_VALUE;
|
uint8_t cmmRegValue = RM3100::CMM_VALUE;
|
||||||
uint8_t tmrcRegValue = RM3100::TMRC_DEFAULT_VALUE;
|
uint8_t tmrcRegValue = RM3100::TMRC_DEFAULT_VALUE;
|
||||||
@ -100,4 +99,4 @@ class MgmRM3100Handler : public DeviceHandlerBase {
|
|||||||
PeriodicOperationDivider debugDivider = PeriodicOperationDivider(3);
|
PeriodicOperationDivider debugDivider = PeriodicOperationDivider(3);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_DEVICEHANDLING_MGMRM3100HANDLER_H_ */
|
#endif /* MISSION_DEVICES_MGMRM3100HANDLER_H_ */
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue)
|
ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue)
|
||||||
: owner(setOwner), queueToUse(useThisQueue) {}
|
: owner(setOwner), queueToUse(useThisQueue) {}
|
||||||
|
|
||||||
ActionHelper::~ActionHelper() {}
|
ActionHelper::~ActionHelper() = default;
|
||||||
|
|
||||||
ReturnValue_t ActionHelper::handleActionMessage(CommandMessage* command) {
|
ReturnValue_t ActionHelper::handleActionMessage(CommandMessage* command) {
|
||||||
if (command->getCommand() == ActionMessage::EXECUTE_ACTION) {
|
if (command->getCommand() == ActionMessage::EXECUTE_ACTION) {
|
||||||
@ -59,7 +59,7 @@ 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) {
|
||||||
const uint8_t* dataPtr = NULL;
|
const uint8_t* dataPtr = nullptr;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
|
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#ifndef FSFW_ACTION_ACTIONHELPER_H_
|
#ifndef FSFW_ACTION_ACTIONHELPER_H_
|
||||||
#define FSFW_ACTION_ACTIONHELPER_H_
|
#define FSFW_ACTION_ACTIONHELPER_H_
|
||||||
|
|
||||||
#include "../ipc/MessageQueueIF.h"
|
|
||||||
#include "../serialize/SerializeIF.h"
|
|
||||||
#include "ActionMessage.h"
|
#include "ActionMessage.h"
|
||||||
|
#include "fsfw/ipc/MessageQueueIF.h"
|
||||||
|
#include "fsfw/serialize/SerializeIF.h"
|
||||||
/**
|
/**
|
||||||
* @brief Action Helper is a helper class which handles action messages
|
* @brief Action Helper is a helper class which handles action messages
|
||||||
*
|
*
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||||
|
|
||||||
ActionMessage::ActionMessage() {}
|
ActionMessage::ActionMessage() = default;
|
||||||
|
|
||||||
ActionMessage::~ActionMessage() {}
|
ActionMessage::~ActionMessage() = default;
|
||||||
|
|
||||||
void ActionMessage::setCommand(CommandMessage* message, ActionId_t fid,
|
void ActionMessage::setCommand(CommandMessage* message, ActionId_t fid,
|
||||||
store_address_t parameters) {
|
store_address_t parameters) {
|
||||||
@ -64,9 +64,8 @@ void ActionMessage::clear(CommandMessage* message) {
|
|||||||
switch (message->getCommand()) {
|
switch (message->getCommand()) {
|
||||||
case EXECUTE_ACTION:
|
case EXECUTE_ACTION:
|
||||||
case DATA_REPLY: {
|
case DATA_REPLY: {
|
||||||
StorageManagerIF* ipcStore =
|
auto* ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
||||||
ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
if (ipcStore != nullptr) {
|
||||||
if (ipcStore != NULL) {
|
|
||||||
ipcStore->deleteData(getStoreId(message));
|
ipcStore->deleteData(getStoreId(message));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
|
|
||||||
CommandActionHelper::CommandActionHelper(CommandsActionsIF *setOwner)
|
CommandActionHelper::CommandActionHelper(CommandsActionsIF *setOwner)
|
||||||
: owner(setOwner), queueToUse(NULL), ipcStore(NULL), commandCount(0), lastTarget(0) {}
|
: owner(setOwner), queueToUse(nullptr), ipcStore(nullptr), commandCount(0), lastTarget(0) {}
|
||||||
|
|
||||||
CommandActionHelper::~CommandActionHelper() {}
|
CommandActionHelper::~CommandActionHelper() = default;
|
||||||
|
|
||||||
ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId_t actionId,
|
ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId_t actionId,
|
||||||
SerializeIF *data) {
|
SerializeIF *data) {
|
||||||
HasActionsIF *receiver = ObjectManager::instance()->get<HasActionsIF>(commandTo);
|
auto *receiver = ObjectManager::instance()->get<HasActionsIF>(commandTo);
|
||||||
if (receiver == NULL) {
|
if (receiver == nullptr) {
|
||||||
return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS;
|
return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS;
|
||||||
}
|
}
|
||||||
store_address_t storeId;
|
store_address_t storeId;
|
||||||
@ -29,11 +29,8 @@ ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId
|
|||||||
|
|
||||||
ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId_t actionId,
|
ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId_t actionId,
|
||||||
const uint8_t *data, uint32_t size) {
|
const uint8_t *data, uint32_t size) {
|
||||||
// if (commandCount != 0) {
|
auto *receiver = ObjectManager::instance()->get<HasActionsIF>(commandTo);
|
||||||
// return CommandsFunctionsIF::ALREADY_COMMANDING;
|
if (receiver == nullptr) {
|
||||||
// }
|
|
||||||
HasActionsIF *receiver = ObjectManager::instance()->get<HasActionsIF>(commandTo);
|
|
||||||
if (receiver == NULL) {
|
|
||||||
return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS;
|
return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS;
|
||||||
}
|
}
|
||||||
store_address_t storeId;
|
store_address_t storeId;
|
||||||
@ -59,12 +56,12 @@ ReturnValue_t CommandActionHelper::sendCommand(MessageQueueId_t queueId, ActionI
|
|||||||
|
|
||||||
ReturnValue_t CommandActionHelper::initialize() {
|
ReturnValue_t CommandActionHelper::initialize() {
|
||||||
ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
||||||
if (ipcStore == NULL) {
|
if (ipcStore == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
queueToUse = owner->getCommandQueuePtr();
|
queueToUse = owner->getCommandQueuePtr();
|
||||||
if (queueToUse == NULL) {
|
if (queueToUse == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
@ -104,7 +101,7 @@ ReturnValue_t CommandActionHelper::handleReply(CommandMessage *reply) {
|
|||||||
uint8_t CommandActionHelper::getCommandCount() const { return commandCount; }
|
uint8_t CommandActionHelper::getCommandCount() const { return commandCount; }
|
||||||
|
|
||||||
void CommandActionHelper::extractDataForOwner(ActionId_t actionId, store_address_t storeId) {
|
void CommandActionHelper::extractDataForOwner(ActionId_t actionId, store_address_t storeId) {
|
||||||
const uint8_t *data = NULL;
|
const uint8_t *data = nullptr;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
ReturnValue_t result = ipcStore->getData(storeId, &data, &size);
|
ReturnValue_t result = ipcStore->getData(storeId, &data, &size);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
@ -14,14 +14,14 @@ class CommandActionHelper {
|
|||||||
friend class CommandsActionsIF;
|
friend class CommandsActionsIF;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CommandActionHelper(CommandsActionsIF* owner);
|
explicit CommandActionHelper(CommandsActionsIF* owner);
|
||||||
virtual ~CommandActionHelper();
|
virtual ~CommandActionHelper();
|
||||||
ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, const uint8_t* data,
|
ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, const uint8_t* data,
|
||||||
uint32_t size);
|
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);
|
||||||
uint8_t getCommandCount() const;
|
[[nodiscard]] uint8_t getCommandCount() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CommandsActionsIF* owner;
|
CommandsActionsIF* owner;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#ifndef FSFW_ACTION_COMMANDSACTIONSIF_H_
|
#ifndef FSFW_ACTION_COMMANDSACTIONSIF_H_
|
||||||
#define FSFW_ACTION_COMMANDSACTIONSIF_H_
|
#define FSFW_ACTION_COMMANDSACTIONSIF_H_
|
||||||
|
|
||||||
#include "../ipc/MessageQueueIF.h"
|
|
||||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
|
||||||
#include "CommandActionHelper.h"
|
#include "CommandActionHelper.h"
|
||||||
|
#include "fsfw/ipc/MessageQueueIF.h"
|
||||||
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface to separate commanding actions of other objects.
|
* Interface to separate commanding actions of other objects.
|
||||||
@ -21,7 +21,7 @@ class CommandsActionsIF {
|
|||||||
static const uint8_t INTERFACE_ID = CLASS_ID::COMMANDS_ACTIONS_IF;
|
static const uint8_t INTERFACE_ID = CLASS_ID::COMMANDS_ACTIONS_IF;
|
||||||
static const ReturnValue_t OBJECT_HAS_NO_FUNCTIONS = MAKE_RETURN_CODE(1);
|
static const ReturnValue_t OBJECT_HAS_NO_FUNCTIONS = MAKE_RETURN_CODE(1);
|
||||||
static const ReturnValue_t ALREADY_COMMANDING = MAKE_RETURN_CODE(2);
|
static const ReturnValue_t ALREADY_COMMANDING = MAKE_RETURN_CODE(2);
|
||||||
virtual ~CommandsActionsIF() {}
|
virtual ~CommandsActionsIF() = default;
|
||||||
virtual MessageQueueIF* getCommandQueuePtr() = 0;
|
virtual MessageQueueIF* getCommandQueuePtr() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#ifndef FSFW_ACTION_HASACTIONSIF_H_
|
#ifndef FSFW_ACTION_HASACTIONSIF_H_
|
||||||
#define FSFW_ACTION_HASACTIONSIF_H_
|
#define FSFW_ACTION_HASACTIONSIF_H_
|
||||||
|
|
||||||
#include "../ipc/MessageQueueIF.h"
|
|
||||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
|
||||||
#include "ActionHelper.h"
|
#include "ActionHelper.h"
|
||||||
#include "ActionMessage.h"
|
#include "ActionMessage.h"
|
||||||
#include "SimpleActionHelper.h"
|
#include "SimpleActionHelper.h"
|
||||||
|
#include "fsfw/ipc/MessageQueueIF.h"
|
||||||
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
@ -40,12 +40,12 @@ class HasActionsIF {
|
|||||||
static const ReturnValue_t INVALID_PARAMETERS = MAKE_RETURN_CODE(2);
|
static const ReturnValue_t INVALID_PARAMETERS = MAKE_RETURN_CODE(2);
|
||||||
static const ReturnValue_t EXECUTION_FINISHED = MAKE_RETURN_CODE(3);
|
static const ReturnValue_t EXECUTION_FINISHED = MAKE_RETURN_CODE(3);
|
||||||
static const ReturnValue_t INVALID_ACTION_ID = MAKE_RETURN_CODE(4);
|
static const ReturnValue_t INVALID_ACTION_ID = MAKE_RETURN_CODE(4);
|
||||||
virtual ~HasActionsIF() {}
|
virtual ~HasActionsIF() = default;
|
||||||
/**
|
/**
|
||||||
* Function to get the MessageQueueId_t of the implementing object
|
* Function to get the MessageQueueId_t of the implementing object
|
||||||
* @return MessageQueueId_t of the object
|
* @return MessageQueueId_t of the object
|
||||||
*/
|
*/
|
||||||
virtual MessageQueueId_t getCommandQueue() const = 0;
|
[[nodiscard]] virtual MessageQueueId_t getCommandQueue() const = 0;
|
||||||
/**
|
/**
|
||||||
* Execute or initialize the execution of a certain function.
|
* Execute or initialize the execution of a certain function.
|
||||||
* The ActionHelpers will execute this function and behave differently
|
* The ActionHelpers will execute this function and behave differently
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
SimpleActionHelper::SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue)
|
SimpleActionHelper::SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue)
|
||||||
: ActionHelper(setOwner, useThisQueue), isExecuting(false) {}
|
: ActionHelper(setOwner, useThisQueue), isExecuting(false) {}
|
||||||
|
|
||||||
SimpleActionHelper::~SimpleActionHelper() {}
|
SimpleActionHelper::~SimpleActionHelper() = default;
|
||||||
|
|
||||||
void SimpleActionHelper::step(ReturnValue_t result) {
|
void SimpleActionHelper::step(ReturnValue_t result) {
|
||||||
// STEP_OFFESET is subtracted to compensate for adding offset in base
|
// STEP_OFFESET is subtracted to compensate for adding offset in base
|
||||||
@ -38,7 +38,7 @@ void SimpleActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId
|
|||||||
ActionMessage::setStepReply(&reply, actionId, 0, HasActionsIF::IS_BUSY);
|
ActionMessage::setStepReply(&reply, actionId, 0, HasActionsIF::IS_BUSY);
|
||||||
queueToUse->sendMessage(commandedBy, &reply);
|
queueToUse->sendMessage(commandedBy, &reply);
|
||||||
}
|
}
|
||||||
const uint8_t* dataPtr = NULL;
|
const uint8_t* dataPtr = nullptr;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
|
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
@ -11,15 +11,15 @@
|
|||||||
class SimpleActionHelper : public ActionHelper {
|
class SimpleActionHelper : public ActionHelper {
|
||||||
public:
|
public:
|
||||||
SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue);
|
SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue);
|
||||||
virtual ~SimpleActionHelper();
|
~SimpleActionHelper() override;
|
||||||
void step(ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
|
void step(ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
|
||||||
void finish(ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
|
void finish(ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
|
||||||
ReturnValue_t reportData(SerializeIF* data);
|
ReturnValue_t reportData(SerializeIF* data);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId,
|
void prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId,
|
||||||
store_address_t dataAddress);
|
store_address_t dataAddress) override;
|
||||||
virtual void resetHelper();
|
void resetHelper() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isExecuting;
|
bool isExecuting;
|
||||||
@ -28,4 +28,4 @@ class SimpleActionHelper : public ActionHelper {
|
|||||||
uint8_t stepCount = 0;
|
uint8_t stepCount = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SIMPLEACTIONHELPER_H_ */
|
#endif /* FSFW_ACTION_SIMPLEACTIONHELPER_H_ */
|
||||||
|
@ -13,10 +13,12 @@ AckInfo::AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCode ackedC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AckInfo::AckInfo() = default;
|
||||||
|
|
||||||
cfdp::ConditionCode AckInfo::getAckedConditionCode() const { return ackedConditionCode; }
|
cfdp::ConditionCode AckInfo::getAckedConditionCode() const { return ackedConditionCode; }
|
||||||
|
|
||||||
void AckInfo::setAckedConditionCode(cfdp::ConditionCode ackedConditionCode) {
|
void AckInfo::setAckedConditionCode(cfdp::ConditionCode ackedConditionCode_) {
|
||||||
this->ackedConditionCode = ackedConditionCode;
|
ackedConditionCode = ackedConditionCode_;
|
||||||
if (ackedDirective == cfdp::FileDirectives::FINISH) {
|
if (ackedDirective == cfdp::FileDirectives::FINISH) {
|
||||||
this->directiveSubtypeCode = 0b0001;
|
this->directiveSubtypeCode = 0b0001;
|
||||||
} else {
|
} else {
|
||||||
@ -26,20 +28,18 @@ void AckInfo::setAckedConditionCode(cfdp::ConditionCode ackedConditionCode) {
|
|||||||
|
|
||||||
cfdp::FileDirectives AckInfo::getAckedDirective() const { return ackedDirective; }
|
cfdp::FileDirectives AckInfo::getAckedDirective() const { return ackedDirective; }
|
||||||
|
|
||||||
void AckInfo::setAckedDirective(cfdp::FileDirectives ackedDirective) {
|
void AckInfo::setAckedDirective(cfdp::FileDirectives ackedDirective_) {
|
||||||
this->ackedDirective = ackedDirective;
|
ackedDirective = ackedDirective_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t AckInfo::getDirectiveSubtypeCode() const { return directiveSubtypeCode; }
|
uint8_t AckInfo::getDirectiveSubtypeCode() const { return directiveSubtypeCode; }
|
||||||
|
|
||||||
void AckInfo::setDirectiveSubtypeCode(uint8_t directiveSubtypeCode) {
|
void AckInfo::setDirectiveSubtypeCode(uint8_t directiveSubtypeCode_) {
|
||||||
this->directiveSubtypeCode = directiveSubtypeCode;
|
directiveSubtypeCode = directiveSubtypeCode_;
|
||||||
}
|
}
|
||||||
|
|
||||||
cfdp::AckTransactionStatus AckInfo::getTransactionStatus() const { return transactionStatus; }
|
cfdp::AckTransactionStatus AckInfo::getTransactionStatus() const { return transactionStatus; }
|
||||||
|
|
||||||
AckInfo::AckInfo() {}
|
void AckInfo::setTransactionStatus(cfdp::AckTransactionStatus transactionStatus_) {
|
||||||
|
transactionStatus = transactionStatus_;
|
||||||
void AckInfo::setTransactionStatus(cfdp::AckTransactionStatus transactionStatus) {
|
|
||||||
this->transactionStatus = transactionStatus;
|
|
||||||
}
|
}
|
||||||
|
@ -9,16 +9,16 @@ class AckInfo {
|
|||||||
AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCode ackedConditionCode,
|
AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCode ackedConditionCode,
|
||||||
cfdp::AckTransactionStatus transactionStatus, uint8_t directiveSubtypeCode = 0);
|
cfdp::AckTransactionStatus transactionStatus, uint8_t directiveSubtypeCode = 0);
|
||||||
|
|
||||||
cfdp::ConditionCode getAckedConditionCode() const;
|
[[nodiscard]] cfdp::ConditionCode getAckedConditionCode() const;
|
||||||
void setAckedConditionCode(cfdp::ConditionCode ackedConditionCode);
|
void setAckedConditionCode(cfdp::ConditionCode ackedConditionCode_);
|
||||||
|
|
||||||
cfdp::FileDirectives getAckedDirective() const;
|
[[nodiscard]] cfdp::FileDirectives getAckedDirective() const;
|
||||||
void setAckedDirective(cfdp::FileDirectives ackedDirective);
|
void setAckedDirective(cfdp::FileDirectives ackedDirective);
|
||||||
|
|
||||||
uint8_t getDirectiveSubtypeCode() const;
|
[[nodiscard]] uint8_t getDirectiveSubtypeCode() const;
|
||||||
void setDirectiveSubtypeCode(uint8_t directiveSubtypeCode);
|
void setDirectiveSubtypeCode(uint8_t directiveSubtypeCode);
|
||||||
|
|
||||||
cfdp::AckTransactionStatus getTransactionStatus() const;
|
[[nodiscard]] cfdp::AckTransactionStatus getTransactionStatus() const;
|
||||||
void setTransactionStatus(cfdp::AckTransactionStatus transactionStatus);
|
void setTransactionStatus(cfdp::AckTransactionStatus transactionStatus);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -13,7 +13,7 @@ class AckPduDeserializer : public FileDirectiveDeserializer {
|
|||||||
* @return
|
* @return
|
||||||
* - cfdp::INVALID_DIRECTIVE_FIELDS: Invalid fields
|
* - cfdp::INVALID_DIRECTIVE_FIELDS: Invalid fields
|
||||||
*/
|
*/
|
||||||
ReturnValue_t parseData();
|
ReturnValue_t parseData() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool checkAndSetCodes(uint8_t rawAckedByte, uint8_t rawAckedConditionCode);
|
bool checkAndSetCodes(uint8_t rawAckedByte, uint8_t rawAckedConditionCode);
|
||||||
|
@ -18,7 +18,7 @@ class AckPduSerializer : public FileDirectiveSerializer {
|
|||||||
*/
|
*/
|
||||||
AckPduSerializer(AckInfo& ackInfo, PduConfig& pduConf);
|
AckPduSerializer(AckInfo& ackInfo, PduConfig& pduConf);
|
||||||
|
|
||||||
size_t getSerializedSize() const override;
|
[[nodiscard]] size_t getSerializedSize() const override;
|
||||||
|
|
||||||
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||||
Endianness streamEndianness) const override;
|
Endianness streamEndianness) const override;
|
||||||
|
@ -26,7 +26,7 @@ ReturnValue_t ControllerBase::initialize() {
|
|||||||
|
|
||||||
MessageQueueId_t parentQueue = 0;
|
MessageQueueId_t parentQueue = 0;
|
||||||
if (parentId != objects::NO_OBJECT) {
|
if (parentId != objects::NO_OBJECT) {
|
||||||
SubsystemBase* parent = ObjectManager::instance()->get<SubsystemBase>(parentId);
|
auto* parent = ObjectManager::instance()->get<SubsystemBase>(parentId);
|
||||||
if (parent == nullptr) {
|
if (parent == nullptr) {
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ MessageQueueId_t ControllerBase::getCommandQueue() const { return commandQueue->
|
|||||||
|
|
||||||
void ControllerBase::handleQueue() {
|
void ControllerBase::handleQueue() {
|
||||||
CommandMessage command;
|
CommandMessage command;
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result;
|
||||||
for (result = commandQueue->receiveMessage(&command); result == RETURN_OK;
|
for (result = commandQueue->receiveMessage(&command); result == RETURN_OK;
|
||||||
result = commandQueue->receiveMessage(&command)) {
|
result = commandQueue->receiveMessage(&command)) {
|
||||||
result = modeHelper.handleModeCommand(&command);
|
result = modeHelper.handleModeCommand(&command);
|
||||||
@ -73,20 +73,20 @@ void ControllerBase::handleQueue() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerBase::startTransition(Mode_t mode, Submode_t submode) {
|
void ControllerBase::startTransition(Mode_t mode_, Submode_t submode_) {
|
||||||
changeHK(this->mode, this->submode, false);
|
changeHK(this->mode, this->submode, false);
|
||||||
triggerEvent(CHANGING_MODE, mode, submode);
|
triggerEvent(CHANGING_MODE, mode, submode);
|
||||||
this->mode = mode;
|
mode = mode_;
|
||||||
this->submode = submode;
|
submode = submode_;
|
||||||
modeHelper.modeChanged(mode, submode);
|
modeHelper.modeChanged(mode, submode);
|
||||||
modeChanged(mode, submode);
|
modeChanged(mode, submode);
|
||||||
announceMode(false);
|
announceMode(false);
|
||||||
changeHK(this->mode, this->submode, true);
|
changeHK(this->mode, this->submode, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerBase::getMode(Mode_t* mode, Submode_t* submode) {
|
void ControllerBase::getMode(Mode_t* mode_, Submode_t* submode_) {
|
||||||
*mode = this->mode;
|
*mode_ = this->mode;
|
||||||
*submode = this->submode;
|
*submode_ = this->submode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerBase::setToExternalControl() { healthHelper.setHealth(EXTERNAL_CONTROL); }
|
void ControllerBase::setToExternalControl() { healthHelper.setHealth(EXTERNAL_CONTROL); }
|
||||||
@ -99,7 +99,7 @@ ReturnValue_t ControllerBase::performOperation(uint8_t opCode) {
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerBase::modeChanged(Mode_t mode, Submode_t submode) { return; }
|
void ControllerBase::modeChanged(Mode_t mode_, Submode_t submode_) {}
|
||||||
|
|
||||||
ReturnValue_t ControllerBase::setHealth(HealthState health) {
|
ReturnValue_t ControllerBase::setHealth(HealthState health) {
|
||||||
switch (health) {
|
switch (health) {
|
||||||
@ -115,6 +115,6 @@ ReturnValue_t ControllerBase::setHealth(HealthState health) {
|
|||||||
HasHealthIF::HealthState ControllerBase::getHealth() { return healthHelper.getHealth(); }
|
HasHealthIF::HealthState ControllerBase::getHealth() { return healthHelper.getHealth(); }
|
||||||
void ControllerBase::setTaskIF(PeriodicTaskIF* task_) { executingTask = task_; }
|
void ControllerBase::setTaskIF(PeriodicTaskIF* task_) { executingTask = task_; }
|
||||||
|
|
||||||
void ControllerBase::changeHK(Mode_t mode, Submode_t submode, bool enable) {}
|
void ControllerBase::changeHK(Mode_t mode_, Submode_t submode_, bool enable) {}
|
||||||
|
|
||||||
ReturnValue_t ControllerBase::initializeAfterTaskCreation() { return HasReturnvaluesIF::RETURN_OK; }
|
ReturnValue_t ControllerBase::initializeAfterTaskCreation() { return HasReturnvaluesIF::RETURN_OK; }
|
||||||
|
@ -24,21 +24,21 @@ class ControllerBase : public HasModesIF,
|
|||||||
static const Mode_t MODE_NORMAL = 2;
|
static const Mode_t MODE_NORMAL = 2;
|
||||||
|
|
||||||
ControllerBase(object_id_t setObjectId, object_id_t parentId, size_t commandQueueDepth = 3);
|
ControllerBase(object_id_t setObjectId, object_id_t parentId, size_t commandQueueDepth = 3);
|
||||||
virtual ~ControllerBase();
|
~ControllerBase() override;
|
||||||
|
|
||||||
/** SystemObject override */
|
/** SystemObject override */
|
||||||
virtual ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
virtual MessageQueueId_t getCommandQueue() const override;
|
[[nodiscard]] MessageQueueId_t getCommandQueue() const override;
|
||||||
|
|
||||||
/** HasHealthIF overrides */
|
/** HasHealthIF overrides */
|
||||||
virtual ReturnValue_t setHealth(HealthState health) override;
|
ReturnValue_t setHealth(HealthState health) override;
|
||||||
virtual HasHealthIF::HealthState getHealth() override;
|
HasHealthIF::HealthState getHealth() override;
|
||||||
|
|
||||||
/** ExecutableObjectIF overrides */
|
/** ExecutableObjectIF overrides */
|
||||||
virtual ReturnValue_t performOperation(uint8_t opCode) override;
|
ReturnValue_t performOperation(uint8_t opCode) override;
|
||||||
virtual void setTaskIF(PeriodicTaskIF *task) override;
|
void setTaskIF(PeriodicTaskIF *task) override;
|
||||||
virtual ReturnValue_t initializeAfterTaskCreation() override;
|
ReturnValue_t initializeAfterTaskCreation() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
@ -54,7 +54,7 @@ class ControllerBase : public HasModesIF,
|
|||||||
*/
|
*/
|
||||||
virtual void performControlOperation() = 0;
|
virtual void performControlOperation() = 0;
|
||||||
|
|
||||||
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
||||||
uint32_t *msToReachTheMode) override = 0;
|
uint32_t *msToReachTheMode) override = 0;
|
||||||
|
|
||||||
const object_id_t parentId;
|
const object_id_t parentId;
|
||||||
@ -80,10 +80,10 @@ class ControllerBase : public HasModesIF,
|
|||||||
|
|
||||||
/** Mode helpers */
|
/** Mode helpers */
|
||||||
virtual void modeChanged(Mode_t mode, Submode_t submode);
|
virtual void modeChanged(Mode_t mode, Submode_t submode);
|
||||||
virtual void startTransition(Mode_t mode, Submode_t submode) override;
|
void startTransition(Mode_t mode, Submode_t submode) override;
|
||||||
virtual void getMode(Mode_t *mode, Submode_t *submode) override;
|
void getMode(Mode_t *mode, Submode_t *submode) override;
|
||||||
virtual void setToExternalControl() override;
|
void setToExternalControl() override;
|
||||||
virtual void announceMode(bool recursive);
|
void announceMode(bool recursive) override;
|
||||||
/** HK helpers */
|
/** HK helpers */
|
||||||
virtual void changeHK(Mode_t mode, Submode_t submode, bool enable);
|
virtual void changeHK(Mode_t mode, Submode_t submode, bool enable);
|
||||||
};
|
};
|
||||||
|
@ -6,7 +6,7 @@ ExtendedControllerBase::ExtendedControllerBase(object_id_t objectId, object_id_t
|
|||||||
poolManager(this, commandQueue),
|
poolManager(this, commandQueue),
|
||||||
actionHelper(this, commandQueue) {}
|
actionHelper(this, commandQueue) {}
|
||||||
|
|
||||||
ExtendedControllerBase::~ExtendedControllerBase() {}
|
ExtendedControllerBase::~ExtendedControllerBase() = default;
|
||||||
|
|
||||||
ReturnValue_t ExtendedControllerBase::executeAction(ActionId_t actionId,
|
ReturnValue_t ExtendedControllerBase::executeAction(ActionId_t actionId,
|
||||||
MessageQueueId_t commandedBy,
|
MessageQueueId_t commandedBy,
|
||||||
@ -31,7 +31,7 @@ ReturnValue_t ExtendedControllerBase::handleCommandMessage(CommandMessage *messa
|
|||||||
|
|
||||||
void ExtendedControllerBase::handleQueue() {
|
void ExtendedControllerBase::handleQueue() {
|
||||||
CommandMessage command;
|
CommandMessage command;
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result;
|
||||||
for (result = commandQueue->receiveMessage(&command); result == RETURN_OK;
|
for (result = commandQueue->receiveMessage(&command); result == RETURN_OK;
|
||||||
result = commandQueue->receiveMessage(&command)) {
|
result = commandQueue->receiveMessage(&command)) {
|
||||||
result = actionHelper.handleActionMessage(&command);
|
result = actionHelper.handleActionMessage(&command);
|
||||||
|
@ -18,16 +18,16 @@ class ExtendedControllerBase : public ControllerBase,
|
|||||||
public HasLocalDataPoolIF {
|
public HasLocalDataPoolIF {
|
||||||
public:
|
public:
|
||||||
ExtendedControllerBase(object_id_t objectId, object_id_t parentId, size_t commandQueueDepth = 3);
|
ExtendedControllerBase(object_id_t objectId, object_id_t parentId, size_t commandQueueDepth = 3);
|
||||||
virtual ~ExtendedControllerBase();
|
~ExtendedControllerBase() override;
|
||||||
|
|
||||||
/* SystemObjectIF overrides */
|
/* SystemObjectIF overrides */
|
||||||
virtual ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
virtual MessageQueueId_t getCommandQueue() const override;
|
[[nodiscard]] MessageQueueId_t getCommandQueue() const override;
|
||||||
|
|
||||||
/* ExecutableObjectIF overrides */
|
/* ExecutableObjectIF overrides */
|
||||||
virtual ReturnValue_t performOperation(uint8_t opCode) override;
|
ReturnValue_t performOperation(uint8_t opCode) override;
|
||||||
virtual ReturnValue_t initializeAfterTaskCreation() override;
|
ReturnValue_t initializeAfterTaskCreation() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LocalDataPoolManager poolManager;
|
LocalDataPoolManager poolManager;
|
||||||
@ -39,31 +39,31 @@ class ExtendedControllerBase : public ControllerBase,
|
|||||||
* @param message
|
* @param message
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t handleCommandMessage(CommandMessage* message) = 0;
|
ReturnValue_t handleCommandMessage(CommandMessage* message) override = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Periodic helper from ControllerBase, implemented by child class.
|
* Periodic helper from ControllerBase, implemented by child class.
|
||||||
*/
|
*/
|
||||||
virtual void performControlOperation() = 0;
|
void performControlOperation() override = 0;
|
||||||
|
|
||||||
/* Handle the four messages mentioned above */
|
/* Handle the four messages mentioned above */
|
||||||
void handleQueue() override;
|
void handleQueue() override;
|
||||||
|
|
||||||
/* HasActionsIF overrides */
|
/* HasActionsIF overrides */
|
||||||
virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
const uint8_t* data, size_t size) override;
|
const uint8_t* data, size_t size) override;
|
||||||
|
|
||||||
/* HasLocalDatapoolIF overrides */
|
/* HasLocalDatapoolIF overrides */
|
||||||
virtual LocalDataPoolManager* getHkManagerHandle() override;
|
LocalDataPoolManager* getHkManagerHandle() override;
|
||||||
virtual object_id_t getObjectId() const override;
|
[[nodiscard]] object_id_t getObjectId() const override;
|
||||||
virtual uint32_t getPeriodicOperationFrequency() const override;
|
[[nodiscard]] uint32_t getPeriodicOperationFrequency() const override;
|
||||||
|
|
||||||
virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) override = 0;
|
LocalDataPoolManager& poolManager) override = 0;
|
||||||
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override = 0;
|
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override = 0;
|
||||||
|
|
||||||
// Mode abstract functions
|
// Mode abstract functions
|
||||||
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
||||||
uint32_t* msToReachTheMode) override = 0;
|
uint32_t* msToReachTheMode) override = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class DataSetIF {
|
|||||||
* @brief This is an empty virtual destructor,
|
* @brief This is an empty virtual destructor,
|
||||||
* as it is proposed for C++ interfaces.
|
* as it is proposed for C++ interfaces.
|
||||||
*/
|
*/
|
||||||
virtual ~DataSetIF() {}
|
virtual ~DataSetIF() = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This operation provides a method to register local data pool
|
* @brief This operation provides a method to register local data pool
|
||||||
@ -39,7 +39,7 @@ class DataSetIF {
|
|||||||
*/
|
*/
|
||||||
virtual ReturnValue_t registerVariable(PoolVariableIF* variable) = 0;
|
virtual ReturnValue_t registerVariable(PoolVariableIF* variable) = 0;
|
||||||
|
|
||||||
virtual uint16_t getFillCount() const = 0;
|
[[nodiscard]] virtual uint16_t getFillCount() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_DATAPOOL_DATASETIF_H_ */
|
#endif /* FSFW_DATAPOOL_DATASETIF_H_ */
|
||||||
|
@ -9,7 +9,7 @@ PoolDataSetBase::PoolDataSetBase(PoolVariableIF** registeredVariablesArray,
|
|||||||
const size_t maxFillCount)
|
const size_t maxFillCount)
|
||||||
: registeredVariables(registeredVariablesArray), maxFillCount(maxFillCount) {}
|
: registeredVariables(registeredVariablesArray), maxFillCount(maxFillCount) {}
|
||||||
|
|
||||||
PoolDataSetBase::~PoolDataSetBase() {}
|
PoolDataSetBase::~PoolDataSetBase() = default;
|
||||||
|
|
||||||
ReturnValue_t PoolDataSetBase::registerVariable(PoolVariableIF* variable) {
|
ReturnValue_t PoolDataSetBase::registerVariable(PoolVariableIF* variable) {
|
||||||
if (registeredVariables == nullptr) {
|
if (registeredVariables == nullptr) {
|
||||||
|
@ -64,7 +64,7 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF, public HasRetu
|
|||||||
* - @c SET_WAS_ALREADY_READ if read() is called twice without calling
|
* - @c SET_WAS_ALREADY_READ if read() is called twice without calling
|
||||||
* commit() in between
|
* commit() in between
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t read(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
|
ReturnValue_t read(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
|
||||||
uint32_t lockTimeout = 20) override;
|
uint32_t lockTimeout = 20) override;
|
||||||
/**
|
/**
|
||||||
* @brief The commit call initializes writing back the registered variables.
|
* @brief The commit call initializes writing back the registered variables.
|
||||||
@ -84,7 +84,7 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF, public HasRetu
|
|||||||
* - @c COMMITING_WITHOUT_READING if set was not read yet and
|
* - @c COMMITING_WITHOUT_READING if set was not read yet and
|
||||||
* contains non write-only variables
|
* contains non write-only variables
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t commit(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
|
ReturnValue_t commit(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
|
||||||
uint32_t lockTimeout = 20) override;
|
uint32_t lockTimeout = 20) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -92,30 +92,29 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF, public HasRetu
|
|||||||
* @param variable
|
* @param variable
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t registerVariable(PoolVariableIF* variable) override;
|
ReturnValue_t registerVariable(PoolVariableIF* variable) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the means to lock the underlying data structure to ensure
|
* Provides the means to lock the underlying data structure to ensure
|
||||||
* thread-safety. Default implementation is empty
|
* thread-safety. Default implementation is empty
|
||||||
* @return Always returns -@c RETURN_OK
|
* @return Always returns -@c RETURN_OK
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t lockDataPool(
|
ReturnValue_t lockDataPool(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
|
||||||
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
|
|
||||||
uint32_t timeoutMs = 20) override;
|
uint32_t timeoutMs = 20) override;
|
||||||
/**
|
/**
|
||||||
* Provides the means to unlock the underlying data structure to ensure
|
* Provides the means to unlock the underlying data structure to ensure
|
||||||
* thread-safety. Default implementation is empty
|
* thread-safety. Default implementation is empty
|
||||||
* @return Always returns -@c RETURN_OK
|
* @return Always returns -@c RETURN_OK
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t unlockDataPool() override;
|
ReturnValue_t unlockDataPool() override;
|
||||||
|
|
||||||
virtual uint16_t getFillCount() const override;
|
[[nodiscard]] uint16_t getFillCount() const override;
|
||||||
|
|
||||||
/* SerializeIF implementations */
|
/* SerializeIF implementations */
|
||||||
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size, const size_t maxSize,
|
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||||
SerializeIF::Endianness streamEndianness) const override;
|
SerializeIF::Endianness streamEndianness) const override;
|
||||||
virtual size_t getSerializedSize() const override;
|
[[nodiscard]] size_t getSerializedSize() const override;
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
SerializeIF::Endianness streamEndianness) override;
|
SerializeIF::Endianness streamEndianness) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -156,7 +155,7 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF, public HasRetu
|
|||||||
const size_t maxFillCount = 0;
|
const size_t maxFillCount = 0;
|
||||||
|
|
||||||
void setContainer(PoolVariableIF** variablesContainer);
|
void setContainer(PoolVariableIF** variablesContainer);
|
||||||
PoolVariableIF** getContainer() const;
|
[[nodiscard]] PoolVariableIF** getContainer() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool protectEveryReadCommitCall = false;
|
bool protectEveryReadCommitCall = false;
|
||||||
|
@ -11,7 +11,7 @@ PoolEntry<T>::PoolEntry(std::initializer_list<T> initValue, bool setValid)
|
|||||||
: length(static_cast<uint8_t>(initValue.size())), valid(setValid) {
|
: length(static_cast<uint8_t>(initValue.size())), valid(setValid) {
|
||||||
this->address = new T[this->length];
|
this->address = new T[this->length];
|
||||||
if (initValue.size() == 0) {
|
if (initValue.size() == 0) {
|
||||||
std::memset(this->address, 0, this->getByteSize());
|
std::memset(this->address, 0, PoolEntry<T>::getByteSize());
|
||||||
} else {
|
} else {
|
||||||
std::copy(initValue.begin(), initValue.end(), this->address);
|
std::copy(initValue.begin(), initValue.end(), this->address);
|
||||||
}
|
}
|
||||||
@ -22,9 +22,9 @@ PoolEntry<T>::PoolEntry(T* initValue, uint8_t setLength, bool setValid)
|
|||||||
: length(setLength), valid(setValid) {
|
: length(setLength), valid(setValid) {
|
||||||
this->address = new T[this->length];
|
this->address = new T[this->length];
|
||||||
if (initValue != nullptr) {
|
if (initValue != nullptr) {
|
||||||
std::memcpy(this->address, initValue, this->getByteSize());
|
std::memcpy(this->address, initValue, PoolEntry<T>::getByteSize());
|
||||||
} else {
|
} else {
|
||||||
std::memset(this->address, 0, this->getByteSize());
|
std::memset(this->address, 0, PoolEntry<T>::getByteSize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ bool PoolEntry<T>::getValid() {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void PoolEntry<T>::print() {
|
void PoolEntry<T>::print() {
|
||||||
const char* validString = nullptr;
|
const char* validString;
|
||||||
if (valid) {
|
if (valid) {
|
||||||
validString = "Valid";
|
validString = "Valid";
|
||||||
} else {
|
} else {
|
||||||
|
@ -62,7 +62,7 @@ class PoolEntry : public PoolEntryIF {
|
|||||||
* @param setValid
|
* @param setValid
|
||||||
* Sets the initialization flag. It is invalid by default.
|
* Sets the initialization flag. It is invalid by default.
|
||||||
*/
|
*/
|
||||||
PoolEntry(T* initValue, uint8_t setLength = 1, bool setValid = false);
|
explicit PoolEntry(T* initValue, uint8_t setLength = 1, bool setValid = false);
|
||||||
|
|
||||||
//! Explicitely deleted copy ctor, copying is not allowed.
|
//! Explicitely deleted copy ctor, copying is not allowed.
|
||||||
PoolEntry(const PoolEntry&) = delete;
|
PoolEntry(const PoolEntry&) = delete;
|
||||||
@ -77,7 +77,7 @@ class PoolEntry : public PoolEntryIF {
|
|||||||
* PoolEntries shall never be copied, as a copy might delete the variable
|
* PoolEntries shall never be copied, as a copy might delete the variable
|
||||||
* on the heap.
|
* on the heap.
|
||||||
*/
|
*/
|
||||||
~PoolEntry();
|
~PoolEntry() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return typed pointer to start of data.
|
* Return typed pointer to start of data.
|
||||||
@ -91,32 +91,32 @@ class PoolEntry : public PoolEntryIF {
|
|||||||
* For non-array pool entries return type size, for vector entries
|
* For non-array pool entries return type size, for vector entries
|
||||||
* return type size times the number of entries.
|
* return type size times the number of entries.
|
||||||
*/
|
*/
|
||||||
uint8_t getSize();
|
uint8_t getSize() override;
|
||||||
/**
|
/**
|
||||||
* @brief This operation returns the size in bytes.
|
* @brief This operation returns the size in bytes.
|
||||||
* @details The size is calculated by sizeof(type) * array_size.
|
* @details The size is calculated by sizeof(type) * array_size.
|
||||||
*/
|
*/
|
||||||
uint16_t getByteSize();
|
uint16_t getByteSize() override;
|
||||||
/**
|
/**
|
||||||
* @brief This operation returns a the address pointer casted to void*.
|
* @brief This operation returns a the address pointer casted to void*.
|
||||||
*/
|
*/
|
||||||
void* getRawData();
|
void* getRawData() override;
|
||||||
/**
|
/**
|
||||||
* @brief This method allows to set the valid information
|
* @brief This method allows to set the valid information
|
||||||
* of the pool entry.
|
* of the pool entry.
|
||||||
*/
|
*/
|
||||||
void setValid(bool isValid);
|
void setValid(bool isValid) override;
|
||||||
/**
|
/**
|
||||||
* @brief This method allows to get the valid information
|
* @brief This method allows to get the valid information
|
||||||
* of the pool entry.
|
* of the pool entry.
|
||||||
*/
|
*/
|
||||||
bool getValid();
|
bool getValid() override;
|
||||||
/**
|
/**
|
||||||
* @brief This is a debug method that prints all values and the valid
|
* @brief This is a debug method that prints all values and the valid
|
||||||
* information to the screen. It prints all array entries in a row.
|
* information to the screen. It prints all array entries in a row.
|
||||||
*/
|
*/
|
||||||
void print();
|
void print() override;
|
||||||
Type getType();
|
Type getType() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +24,7 @@ class PoolEntryIF {
|
|||||||
* @brief This is an empty virtual destructor,
|
* @brief This is an empty virtual destructor,
|
||||||
* as it is required for C++ interfaces.
|
* as it is required for C++ interfaces.
|
||||||
*/
|
*/
|
||||||
virtual ~PoolEntryIF() {}
|
virtual ~PoolEntryIF() = default;
|
||||||
/**
|
/**
|
||||||
* @brief getSize returns the array size of the entry.
|
* @brief getSize returns the array size of the entry.
|
||||||
* A single variable parameter has size 1.
|
* A single variable parameter has size 1.
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
*/
|
*/
|
||||||
class PoolReadGuard {
|
class PoolReadGuard {
|
||||||
public:
|
public:
|
||||||
PoolReadGuard(ReadCommitIF* readObject,
|
explicit PoolReadGuard(ReadCommitIF* readObject,
|
||||||
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
|
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
|
||||||
uint32_t mutexTimeout = 20)
|
uint32_t mutexTimeout = 20)
|
||||||
: readObject(readObject), mutexTimeout(mutexTimeout) {
|
: readObject(readObject), mutexTimeout(mutexTimeout) {
|
||||||
@ -29,7 +29,7 @@ class PoolReadGuard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t getReadResult() const { return readResult; }
|
[[nodiscard]] ReturnValue_t getReadResult() const { return readResult; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Can be used to suppress commit on destruction.
|
* @brief Can be used to suppress commit on destruction.
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
#ifndef FSFW_DATAPOOL_POOLVARLIST_H_
|
|
||||||
#define FSFW_DATAPOOL_POOLVARLIST_H_
|
|
||||||
|
|
||||||
#include "../datapool/PoolVariableIF.h"
|
|
||||||
#include "../datapoolglob/GlobalPoolVariable.h"
|
|
||||||
template <class T, uint8_t n_var>
|
|
||||||
class PoolVarList {
|
|
||||||
private:
|
|
||||||
GlobPoolVar<T> variables[n_var];
|
|
||||||
|
|
||||||
public:
|
|
||||||
PoolVarList(const uint32_t set_id[n_var], DataSetIF* dataSet,
|
|
||||||
PoolVariableIF::ReadWriteMode_t setReadWriteMode) {
|
|
||||||
// I really should have a look at the new init list c++ syntax.
|
|
||||||
if (dataSet == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (uint8_t count = 0; count < n_var; count++) {
|
|
||||||
variables[count].dataPoolId = set_id[count];
|
|
||||||
variables[count].readWriteMode = setReadWriteMode;
|
|
||||||
dataSet->registerVariable(&variables[count]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GlobPoolVar<T>& operator[](int i) { return variables[i]; }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* FSFW_DATAPOOL_POOLVARLIST_H_ */
|
|
@ -24,8 +24,8 @@ class PoolVariableIF : public SerializeIF, public ReadCommitIF {
|
|||||||
static constexpr ReturnValue_t INVALID_READ_WRITE_MODE = MAKE_RETURN_CODE(0xA0);
|
static constexpr ReturnValue_t INVALID_READ_WRITE_MODE = MAKE_RETURN_CODE(0xA0);
|
||||||
static constexpr ReturnValue_t INVALID_POOL_ENTRY = MAKE_RETURN_CODE(0xA1);
|
static constexpr ReturnValue_t INVALID_POOL_ENTRY = MAKE_RETURN_CODE(0xA1);
|
||||||
|
|
||||||
static constexpr bool VALID = 1;
|
static constexpr bool VALID = true;
|
||||||
static constexpr bool INVALID = 0;
|
static constexpr bool INVALID = false;
|
||||||
static constexpr uint32_t NO_PARAMETER = 0xffffffff;
|
static constexpr uint32_t NO_PARAMETER = 0xffffffff;
|
||||||
|
|
||||||
enum ReadWriteMode_t { VAR_READ, VAR_WRITE, VAR_READ_WRITE };
|
enum ReadWriteMode_t { VAR_READ, VAR_WRITE, VAR_READ_WRITE };
|
||||||
@ -34,23 +34,23 @@ class PoolVariableIF : public SerializeIF, public ReadCommitIF {
|
|||||||
* @brief This is an empty virtual destructor,
|
* @brief This is an empty virtual destructor,
|
||||||
* as it is proposed for C++ interfaces.
|
* as it is proposed for C++ interfaces.
|
||||||
*/
|
*/
|
||||||
virtual ~PoolVariableIF() {}
|
~PoolVariableIF() override = default;
|
||||||
/**
|
/**
|
||||||
* @brief This method returns if the variable is write-only,
|
* @brief This method returns if the variable is write-only,
|
||||||
* read-write or read-only.
|
* read-write or read-only.
|
||||||
*/
|
*/
|
||||||
virtual ReadWriteMode_t getReadWriteMode() const = 0;
|
[[nodiscard]] virtual ReadWriteMode_t getReadWriteMode() const = 0;
|
||||||
virtual void setReadWriteMode(ReadWriteMode_t newMode) = 0;
|
virtual void setReadWriteMode(ReadWriteMode_t newMode) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This operation shall return the data pool id of the variable.
|
* @brief This operation shall return the data pool id of the variable.
|
||||||
*/
|
*/
|
||||||
virtual uint32_t getDataPoolId() const = 0;
|
[[nodiscard]] virtual uint32_t getDataPoolId() const = 0;
|
||||||
/**
|
/**
|
||||||
* @brief With this call, the valid information of the
|
* @brief With this call, the valid information of the
|
||||||
* variable is returned.
|
* variable is returned.
|
||||||
*/
|
*/
|
||||||
virtual bool isValid() const = 0;
|
[[nodiscard]] virtual bool isValid() const = 0;
|
||||||
/**
|
/**
|
||||||
* @brief With this call, the valid information of the variable is set.
|
* @brief With this call, the valid information of the variable is set.
|
||||||
*/
|
*/
|
||||||
|
@ -12,7 +12,7 @@ class ReadCommitIF {
|
|||||||
friend class ReadCommitIFAttorney;
|
friend class ReadCommitIFAttorney;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~ReadCommitIF() {}
|
virtual ~ReadCommitIF() = default;
|
||||||
virtual ReturnValue_t read(MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) = 0;
|
virtual ReturnValue_t read(MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) = 0;
|
||||||
virtual ReturnValue_t commit(MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) = 0;
|
virtual ReturnValue_t commit(MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) = 0;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class SharedDataSetIF {
|
class SharedDataSetIF {
|
||||||
public:
|
public:
|
||||||
virtual ~SharedDataSetIF(){};
|
virtual ~SharedDataSetIF() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual ReturnValue_t lockDataset(MutexIF::TimeoutType timeoutType,
|
virtual ReturnValue_t lockDataset(MutexIF::TimeoutType timeoutType,
|
||||||
|
@ -9,7 +9,8 @@ class MutexIF;
|
|||||||
*/
|
*/
|
||||||
class AccessPoolManagerIF {
|
class AccessPoolManagerIF {
|
||||||
public:
|
public:
|
||||||
virtual ~AccessPoolManagerIF(){};
|
virtual ~AccessPoolManagerIF() = default;
|
||||||
|
;
|
||||||
|
|
||||||
virtual MutexIF* getLocalPoolMutex() = 0;
|
virtual MutexIF* getLocalPoolMutex() = 0;
|
||||||
|
|
||||||
|
@ -44,14 +44,15 @@ class HasLocalDataPoolIF {
|
|||||||
friend class HasLocalDpIFUserAttorney;
|
friend class HasLocalDpIFUserAttorney;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~HasLocalDataPoolIF(){};
|
virtual ~HasLocalDataPoolIF() = default;
|
||||||
|
;
|
||||||
|
|
||||||
static constexpr uint32_t INVALID_LPID = localpool::INVALID_LPID;
|
static constexpr uint32_t INVALID_LPID = localpool::INVALID_LPID;
|
||||||
|
|
||||||
virtual object_id_t getObjectId() const = 0;
|
[[nodiscard]] virtual object_id_t getObjectId() const = 0;
|
||||||
|
|
||||||
/** Command queue for housekeeping messages. */
|
/** Command queue for housekeeping messages. */
|
||||||
virtual MessageQueueId_t getCommandQueue() const = 0;
|
[[nodiscard]] virtual MessageQueueId_t getCommandQueue() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is used by pool owner to initialize the pool map once
|
* Is used by pool owner to initialize the pool map once
|
||||||
@ -66,7 +67,7 @@ class HasLocalDataPoolIF {
|
|||||||
* usually be the period the pool owner performs its periodic operation.
|
* usually be the period the pool owner performs its periodic operation.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual dur_millis_t getPeriodicOperationFrequency() const = 0;
|
[[nodiscard]] virtual dur_millis_t getPeriodicOperationFrequency() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function will be called by the manager if an update
|
* @brief This function will be called by the manager if an update
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "fsfw/datapoollocal.h"
|
#include "fsfw/datapoollocal.h"
|
||||||
@ -57,7 +56,7 @@ ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (defaultHkDestination != objects::NO_OBJECT) {
|
if (defaultHkDestination != objects::NO_OBJECT) {
|
||||||
AcceptsHkPacketsIF* hkPacketReceiver =
|
auto* hkPacketReceiver =
|
||||||
ObjectManager::instance()->get<AcceptsHkPacketsIF>(defaultHkDestination);
|
ObjectManager::instance()->get<AcceptsHkPacketsIF>(defaultHkDestination);
|
||||||
if (hkPacketReceiver != nullptr) {
|
if (hkPacketReceiver != nullptr) {
|
||||||
hkDestinationId = hkPacketReceiver->getHkQueue();
|
hkDestinationId = hkPacketReceiver->getHkQueue();
|
||||||
@ -209,9 +208,9 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare and send update snapshot */
|
/* Prepare and send update snapshot */
|
||||||
timeval now;
|
timeval now{};
|
||||||
Clock::getClock_timeval(&now);
|
Clock::getClock_timeval(&now);
|
||||||
CCSDSTime::CDS_short cds;
|
CCSDSTime::CDS_short cds{};
|
||||||
CCSDSTime::convertToCcsds(&cds, &now);
|
CCSDSTime::convertToCcsds(&cds, &now);
|
||||||
HousekeepingSnapshot updatePacket(
|
HousekeepingSnapshot updatePacket(
|
||||||
reinterpret_cast<uint8_t*>(&cds), sizeof(cds),
|
reinterpret_cast<uint8_t*>(&cds), sizeof(cds),
|
||||||
@ -245,9 +244,9 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare and send update snapshot */
|
/* Prepare and send update snapshot */
|
||||||
timeval now;
|
timeval now{};
|
||||||
Clock::getClock_timeval(&now);
|
Clock::getClock_timeval(&now);
|
||||||
CCSDSTime::CDS_short cds;
|
CCSDSTime::CDS_short cds{};
|
||||||
CCSDSTime::convertToCcsds(&cds, &now);
|
CCSDSTime::convertToCcsds(&cds, &now);
|
||||||
HousekeepingSnapshot updatePacket(
|
HousekeepingSnapshot updatePacket(
|
||||||
reinterpret_cast<uint8_t*>(&cds), sizeof(cds),
|
reinterpret_cast<uint8_t*>(&cds), sizeof(cds),
|
||||||
@ -339,8 +338,7 @@ ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid, bool e
|
|||||||
float collectionInterval,
|
float collectionInterval,
|
||||||
bool isDiagnostics,
|
bool isDiagnostics,
|
||||||
object_id_t packetDestination) {
|
object_id_t packetDestination) {
|
||||||
AcceptsHkPacketsIF* hkReceiverObject =
|
auto* hkReceiverObject = ObjectManager::instance()->get<AcceptsHkPacketsIF>(packetDestination);
|
||||||
ObjectManager::instance()->get<AcceptsHkPacketsIF>(packetDestination);
|
|
||||||
if (hkReceiverObject == nullptr) {
|
if (hkReceiverObject == nullptr) {
|
||||||
printWarningOrError(sif::OutputTypes::OUT_WARNING, "subscribeForPeriodicPacket",
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "subscribeForPeriodicPacket",
|
||||||
QUEUE_OR_DESTINATION_INVALID);
|
QUEUE_OR_DESTINATION_INVALID);
|
||||||
@ -368,8 +366,7 @@ ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid, bool e
|
|||||||
ReturnValue_t LocalDataPoolManager::subscribeForUpdatePacket(sid_t sid, bool isDiagnostics,
|
ReturnValue_t LocalDataPoolManager::subscribeForUpdatePacket(sid_t sid, bool isDiagnostics,
|
||||||
bool reportingEnabled,
|
bool reportingEnabled,
|
||||||
object_id_t packetDestination) {
|
object_id_t packetDestination) {
|
||||||
AcceptsHkPacketsIF* hkReceiverObject =
|
auto* hkReceiverObject = ObjectManager::instance()->get<AcceptsHkPacketsIF>(packetDestination);
|
||||||
ObjectManager::instance()->get<AcceptsHkPacketsIF>(packetDestination);
|
|
||||||
if (hkReceiverObject == nullptr) {
|
if (hkReceiverObject == nullptr) {
|
||||||
printWarningOrError(sif::OutputTypes::OUT_WARNING, "subscribeForPeriodicPacket",
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "subscribeForPeriodicPacket",
|
||||||
QUEUE_OR_DESTINATION_INVALID);
|
QUEUE_OR_DESTINATION_INVALID);
|
||||||
@ -696,7 +693,8 @@ void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) {
|
|||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
/* Configuration error */
|
/* Configuration error */
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "LocalDataPoolManager::performPeriodicHkOperation: HK generation failed." << std::endl;
|
sif::warning << "LocalDataPoolManager::performPeriodicHkOperation: HK generation failed."
|
||||||
|
<< std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printWarning("LocalDataPoolManager::performPeriodicHkOperation: HK generation failed.\n");
|
sif::printWarning("LocalDataPoolManager::performPeriodicHkOperation: HK generation failed.\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -80,7 +80,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
|
|||||||
*/
|
*/
|
||||||
LocalDataPoolManager(HasLocalDataPoolIF* owner, MessageQueueIF* queueToUse,
|
LocalDataPoolManager(HasLocalDataPoolIF* owner, MessageQueueIF* queueToUse,
|
||||||
bool appendValidityBuffer = true);
|
bool appendValidityBuffer = true);
|
||||||
virtual ~LocalDataPoolManager();
|
~LocalDataPoolManager() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assigns the queue to use. Make sure to call this in the #initialize
|
* Assigns the queue to use. Make sure to call this in the #initialize
|
||||||
@ -151,7 +151,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
|
|||||||
* Otherwise, only an notification message is sent.
|
* Otherwise, only an notification message is sent.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReturnValue_t subscribeForSetUpdateMessage(const uint32_t setId, object_id_t destinationObject,
|
ReturnValue_t subscribeForSetUpdateMessage(uint32_t setId, object_id_t destinationObject,
|
||||||
MessageQueueId_t targetQueueId,
|
MessageQueueId_t targetQueueId,
|
||||||
bool generateSnapshot) override;
|
bool generateSnapshot) override;
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
|
|||||||
* Otherwise, only an notification message is sent.
|
* Otherwise, only an notification message is sent.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReturnValue_t subscribeForVariableUpdateMessage(const lp_id_t localPoolId,
|
ReturnValue_t subscribeForVariableUpdateMessage(lp_id_t localPoolId,
|
||||||
object_id_t destinationObject,
|
object_id_t destinationObject,
|
||||||
MessageQueueId_t targetQueueId,
|
MessageQueueId_t targetQueueId,
|
||||||
bool generateSnapshot) override;
|
bool generateSnapshot) override;
|
||||||
@ -252,7 +252,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
|
|||||||
*/
|
*/
|
||||||
void clearReceiversList();
|
void clearReceiversList();
|
||||||
|
|
||||||
object_id_t getCreatorObjectId() const;
|
[[nodiscard]] object_id_t getCreatorObjectId() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the pointer to the mutex. Can be used to lock the data pool
|
* Get the pointer to the mutex. Can be used to lock the data pool
|
||||||
@ -262,7 +262,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
|
|||||||
*/
|
*/
|
||||||
MutexIF* getMutexHandle();
|
MutexIF* getMutexHandle();
|
||||||
|
|
||||||
virtual LocalDataPoolManager* getPoolManagerHandle() override;
|
LocalDataPoolManager* getPoolManagerHandle() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Core data structure for the actual pool data */
|
/** Core data structure for the actual pool data */
|
||||||
@ -306,8 +306,8 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
|
|||||||
struct HkUpdateResetHelper {
|
struct HkUpdateResetHelper {
|
||||||
DataType dataType = DataType::DATA_SET;
|
DataType dataType = DataType::DATA_SET;
|
||||||
DataId dataId;
|
DataId dataId;
|
||||||
uint8_t updateCounter;
|
uint8_t updateCounter{};
|
||||||
uint8_t currentUpdateCounter;
|
uint8_t currentUpdateCounter{};
|
||||||
};
|
};
|
||||||
|
|
||||||
using HkUpdateResetList = std::vector<struct HkUpdateResetHelper>;
|
using HkUpdateResetList = std::vector<struct HkUpdateResetHelper>;
|
||||||
|
@ -207,13 +207,11 @@ class DeviceHandlerBase : public DeviceHandlerIF,
|
|||||||
|
|
||||||
Mode_t getTransitionSourceMode() const;
|
Mode_t getTransitionSourceMode() const;
|
||||||
Submode_t getTransitionSourceSubMode() const;
|
Submode_t getTransitionSourceSubMode() const;
|
||||||
virtual void getMode(Mode_t *mode, Submode_t *submode);
|
void getMode(Mode_t *mode, Submode_t *submode) override;
|
||||||
HealthState getHealth();
|
HealthState getHealth() override;
|
||||||
ReturnValue_t setHealth(HealthState health);
|
ReturnValue_t setHealth(HealthState health) override;
|
||||||
virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId,
|
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper *parameterWrapper,
|
||||||
ParameterWrapper *parameterWrapper,
|
const ParameterWrapper *newValues, uint16_t startAtIndex) override;
|
||||||
const ParameterWrapper *newValues,
|
|
||||||
uint16_t startAtIndex) override;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
@ -1042,11 +1040,9 @@ class DeviceHandlerBase : public DeviceHandlerIF,
|
|||||||
bool isAwaitingReply();
|
bool isAwaitingReply();
|
||||||
|
|
||||||
void handleDeviceTM(SerializeIF *dataSet, DeviceCommandId_t replyId, bool forceDirectTm = false);
|
void handleDeviceTM(SerializeIF *dataSet, DeviceCommandId_t replyId, bool forceDirectTm = false);
|
||||||
// void handleDeviceTM(uint8_t* data, size_t dataSize, DeviceCommandId_t replyId,
|
|
||||||
// bool forceDirectTm);
|
|
||||||
|
|
||||||
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
||||||
uint32_t *msToReachTheMode);
|
uint32_t *msToReachTheMode) override;
|
||||||
|
|
||||||
virtual ReturnValue_t letChildHandleMessage(CommandMessage *message);
|
virtual ReturnValue_t letChildHandleMessage(CommandMessage *message);
|
||||||
|
|
||||||
@ -1062,8 +1058,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
|
|||||||
/**
|
/**
|
||||||
* Same as triggerEvent, but for forwarding if object is used as proxy.
|
* Same as triggerEvent, but for forwarding if object is used as proxy.
|
||||||
*/
|
*/
|
||||||
virtual void forwardEvent(Event event, uint32_t parameter1 = 0,
|
void forwardEvent(Event event, uint32_t parameter1 = 0, uint32_t parameter2 = 0) const override;
|
||||||
uint32_t parameter2 = 0) const override;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if current mode is transitional mode.
|
* Checks if current mode is transitional mode.
|
||||||
|
@ -36,7 +36,7 @@ class HasHealthIF {
|
|||||||
12,
|
12,
|
||||||
severity::MEDIUM); //!< Recovery was completed. Not necessarily successful. No parameters.
|
severity::MEDIUM); //!< Recovery was completed. Not necessarily successful. No parameters.
|
||||||
|
|
||||||
virtual ~HasHealthIF() {}
|
virtual ~HasHealthIF() = default;
|
||||||
|
|
||||||
virtual MessageQueueId_t getCommandQueue() const = 0;
|
virtual MessageQueueId_t getCommandQueue() const = 0;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ class HousekeepingSnapshot : public SerializeIF {
|
|||||||
: timeStamp(timeStamp), timeStampSize(timeStampSize), updateData(dataSetPtr){};
|
: timeStamp(timeStamp), timeStampSize(timeStampSize), updateData(dataSetPtr){};
|
||||||
|
|
||||||
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const override {
|
||||||
if (timeStamp != nullptr) {
|
if (timeStamp != nullptr) {
|
||||||
/* Endianness will always be MACHINE, so we can simply use memcpy
|
/* Endianness will always be MACHINE, so we can simply use memcpy
|
||||||
here. */
|
here. */
|
||||||
@ -70,7 +70,7 @@ class HousekeepingSnapshot : public SerializeIF {
|
|||||||
return updateData->serialize(buffer, size, maxSize, streamEndianness);
|
return updateData->serialize(buffer, size, maxSize, streamEndianness);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual size_t getSerializedSize() const {
|
virtual size_t getSerializedSize() const override {
|
||||||
if (updateData == nullptr) {
|
if (updateData == nullptr) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -10,25 +10,25 @@ class MessageQueueBase : public MessageQueueIF {
|
|||||||
virtual ~MessageQueueBase();
|
virtual ~MessageQueueBase();
|
||||||
|
|
||||||
// Default implementations for MessageQueueIF where possible
|
// Default implementations for MessageQueueIF where possible
|
||||||
virtual MessageQueueId_t getLastPartner() const override;
|
MessageQueueId_t getLastPartner() const override;
|
||||||
virtual MessageQueueId_t getId() const override;
|
MessageQueueId_t getId() const override;
|
||||||
virtual MqArgs& getMqArgs() override;
|
MqArgs& getMqArgs() override;
|
||||||
virtual void setDefaultDestination(MessageQueueId_t defaultDestination) override;
|
void setDefaultDestination(MessageQueueId_t defaultDestination) override;
|
||||||
virtual MessageQueueId_t getDefaultDestination() const override;
|
MessageQueueId_t getDefaultDestination() const override;
|
||||||
virtual bool isDefaultDestinationSet() const override;
|
bool isDefaultDestinationSet() const override;
|
||||||
virtual ReturnValue_t sendMessage(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
|
ReturnValue_t sendMessage(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
|
||||||
bool ignoreFault) override;
|
bool ignoreFault) override;
|
||||||
virtual ReturnValue_t sendToDefault(MessageQueueMessageIF* message) override;
|
ReturnValue_t sendToDefault(MessageQueueMessageIF* message) override;
|
||||||
virtual ReturnValue_t reply(MessageQueueMessageIF* message) override;
|
ReturnValue_t reply(MessageQueueMessageIF* message) override;
|
||||||
virtual ReturnValue_t receiveMessage(MessageQueueMessageIF* message,
|
ReturnValue_t receiveMessage(MessageQueueMessageIF* message,
|
||||||
MessageQueueId_t* receivedFrom) override;
|
MessageQueueId_t* receivedFrom) override;
|
||||||
virtual ReturnValue_t sendToDefaultFrom(MessageQueueMessageIF* message, MessageQueueId_t sentFrom,
|
ReturnValue_t sendToDefaultFrom(MessageQueueMessageIF* message, MessageQueueId_t sentFrom,
|
||||||
bool ignoreFault = false) override;
|
bool ignoreFault = false) override;
|
||||||
|
|
||||||
// OSAL specific, forward the abstract function
|
// OSAL specific, forward the abstract function
|
||||||
virtual ReturnValue_t receiveMessage(MessageQueueMessageIF* message) = 0;
|
ReturnValue_t receiveMessage(MessageQueueMessageIF* message) override = 0;
|
||||||
virtual ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
|
ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
|
||||||
MessageQueueId_t sentFrom, bool ignoreFault = false) = 0;
|
MessageQueueId_t sentFrom, bool ignoreFault = false) override = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MessageQueueId_t id = MessageQueueIF::NO_QUEUE;
|
MessageQueueId_t id = MessageQueueIF::NO_QUEUE;
|
||||||
|
@ -17,8 +17,8 @@ class AbsLimitMonitor : public MonitorBase<T> {
|
|||||||
limit(limit),
|
limit(limit),
|
||||||
violationEvent(violationEvent),
|
violationEvent(violationEvent),
|
||||||
aboveIsViolation(aboveIsViolation) {}
|
aboveIsViolation(aboveIsViolation) {}
|
||||||
virtual ~AbsLimitMonitor() {}
|
virtual ~AbsLimitMonitor() = default;
|
||||||
virtual ReturnValue_t checkSample(T sample, T *crossedLimit) {
|
ReturnValue_t checkSample(T sample, T *crossedLimit) override {
|
||||||
*crossedLimit = limit;
|
*crossedLimit = limit;
|
||||||
if (aboveIsViolation) {
|
if (aboveIsViolation) {
|
||||||
if ((std::abs(sample) > limit)) {
|
if ((std::abs(sample) > limit)) {
|
||||||
@ -32,9 +32,9 @@ class AbsLimitMonitor : public MonitorBase<T> {
|
|||||||
return HasReturnvaluesIF::RETURN_OK; // We're not out of range.
|
return HasReturnvaluesIF::RETURN_OK; // We're not out of range.
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
|
ReturnValue_t getParameter(uint8_t domainId, uint8_t parameterId,
|
||||||
ParameterWrapper *parameterWrapper,
|
ParameterWrapper *parameterWrapper, const ParameterWrapper *newValues,
|
||||||
const ParameterWrapper *newValues, uint16_t startAtIndex) {
|
uint16_t startAtIndex) override {
|
||||||
ReturnValue_t result = this->MonitorBase<T>::getParameter(
|
ReturnValue_t result = this->MonitorBase<T>::getParameter(
|
||||||
domainId, parameterId, parameterWrapper, newValues, startAtIndex);
|
domainId, parameterId, parameterWrapper, newValues, startAtIndex);
|
||||||
// We'll reuse the DOMAIN_ID of MonitorReporter,
|
// We'll reuse the DOMAIN_ID of MonitorReporter,
|
||||||
@ -61,7 +61,7 @@ class AbsLimitMonitor : public MonitorBase<T> {
|
|||||||
void setLimit(T value) { limit = value; }
|
void setLimit(T value) { limit = value; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void sendTransitionEvent(T currentValue, ReturnValue_t state) {
|
void sendTransitionEvent(T currentValue, ReturnValue_t state) override {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case MonitoringIF::OUT_OF_RANGE:
|
case MonitoringIF::OUT_OF_RANGE:
|
||||||
EventManagerIF::triggerEvent(this->reportingId, violationEvent, this->globalPoolId.objectId,
|
EventManagerIF::triggerEvent(this->reportingId, violationEvent, this->globalPoolId.objectId,
|
||||||
|
@ -51,9 +51,8 @@ class MonitorReporter : public HasParametersIF {
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId,
|
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper *parameterWrapper,
|
||||||
ParameterWrapper *parameterWrapper,
|
const ParameterWrapper *newValues, uint16_t startAtIndex) override {
|
||||||
const ParameterWrapper *newValues, uint16_t startAtIndex) {
|
|
||||||
if (domainId != monitorId) {
|
if (domainId != monitorId) {
|
||||||
return INVALID_DOMAIN_ID;
|
return INVALID_DOMAIN_ID;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ class HasParametersIF {
|
|||||||
return (domainId << 24) + (uniqueId << 16) + linearIndex;
|
return (domainId << 24) + (uniqueId << 16) + linearIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~HasParametersIF() {}
|
virtual ~HasParametersIF() = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the generic function overriden by child classes to set
|
* This is the generic function overriden by child classes to set
|
||||||
|
@ -63,13 +63,13 @@ class Fuse : public SystemObject,
|
|||||||
SerializeIF::Endianness streamEndianness) override;
|
SerializeIF::Endianness streamEndianness) override;
|
||||||
void setAllMonitorsToUnchecked();
|
void setAllMonitorsToUnchecked();
|
||||||
ReturnValue_t performOperation(uint8_t opCode);
|
ReturnValue_t performOperation(uint8_t opCode);
|
||||||
MessageQueueId_t getCommandQueue() const;
|
MessageQueueId_t getCommandQueue() const override;
|
||||||
void setDataPoolEntriesInvalid();
|
void setDataPoolEntriesInvalid();
|
||||||
ReturnValue_t setHealth(HealthState health);
|
ReturnValue_t setHealth(HealthState health) override;
|
||||||
HasHealthIF::HealthState getHealth();
|
HasHealthIF::HealthState getHealth() override;
|
||||||
|
|
||||||
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper *parameterWrapper,
|
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper *parameterWrapper,
|
||||||
const ParameterWrapper *newValues, uint16_t startAtIndex);
|
const ParameterWrapper *newValues, uint16_t startAtIndex) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t oldFuseState;
|
uint8_t oldFuseState;
|
||||||
@ -81,7 +81,7 @@ class Fuse : public SystemObject,
|
|||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
PowerMonitor(Args... args) : MonitorReporter<float>(std::forward<Args>(args)...) {}
|
PowerMonitor(Args... args) : MonitorReporter<float>(std::forward<Args>(args)...) {}
|
||||||
ReturnValue_t checkPower(float sample, float lowerLimit, float upperLimit);
|
ReturnValue_t checkPower(float sample, float lowerLimit, float upperLimit);
|
||||||
void sendTransitionEvent(float currentValue, ReturnValue_t state) {}
|
void sendTransitionEvent(float currentValue, ReturnValue_t state_) override {}
|
||||||
};
|
};
|
||||||
PowerMonitor powerMonitor;
|
PowerMonitor powerMonitor;
|
||||||
StaticLocalDataSet<3> set;
|
StaticLocalDataSet<3> set;
|
||||||
|
@ -10,15 +10,15 @@ class PowerComponent : public PowerComponentIF {
|
|||||||
PowerComponent(object_id_t setId, uint8_t moduleId, float minPower, float maxPower,
|
PowerComponent(object_id_t setId, uint8_t moduleId, float minPower, float maxPower,
|
||||||
uint8_t switchId1, bool twoSwitches = false, uint8_t switchId2 = 0xFF);
|
uint8_t switchId1, bool twoSwitches = false, uint8_t switchId2 = 0xFF);
|
||||||
|
|
||||||
virtual object_id_t getDeviceObjectId();
|
object_id_t getDeviceObjectId() override;
|
||||||
|
|
||||||
virtual uint8_t getSwitchId1();
|
uint8_t getSwitchId1() override;
|
||||||
virtual uint8_t getSwitchId2();
|
uint8_t getSwitchId2() override;
|
||||||
|
|
||||||
bool hasTwoSwitches();
|
bool hasTwoSwitches() override;
|
||||||
|
|
||||||
float getMin();
|
float getMin() override;
|
||||||
float getMax();
|
float getMax() override;
|
||||||
|
|
||||||
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||||
Endianness streamEndianness) const override;
|
Endianness streamEndianness) const override;
|
||||||
@ -29,7 +29,7 @@ class PowerComponent : public PowerComponentIF {
|
|||||||
Endianness streamEndianness) override;
|
Endianness streamEndianness) override;
|
||||||
|
|
||||||
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper* parameterWrapper,
|
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper* parameterWrapper,
|
||||||
const ParameterWrapper* newValues, uint16_t startAtIndex);
|
const ParameterWrapper* newValues, uint16_t startAtIndex) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const object_id_t deviceObjectId = objects::NO_OBJECT;
|
const object_id_t deviceObjectId = objects::NO_OBJECT;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
class PowerComponentIF : public SerializeIF, public HasParametersIF {
|
class PowerComponentIF : public SerializeIF, public HasParametersIF {
|
||||||
public:
|
public:
|
||||||
virtual ~PowerComponentIF() {}
|
~PowerComponentIF() override = default;
|
||||||
|
|
||||||
virtual object_id_t getDeviceObjectId() = 0;
|
virtual object_id_t getDeviceObjectId() = 0;
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ class FailureReport : public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 2, 4, 6
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual size_t getSerializedSize() const {
|
size_t getSerializedSize() const override {
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
size += SerializeAdapter::getSerializedSize(&packetId);
|
size += SerializeAdapter::getSerializedSize(&packetId);
|
||||||
size += sizeof(packetSequenceControl);
|
size += sizeof(packetSequenceControl);
|
||||||
|
@ -34,7 +34,7 @@ class SerializeIF {
|
|||||||
static const ReturnValue_t TOO_MANY_ELEMENTS =
|
static const ReturnValue_t TOO_MANY_ELEMENTS =
|
||||||
MAKE_RETURN_CODE(3); // !< There are too many elements to be deserialized
|
MAKE_RETURN_CODE(3); // !< There are too many elements to be deserialized
|
||||||
|
|
||||||
virtual ~SerializeIF() {}
|
virtual ~SerializeIF() = default;
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
* Function to serialize the object into a buffer with maxSize. Size represents the written
|
* Function to serialize the object into a buffer with maxSize. Size represents the written
|
||||||
@ -66,7 +66,7 @@ class SerializeIF {
|
|||||||
* Gets the size of a object if it would be serialized in a buffer
|
* Gets the size of a object if it would be serialized in a buffer
|
||||||
* @return Size of serialized object
|
* @return Size of serialized object
|
||||||
*/
|
*/
|
||||||
virtual size_t getSerializedSize() const = 0;
|
[[nodiscard]] virtual size_t getSerializedSize() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
|
@ -10,7 +10,7 @@ StorageAccessor::StorageAccessor(store_address_t storeId) : ConstStorageAccessor
|
|||||||
StorageAccessor::StorageAccessor(store_address_t storeId, StorageManagerIF* store)
|
StorageAccessor::StorageAccessor(store_address_t storeId, StorageManagerIF* store)
|
||||||
: ConstStorageAccessor(storeId, store) {}
|
: ConstStorageAccessor(storeId, store) {}
|
||||||
|
|
||||||
StorageAccessor& StorageAccessor::operator=(StorageAccessor&& other) {
|
StorageAccessor& StorageAccessor::operator=(StorageAccessor&& other) noexcept {
|
||||||
// Call the parent move assignment and also assign own member.
|
// Call the parent move assignment and also assign own member.
|
||||||
dataPointer = other.dataPointer;
|
dataPointer = other.dataPointer;
|
||||||
ConstStorageAccessor::operator=(std::move(other));
|
ConstStorageAccessor::operator=(std::move(other));
|
||||||
@ -18,7 +18,7 @@ StorageAccessor& StorageAccessor::operator=(StorageAccessor&& other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Call the parent move ctor and also transfer own member.
|
// Call the parent move ctor and also transfer own member.
|
||||||
StorageAccessor::StorageAccessor(StorageAccessor&& other)
|
StorageAccessor::StorageAccessor(StorageAccessor&& other) noexcept
|
||||||
: ConstStorageAccessor(std::move(other)), dataPointer(other.dataPointer) {}
|
: ConstStorageAccessor(std::move(other)), dataPointer(other.dataPointer) {}
|
||||||
|
|
||||||
ReturnValue_t StorageAccessor::getDataCopy(uint8_t* pointer, size_t maxSize) {
|
ReturnValue_t StorageAccessor::getDataCopy(uint8_t* pointer, size_t maxSize) {
|
||||||
|
@ -14,7 +14,7 @@ class StorageAccessor : public ConstStorageAccessor {
|
|||||||
friend class LocalPool;
|
friend class LocalPool;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StorageAccessor(store_address_t storeId);
|
explicit StorageAccessor(store_address_t storeId);
|
||||||
StorageAccessor(store_address_t storeId, StorageManagerIF* store);
|
StorageAccessor(store_address_t storeId, StorageManagerIF* store);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,8 +25,8 @@ class StorageAccessor : public ConstStorageAccessor {
|
|||||||
* @param
|
* @param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
StorageAccessor& operator=(StorageAccessor&&);
|
StorageAccessor& operator=(StorageAccessor&&) noexcept;
|
||||||
StorageAccessor(StorageAccessor&&);
|
StorageAccessor(StorageAccessor&&) noexcept;
|
||||||
|
|
||||||
ReturnValue_t write(uint8_t* data, size_t size, uint16_t offset = 0);
|
ReturnValue_t write(uint8_t* data, size_t size, uint16_t offset = 0);
|
||||||
uint8_t* data();
|
uint8_t* data();
|
||||||
|
@ -29,11 +29,11 @@ CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() {
|
|||||||
storeId.packetIndex);
|
storeId.packetIndex);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
TcMqMapIter queueMapIt = this->queueMap.end();
|
auto queueMapIt = this->queueMap.end();
|
||||||
if (this->currentPacket == nullptr) {
|
if (this->currentPacket == nullptr) {
|
||||||
return queueMapIt;
|
return queueMapIt;
|
||||||
}
|
}
|
||||||
this->currentPacket->setStoreAddress(this->currentMessage.getStorageId());
|
this->currentPacket->setStoreAddress(this->currentMessage.getStorageId(), currentPacket);
|
||||||
if (currentPacket->getWholeData() != nullptr) {
|
if (currentPacket->getWholeData() != nullptr) {
|
||||||
tcStatus = checker.checkPacket(currentPacket);
|
tcStatus = checker.checkPacket(currentPacket);
|
||||||
if (tcStatus != HasReturnvaluesIF::RETURN_OK) {
|
if (tcStatus != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
@ -190,13 +190,13 @@ ReturnValue_t Heater::performOperation(uint8_t opCode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Heater::setSwitch(uint8_t number, ReturnValue_t state, uint32_t* uptimeOfSwitching) {
|
void Heater::setSwitch(uint8_t number, ReturnValue_t state, uint32_t* uptimeOfSwitching) {
|
||||||
if (powerSwitcher == NULL) {
|
if (powerSwitcher == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (powerSwitcher->getSwitchState(number) == state) {
|
if (powerSwitcher->getSwitchState(number) == state) {
|
||||||
*uptimeOfSwitching = INVALID_UPTIME;
|
*uptimeOfSwitching = INVALID_UPTIME;
|
||||||
} else {
|
} else {
|
||||||
if ((*uptimeOfSwitching == INVALID_UPTIME)) {
|
if (*uptimeOfSwitching == INVALID_UPTIME) {
|
||||||
powerSwitcher->sendSwitchCommand(number, state);
|
powerSwitcher->sendSwitchCommand(number, state);
|
||||||
Clock::getUptime(uptimeOfSwitching);
|
Clock::getUptime(uptimeOfSwitching);
|
||||||
} else {
|
} else {
|
||||||
|
@ -11,11 +11,11 @@ class CFDPPacket : public SpacePacketBase {
|
|||||||
* forwards the data pointer to the parent SpacePacketBase class.
|
* forwards the data pointer to the parent SpacePacketBase class.
|
||||||
* @param setData The position where the packet data lies.
|
* @param setData The position where the packet data lies.
|
||||||
*/
|
*/
|
||||||
CFDPPacket(const uint8_t* setData);
|
explicit CFDPPacket(const uint8_t* setData);
|
||||||
/**
|
/**
|
||||||
* This is the empty default destructor.
|
* This is the empty default destructor.
|
||||||
*/
|
*/
|
||||||
virtual ~CFDPPacket();
|
~CFDPPacket() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a debugging helper method that prints the whole packet content
|
* This is a debugging helper method that prints the whole packet content
|
||||||
|
@ -2,48 +2,44 @@
|
|||||||
|
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
|
|
||||||
StorageManagerIF* CFDPPacketStored::store = nullptr;
|
|
||||||
|
|
||||||
CFDPPacketStored::CFDPPacketStored() : CFDPPacket(nullptr) {}
|
CFDPPacketStored::CFDPPacketStored() : CFDPPacket(nullptr) {}
|
||||||
|
|
||||||
CFDPPacketStored::CFDPPacketStored(store_address_t setAddress) : CFDPPacket(nullptr) {
|
CFDPPacketStored::CFDPPacketStored(store_address_t setAddress) : CFDPPacket(nullptr) {
|
||||||
this->setStoreAddress(setAddress);
|
CFDPPacketStored::setStoreAddress(setAddress, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
CFDPPacketStored::CFDPPacketStored(const uint8_t* data, size_t size) : CFDPPacket(data) {
|
CFDPPacketStored::CFDPPacketStored(const uint8_t* data, size_t size) : CFDPPacket(data) {
|
||||||
if (this->getFullSize() != size) {
|
if (this->getFullSize() != size) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this->checkAndSetStore()) {
|
if (CFDPPacketStored::checkAndSetStore()) {
|
||||||
ReturnValue_t status = store->addData(&storeAddress, data, size);
|
ReturnValue_t status = STORE->addData(&storeAddress, data, size);
|
||||||
if (status != HasReturnvaluesIF::RETURN_OK) {
|
if (status != HasReturnvaluesIF::RETURN_OK) {
|
||||||
this->setData(nullptr, -1);
|
this->setData(nullptr, -1);
|
||||||
}
|
}
|
||||||
const uint8_t* storePtr = nullptr;
|
const uint8_t* storePtr = nullptr;
|
||||||
// Repoint base data pointer to the data in the store.
|
// Repoint base data pointer to the data in the store.
|
||||||
store->getData(storeAddress, &storePtr, &size);
|
STORE->getData(storeAddress, &storePtr, &size);
|
||||||
this->setData(const_cast<uint8_t*>(storePtr), size);
|
this->setData(const_cast<uint8_t*>(storePtr), size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CFDPPacketStored::deletePacket() {
|
ReturnValue_t CFDPPacketStored::deletePacket() {
|
||||||
ReturnValue_t result = this->store->deleteData(this->storeAddress);
|
ReturnValue_t result = CFDPPacketStored::STORE->deleteData(this->storeAddress);
|
||||||
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
|
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
|
||||||
// To circumvent size checks
|
// To circumvent size checks
|
||||||
this->setData(nullptr, -1);
|
this->setData(nullptr, -1);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CFDPPacket* CFDPPacketStored::getPacketBase() {
|
void CFDPPacketStored::setStoreAddress(store_address_t setAddress,
|
||||||
// return this;
|
RedirectableDataPointerIF* packet) {
|
||||||
// }
|
|
||||||
void CFDPPacketStored::setStoreAddress(store_address_t setAddress) {
|
|
||||||
this->storeAddress = setAddress;
|
this->storeAddress = setAddress;
|
||||||
const uint8_t* tempData = nullptr;
|
const uint8_t* tempData = nullptr;
|
||||||
size_t tempSize;
|
size_t tempSize;
|
||||||
ReturnValue_t status = StorageManagerIF::RETURN_FAILED;
|
ReturnValue_t status = StorageManagerIF::RETURN_FAILED;
|
||||||
if (this->checkAndSetStore()) {
|
if (CFDPPacketStored::checkAndSetStore()) {
|
||||||
status = this->store->getData(this->storeAddress, &tempData, &tempSize);
|
status = CFDPPacketStored::STORE->getData(this->storeAddress, &tempData, &tempSize);
|
||||||
}
|
}
|
||||||
if (status == StorageManagerIF::RETURN_OK) {
|
if (status == StorageManagerIF::RETURN_OK) {
|
||||||
this->setData(const_cast<uint8_t*>(tempData), tempSize);
|
this->setData(const_cast<uint8_t*>(tempData), tempSize);
|
||||||
@ -56,33 +52,17 @@ void CFDPPacketStored::setStoreAddress(store_address_t setAddress) {
|
|||||||
|
|
||||||
store_address_t CFDPPacketStored::getStoreAddress() { return this->storeAddress; }
|
store_address_t CFDPPacketStored::getStoreAddress() { return this->storeAddress; }
|
||||||
|
|
||||||
CFDPPacketStored::~CFDPPacketStored() {}
|
CFDPPacketStored::~CFDPPacketStored() = default;
|
||||||
|
|
||||||
ReturnValue_t CFDPPacketStored::getData(const uint8_t** dataPtr, size_t* dataSize) {
|
ReturnValue_t CFDPPacketStored::getData(const uint8_t** dataPtr, size_t* dataSize) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReturnValue_t CFDPPacketStored::setData(const uint8_t *data) {
|
|
||||||
// return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
// }
|
|
||||||
|
|
||||||
bool CFDPPacketStored::checkAndSetStore() {
|
|
||||||
if (this->store == nullptr) {
|
|
||||||
this->store = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
|
|
||||||
if (this->store == nullptr) {
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
||||||
sif::error << "CFDPPacketStored::CFDPPacketStored: TC Store not found!" << std::endl;
|
|
||||||
#endif
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CFDPPacketStored::isSizeCorrect() {
|
bool CFDPPacketStored::isSizeCorrect() {
|
||||||
const uint8_t* temp_data = nullptr;
|
const uint8_t* temp_data = nullptr;
|
||||||
size_t temp_size;
|
size_t temp_size;
|
||||||
ReturnValue_t status = this->store->getData(this->storeAddress, &temp_data, &temp_size);
|
ReturnValue_t status =
|
||||||
|
CFDPPacketStored::STORE->getData(this->storeAddress, &temp_data, &temp_size);
|
||||||
if (status == StorageManagerIF::RETURN_OK) {
|
if (status == StorageManagerIF::RETURN_OK) {
|
||||||
if (this->getFullSize() == temp_size) {
|
if (this->getFullSize() == temp_size) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -16,10 +16,10 @@ class CFDPPacketStored : public CFDPPacket, public TcPacketStoredBase {
|
|||||||
* Create stored packet from existing packet in store
|
* Create stored packet from existing packet in store
|
||||||
* @param setAddress
|
* @param setAddress
|
||||||
*/
|
*/
|
||||||
CFDPPacketStored(store_address_t setAddress);
|
explicit CFDPPacketStored(store_address_t setAddress);
|
||||||
CFDPPacketStored();
|
CFDPPacketStored();
|
||||||
|
|
||||||
virtual ~CFDPPacketStored();
|
~CFDPPacketStored() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter function for the raw data.
|
* Getter function for the raw data.
|
||||||
@ -27,37 +27,22 @@ class CFDPPacketStored : public CFDPPacket, public TcPacketStoredBase {
|
|||||||
* @param dataSize [out] Address of size to set.
|
* @param dataSize [out] Address of size to set.
|
||||||
* @return -@c RETURN_OK if data was retrieved successfully.
|
* @return -@c RETURN_OK if data was retrieved successfully.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t getData(const uint8_t** dataPtr, size_t* dataSize);
|
ReturnValue_t getData(const uint8_t** dataPtr, size_t* dataSize) override;
|
||||||
|
|
||||||
void setStoreAddress(store_address_t setAddress);
|
void setStoreAddress(store_address_t setAddress, RedirectableDataPointerIF* packet) override;
|
||||||
|
|
||||||
store_address_t getStoreAddress();
|
store_address_t getStoreAddress() override;
|
||||||
|
|
||||||
ReturnValue_t deletePacket();
|
ReturnValue_t deletePacket() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isSizeCorrect();
|
bool isSizeCorrect() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
|
||||||
* This is a pointer to the store all instances of the class use.
|
|
||||||
* If the store is not yet set (i.e. @c store is NULL), every constructor
|
|
||||||
* call tries to set it and throws an error message in case of failures.
|
|
||||||
* The default store is objects::TC_STORE.
|
|
||||||
*/
|
|
||||||
static StorageManagerIF* store;
|
|
||||||
/**
|
/**
|
||||||
* The address where the packet data of the object instance is stored.
|
* The address where the packet data of the object instance is stored.
|
||||||
*/
|
*/
|
||||||
store_address_t storeAddress;
|
store_address_t storeAddress;
|
||||||
/**
|
|
||||||
* A helper method to check if a store is assigned to the class.
|
|
||||||
* If not, the method tries to retrieve the store from the global
|
|
||||||
* ObjectManager.
|
|
||||||
* @return @li @c true if the store is linked or could be created.
|
|
||||||
* @li @c false otherwise.
|
|
||||||
*/
|
|
||||||
bool checkAndSetStore();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_INC_FSFW_TMTCPACKET_CFDP_CFDPPACKETSTORED_H_ */
|
#endif /* FSFW_INC_FSFW_TMTCPACKET_CFDP_CFDPPACKETSTORED_H_ */
|
||||||
|
@ -19,7 +19,7 @@ class TcPacketStoredBase : public TcPacketStoredIF {
|
|||||||
* Constructor to set to an existing store address.
|
* Constructor to set to an existing store address.
|
||||||
* @param setAddress
|
* @param setAddress
|
||||||
*/
|
*/
|
||||||
TcPacketStoredBase(store_address_t setAddress);
|
explicit TcPacketStoredBase(store_address_t setAddress);
|
||||||
/**
|
/**
|
||||||
* Another constructor to create a TcPacket from a raw packet stream.
|
* Another constructor to create a TcPacket from a raw packet stream.
|
||||||
* Takes the data and adds it unchecked to the TcStore.
|
* Takes the data and adds it unchecked to the TcStore.
|
||||||
@ -28,7 +28,7 @@ class TcPacketStoredBase : public TcPacketStoredIF {
|
|||||||
*/
|
*/
|
||||||
TcPacketStoredBase(const uint8_t* data, uint32_t size);
|
TcPacketStoredBase(const uint8_t* data, uint32_t size);
|
||||||
|
|
||||||
virtual ~TcPacketStoredBase();
|
~TcPacketStoredBase() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter function for the raw data.
|
* Getter function for the raw data.
|
||||||
@ -70,6 +70,7 @@ class TcPacketStoredBase : public TcPacketStoredIF {
|
|||||||
* The address where the packet data of the object instance is stored.
|
* The address where the packet data of the object instance is stored.
|
||||||
*/
|
*/
|
||||||
store_address_t storeAddress;
|
store_address_t storeAddress;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper method to check if a store is assigned to the class.
|
* A helper method to check if a store is assigned to the class.
|
||||||
* If not, the method tries to retrieve the store from the global
|
* If not, the method tries to retrieve the store from the global
|
||||||
|
@ -16,6 +16,8 @@ class TcPacketStoredIF {
|
|||||||
* With this call, the stored packet can be set to another packet in a store. This is useful
|
* With this call, the stored packet can be set to another packet in a store. This is useful
|
||||||
* if the packet is a class member and used for more than one packet.
|
* if the packet is a class member and used for more than one packet.
|
||||||
* @param setAddress The new packet id to link to.
|
* @param setAddress The new packet id to link to.
|
||||||
|
* @param packet Explicit packet instance. The setData function should be called on this
|
||||||
|
* pointer
|
||||||
*/
|
*/
|
||||||
virtual void setStoreAddress(store_address_t setAddress, RedirectableDataPointerIF* packet) = 0;
|
virtual void setStoreAddress(store_address_t setAddress, RedirectableDataPointerIF* packet) = 0;
|
||||||
|
|
||||||
|
@ -147,8 +147,9 @@ ReturnValue_t testserialize::test_autoserialization() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// These epsilon values were just guessed.. It appears to work though.
|
// These epsilon values were just guessed.. It appears to work though.
|
||||||
if (abs(tv_float - tv::tv_float) > 0.0001 or abs(tv_double - tv::tv_double) > 0.01 or
|
if (std::abs(tv_float - tv::tv_float) > 0.0001 or std::abs(tv_double - tv::tv_double) > 0.01 or
|
||||||
abs(tv_sfloat - tv::tv_sfloat) > 0.0001 or abs(tv_sdouble - tv::tv_sdouble) > 0.01) {
|
std::abs(tv_sfloat - tv::tv_sfloat) > 0.0001 or
|
||||||
|
std::abs(tv_sdouble - tv::tv_sdouble) > 0.01) {
|
||||||
return unitt::put_error(id);
|
return unitt::put_error(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "tests/TestsConfig.h"
|
|
||||||
#include "fsfw/container/DynamicFIFO.h"
|
#include "fsfw/container/DynamicFIFO.h"
|
||||||
#include "fsfw/container/SimpleRingBuffer.h"
|
#include "fsfw/container/SimpleRingBuffer.h"
|
||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface.h"
|
||||||
#include "fsfw_hal/linux/CommandExecutor.h"
|
#include "fsfw_hal/linux/CommandExecutor.h"
|
||||||
|
#include "tests/TestsConfig.h"
|
||||||
|
|
||||||
#ifdef PLATFORM_UNIX
|
#ifdef PLATFORM_UNIX
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/storagemanager/LocalPool.h>
|
#include <fsfw/storagemanager/LocalPool.h>
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <array>
|
|
||||||
|
|
||||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user