a lot of clang improvements
This commit is contained in:
parent
fea301bcc9
commit
b904d33cfe
|
@ -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_ */
|
||||||
|
|
|
@ -314,7 +314,7 @@ void UartComIF::configureBaudrate(struct termios* options, UartCookie* uartCooki
|
||||||
cfsetispeed(options, B4000000);
|
cfsetispeed(options, B4000000);
|
||||||
cfsetospeed(options, B4000000);
|
cfsetospeed(options, B4000000);
|
||||||
break;
|
break;
|
||||||
#endif // ! __APPLE__
|
#endif // ! __APPLE__
|
||||||
default:
|
default:
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "UartComIF::configureBaudrate: Baudrate not supported" << std::endl;
|
sif::warning << "UartComIF::configureBaudrate: Baudrate not supported" << std::endl;
|
||||||
|
|
|
@ -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);
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,12 +39,12 @@ class ExtendedControllerBase : public ControllerBase,
|
||||||
* @param message
|
* @param message
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t handleCommandMessage(CommandMessage* message) = 0;
|
virtual 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;
|
virtual void performControlOperation() override = 0;
|
||||||
|
|
||||||
/* Handle the four messages mentioned above */
|
/* Handle the four messages mentioned above */
|
||||||
void handleQueue() override;
|
void handleQueue() override;
|
||||||
|
|
|
@ -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,7 +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, uint32_t parameter2 = 0) const override;
|
void forwardEvent(Event event, uint32_t parameter1 = 0, 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;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,8 @@ class SystemObject : public SystemObjectIF {
|
||||||
virtual ReturnValue_t initialize() override;
|
virtual ReturnValue_t initialize() override;
|
||||||
virtual ReturnValue_t checkObjectConnections() override;
|
virtual ReturnValue_t checkObjectConnections() override;
|
||||||
|
|
||||||
virtual void forwardEvent(Event event, uint32_t parameter1 = 0, uint32_t parameter2 = 0) const override;
|
virtual void forwardEvent(Event event, uint32_t parameter1 = 0,
|
||||||
|
uint32_t parameter2 = 0) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_OBJECTMANAGER_SYSTEMOBJECT_H_ */
|
#endif /* FSFW_OBJECTMANAGER_SYSTEMOBJECT_H_ */
|
||||||
|
|
|
@ -154,7 +154,7 @@ void UdpTcPollingTask::setTimeout(double timeoutSeconds) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#elif defined(PLATFORM_UNIX)
|
#elif defined(PLATFORM_UNIX)
|
||||||
timeval tval {};
|
timeval tval{};
|
||||||
tval = timevalOperations::toTimeval(timeoutSeconds);
|
tval = timevalOperations::toTimeval(timeoutSeconds);
|
||||||
int result = setsockopt(serverSocket, SOL_SOCKET, SO_RCVTIMEO, &tval, sizeof(receptionTimeout));
|
int result = setsockopt(serverSocket, SOL_SOCKET, SO_RCVTIMEO, &tval, sizeof(receptionTimeout));
|
||||||
if (result == -1) {
|
if (result == -1) {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
const std::string UdpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT;
|
const std::string UdpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT;
|
||||||
|
|
||||||
UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
|
UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
|
||||||
const std::string& udpServerPort_, object_id_t tmStoreId,
|
const std::string &udpServerPort_, object_id_t tmStoreId,
|
||||||
object_id_t tcStoreId)
|
object_id_t tcStoreId)
|
||||||
: TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
|
: TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
|
||||||
if (udpServerPort_.empty()) {
|
if (udpServerPort_.empty()) {
|
||||||
|
@ -118,7 +118,7 @@ ReturnValue_t UdpTmTcBridge::sendTm(const uint8_t *data, size_t dataLen) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ssize_t bytesSent = sendto(serverSocket, reinterpret_cast<const char *>(data), dataLen, flags,
|
ssize_t bytesSent = sendto(serverSocket, reinterpret_cast<const char *>(data), dataLen, flags,
|
||||||
&clientAddress, clientAddressLen);
|
&clientAddress, clientAddressLen);
|
||||||
if (bytesSent == SOCKET_ERROR) {
|
if (bytesSent == SOCKET_ERROR) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "TmTcUdpBridge::sendTm: Send operation failed." << std::endl;
|
sif::warning << "TmTcUdpBridge::sendTm: Send operation failed." << std::endl;
|
||||||
|
|
|
@ -29,8 +29,8 @@ class UdpTmTcBridge : public TmTcBridge, public TcpIpBase {
|
||||||
/* The ports chosen here should not be used by any other process. */
|
/* The ports chosen here should not be used by any other process. */
|
||||||
static const std::string DEFAULT_SERVER_PORT;
|
static const std::string DEFAULT_SERVER_PORT;
|
||||||
|
|
||||||
UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination, const std::string& udpServerPort = "",
|
UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
|
||||||
object_id_t tmStoreId = objects::TM_STORE,
|
const std::string& udpServerPort = "", object_id_t tmStoreId = objects::TM_STORE,
|
||||||
object_id_t tcStoreId = objects::TC_STORE);
|
object_id_t tcStoreId = objects::TC_STORE);
|
||||||
~UdpTmTcBridge() override;
|
~UdpTmTcBridge() override;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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,46 @@
|
||||||
|
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
|
|
||||||
StorageManagerIF* CFDPPacketStored::store = nullptr;
|
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 (this->checkAndSetStore()) {
|
||||||
status = this->store->getData(this->storeAddress, &tempData, &tempSize);
|
status = this->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);
|
||||||
|
@ -67,9 +65,9 @@ ReturnValue_t CFDPPacketStored::getData(const uint8_t** dataPtr, size_t* dataSiz
|
||||||
// }
|
// }
|
||||||
|
|
||||||
bool CFDPPacketStored::checkAndSetStore() {
|
bool CFDPPacketStored::checkAndSetStore() {
|
||||||
if (this->store == nullptr) {
|
if (CFDPPacketStored::STORE == nullptr) {
|
||||||
this->store = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
|
CFDPPacketStored::STORE = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
|
||||||
if (this->store == nullptr) {
|
if (CFDPPacketStored::STORE == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "CFDPPacketStored::CFDPPacketStored: TC Store not found!" << std::endl;
|
sif::error << "CFDPPacketStored::CFDPPacketStored: TC Store not found!" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
@ -82,7 +80,8 @@ bool CFDPPacketStored::checkAndSetStore() {
|
||||||
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,16 +27,16 @@ 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:
|
||||||
/**
|
/**
|
||||||
|
@ -45,7 +45,7 @@ class CFDPPacketStored : public CFDPPacket, public TcPacketStoredBase {
|
||||||
* call tries to set it and throws an error message in case of failures.
|
* call tries to set it and throws an error message in case of failures.
|
||||||
* The default store is objects::TC_STORE.
|
* The default store is objects::TC_STORE.
|
||||||
*/
|
*/
|
||||||
static StorageManagerIF* 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.
|
||||||
*/
|
*/
|
||||||
|
@ -57,7 +57,7 @@ class CFDPPacketStored : public CFDPPacket, public TcPacketStoredBase {
|
||||||
* @return @li @c true if the store is linked or could be created.
|
* @return @li @c true if the store is linked or could be created.
|
||||||
* @li @c false otherwise.
|
* @li @c false otherwise.
|
||||||
*/
|
*/
|
||||||
bool checkAndSetStore();
|
bool checkAndSetStore() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#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.
|
||||||
|
@ -70,14 +70,16 @@ 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.
|
virtual /**
|
||||||
* If not, the method tries to retrieve the store from the global
|
* A helper method to check if a store is assigned to the class.
|
||||||
* ObjectManager.
|
* If not, the method tries to retrieve the store from the global
|
||||||
* @return @li @c true if the store is linked or could be created.
|
* ObjectManager.
|
||||||
* @li @c false otherwise.
|
* @return @li @c true if the store is linked or could be created.
|
||||||
*/
|
* @li @c false otherwise.
|
||||||
bool checkAndSetStore();
|
*/
|
||||||
|
bool
|
||||||
|
checkAndSetStore();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* TMTCPACKET_PUS_TcPacketStoredBase_H_ */
|
#endif /* TMTCPACKET_PUS_TcPacketStoredBase_H_ */
|
||||||
|
|
|
@ -9,12 +9,15 @@
|
||||||
|
|
||||||
class TcPacketStoredIF {
|
class TcPacketStoredIF {
|
||||||
public:
|
public:
|
||||||
virtual ~TcPacketStoredIF(){};
|
virtual ~TcPacketStoredIF() = default;
|
||||||
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user