Merge branch 'mueller/datalinklayer-convergence' of https://egit.irs.uni-stuttgart.de/KSat/fsfw into mueller/datalinklayer-convergence

This commit is contained in:
Robin Müller 2020-12-08 15:15:50 +01:00
commit 3b0e5daeed
58 changed files with 515 additions and 475 deletions

View File

@ -14,3 +14,10 @@ a C file without issues
- It is now possible to change the message queue depth for the telecommand verification service (PUS1) - It is now possible to change the message queue depth for the telecommand verification service (PUS1)
- The same is possible for the event reporting service (PUS5) - The same is possible for the event reporting service (PUS5)
- PUS Health Service added, which allows to command and retrieve health via PUS packets - PUS Health Service added, which allows to command and retrieve health via PUS packets
### Events
- makeEvent function: Now takes three input parameters instead of two and
allows setting a unique ID. Event.cpp source file removed, functions now
defined in header directly. Namespaces renamed. Functions declared `constexpr`
now

View File

@ -19,12 +19,12 @@ class VirtualChannelReception;
class DataLinkLayer : public CCSDSReturnValuesIF { class DataLinkLayer : public CCSDSReturnValuesIF {
public: public:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYSTEM_1; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYSTEM_1;
static const Event RF_AVAILABLE = MAKE_EVENT(0, SEVERITY::INFO); //!< A RF available signal was detected. P1: raw RFA state, P2: 0 static const Event RF_AVAILABLE = MAKE_EVENT(0, severity::INFO); //!< A RF available signal was detected. P1: raw RFA state, P2: 0
static const Event RF_LOST = MAKE_EVENT(1, SEVERITY::INFO); //!< A previously found RF available signal was lost. P1: raw RFA state, P2: 0 static const Event RF_LOST = MAKE_EVENT(1, severity::INFO); //!< A previously found RF available signal was lost. P1: raw RFA state, P2: 0
static const Event BIT_LOCK = MAKE_EVENT(2, SEVERITY::INFO); //!< A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0 static const Event BIT_LOCK = MAKE_EVENT(2, severity::INFO); //!< A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0
static const Event BIT_LOCK_LOST = MAKE_EVENT(3, SEVERITY::INFO); //!< A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0 static const Event BIT_LOCK_LOST = MAKE_EVENT(3, severity::INFO); //!< A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0
// static const Event RF_CHAIN_LOST = MAKE_EVENT(4, SEVERITY::INFO); //!< The CCSDS Board detected that either bit lock or RF available or both are lost. No parameters. // static const Event RF_CHAIN_LOST = MAKE_EVENT(4, severity::INFO); //!< The CCSDS Board detected that either bit lock or RF available or both are lost. No parameters.
static const Event FRAME_PROCESSING_FAILED = MAKE_EVENT(5, SEVERITY::LOW); //!< The CCSDS Board could not interpret a TC static const Event FRAME_PROCESSING_FAILED = MAKE_EVENT(5, severity::LOW); //!< The CCSDS Board could not interpret a TC
/** /**
* The Constructor sets the passed parameters and nothing else. * The Constructor sets the passed parameters and nothing else.
* @param set_frame_buffer The buffer in which incoming frame candidates are stored. * @param set_frame_buffer The buffer in which incoming frame candidates are stored.

View File

@ -13,7 +13,7 @@ class HkSwitchHelper: public ExecutableObjectIF, public CommandsActionsIF {
public: public:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::HK; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::HK;
static const Event SWITCHING_TM_FAILED = MAKE_EVENT(1, SEVERITY::LOW); //!< Commanding the HK Service failed, p1: error code, p2 action: 0 disable / 1 enable static const Event SWITCHING_TM_FAILED = MAKE_EVENT(1, severity::LOW); //!< Commanding the HK Service failed, p1: error code, p2 action: 0 disable / 1 enable
HkSwitchHelper(EventReportingProxyIF *eventProxy); HkSwitchHelper(EventReportingProxyIF *eventProxy);
virtual ~HkSwitchHelper(); virtual ~HkSwitchHelper();

View File

@ -191,7 +191,7 @@ void DeviceHandlerFailureIsolation::triggerEvent(Event event, uint32_t parameter
uint32_t parameter2) { uint32_t parameter2) {
//Do not throw error events if fdirState != none. //Do not throw error events if fdirState != none.
//This will still forward MODE and HEALTH INFO events in any case. //This will still forward MODE and HEALTH INFO events in any case.
if (fdirState == NONE || EVENT::getSeverity(event) == SEVERITY::INFO) { if (fdirState == NONE || event::getSeverity(event) == severity::INFO) {
FailureIsolationBase::triggerEvent(event, parameter1, parameter2); FailureIsolationBase::triggerEvent(event, parameter1, parameter2);
} }
} }
@ -201,7 +201,7 @@ bool DeviceHandlerFailureIsolation::isFdirActionInProgress() {
} }
void DeviceHandlerFailureIsolation::startRecovery(Event reason) { void DeviceHandlerFailureIsolation::startRecovery(Event reason) {
throwFdirEvent(FDIR_STARTS_RECOVERY, EVENT::getEventId(reason)); throwFdirEvent(FDIR_STARTS_RECOVERY, event::getEventId(reason));
setOwnerHealth(HasHealthIF::NEEDS_RECOVERY); setOwnerHealth(HasHealthIF::NEEDS_RECOVERY);
setFdirState(RECOVERY_ONGOING); setFdirState(RECOVERY_ONGOING);
} }
@ -228,7 +228,7 @@ ReturnValue_t DeviceHandlerFailureIsolation::getParameter(uint8_t domainId,
} }
void DeviceHandlerFailureIsolation::setFaulty(Event reason) { void DeviceHandlerFailureIsolation::setFaulty(Event reason) {
throwFdirEvent(FDIR_TURNS_OFF_DEVICE, EVENT::getEventId(reason)); throwFdirEvent(FDIR_TURNS_OFF_DEVICE, event::getEventId(reason));
setOwnerHealth(HasHealthIF::FAULTY); setOwnerHealth(HasHealthIF::FAULTY);
setFdirState(AWAIT_SHUTDOWN); setFdirState(AWAIT_SHUTDOWN);
} }

View File

@ -83,17 +83,17 @@ public:
static const Mode_t _MODE_SWITCH_IS_OFF = TRANSITION_MODE_BASE_ACTION_MASK | 5; static const Mode_t _MODE_SWITCH_IS_OFF = TRANSITION_MODE_BASE_ACTION_MASK | 5;
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CDH; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CDH;
static const Event DEVICE_BUILDING_COMMAND_FAILED = MAKE_EVENT(0, SEVERITY::LOW); static const Event DEVICE_BUILDING_COMMAND_FAILED = MAKE_EVENT(0, severity::LOW);
static const Event DEVICE_SENDING_COMMAND_FAILED = MAKE_EVENT(1, SEVERITY::LOW); static const Event DEVICE_SENDING_COMMAND_FAILED = MAKE_EVENT(1, severity::LOW);
static const Event DEVICE_REQUESTING_REPLY_FAILED = MAKE_EVENT(2, SEVERITY::LOW); static const Event DEVICE_REQUESTING_REPLY_FAILED = MAKE_EVENT(2, severity::LOW);
static const Event DEVICE_READING_REPLY_FAILED = MAKE_EVENT(3, SEVERITY::LOW); static const Event DEVICE_READING_REPLY_FAILED = MAKE_EVENT(3, severity::LOW);
static const Event DEVICE_INTERPRETING_REPLY_FAILED = MAKE_EVENT(4, SEVERITY::LOW); static const Event DEVICE_INTERPRETING_REPLY_FAILED = MAKE_EVENT(4, severity::LOW);
static const Event DEVICE_MISSED_REPLY = MAKE_EVENT(5, SEVERITY::LOW); static const Event DEVICE_MISSED_REPLY = MAKE_EVENT(5, severity::LOW);
static const Event DEVICE_UNKNOWN_REPLY = MAKE_EVENT(6, SEVERITY::LOW); static const Event DEVICE_UNKNOWN_REPLY = MAKE_EVENT(6, severity::LOW);
static const Event DEVICE_UNREQUESTED_REPLY = MAKE_EVENT(7, SEVERITY::LOW); static const Event DEVICE_UNREQUESTED_REPLY = MAKE_EVENT(7, severity::LOW);
static const Event INVALID_DEVICE_COMMAND = MAKE_EVENT(8, SEVERITY::LOW); //!< Indicates a SW bug in child class. static const Event INVALID_DEVICE_COMMAND = MAKE_EVENT(8, severity::LOW); //!< Indicates a SW bug in child class.
static const Event MONITORING_LIMIT_EXCEEDED = MAKE_EVENT(9, SEVERITY::LOW); static const Event MONITORING_LIMIT_EXCEEDED = MAKE_EVENT(9, severity::LOW);
static const Event MONITORING_AMBIGUOUS = MAKE_EVENT(10, SEVERITY::HIGH); static const Event MONITORING_AMBIGUOUS = MAKE_EVENT(10, severity::HIGH);
static const uint8_t INTERFACE_ID = CLASS_ID::DEVICE_HANDLER_IF; static const uint8_t INTERFACE_ID = CLASS_ID::DEVICE_HANDLER_IF;

View File

@ -1,14 +0,0 @@
#include "Event.h"
namespace EVENT {
EventId_t getEventId(Event event) {
return (event & 0xFFFF);
}
EventSeverity_t getSeverity(Event event) {
return ((event >> 16) & 0xFF);
}
Event makeEvent(EventId_t eventId, EventSeverity_t eventSeverity) {
return (eventSeverity << 16) + (eventId & 0xFFFF);
}
}

View File

@ -3,7 +3,7 @@
#include <stdint.h> #include <stdint.h>
#include "fwSubsystemIdRanges.h" #include "fwSubsystemIdRanges.h"
//could be move to more suitable location // could be moved to more suitable location
#include <events/subsystemIdRanges.h> #include <events/subsystemIdRanges.h>
typedef uint16_t EventId_t; typedef uint16_t EventId_t;
@ -13,32 +13,28 @@ typedef uint8_t EventSeverity_t;
typedef uint32_t Event; typedef uint32_t Event;
namespace EVENT { namespace event {
EventId_t getEventId(Event event);
EventSeverity_t getSeverity(Event event); constexpr EventId_t getEventId(Event event) {
return (event & 0xFFFF);
Event makeEvent(EventId_t eventId, EventSeverity_t eventSeverity);
}
namespace SEVERITY {
static const EventSeverity_t INFO = 1;
static const EventSeverity_t LOW = 2;
static const EventSeverity_t MEDIUM = 3;
static const EventSeverity_t HIGH = 4;
} }
//Unfortunately, this does not work nicely because of the inability to define static classes in headers. constexpr EventSeverity_t getSeverity(Event event) {
//struct Event { return ((event >> 16) & 0xFF);
// Event(uint8_t domain, uint8_t counter, EventSeverity_t severity) : }
// id(domain*100+counter), severity(severity) {
// } constexpr Event makeEvent(uint8_t subsystemId, uint8_t uniqueEventId,
// EventId_t id; EventSeverity_t eventSeverity) {
// EventSeverity_t severity; return (eventSeverity << 16) + (subsystemId * 100) + uniqueEventId;
// static const EventSeverity_t INFO = 1; }
// static const EventSeverity_t LOW = 2;
// static const EventSeverity_t MEDIUM = 3; }
// static const EventSeverity_t HIGH = 4;
//}; namespace severity {
static constexpr EventSeverity_t INFO = 1;
static constexpr EventSeverity_t LOW = 2;
static constexpr EventSeverity_t MEDIUM = 3;
static constexpr EventSeverity_t HIGH = 4;
}
#endif /* EVENTOBJECT_EVENT_H_ */ #endif /* EVENTOBJECT_EVENT_H_ */

View File

@ -118,7 +118,7 @@ ReturnValue_t EventManager::unsubscribeFromEventRange(MessageQueueId_t listener,
void EventManager::printEvent(EventMessage* message) { void EventManager::printEvent(EventMessage* message) {
const char *string = 0; const char *string = 0;
switch (message->getSeverity()) { switch (message->getSeverity()) {
case SEVERITY::INFO: case severity::INFO:
#ifdef DEBUG_INFO_EVENT #ifdef DEBUG_INFO_EVENT
string = translateObject(message->getReporter()); string = translateObject(message->getReporter());
sif::info << "EVENT: "; sif::info << "EVENT: ";

View File

@ -48,7 +48,7 @@ void EventMessage::setMessageId(uint8_t id) {
EventSeverity_t EventMessage::getSeverity() { EventSeverity_t EventMessage::getSeverity() {
Event event; Event event;
memcpy(&event, getData(), sizeof(Event)); memcpy(&event, getData(), sizeof(Event));
return EVENT::getSeverity(event); return event::getSeverity(event);
} }
void EventMessage::setSeverity(EventSeverity_t severity) { void EventMessage::setSeverity(EventSeverity_t severity) {
@ -61,7 +61,7 @@ void EventMessage::setSeverity(EventSeverity_t severity) {
EventId_t EventMessage::getEventId() { EventId_t EventMessage::getEventId() {
Event event; Event event;
memcpy(&event, getData(), sizeof(Event)); memcpy(&event, getData(), sizeof(Event));
return EVENT::getEventId(event); return event::getEventId(event);
} }
void EventMessage::setEventId(EventId_t eventId) { void EventMessage::setEventId(EventId_t eventId) {

View File

@ -139,7 +139,7 @@ void FailureIsolationBase::triggerEvent(Event event, uint32_t parameter1,
uint32_t parameter2) { uint32_t parameter2) {
//With this mechanism, all events are disabled for a certain device. //With this mechanism, all events are disabled for a certain device.
//That's not so good for visibility. //That's not so good for visibility.
if (isFdirDisabledForSeverity(EVENT::getSeverity(event))) { if (isFdirDisabledForSeverity(event::getSeverity(event))) {
return; return;
} }
EventMessage message(event, ownerId, parameter1, parameter2); EventMessage message(event, ownerId, parameter1, parameter2);
@ -148,7 +148,7 @@ void FailureIsolationBase::triggerEvent(Event event, uint32_t parameter1,
} }
bool FailureIsolationBase::isFdirDisabledForSeverity(EventSeverity_t severity) { bool FailureIsolationBase::isFdirDisabledForSeverity(EventSeverity_t severity) {
if ((owner != NULL) && (severity != SEVERITY::INFO)) { if ((owner != NULL) && (severity != severity::INFO)) {
if (owner->getHealth() == HasHealthIF::EXTERNAL_CONTROL) { if (owner->getHealth() == HasHealthIF::EXTERNAL_CONTROL) {
//External control disables handling of fault messages. //External control disables handling of fault messages.
return true; return true;

View File

@ -14,9 +14,9 @@ class FailureIsolationBase: public HasReturnvaluesIF,
public HasParametersIF { public HasParametersIF {
public: public:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::FDIR_1; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::FDIR_1;
static const Event FDIR_CHANGED_STATE = MAKE_EVENT(1, SEVERITY::INFO); //!< FDIR has an internal state, which changed from par2 (oldState) to par1 (newState). static const Event FDIR_CHANGED_STATE = MAKE_EVENT(1, severity::INFO); //!< FDIR has an internal state, which changed from par2 (oldState) to par1 (newState).
static const Event FDIR_STARTS_RECOVERY = MAKE_EVENT(2, SEVERITY::MEDIUM); //!< FDIR tries to restart device. Par1: event that caused recovery. static const Event FDIR_STARTS_RECOVERY = MAKE_EVENT(2, severity::MEDIUM); //!< FDIR tries to restart device. Par1: event that caused recovery.
static const Event FDIR_TURNS_OFF_DEVICE = MAKE_EVENT(3, SEVERITY::MEDIUM); //!< FDIR turns off device. Par1: event that caused recovery. static const Event FDIR_TURNS_OFF_DEVICE = MAKE_EVENT(3, severity::MEDIUM); //!< FDIR turns off device. Par1: event that caused recovery.
FailureIsolationBase(object_id_t owner, FailureIsolationBase(object_id_t owner,
object_id_t parent = objects::NO_OBJECT, object_id_t parent = objects::NO_OBJECT,

View File

@ -7,16 +7,26 @@ PeriodicOperationDivider::PeriodicOperationDivider(uint32_t divider,
} }
bool PeriodicOperationDivider::checkAndIncrement() { bool PeriodicOperationDivider::checkAndIncrement() {
if(counter >= divider) { bool opNecessary = check();
if(opNecessary) {
if(resetAutomatically) { if(resetAutomatically) {
counter = 0; counter = 0;
} }
return true; return opNecessary;
} }
counter ++; counter ++;
return opNecessary;
}
bool PeriodicOperationDivider::check() {
if(counter >= divider) {
return true;
}
return false; return false;
} }
void PeriodicOperationDivider::resetCounter() { void PeriodicOperationDivider::resetCounter() {
counter = 0; counter = 0;
} }

View File

@ -21,17 +21,27 @@ public:
*/ */
PeriodicOperationDivider(uint32_t divider, bool resetAutomatically = true); PeriodicOperationDivider(uint32_t divider, bool resetAutomatically = true);
/** /**
* Check whether operation is necessary. * Check whether operation is necessary.
* If an operation is necessary and the class has been * If an operation is necessary and the class has been
* configured to be reset automatically, the counter will be reset. * configured to be reset automatically, the counter will be reset.
* If not, the counter will be incremented. *
* @return * @return
* -@c true if the counter is larger or equal to the divider * -@c true if the counter is larger or equal to the divider
* -@c false otherwise * -@c false otherwise
*/ */
bool checkAndIncrement(); bool checkAndIncrement();
/**
* Checks whether an operation is necessary.
* This function will not increment the counter!
* @return
* -@c true if the counter is larger or equal to the divider
* -@c false otherwise
*/
bool check();
/** /**
* Can be used to reset the counter to 0 manually. * Can be used to reset the counter to 0 manually.
*/ */

View File

@ -21,13 +21,13 @@ public:
static const ReturnValue_t INVALID_HEALTH_STATE = MAKE_RETURN_CODE(2); static const ReturnValue_t INVALID_HEALTH_STATE = MAKE_RETURN_CODE(2);
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYSTEM_MANAGER_1; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYSTEM_MANAGER_1;
static const Event HEALTH_INFO = MAKE_EVENT(6, SEVERITY::INFO); static const Event HEALTH_INFO = MAKE_EVENT(6, severity::INFO);
static const Event CHILD_CHANGED_HEALTH = MAKE_EVENT(7, SEVERITY::INFO); static const Event CHILD_CHANGED_HEALTH = MAKE_EVENT(7, severity::INFO);
static const Event CHILD_PROBLEMS = MAKE_EVENT(8, SEVERITY::LOW); static const Event CHILD_PROBLEMS = MAKE_EVENT(8, severity::LOW);
static const Event OVERWRITING_HEALTH = MAKE_EVENT(9, SEVERITY::LOW); //!< Assembly overwrites health information of children to keep satellite alive. static const Event OVERWRITING_HEALTH = MAKE_EVENT(9, severity::LOW); //!< Assembly overwrites health information of children to keep satellite alive.
static const Event TRYING_RECOVERY = MAKE_EVENT(10, SEVERITY::MEDIUM); //!< Someone starts a recovery of a component (typically power-cycle). No parameters. static const Event TRYING_RECOVERY = MAKE_EVENT(10, severity::MEDIUM); //!< Someone starts a recovery of a component (typically power-cycle). No parameters.
static const Event RECOVERY_STEP = MAKE_EVENT(11, SEVERITY::MEDIUM); //!< Recovery is ongoing. Comes twice during recovery. P1: 0 for the first, 1 for the second event. P2: 0 static const Event RECOVERY_STEP = MAKE_EVENT(11, severity::MEDIUM); //!< Recovery is ongoing. Comes twice during recovery. P1: 0 for the first, 1 for the second event. P2: 0
static const Event RECOVERY_DONE = MAKE_EVENT(12, SEVERITY::MEDIUM); //!< Recovery was completed. Not necessarily successful. No parameters. static const Event RECOVERY_DONE = MAKE_EVENT(12, severity::MEDIUM); //!< Recovery was completed. Not necessarily successful. No parameters.
virtual ~HasHealthIF() { virtual ~HasHealthIF() {
} }

View File

@ -18,14 +18,14 @@ public:
static const ReturnValue_t INVALID_SUBMODE = MAKE_RETURN_CODE(0x04); static const ReturnValue_t INVALID_SUBMODE = MAKE_RETURN_CODE(0x04);
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYSTEM_MANAGER; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYSTEM_MANAGER;
static const Event CHANGING_MODE = MAKE_EVENT(0, SEVERITY::INFO); //!< An object announces changing the mode. p1: target mode. p2: target submode static const Event CHANGING_MODE = MAKE_EVENT(0, severity::INFO); //!< An object announces changing the mode. p1: target mode. p2: target submode
static const Event MODE_INFO = MAKE_EVENT(1, SEVERITY::INFO); //!< An Object announces its mode; parameter1 is mode, parameter2 is submode static const Event MODE_INFO = MAKE_EVENT(1, severity::INFO); //!< An Object announces its mode; parameter1 is mode, parameter2 is submode
static const Event FALLBACK_FAILED = MAKE_EVENT(2, SEVERITY::HIGH); static const Event FALLBACK_FAILED = MAKE_EVENT(2, severity::HIGH);
static const Event MODE_TRANSITION_FAILED = MAKE_EVENT(3, SEVERITY::LOW); static const Event MODE_TRANSITION_FAILED = MAKE_EVENT(3, severity::LOW);
static const Event CANT_KEEP_MODE = MAKE_EVENT(4, SEVERITY::HIGH); static const Event CANT_KEEP_MODE = MAKE_EVENT(4, severity::HIGH);
static const Event OBJECT_IN_INVALID_MODE = MAKE_EVENT(5, SEVERITY::LOW); //!< Indicates a bug or configuration failure: Object is in a mode it should never be in. static const Event OBJECT_IN_INVALID_MODE = MAKE_EVENT(5, severity::LOW); //!< Indicates a bug or configuration failure: Object is in a mode it should never be in.
static const Event FORCING_MODE = MAKE_EVENT(6, SEVERITY::MEDIUM); //!< The mode is changed, but for some reason, the change is forced, i.e. EXTERNAL_CONTROL ignored. p1: target mode. p2: target submode static const Event FORCING_MODE = MAKE_EVENT(6, severity::MEDIUM); //!< The mode is changed, but for some reason, the change is forced, i.e. EXTERNAL_CONTROL ignored. p1: target mode. p2: target submode
static const Event MODE_CMD_REJECTED = MAKE_EVENT(7, SEVERITY::LOW); //!< A mode command was rejected by the called object. Par1: called object id, Par2: return code. static const Event MODE_CMD_REJECTED = MAKE_EVENT(7, severity::LOW); //!< A mode command was rejected by the called object. Par1: called object id, Par2: return code.
static const Mode_t MODE_ON = 1; //!< The device is powered and ready to perform operations. In this mode, no commands are sent by the device handler itself, but direct commands van be commanded and will be interpreted static const Mode_t MODE_ON = 1; //!< The device is powered and ready to perform operations. In this mode, no commands are sent by the device handler itself, but direct commands van be commanded and will be interpreted
static const Mode_t MODE_OFF = 0; //!< The device is powered off. The only command accepted in this mode is a mode change to on. static const Mode_t MODE_OFF = 0; //!< The device is powered off. The only command accepted in this mode is a mode change to on.

View File

@ -15,10 +15,10 @@ public:
static const uint8_t LIMIT_TYPE_OBJECT = 128; static const uint8_t LIMIT_TYPE_OBJECT = 128;
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::FDIR_2; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::FDIR_2;
static const Event MONITOR_CHANGED_STATE = MAKE_EVENT(1, SEVERITY::LOW); static const Event MONITOR_CHANGED_STATE = MAKE_EVENT(1, severity::LOW);
static const Event VALUE_BELOW_LOW_LIMIT = MAKE_EVENT(2, SEVERITY::LOW); static const Event VALUE_BELOW_LOW_LIMIT = MAKE_EVENT(2, severity::LOW);
static const Event VALUE_ABOVE_HIGH_LIMIT = MAKE_EVENT(3, SEVERITY::LOW); static const Event VALUE_ABOVE_HIGH_LIMIT = MAKE_EVENT(3, severity::LOW);
static const Event VALUE_OUT_OF_RANGE = MAKE_EVENT(4, SEVERITY::LOW); static const Event VALUE_OUT_OF_RANGE = MAKE_EVENT(4, severity::LOW);
static const uint8_t INTERFACE_ID = CLASS_ID::LIMITS_IF; static const uint8_t INTERFACE_ID = CLASS_ID::LIMITS_IF;
static const ReturnValue_t UNCHECKED = MAKE_RETURN_CODE(1); static const ReturnValue_t UNCHECKED = MAKE_RETURN_CODE(1);

View File

@ -46,7 +46,7 @@ FixedTimeslotTask::FixedTimeslotTask(const char *name, TaskPriority setPriority,
<< GetLastError() << std::endl; << GetLastError() << std::endl;
} }
#elif defined(LINUX) #elif defined(LINUX)
// we can just copy and paste the code from linux here. // TODO: we can just copy and paste the code from the linux OSAL here.
#endif #endif
} }
@ -115,8 +115,9 @@ void FixedTimeslotTask::taskFunctionality() {
this->pollingSeqTable.executeAndAdvance(); this->pollingSeqTable.executeAndAdvance();
if (not pollingSeqTable.slotFollowsImmediately()) { if (not pollingSeqTable.slotFollowsImmediately()) {
// we need to wait before executing the current slot // we need to wait before executing the current slot
//this gives us the time to wait: // this gives us the time to wait:
interval = chron_ms(this->pollingSeqTable.getIntervalToPreviousSlotMs()); interval = chron_ms(
this->pollingSeqTable.getIntervalToPreviousSlotMs());
delayForInterval(&currentStartTime, interval); delayForInterval(&currentStartTime, interval);
//TODO deadline missed check //TODO deadline missed check
} }

View File

@ -74,7 +74,7 @@ protected:
//!< Typedef for the List of objects. //!< Typedef for the List of objects.
typedef std::vector<ExecutableObjectIF*> ObjectList; typedef std::vector<ExecutableObjectIF*> ObjectList;
std::thread mainThread; std::thread mainThread;
std::atomic<bool> terminateThread = false; std::atomic<bool> terminateThread { false };
//! Polling sequence table which contains the object to execute //! Polling sequence table which contains the object to execute
//! and information like the timeslots and the passed execution step. //! and information like the timeslots and the passed execution step.

View File

@ -4,21 +4,18 @@
Mutex::Mutex() {} Mutex::Mutex() {}
ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType, uint32_t timeoutMs) { ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType, uint32_t timeoutMs) {
if(timeoutMs == MutexIF::BLOCKING) { if(timeoutType == MutexIF::BLOCKING) {
mutex.lock(); mutex.lock();
locked = true;
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
else if(timeoutMs == MutexIF::POLLING) { else if(timeoutType == MutexIF::POLLING) {
if(mutex.try_lock()) { if(mutex.try_lock()) {
locked = true;
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
} }
else if(timeoutMs > MutexIF::POLLING){ else if(timeoutMs > MutexIF::POLLING){
auto chronoMs = std::chrono::milliseconds(timeoutMs); auto chronoMs = std::chrono::milliseconds(timeoutMs);
if(mutex.try_lock_for(chronoMs)) { if(mutex.try_lock_for(chronoMs)) {
locked = true;
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
} }
@ -26,11 +23,7 @@ ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType, uint32_t timeoutMs) {
} }
ReturnValue_t Mutex::unlockMutex() { ReturnValue_t Mutex::unlockMutex() {
if(not locked) {
return MutexIF::CURR_THREAD_DOES_NOT_OWN_MUTEX;
}
mutex.unlock(); mutex.unlock();
locked = false;
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }

View File

@ -22,7 +22,7 @@ public:
std::timed_mutex* getMutexHandle(); std::timed_mutex* getMutexHandle();
private: private:
bool locked = false; //bool locked = false;
std::timed_mutex mutex; std::timed_mutex mutex;
}; };

View File

@ -89,25 +89,26 @@ ReturnValue_t PeriodicTask::sleepFor(uint32_t ms) {
} }
void PeriodicTask::taskFunctionality() { void PeriodicTask::taskFunctionality() {
for (const auto& object: objectList) {
object->initializeAfterTaskCreation();
}
std::chrono::milliseconds periodChrono(static_cast<uint32_t>(period*1000)); std::chrono::milliseconds periodChrono(static_cast<uint32_t>(period*1000));
auto currentStartTime { auto currentStartTime {
std::chrono::duration_cast<std::chrono::milliseconds>( std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::system_clock::now().time_since_epoch()) std::chrono::system_clock::now().time_since_epoch())
}; };
auto nextStartTime{ currentStartTime }; auto nextStartTime { currentStartTime };
/* Enter the loop that defines the task behavior. */ /* Enter the loop that defines the task behavior. */
for (;;) { for (;;) {
if(terminateThread.load()) { if(terminateThread.load()) {
break; break;
} }
for (ObjectList::iterator it = objectList.begin(); for (const auto& object: objectList) {
it != objectList.end(); ++it) { object->performOperation();
(*it)->performOperation();
} }
if(not delayForInterval(&currentStartTime, periodChrono)) { if(not delayForInterval(&currentStartTime, periodChrono)) {
sif::warning << "PeriodicTask: " << taskName <<
" missed deadline!\n" << std::flush;
if(deadlineMissedFunc != nullptr) { if(deadlineMissedFunc != nullptr) {
this->deadlineMissedFunc(); this->deadlineMissedFunc();
} }
@ -121,6 +122,7 @@ ReturnValue_t PeriodicTask::addComponent(object_id_t object) {
if (newObject == nullptr) { if (newObject == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
newObject->setTaskIF(this);
objectList.push_back(newObject); objectList.push_back(newObject);
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }

View File

@ -69,7 +69,7 @@ protected:
//!< Typedef for the List of objects. //!< Typedef for the List of objects.
typedef std::vector<ExecutableObjectIF*> ObjectList; typedef std::vector<ExecutableObjectIF*> ObjectList;
std::thread mainThread; std::thread mainThread;
std::atomic<bool> terminateThread = false; std::atomic<bool> terminateThread { false };
/** /**
* @brief This attribute holds a list of objects to be executed. * @brief This attribute holds a list of objects to be executed.

View File

@ -44,7 +44,7 @@ MessageQueueIF* QueueMapManager::getMessageQueue(
return queueIter->second; return queueIter->second;
} }
else { else {
sif::warning << "QueueMapManager::getQueueHandle: The ID" << sif::warning << "QueueMapManager::getQueueHandle: The ID " <<
messageQueueId << " does not exists in the map" << std::endl; messageQueueId << " does not exists in the map" << std::endl;
return nullptr; return nullptr;
} }

View File

@ -6,6 +6,7 @@ TmTcWinUdpBridge::TmTcWinUdpBridge(object_id_t objectId,
uint16_t serverPort, uint16_t clientPort): uint16_t serverPort, uint16_t clientPort):
TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) { TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
mutex = MutexFactory::instance()->createMutex(); mutex = MutexFactory::instance()->createMutex();
communicationLinkUp = false;
// Initiates Winsock DLL. // Initiates Winsock DLL.
WSAData wsaData; WSAData wsaData;
@ -90,7 +91,6 @@ ReturnValue_t TmTcWinUdpBridge::sendTm(const uint8_t *data, size_t dataLen) {
// sif::debug << "TmTcUnixUdpBridge::sendTm: " << bytesSent << " bytes were" // sif::debug << "TmTcUnixUdpBridge::sendTm: " << bytesSent << " bytes were"
// " sent." << std::endl; // " sent." << std::endl;
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
return HasReturnvaluesIF::RETURN_OK;
} }
void TmTcWinUdpBridge::checkAndSetClientAddress(sockaddr_in newAddress) { void TmTcWinUdpBridge::checkAndSetClientAddress(sockaddr_in newAddress) {
@ -101,6 +101,7 @@ void TmTcWinUdpBridge::checkAndSetClientAddress(sockaddr_in newAddress) {
// &newAddress.sin_addr.s_addr, ipAddress, 15) << std::endl; // &newAddress.sin_addr.s_addr, ipAddress, 15) << std::endl;
// sif::debug << "IP Address Old: " << inet_ntop(AF_INET, // sif::debug << "IP Address Old: " << inet_ntop(AF_INET,
// &clientAddress.sin_addr.s_addr, ipAddress, 15) << std::endl; // &clientAddress.sin_addr.s_addr, ipAddress, 15) << std::endl;
registerCommConnect();
// Set new IP address if it has changed. // Set new IP address if it has changed.
if(clientAddress.sin_addr.s_addr != newAddress.sin_addr.s_addr) { if(clientAddress.sin_addr.s_addr != newAddress.sin_addr.s_addr) {
@ -114,7 +115,7 @@ void TmTcWinUdpBridge::handleSocketError() {
switch(errCode) { switch(errCode) {
case(WSANOTINITIALISED): { case(WSANOTINITIALISED): {
sif::info << "TmTcWinUdpBridge::handleSocketError: WSANOTINITIALISED: " sif::info << "TmTcWinUdpBridge::handleSocketError: WSANOTINITIALISED: "
<< "WSAStartup(...) call " << "necessary" << std::endl; << "WSAStartup(...) call necessary" << std::endl;
break; break;
} }
default: { default: {
@ -154,11 +155,11 @@ void TmTcWinUdpBridge::handleSendError() {
switch(errCode) { switch(errCode) {
case(WSANOTINITIALISED): { case(WSANOTINITIALISED): {
sif::info << "TmTcWinUdpBridge::handleSendError: WSANOTINITIALISED: " sif::info << "TmTcWinUdpBridge::handleSendError: WSANOTINITIALISED: "
<< "WSAStartup(...) call " << "necessary" << std::endl; << "WSAStartup(...) call necessary" << std::endl;
break; break;
} }
case(WSAEADDRNOTAVAIL): { case(WSAEADDRNOTAVAIL): {
sif::info << "TmTcWinUdpBridge::handleReadError: WSAEADDRNOTAVAIL: " sif::info << "TmTcWinUdpBridge::handleSendError: WSAEADDRNOTAVAIL: "
<< "Check target address. " << std::endl; << "Check target address. " << std::endl;
break; break;
} }

View File

@ -32,10 +32,10 @@ public:
}; };
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PCDU_1; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PCDU_1;
static const Event FUSE_CURRENT_HIGH = MAKE_EVENT(1, SEVERITY::LOW); //!< PSS detected that current on a fuse is totally out of bounds. static const Event FUSE_CURRENT_HIGH = MAKE_EVENT(1, severity::LOW); //!< PSS detected that current on a fuse is totally out of bounds.
static const Event FUSE_WENT_OFF = MAKE_EVENT(2, SEVERITY::LOW); //!< PSS detected a fuse that went off. static const Event FUSE_WENT_OFF = MAKE_EVENT(2, severity::LOW); //!< PSS detected a fuse that went off.
static const Event POWER_ABOVE_HIGH_LIMIT = MAKE_EVENT(4, SEVERITY::LOW); //!< PSS detected a fuse that violates its limits. static const Event POWER_ABOVE_HIGH_LIMIT = MAKE_EVENT(4, severity::LOW); //!< PSS detected a fuse that violates its limits.
static const Event POWER_BELOW_LOW_LIMIT = MAKE_EVENT(5, SEVERITY::LOW); //!< PSS detected a fuse that violates its limits. static const Event POWER_BELOW_LOW_LIMIT = MAKE_EVENT(5, severity::LOW); //!< PSS detected a fuse that violates its limits.
typedef std::list<PowerComponentIF*> DeviceList; typedef std::list<PowerComponentIF*> DeviceList;
Fuse(object_id_t fuseObjectId, uint8_t fuseId, VariableIds ids, Fuse(object_id_t fuseObjectId, uint8_t fuseId, VariableIds ids,

View File

@ -32,7 +32,7 @@ public:
static const ReturnValue_t FUSE_ON = MAKE_RETURN_CODE(3); static const ReturnValue_t FUSE_ON = MAKE_RETURN_CODE(3);
static const ReturnValue_t FUSE_OFF = MAKE_RETURN_CODE(4); static const ReturnValue_t FUSE_OFF = MAKE_RETURN_CODE(4);
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PCDU_2; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PCDU_2;
static const Event SWITCH_WENT_OFF = MAKE_EVENT(0, SEVERITY::LOW); //!< Someone detected that a switch went off which shouldn't. Severity: Low, Parameter1: switchId1, Parameter2: switchId2 static const Event SWITCH_WENT_OFF = MAKE_EVENT(0, severity::LOW); //!< Someone detected that a switch went off which shouldn't. Severity: Low, Parameter1: switchId1, Parameter2: switchId2
/** /**
* send a direct command to the Power Unit to enable/disable the specified switch. * send a direct command to the Power Unit to enable/disable the specified switch.
* *

View File

@ -21,7 +21,7 @@ class Service17Test: public PusServiceBase {
public: public:
// Custom events which can be triggered // Custom events which can be triggered
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PUS_SERVICE_17; static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PUS_SERVICE_17;
static constexpr Event TEST = MAKE_EVENT(0, SEVERITY::INFO); static constexpr Event TEST = MAKE_EVENT(0, severity::INFO);
enum Subservice: uint8_t { enum Subservice: uint8_t {
//! [EXPORT] : [COMMAND] Perform connection test //! [EXPORT] : [COMMAND] Perform connection test

View File

@ -7,8 +7,8 @@ class Service9TimeManagement: public PusServiceBase {
public: public:
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PUS_SERVICE_9; static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PUS_SERVICE_9;
static constexpr Event CLOCK_SET = MAKE_EVENT(0, SEVERITY::INFO); //!< Clock has been set. P1: New Uptime. P2: Old Uptime static constexpr Event CLOCK_SET = MAKE_EVENT(0, severity::INFO); //!< Clock has been set. P1: New Uptime. P2: Old Uptime
static constexpr Event CLOCK_SET_FAILURE = MAKE_EVENT(1, SEVERITY::LOW); //!< Clock could not be set. P1: Returncode. static constexpr Event CLOCK_SET_FAILURE = MAKE_EVENT(1, severity::LOW); //!< Clock could not be set. P1: Returncode.
static constexpr uint8_t CLASS_ID = CLASS_ID::PUS_SERVICE_9; static constexpr uint8_t CLASS_ID = CLASS_ID::PUS_SERVICE_9;

View File

@ -37,8 +37,8 @@ public:
static const ReturnValue_t POOL_TOO_LARGE = MAKE_RETURN_CODE(6); //!< Pool size too large on initialization. static const ReturnValue_t POOL_TOO_LARGE = MAKE_RETURN_CODE(6); //!< Pool size too large on initialization.
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::OBSW; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::OBSW;
static const Event GET_DATA_FAILED = MAKE_EVENT(0, SEVERITY::LOW); static const Event GET_DATA_FAILED = MAKE_EVENT(0, severity::LOW);
static const Event STORE_DATA_FAILED = MAKE_EVENT(1, SEVERITY::LOW); static const Event STORE_DATA_FAILED = MAKE_EVENT(1, severity::LOW);
static const uint32_t INVALID_ADDRESS = 0xFFFFFFFF; //!< Indicates an invalid (i.e unused) storage address. static const uint32_t INVALID_ADDRESS = 0xFFFFFFFF; //!< Indicates an invalid (i.e unused) storage address.
/** /**

View File

@ -17,9 +17,9 @@ class AbstractTemperatureSensor: public HasHealthIF,
public: public:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::T_SENSORS; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::T_SENSORS;
static const Event TEMP_SENSOR_HIGH = MAKE_EVENT(0, SEVERITY::LOW); static const Event TEMP_SENSOR_HIGH = MAKE_EVENT(0, severity::LOW);
static const Event TEMP_SENSOR_LOW = MAKE_EVENT(1, SEVERITY::LOW); static const Event TEMP_SENSOR_LOW = MAKE_EVENT(1, severity::LOW);
static const Event TEMP_SENSOR_GRADIENT = MAKE_EVENT(2, SEVERITY::LOW); static const Event TEMP_SENSOR_GRADIENT = MAKE_EVENT(2, severity::LOW);
static constexpr float ZERO_KELVIN_C = -273.15; static constexpr float ZERO_KELVIN_C = -273.15;
AbstractTemperatureSensor(object_id_t setObjectid, AbstractTemperatureSensor(object_id_t setObjectid,

View File

@ -14,11 +14,11 @@ class Heater: public HealthDevice, public ReceivesParameterMessagesIF {
public: public:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::HEATER; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::HEATER;
static const Event HEATER_ON = MAKE_EVENT(0, SEVERITY::INFO); static const Event HEATER_ON = MAKE_EVENT(0, severity::INFO);
static const Event HEATER_OFF = MAKE_EVENT(1, SEVERITY::INFO); static const Event HEATER_OFF = MAKE_EVENT(1, severity::INFO);
static const Event HEATER_TIMEOUT = MAKE_EVENT(2, SEVERITY::LOW); static const Event HEATER_TIMEOUT = MAKE_EVENT(2, severity::LOW);
static const Event HEATER_STAYED_ON = MAKE_EVENT(3, SEVERITY::LOW); static const Event HEATER_STAYED_ON = MAKE_EVENT(3, severity::LOW);
static const Event HEATER_STAYED_OFF = MAKE_EVENT(4, SEVERITY::LOW); static const Event HEATER_STAYED_OFF = MAKE_EVENT(4, severity::LOW);
Heater(uint32_t objectId, uint8_t switch0, uint8_t switch1); Heater(uint32_t objectId, uint8_t switch0, uint8_t switch1);
virtual ~Heater(); virtual ~Heater();

View File

@ -10,11 +10,11 @@ class ThermalComponentIF : public HasParametersIF {
public: public:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TCS_1; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TCS_1;
static const Event COMPONENT_TEMP_LOW = MAKE_EVENT(1, SEVERITY::LOW); static const Event COMPONENT_TEMP_LOW = MAKE_EVENT(1, severity::LOW);
static const Event COMPONENT_TEMP_HIGH = MAKE_EVENT(2, SEVERITY::LOW); static const Event COMPONENT_TEMP_HIGH = MAKE_EVENT(2, severity::LOW);
static const Event COMPONENT_TEMP_OOL_LOW = MAKE_EVENT(3, SEVERITY::LOW); static const Event COMPONENT_TEMP_OOL_LOW = MAKE_EVENT(3, severity::LOW);
static const Event COMPONENT_TEMP_OOL_HIGH = MAKE_EVENT(4, SEVERITY::LOW); static const Event COMPONENT_TEMP_OOL_HIGH = MAKE_EVENT(4, severity::LOW);
static const Event TEMP_NOT_IN_OP_RANGE = MAKE_EVENT(5, SEVERITY::LOW); //!< Is thrown when a device should start-up, but the temperature is out of OP range. P1: thermalState of the component, P2: 0 static const Event TEMP_NOT_IN_OP_RANGE = MAKE_EVENT(5, severity::LOW); //!< Is thrown when a device should start-up, but the temperature is out of OP range. P1: thermalState of the component, P2: 0
static const uint8_t INTERFACE_ID = CLASS_ID::THERMAL_COMPONENT_IF; static const uint8_t INTERFACE_ID = CLASS_ID::THERMAL_COMPONENT_IF;
static const ReturnValue_t INVALID_TARGET_STATE = MAKE_RETURN_CODE(1); static const ReturnValue_t INVALID_TARGET_STATE = MAKE_RETURN_CODE(1);

View File

@ -31,22 +31,22 @@ public:
static const ReturnValue_t INVALID_REQUEST = MAKE_RETURN_CODE(15); static const ReturnValue_t INVALID_REQUEST = MAKE_RETURN_CODE(15);
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::MEMORY; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::MEMORY;
static const Event STORE_SEND_WRITE_FAILED = MAKE_EVENT(0, SEVERITY::LOW); //!< Initiating sending data to store failed. Low, par1: returnCode, par2: integer (debug info) static const Event STORE_SEND_WRITE_FAILED = MAKE_EVENT(0, severity::LOW); //!< Initiating sending data to store failed. Low, par1: returnCode, par2: integer (debug info)
static const Event STORE_WRITE_FAILED = MAKE_EVENT(1, SEVERITY::LOW); //!< Data was sent, but writing failed. Low, par1: returnCode, par2: 0 static const Event STORE_WRITE_FAILED = MAKE_EVENT(1, severity::LOW); //!< Data was sent, but writing failed. Low, par1: returnCode, par2: 0
static const Event STORE_SEND_READ_FAILED = MAKE_EVENT(2, SEVERITY::LOW); //!< Initiating reading data from store failed. Low, par1: returnCode, par2: 0 static const Event STORE_SEND_READ_FAILED = MAKE_EVENT(2, severity::LOW); //!< Initiating reading data from store failed. Low, par1: returnCode, par2: 0
static const Event STORE_READ_FAILED = MAKE_EVENT(3, SEVERITY::LOW); //!< Data was requested, but access failed. Low, par1: returnCode, par2: 0 static const Event STORE_READ_FAILED = MAKE_EVENT(3, severity::LOW); //!< Data was requested, but access failed. Low, par1: returnCode, par2: 0
static const Event UNEXPECTED_MSG = MAKE_EVENT(4, SEVERITY::LOW); //!< An unexpected TM packet or data message occurred. Low, par1: 0, par2: integer (debug info) static const Event UNEXPECTED_MSG = MAKE_EVENT(4, severity::LOW); //!< An unexpected TM packet or data message occurred. Low, par1: 0, par2: integer (debug info)
static const Event STORING_FAILED = MAKE_EVENT(5, SEVERITY::LOW); //!< Storing data failed. May simply be a full store. Low, par1: returnCode, par2: integer (sequence count of failed packet). static const Event STORING_FAILED = MAKE_EVENT(5, severity::LOW); //!< Storing data failed. May simply be a full store. Low, par1: returnCode, par2: integer (sequence count of failed packet).
static const Event TM_DUMP_FAILED = MAKE_EVENT(6, SEVERITY::LOW); //!< Dumping retrieved data failed. Low, par1: returnCode, par2: integer (sequence count of failed packet). static const Event TM_DUMP_FAILED = MAKE_EVENT(6, severity::LOW); //!< Dumping retrieved data failed. Low, par1: returnCode, par2: integer (sequence count of failed packet).
static const Event STORE_INIT_FAILED = MAKE_EVENT(7, SEVERITY::LOW); //!< Corrupted init data or read error. Low, par1: returnCode, par2: integer (debug info) static const Event STORE_INIT_FAILED = MAKE_EVENT(7, severity::LOW); //!< Corrupted init data or read error. Low, par1: returnCode, par2: integer (debug info)
static const Event STORE_INIT_EMPTY = MAKE_EVENT(8, SEVERITY::INFO); //!< Store was not initialized. Starts empty. Info, parameters both zero. static const Event STORE_INIT_EMPTY = MAKE_EVENT(8, severity::INFO); //!< Store was not initialized. Starts empty. Info, parameters both zero.
static const Event STORE_CONTENT_CORRUPTED = MAKE_EVENT(9, SEVERITY::LOW); //!< Data was read out, but it is inconsistent. Low par1: Memory address of corruption, par2: integer (debug info) static const Event STORE_CONTENT_CORRUPTED = MAKE_EVENT(9, severity::LOW); //!< Data was read out, but it is inconsistent. Low par1: Memory address of corruption, par2: integer (debug info)
static const Event STORE_INITIALIZE = MAKE_EVENT(10, SEVERITY::INFO); //!< Info event indicating the store will be initialized, either at boot or after IOB switch. Info. pars: 0 static const Event STORE_INITIALIZE = MAKE_EVENT(10, severity::INFO); //!< Info event indicating the store will be initialized, either at boot or after IOB switch. Info. pars: 0
static const Event INIT_DONE = MAKE_EVENT(11, SEVERITY::INFO); //!< Info event indicating the store was successfully initialized, either at boot or after IOB switch. Info. pars: 0 static const Event INIT_DONE = MAKE_EVENT(11, severity::INFO); //!< Info event indicating the store was successfully initialized, either at boot or after IOB switch. Info. pars: 0
static const Event DUMP_FINISHED = MAKE_EVENT(12, SEVERITY::INFO); //!< Info event indicating that dumping finished successfully. par1: Number of dumped packets. par2: APID/SSC (16bits each) static const Event DUMP_FINISHED = MAKE_EVENT(12, severity::INFO); //!< Info event indicating that dumping finished successfully. par1: Number of dumped packets. par2: APID/SSC (16bits each)
static const Event DELETION_FINISHED = MAKE_EVENT(13, SEVERITY::INFO); //!< Info event indicating that deletion finished successfully. par1: Number of deleted packets. par2: APID/SSC (16bits each) static const Event DELETION_FINISHED = MAKE_EVENT(13, severity::INFO); //!< Info event indicating that deletion finished successfully. par1: Number of deleted packets. par2: APID/SSC (16bits each)
static const Event DELETION_FAILED = MAKE_EVENT(14, SEVERITY::LOW); //!< Info event indicating that something went wrong during deletion. pars: 0 static const Event DELETION_FAILED = MAKE_EVENT(14, severity::LOW); //!< Info event indicating that something went wrong during deletion. pars: 0
static const Event AUTO_CATALOGS_SENDING_FAILED = MAKE_EVENT(15, SEVERITY::INFO);//!< Info that the a auto catalog report failed static const Event AUTO_CATALOGS_SENDING_FAILED = MAKE_EVENT(15, severity::INFO);//!< Info that the a auto catalog report failed
virtual ~TmStoreBackendIF() {} virtual ~TmStoreBackendIF() {}
virtual ReturnValue_t performOperation(uint8_t opCode) = 0; virtual ReturnValue_t performOperation(uint8_t opCode) = 0;

View File

@ -1,8 +1,7 @@
#include "CatchDefinitions.h" #include "CatchDefinitions.h"
#include "CatchFactory.h"
#include <testcfg/cdatapool/dataPoolInit.h> #include <testcfg/cdatapool/dataPoolInit.h>
#include <testcfg/objects/Factory.h>
#ifdef GCOV #ifdef GCOV
#include <gcov.h> #include <gcov.h>

View File

@ -2,7 +2,7 @@
#define FRAMEWORK_TEST_UNITTESTCLASS_H_ #define FRAMEWORK_TEST_UNITTESTCLASS_H_
#include "UnittDefinitions.h" #include "UnittDefinitions.h"
#include <fsfw/returnvalues/HasReturnvaluesIF.h> #include "../../returnvalues/HasReturnvaluesIF.h"
/** /**
* @brief Can be used for internal testing, for example for hardware specific * @brief Can be used for internal testing, for example for hardware specific

View File

@ -1,4 +1,4 @@
#include <fsfw/unittest/internal/UnittDefinitions.h> #include "UnittDefinitions.h"
ReturnValue_t unitt::put_error(std::string errorId) { ReturnValue_t unitt::put_error(std::string errorId) {
sif::error << "Unit Tester error: Failed at test ID " sif::error << "Unit Tester error: Failed at test ID "

View File

@ -1,7 +1,8 @@
#include <fsfw/ipc/MessageQueueIF.h> #include "IntTestMq.h"
#include <fsfw/ipc/QueueFactory.h> #include "../UnittDefinitions.h"
#include <fsfw/unittest/internal/osal/IntTestMq.h>
#include <fsfw/unittest/internal/UnittDefinitions.h> #include "../../ipc/MessageQueueIF.h"
#include "../../ipc/QueueFactory.h"
#include <array> #include <array>

View File

@ -1,10 +1,10 @@
#include "IntTestMutex.h" #include "IntTestMutex.h"
#include <fsfw/ipc/MutexFactory.h> #include "../../ipc/MutexFactory.h"
#include <unittest/internal/UnittDefinitions.h> #include "../UnittDefinitions.h"
#if defined(hosted) #if defined(hosted)
#include <fsfw/osal/hosted/Mutex.h> #include "../../osal/hosted/Mutex.h"
#include <thread> #include <thread>
#include <future> #include <future>
#endif #endif
@ -20,7 +20,7 @@ void testmutex::testMutex() {
// timed_mutex from the C++ library specifies undefined behaviour if // timed_mutex from the C++ library specifies undefined behaviour if
// the timed mutex is locked twice from the same thread. // the timed mutex is locked twice from the same thread.
#if defined(hosted) #if defined(hosted)
// hold on, this actually worked ? :-D This calls the function from // This calls the function from
// another thread and stores the returnvalue in a future. // another thread and stores the returnvalue in a future.
auto future = std::async(&MutexIF::lockMutex, mutex, 1); auto future = std::async(&MutexIF::lockMutex, mutex, 1);
result = future.get(); result = future.get();

View File

@ -1,8 +1,9 @@
#include "IntTestSemaphore.h" #include "IntTestSemaphore.h"
#include <fsfw/tasks/SemaphoreFactory.h> #include "../UnittDefinitions.h"
#include <unittest/internal/UnittDefinitions.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h> #include "../../tasks/SemaphoreFactory.h"
#include <fsfw/timemanager/Stopwatch.h> #include "../../serviceinterface/ServiceInterfaceStream.h"
#include "../../timemanager/Stopwatch.h"
void testsemaph::testBinSemaph() { void testsemaph::testBinSemaph() {

View File

@ -1,8 +1,9 @@
#include "IntTestSerialization.h" #include "IntTestSerialization.h"
#include <fsfw/serialize/SerializeElement.h> #include "../UnittDefinitions.h"
#include <fsfw/serialize/SerialBufferAdapter.h> #include "../../serialize/SerializeElement.h"
#include <unittest/internal/UnittDefinitions.h> #include "../../serialize/SerialBufferAdapter.h"
#include <fsfw/serialize/SerializeIF.h> #include "../../serialize/SerializeIF.h"
#include <array> #include <array>
using retval = HasReturnvaluesIF; using retval = HasReturnvaluesIF;

View File

@ -1,6 +1,7 @@
#ifndef UNITTEST_INTERNAL_INTTESTSERIALIZATION_H_ #ifndef FSFW_UNITTEST_INTERNAL_INTTESTSERIALIZATION_H_
#define UNITTEST_INTERNAL_INTTESTSERIALIZATION_H_ #define FSFW_UNITTEST_INTERNAL_INTTESTSERIALIZATION_H_
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include "../../returnvalues/HasReturnvaluesIF.h"
#include <array> #include <array>
namespace testserialize { namespace testserialize {
@ -12,4 +13,4 @@ ReturnValue_t test_serial_buffer_adapter();
extern std::array<uint8_t, 512> test_array; extern std::array<uint8_t, 512> test_array;
} }
#endif /* UNITTEST_INTERNAL_INTTESTSERIALIZATION_H_ */ #endif /* FSFW_UNITTEST_INTERNAL_INTTESTSERIALIZATION_H_ */

View File

@ -0,0 +1,60 @@
#include "CatchFactory.h"
#include <fsfw/events/EventManager.h>
#include <fsfw/health/HealthTable.h>
#include <fsfw/internalError/InternalErrorReporter.h>
#include <fsfw/objectmanager/frameworkObjects.h>
#include <fsfw/storagemanager/PoolManager.h>
/**
* @brief Produces system objects.
* @details
* Build tasks by using SystemObject Interface (Interface).
* Header files of all tasks must be included
* Please note that an object has to implement the system object interface
* if the interface validity is checked or retrieved later by using the
* get<TargetInterface>(object_id) function from the ObjectManagerIF.
*
* Framework objects are created first.
*
* @ingroup init
*/
void Factory::produce(void) {
setStaticFrameworkObjectIds();
new EventManager(objects::EVENT_MANAGER);
new HealthTable(objects::HEALTH_TABLE);
//new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
{
static constexpr uint8_t NUMBER_OF_POOLS = 5;
const uint16_t element_sizes[NUMBER_OF_POOLS] = {16, 32, 64, 128, 1024};
const uint16_t n_elements[NUMBER_OF_POOLS] = {100, 50, 25, 15, 5};
new PoolManager<NUMBER_OF_POOLS>(objects::TC_STORE, element_sizes,
n_elements);
}
{
static constexpr uint8_t NUMBER_OF_POOLS = 5;
const uint16_t element_sizes[NUMBER_OF_POOLS] = {16, 32, 64, 128, 1024};
const uint16_t n_elements[NUMBER_OF_POOLS] = {100, 50, 25, 15, 5};
new PoolManager<NUMBER_OF_POOLS>(objects::TM_STORE, element_sizes,
n_elements);
}
{
static constexpr uint8_t NUMBER_OF_POOLS = 6;
const uint16_t element_sizes[NUMBER_OF_POOLS] = {32, 64, 512,
1024, 2048, 4096};
const uint16_t n_elements[NUMBER_OF_POOLS] = {200, 100, 50, 25, 15, 5};
new PoolManager<NUMBER_OF_POOLS>(objects::IPC_STORE, element_sizes,
n_elements);
}
}
void Factory::setStaticFrameworkObjectIds() {
}

View File

@ -1,34 +0,0 @@
#include "Factory.h"
#include <fsfw/events/EventManager.h>
#include <fsfw/health/HealthTable.h>
#include <fsfw/internalError/InternalErrorReporter.h>
#include <fsfw/objectmanager/frameworkObjects.h>
/**
* @brief Produces system objects.
* @details
* Build tasks by using SystemObject Interface (Interface).
* Header files of all tasks must be included
* Please note that an object has to implement the system object interface
* if the interface validity is checked or retrieved later by using the
* get<TargetInterface>(object_id) function from the ObjectManagerIF.
*
* Framework objects are created first.
*
* @ingroup init
*/
void Factory::produce(void) {
setStaticFrameworkObjectIds();
new EventManager(objects::EVENT_MANAGER);
new HealthTable(objects::HEALTH_TABLE);
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
}
void Factory::setStaticFrameworkObjectIds() {
}

View File

@ -3,6 +3,7 @@ CXXSRC += $(wildcard $(CURRENTPATH)/ipc/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/objects/*.cpp) CXXSRC += $(wildcard $(CURRENTPATH)/objects/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/pollingsequence/*.cpp) CXXSRC += $(wildcard $(CURRENTPATH)/pollingsequence/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/events/*.cpp) CXXSRC += $(wildcard $(CURRENTPATH)/events/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/*.cpp)
INCLUDES += $(CURRENTPATH) INCLUDES += $(CURRENTPATH)
INCLUDES += $(CURRENTPATH)/objects INCLUDES += $(CURRENTPATH)/objects

View File

@ -1,106 +1,107 @@
//#include "TestActionHelper.h" #include "TestActionHelper.h"
//#include <fsfw/action/ActionHelper.h> #include <fsfw/action/ActionHelper.h>
//#include <fsfw/ipc/CommandMessage.h> #include <fsfw/ipc/CommandMessage.h>
//#include <catch2/catch.hpp> #include <catch2/catch.hpp>
//#include "../../core/CatchDefinitions.h" #include "../../core/CatchDefinitions.h"
//
//
//TEST_CASE( "Action Helper" , "[ActionHelper]") { TEST_CASE( "Action Helper" , "[ActionHelper]") {
// ActionHelperOwnerMockBase testDhMock; ActionHelperOwnerMockBase testDhMock;
// MessageQueueMockBase testMqMock; MessageQueueMockBase testMqMock;
// ActionHelper actionHelper = ActionHelper( ActionHelper actionHelper = ActionHelper(
// &testDhMock, dynamic_cast<MessageQueueIF*>(&testMqMock)); &testDhMock, dynamic_cast<MessageQueueIF*>(&testMqMock));
// CommandMessage actionMessage; CommandMessage actionMessage;
// ActionId_t testActionId = 777; ActionId_t testActionId = 777;
// std::array <uint8_t, 3> testParams {1, 2, 3}; std::array <uint8_t, 3> testParams {1, 2, 3};
// store_address_t paramAddress; store_address_t paramAddress;
// StorageManagerIF *ipcStore = tglob::getIpcStoreHandle(); StorageManagerIF *ipcStore = tglob::getIpcStoreHandle();
// ipcStore->addData(&paramAddress, testParams.data(), 3); REQUIRE(ipcStore != nullptr);
// REQUIRE(actionHelper.initialize() == retval::CATCH_OK); ipcStore->addData(&paramAddress, testParams.data(), 3);
// REQUIRE(actionHelper.initialize() == retval::CATCH_OK);
// SECTION ("Simple tests") {
// ActionMessage::setCommand(&actionMessage, testActionId, paramAddress); SECTION ("Simple tests") {
// CHECK(not testDhMock.executeActionCalled); ActionMessage::setCommand(&actionMessage, testActionId, paramAddress);
// REQUIRE(actionHelper.handleActionMessage(&actionMessage) == retval::CATCH_OK); CHECK(not testDhMock.executeActionCalled);
// CHECK(testDhMock.executeActionCalled); REQUIRE(actionHelper.handleActionMessage(&actionMessage) == retval::CATCH_OK);
// // No message is sent if everything is alright. CHECK(testDhMock.executeActionCalled);
// CHECK(not testMqMock.wasMessageSent()); // No message is sent if everything is alright.
// store_address_t invalidAddress; CHECK(not testMqMock.wasMessageSent());
// ActionMessage::setCommand(&actionMessage, testActionId, invalidAddress); store_address_t invalidAddress;
// actionHelper.handleActionMessage(&actionMessage); ActionMessage::setCommand(&actionMessage, testActionId, invalidAddress);
// CHECK(testMqMock.wasMessageSent()); actionHelper.handleActionMessage(&actionMessage);
// const uint8_t* ptr = nullptr; CHECK(testMqMock.wasMessageSent());
// size_t size = 0; const uint8_t* ptr = nullptr;
// REQUIRE(ipcStore->getData(paramAddress, &ptr, &size) == static_cast<uint32_t>(StorageManagerIF::DATA_DOES_NOT_EXIST)); size_t size = 0;
// REQUIRE(ptr == nullptr); REQUIRE(ipcStore->getData(paramAddress, &ptr, &size) == static_cast<uint32_t>(StorageManagerIF::DATA_DOES_NOT_EXIST));
// REQUIRE(size == 0); REQUIRE(ptr == nullptr);
// testDhMock.getBuffer(&ptr, &size); REQUIRE(size == 0);
// REQUIRE(size == 3); testDhMock.getBuffer(&ptr, &size);
// for(uint8_t i = 0; i<3;i++){ REQUIRE(size == 3);
// REQUIRE(ptr[i] == (i+1)); for(uint8_t i = 0; i<3;i++){
// } REQUIRE(ptr[i] == (i+1));
// testDhMock.clearBuffer(); }
// } testDhMock.clearBuffer();
// }
// SECTION("Handle failures"){
// actionMessage.setCommand(1234); SECTION("Handle failures"){
// REQUIRE(actionHelper.handleActionMessage(&actionMessage) == static_cast<uint32_t>(CommandMessage::UNKNOWN_COMMAND)); actionMessage.setCommand(1234);
// CHECK(not testMqMock.wasMessageSent()); REQUIRE(actionHelper.handleActionMessage(&actionMessage) == static_cast<uint32_t>(CommandMessage::UNKNOWN_COMMAND));
// uint16_t step = 5; CHECK(not testMqMock.wasMessageSent());
// ReturnValue_t status = 0x1234; uint16_t step = 5;
// actionHelper.step(step, testMqMock.getId(), testActionId, status); ReturnValue_t status = 0x1234;
// step += 1; actionHelper.step(step, testMqMock.getId(), testActionId, status);
// CHECK(testMqMock.wasMessageSent()); step += 1;
// CommandMessage testMessage; CHECK(testMqMock.wasMessageSent());
// REQUIRE(testMqMock.receiveMessage(&testMessage) == static_cast<uint32_t>(HasReturnvaluesIF::RETURN_OK)); CommandMessage testMessage;
// REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::STEP_FAILED)); REQUIRE(testMqMock.receiveMessage(&testMessage) == static_cast<uint32_t>(HasReturnvaluesIF::RETURN_OK));
// REQUIRE(testMessage.getParameter() == static_cast<uint32_t>(testActionId)); REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::STEP_FAILED));
// uint32_t parameter2 = ((uint32_t)step << 16) | (uint32_t)status; REQUIRE(testMessage.getParameter() == static_cast<uint32_t>(testActionId));
// REQUIRE(testMessage.getParameter2() == parameter2); uint32_t parameter2 = ((uint32_t)step << 16) | (uint32_t)status;
// REQUIRE(ActionMessage::getStep(&testMessage) == step); REQUIRE(testMessage.getParameter2() == parameter2);
// } REQUIRE(ActionMessage::getStep(&testMessage) == step);
// }
// SECTION("Handle finish"){
// CHECK(not testMqMock.wasMessageSent()); SECTION("Handle finish"){
// ReturnValue_t status = 0x9876; CHECK(not testMqMock.wasMessageSent());
// actionHelper.finish(testMqMock.getId(), testActionId, status); ReturnValue_t status = 0x9876;
// CHECK(testMqMock.wasMessageSent()); actionHelper.finish(testMqMock.getId(), testActionId, status);
// CommandMessage testMessage; CHECK(testMqMock.wasMessageSent());
// REQUIRE(testMqMock.receiveMessage(&testMessage) == static_cast<uint32_t>(HasReturnvaluesIF::RETURN_OK)); CommandMessage testMessage;
// REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::COMPLETION_FAILED)); REQUIRE(testMqMock.receiveMessage(&testMessage) == static_cast<uint32_t>(HasReturnvaluesIF::RETURN_OK));
// REQUIRE(ActionMessage::getActionId(&testMessage) == testActionId); REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::COMPLETION_FAILED));
// REQUIRE(ActionMessage::getReturnCode(&testMessage) == static_cast<uint32_t>(status)); REQUIRE(ActionMessage::getActionId(&testMessage) == testActionId);
// } REQUIRE(ActionMessage::getReturnCode(&testMessage) == static_cast<uint32_t>(status));
// }
// SECTION("Handle failed"){
// store_address_t toLongParamAddress = StorageManagerIF::INVALID_ADDRESS; SECTION("Handle failed"){
// std::array<uint8_t, 5> toLongData = {5, 4, 3, 2, 1}; store_address_t toLongParamAddress = StorageManagerIF::INVALID_ADDRESS;
// REQUIRE(ipcStore->addData(&toLongParamAddress, toLongData.data(), 5) == retval::CATCH_OK); std::array<uint8_t, 5> toLongData = {5, 4, 3, 2, 1};
// ActionMessage::setCommand(&actionMessage, testActionId, toLongParamAddress); REQUIRE(ipcStore->addData(&toLongParamAddress, toLongData.data(), 5) == retval::CATCH_OK);
// CHECK(not testDhMock.executeActionCalled); ActionMessage::setCommand(&actionMessage, testActionId, toLongParamAddress);
// REQUIRE(actionHelper.handleActionMessage(&actionMessage) == retval::CATCH_OK); CHECK(not testDhMock.executeActionCalled);
// REQUIRE(ipcStore->getData(toLongParamAddress).first == static_cast<uint32_t>(StorageManagerIF::DATA_DOES_NOT_EXIST)); REQUIRE(actionHelper.handleActionMessage(&actionMessage) == retval::CATCH_OK);
// CommandMessage testMessage; REQUIRE(ipcStore->getData(toLongParamAddress).first == static_cast<uint32_t>(StorageManagerIF::DATA_DOES_NOT_EXIST));
// REQUIRE(testMqMock.receiveMessage(&testMessage) == static_cast<uint32_t>(HasReturnvaluesIF::RETURN_OK)); CommandMessage testMessage;
// REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::STEP_FAILED)); REQUIRE(testMqMock.receiveMessage(&testMessage) == static_cast<uint32_t>(HasReturnvaluesIF::RETURN_OK));
// REQUIRE(ActionMessage::getReturnCode(&testMessage) == 0xAFFE); REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::STEP_FAILED));
// REQUIRE(ActionMessage::getStep(&testMessage) == 0); REQUIRE(ActionMessage::getReturnCode(&testMessage) == 0xAFFE);
// REQUIRE(ActionMessage::getActionId(&testMessage) == testActionId); REQUIRE(ActionMessage::getStep(&testMessage) == 0);
// } REQUIRE(ActionMessage::getActionId(&testMessage) == testActionId);
// }
// SECTION("Missing IPC Data"){
// ActionMessage::setCommand(&actionMessage, testActionId, StorageManagerIF::INVALID_ADDRESS); SECTION("Missing IPC Data"){
// CHECK(not testDhMock.executeActionCalled); ActionMessage::setCommand(&actionMessage, testActionId, StorageManagerIF::INVALID_ADDRESS);
// REQUIRE(actionHelper.handleActionMessage(&actionMessage) == retval::CATCH_OK); CHECK(not testDhMock.executeActionCalled);
// CommandMessage testMessage; REQUIRE(actionHelper.handleActionMessage(&actionMessage) == retval::CATCH_OK);
// REQUIRE(testMqMock.receiveMessage(&testMessage) == static_cast<uint32_t>(HasReturnvaluesIF::RETURN_OK)); CommandMessage testMessage;
// REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::STEP_FAILED)); REQUIRE(testMqMock.receiveMessage(&testMessage) == static_cast<uint32_t>(HasReturnvaluesIF::RETURN_OK));
// REQUIRE(ActionMessage::getReturnCode(&testMessage) == static_cast<uint32_t>(StorageManagerIF::ILLEGAL_STORAGE_ID)); REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::STEP_FAILED));
// REQUIRE(ActionMessage::getStep(&testMessage) == 0); REQUIRE(ActionMessage::getReturnCode(&testMessage) == static_cast<uint32_t>(StorageManagerIF::ILLEGAL_STORAGE_ID));
// } REQUIRE(ActionMessage::getStep(&testMessage) == 0);
// }
//
// SECTION("Data Reply"){
// SECTION("Data Reply"){
// }
//} }
}

View File

@ -1,131 +1,132 @@
//#ifndef UNITTEST_HOSTED_TESTACTIONHELPER_H_ #ifndef UNITTEST_HOSTED_TESTACTIONHELPER_H_
//#define UNITTEST_HOSTED_TESTACTIONHELPER_H_ #define UNITTEST_HOSTED_TESTACTIONHELPER_H_
//
//#include <fsfw/action/HasActionsIF.h> #include <fsfw/action/HasActionsIF.h>
//#include <fsfw/ipc/MessageQueueIF.h> #include <fsfw/ipc/MessageQueueIF.h>
//#include <fsfw/unittest/core/CatchDefinitions.h> #include <fsfw/unittest/core/CatchDefinitions.h>
//#include <cstring> #include <cstring>
//
//
//class ActionHelperOwnerMockBase: public HasActionsIF { class ActionHelperOwnerMockBase: public HasActionsIF {
//public: public:
// bool getCommandQueueCalled = false; bool getCommandQueueCalled = false;
// bool executeActionCalled = false; bool executeActionCalled = false;
// static const size_t MAX_SIZE = 3; static const size_t MAX_SIZE = 3;
// uint8_t buffer[MAX_SIZE] = {0, 0, 0}; uint8_t buffer[MAX_SIZE] = {0, 0, 0};
// size_t size = 0; size_t size = 0;
//
// MessageQueueId_t getCommandQueue() const override { MessageQueueId_t getCommandQueue() const override {
// return tconst::testQueueId; return tconst::testQueueId;
// } }
//
// 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 {
// executeActionCalled = true; executeActionCalled = true;
// if(size > MAX_SIZE){ if(size > MAX_SIZE){
// return 0xAFFE; return 0xAFFE;
// } }
// this->size = size; this->size = size;
// memcpy(buffer, data, size); memcpy(buffer, data, size);
// return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
// } }
//
// void clearBuffer(){ void clearBuffer(){
// this->size = 0; this->size = 0;
// for(size_t i = 0; i<MAX_SIZE; i++){ for(size_t i = 0; i<MAX_SIZE; i++){
// buffer[i] = 0; buffer[i] = 0;
// } }
// } }
//
// void getBuffer(const uint8_t** ptr, size_t* size){ void getBuffer(const uint8_t** ptr, size_t* size){
// if(size != nullptr){ if(size != nullptr){
// *size = this->size; *size = this->size;
// } }
// if(ptr != nullptr){ if(ptr != nullptr){
// *ptr = buffer; *ptr = buffer;
// } }
// } }
//}; };
//
//
//class MessageQueueMockBase: public MessageQueueIF { class MessageQueueMockBase: public MessageQueueIF {
//public: public:
// MessageQueueId_t myQueueId = 0; MessageQueueId_t myQueueId = 0;
// bool defaultDestSet = false; bool defaultDestSet = false;
// bool messageSent = false; bool messageSent = false;
//
//
//
// bool wasMessageSent() { bool wasMessageSent() {
// bool tempMessageSent = messageSent; bool tempMessageSent = messageSent;
// messageSent = false; messageSent = false;
// return tempMessageSent; return tempMessageSent;
// } }
//
// virtual ReturnValue_t reply( MessageQueueMessage* message ) { virtual ReturnValue_t reply( MessageQueueMessageIF* message ) {
// messageSent = true; messageSent = true;
// lastMessage = (*message); lastMessage = *(dynamic_cast<MessageQueueMessage*>(message));
// return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
// }; };
// virtual ReturnValue_t receiveMessage(MessageQueueMessage* message, virtual ReturnValue_t receiveMessage(MessageQueueMessageIF* message,
// MessageQueueId_t *receivedFrom) { MessageQueueId_t *receivedFrom) {
// (*message) = lastMessage; (*message) = lastMessage;
// lastMessage.clear(); lastMessage.clear();
// return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
// } }
// virtual ReturnValue_t receiveMessage(MessageQueueMessage* message) { virtual ReturnValue_t receiveMessage(MessageQueueMessageIF* message) {
// (*message) = lastMessage; memcpy(message->getBuffer(), lastMessage.getBuffer(),
// lastMessage.clear(); message->getMessageSize());
// return HasReturnvaluesIF::RETURN_OK; lastMessage.clear();
// } return HasReturnvaluesIF::RETURN_OK;
// virtual ReturnValue_t flush(uint32_t* count) { }
// return HasReturnvaluesIF::RETURN_OK; virtual ReturnValue_t flush(uint32_t* count) {
// } return HasReturnvaluesIF::RETURN_OK;
// virtual MessageQueueId_t getLastPartner() const { }
// return tconst::testQueueId; virtual MessageQueueId_t getLastPartner() const {
// } return tconst::testQueueId;
// virtual MessageQueueId_t getId() const { }
// return tconst::testQueueId; virtual MessageQueueId_t getId() const {
// } return tconst::testQueueId;
// virtual ReturnValue_t sendMessageFrom( MessageQueueId_t sendTo, }
// MessageQueueMessage* message, MessageQueueId_t sentFrom, virtual ReturnValue_t sendMessageFrom( MessageQueueId_t sendTo,
// bool ignoreFault = false ) { MessageQueueMessageIF* message, MessageQueueId_t sentFrom,
// messageSent = true; bool ignoreFault = false ) {
// lastMessage = (*message); messageSent = true;
// return HasReturnvaluesIF::RETURN_OK; lastMessage = *(dynamic_cast<MessageQueueMessage*>(message));
// } return HasReturnvaluesIF::RETURN_OK;
// virtual ReturnValue_t sendMessage( MessageQueueId_t sendTo, }
// MessageQueueMessage* message, bool ignoreFault = false ) override { virtual ReturnValue_t sendMessage( MessageQueueId_t sendTo,
// messageSent = true; MessageQueueMessageIF* message, bool ignoreFault = false ) override {
// lastMessage = (*message); messageSent = true;
// return HasReturnvaluesIF::RETURN_OK; lastMessage = *(dynamic_cast<MessageQueueMessage*>(message));
// } return HasReturnvaluesIF::RETURN_OK;
// virtual ReturnValue_t sendToDefaultFrom( MessageQueueMessage* message, }
// MessageQueueId_t sentFrom, bool ignoreFault = false ) { virtual ReturnValue_t sendToDefaultFrom( MessageQueueMessageIF* message,
// messageSent = true; MessageQueueId_t sentFrom, bool ignoreFault = false ) {
// lastMessage = (*message); messageSent = true;
// return HasReturnvaluesIF::RETURN_OK; lastMessage = *(dynamic_cast<MessageQueueMessage*>(message));
// } return HasReturnvaluesIF::RETURN_OK;
// virtual ReturnValue_t sendToDefault( MessageQueueMessage* message ) { }
// messageSent = true; virtual ReturnValue_t sendToDefault( MessageQueueMessageIF* message ) {
// lastMessage = (*message); messageSent = true;
// return HasReturnvaluesIF::RETURN_OK; lastMessage = *(dynamic_cast<MessageQueueMessage*>(message));
// } return HasReturnvaluesIF::RETURN_OK;
// virtual void setDefaultDestination(MessageQueueId_t defaultDestination) { }
// myQueueId = defaultDestination; virtual void setDefaultDestination(MessageQueueId_t defaultDestination) {
// defaultDestSet = true; myQueueId = defaultDestination;
// } defaultDestSet = true;
// }
// virtual MessageQueueId_t getDefaultDestination() const {
// return myQueueId; virtual MessageQueueId_t getDefaultDestination() const {
// } return myQueueId;
// virtual bool isDefaultDestinationSet() const { }
// return defaultDestSet; virtual bool isDefaultDestinationSet() const {
// } return defaultDestSet;
//private: }
// MessageQueueMessage lastMessage; private:
// MessageQueueMessage lastMessage;
//};
// };
//
//#endif /* UNITTEST_TESTFW_NEWTESTS_TESTACTIONHELPER_H_ */
#endif /* UNITTEST_TESTFW_NEWTESTS_TESTACTIONHELPER_H_ */

View File

@ -1,7 +1,7 @@
#include <fsfw/container/SimpleRingBuffer.h>
#include <catch2/catch.hpp>
#include "../../core/CatchDefinitions.h" #include "../../core/CatchDefinitions.h"
#include "../../container/SimpleRingBuffer.h"
#include <catch2/catch.hpp>
#include <cstring> #include <cstring>
TEST_CASE("Ring Buffer Test" , "[RingBufferTest]") { TEST_CASE("Ring Buffer Test" , "[RingBufferTest]") {

View File

@ -1,5 +1,6 @@
#include <fsfw/container/ArrayList.h> #include "../../container/ArrayList.h"
#include <fsfw/returnvalues/HasReturnvaluesIF.h> #include "../../returnvalues/HasReturnvaluesIF.h"
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include "../../core/CatchDefinitions.h" #include "../../core/CatchDefinitions.h"

View File

@ -1,7 +1,7 @@
#include <fsfw/container/DynamicFIFO.h> #include "../../container/DynamicFIFO.h"
#include <fsfw/container/FIFO.h> #include "../../container/FIFO.h"
#include <fsfw/returnvalues/HasReturnvaluesIF.h> #include "../../returnvalues/HasReturnvaluesIF.h"
#include <catch.hpp> #include <catch.hpp>
#include <CatchDefinitions.h> #include <CatchDefinitions.h>

View File

@ -1,7 +1,7 @@
#include <fsfw/container/DynamicFIFO.h> #include "../../container/DynamicFIFO.h"
#include <fsfw/container/FIFO.h> #include "../../container/FIFO.h"
#include <fsfw/returnvalues/HasReturnvaluesIF.h> #include "../../returnvalues/HasReturnvaluesIF.h"
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include "../../core/CatchDefinitions.h" #include "../../core/CatchDefinitions.h"

View File

@ -1,7 +1,7 @@
#include "../../core/CatchDefinitions.h" #include "../../core/CatchDefinitions.h"
#include <fsfw/container/FixedArrayList.h> #include "../../container/FixedArrayList.h"
#include <fsfw/returnvalues/HasReturnvaluesIF.h> #include "../../returnvalues/HasReturnvaluesIF.h"
#include <catch2/catch.hpp> #include <catch2/catch.hpp>

View File

@ -1,5 +1,5 @@
#include <fsfw/container/FixedMap.h> #include "../../container/FixedMap.h"
#include <fsfw/returnvalues/HasReturnvaluesIF.h> #include "../../returnvalues/HasReturnvaluesIF.h"
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include "../../core/CatchDefinitions.h" #include "../../core/CatchDefinitions.h"

View File

@ -1,5 +1,5 @@
#include <fsfw/container/FixedOrderedMultimap.h> #include "../../container/FixedOrderedMultimap.h"
#include <fsfw/returnvalues/HasReturnvaluesIF.h> #include "../../returnvalues/HasReturnvaluesIF.h"
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include "../../core/CatchDefinitions.h" #include "../../core/CatchDefinitions.h"

View File

@ -1,8 +1,8 @@
#include <fsfw/ipc/MessageQueueIF.h> #include "../../ipc/MessageQueueIF.h"
#include <fsfw/ipc/QueueFactory.h> #include "../../ipc/QueueFactory.h"
#include "catch.hpp" #include <catch.hpp>
#include <array> #include <array>
#include "core/CatchDefinitions.h" #include "../../core/CatchDefinitions.h"
TEST_CASE("MessageQueue Basic Test","[TestMq]") { TEST_CASE("MessageQueue Basic Test","[TestMq]") {
MessageQueueIF* testSenderMq = MessageQueueIF* testSenderMq =

View File

@ -1,4 +1,4 @@
#include <fsfw/serialize/SerialBufferAdapter.h> #include "../../serialize/SerialBufferAdapter.h"
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include "../../core/CatchDefinitions.h" #include "../../core/CatchDefinitions.h"

View File

@ -1,8 +1,9 @@
#include <fsfw/globalfunctions/arrayprinter.h> #include "TestSerialLinkedPacket.h"
#include "../../core/CatchDefinitions.h"
#include "../../globalfunctions/arrayprinter.h"
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include "../../core/CatchDefinitions.h"
#include "TestSerialLinkedPacket.h"
TEST_CASE("Serial Linked Packet" , "[SerLinkPacket]") { TEST_CASE("Serial Linked Packet" , "[SerLinkPacket]") {

View File

@ -1,4 +1,4 @@
#include <fsfw/serialize/SerializeAdapter.h> #include "../../serialize/SerializeAdapter.h"
#include "catch.hpp" #include "catch.hpp"
#include <array> #include <array>