Merge remote-tracking branch 'upstream/mueller/master' into mueller/master

This commit is contained in:
Robin Müller 2021-08-03 16:32:39 +02:00
commit ce0f30f685
155 changed files with 293 additions and 659 deletions

View File

@ -10,6 +10,7 @@ endif()
option(FSFW_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON) option(FSFW_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON)
# Options to exclude parts of the FSFW from compilation. # Options to exclude parts of the FSFW from compilation.
option(FSFW_ADD_INTERNAL_TESTS "Add internal unit tests" ON) option(FSFW_ADD_INTERNAL_TESTS "Add internal unit tests" ON)
option(FSFW_ADD_HAL "Add Hardware Abstraction Layer" ON)
# Optional sources # Optional sources
option(FSFW_ADD_PUS "Compile with PUS sources" ON) option(FSFW_ADD_PUS "Compile with PUS sources" ON)
@ -21,7 +22,7 @@ option(FSFW_ADD_COORDINATES "Compile with coordinate components" OFF)
option(FSFW_ADD_TMSTORAGE "Compile with tm storage components" OFF) option(FSFW_ADD_TMSTORAGE "Compile with tm storage components" OFF)
# Contrib sources # Contrib sources
option(FSFW_ADD_SPG4_PROPAGATOR "Add SPG4 propagator code" OFF) option(FSFW_ADD_SGP4_PROPAGATOR "Add SGP4 propagator code" OFF)
set(LIB_FSFW_NAME fsfw) set(LIB_FSFW_NAME fsfw)
add_library(${LIB_FSFW_NAME}) add_library(${LIB_FSFW_NAME})
@ -94,7 +95,9 @@ message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system.")
add_subdirectory(src) add_subdirectory(src)
add_subdirectory(tests) add_subdirectory(tests)
add_subdirectory(hal) if(FSFW_ADD_HAL)
add_subdirectory(hal)
endif()
add_subdirectory(contrib) add_subdirectory(contrib)
# The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it. # The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it.

View File

@ -1,11 +1,9 @@
if(FSFW_ADD_SPG4_PROPAGATOR) target_include_directories(${LIB_FSFW_NAME} PRIVATE
target_sources(${LIB_FSFW_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
sgp4/sgp4unit.cpp )
)
target_include_directories(${LIB_FSFW_NAME} PRIVATE target_include_directories(${LIB_FSFW_NAME} INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/sgp4 ${CMAKE_CURRENT_SOURCE_DIR}
) )
target_include_directories(${LIB_FSFW_NAME} INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/sgp4 add_subdirectory(fsfw_contrib)
)
endif()

View File

@ -0,0 +1,11 @@
if(FSFW_ADD_SGP4_PROPAGATOR)
target_sources(${LIB_FSFW_NAME} PRIVATE
sgp4/sgp4unit.cpp
)
target_include_directories(${LIB_FSFW_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/sgp4
)
target_include_directories(${LIB_FSFW_NAME} INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/sgp4
)
endif()

View File

@ -6,4 +6,4 @@ target_include_directories(${LIB_FSFW_NAME} INTERFACE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
) )
add_subdirectory(fsfw) add_subdirectory(fsfw_hal)

View File

@ -1 +0,0 @@
add_subdirectory(hal)

View File

@ -1,4 +1,4 @@
#include "fsfw/hal/common/gpio/GpioCookie.h" #include "fsfw_hal/common/gpio/GpioCookie.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
GpioCookie::GpioCookie() { GpioCookie::GpioCookie() {

View File

@ -1,4 +1,4 @@
#include "fsfw/hal/devicehandlers/GyroL3GD20Handler.h" #include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
#include "fsfw/datapool/PoolReadGuard.h" #include "fsfw/datapool/PoolReadGuard.h"

View File

@ -1,14 +1,14 @@
#ifndef MISSION_DEVICES_GYROL3GD20HANDLER_H_ #ifndef MISSION_DEVICES_GYROL3GD20HANDLER_H_
#define MISSION_DEVICES_GYROL3GD20HANDLER_H_ #define MISSION_DEVICES_GYROL3GD20HANDLER_H_
#include "OBSWConfig.h" #include "fsfw/FSFW.h"
#include "devicedefinitions/GyroL3GD20Definitions.h" #include "devicedefinitions/GyroL3GD20Definitions.h"
#include <fsfw/devicehandlers/DeviceHandlerBase.h> #include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <fsfw/globalfunctions/PeriodicOperationDivider.h> #include <fsfw/globalfunctions/PeriodicOperationDivider.h>
#ifndef FSFW_HAL_L3GD20_GYRO_DEBUG #ifndef FSFW_HAL_L3GD20_GYRO_DEBUG
#define FSFW_HAL_L3GD20_GYRO_DEBUG 1 #define FSFW_HAL_L3GD20_GYRO_DEBUG 0
#endif /* FSFW_HAL_L3GD20_GYRO_DEBUG */ #endif /* FSFW_HAL_L3GD20_GYRO_DEBUG */
/** /**

View File

@ -1,4 +1,4 @@
#include "fsfw/hal/linux/UnixFileGuard.h" #include "fsfw_hal/linux/UnixFileGuard.h"
UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags, UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags,
std::string diagnosticPrefix): std::string diagnosticPrefix):

View File

@ -1,6 +1,6 @@
#include "fsfw/hal/linux/gpio/LinuxLibgpioIF.h" #include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
#include "fsfw/hal/common/gpio/gpioDefinitions.h" #include "fsfw_hal/common/gpio/gpioDefinitions.h"
#include "fsfw/hal/common/gpio/GpioCookie.h" #include "fsfw_hal/common/gpio/GpioCookie.h"
#include <fsfw/serviceinterface/ServiceInterface.h> #include <fsfw/serviceinterface/ServiceInterface.h>

View File

@ -1,6 +1,6 @@
#include "fsfw/hal/linux/i2c/I2cComIF.h" #include "fsfw_hal/linux/i2c/I2cComIF.h"
#include "fsfw/hal/linux/utility.h" #include "fsfw_hal/linux/utility.h"
#include "fsfw/hal/linux/UnixFileGuard.h" #include "fsfw_hal/linux/UnixFileGuard.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"

View File

@ -1,4 +1,4 @@
#include "fsfw/hal/linux/i2c/I2cCookie.h" #include "fsfw_hal/linux/i2c/I2cCookie.h"
I2cCookie::I2cCookie(address_t i2cAddress_, size_t maxReplyLen_, I2cCookie::I2cCookie(address_t i2cAddress_, size_t maxReplyLen_,
std::string deviceFile_) : std::string deviceFile_) :

View File

@ -1,7 +1,7 @@
#include "fsfw/FSFW.h" #include "fsfw/FSFW.h"
#include "fsfw/hal/linux/rpi/GpioRPi.h" #include "fsfw_hal/linux/rpi/GpioRPi.h"
#include "fsfw/hal/common/gpio/GpioCookie.h" #include "fsfw_hal/common/gpio/GpioCookie.h"
#include <fsfw/serviceinterface/ServiceInterface.h> #include <fsfw/serviceinterface/ServiceInterface.h>

View File

@ -1,8 +1,8 @@
#include "fsfw/FSFW.h" #include "fsfw/FSFW.h"
#include "fsfw/hal/linux/spi/SpiComIF.h" #include "fsfw_hal/linux/spi/SpiComIF.h"
#include "fsfw/hal/linux/spi/SpiCookie.h" #include "fsfw_hal/linux/spi/SpiCookie.h"
#include "fsfw/hal/linux/utility.h" #include "fsfw_hal/linux/utility.h"
#include "fsfw/hal/linux/UnixFileGuard.h" #include "fsfw_hal/linux/UnixFileGuard.h"
#include <fsfw/ipc/MutexFactory.h> #include <fsfw/ipc/MutexFactory.h>
#include <fsfw/globalfunctions/arrayprinter.h> #include <fsfw/globalfunctions/arrayprinter.h>

View File

@ -3,7 +3,7 @@
#include "spiDefinitions.h" #include "spiDefinitions.h"
#include "returnvalues/classIds.h" #include "returnvalues/classIds.h"
#include "fsfw/hal/common/gpio/GpioIF.h" #include "fsfw_hal/common/gpio/GpioIF.h"
#include "fsfw/devicehandlers/DeviceCommunicationIF.h" #include "fsfw/devicehandlers/DeviceCommunicationIF.h"
#include "fsfw/objectmanager/SystemObject.h" #include "fsfw/objectmanager/SystemObject.h"

View File

@ -1,4 +1,4 @@
#include "fsfw/hal/linux/spi/SpiCookie.h" #include "fsfw_hal/linux/spi/SpiCookie.h"
SpiCookie::SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, SpiCookie::SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev,
const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed): const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed):

View File

@ -1,4 +1,4 @@
#include "fsfw/hal/linux/uart/UartComIF.h" #include "fsfw_hal/linux/uart/UartComIF.h"
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"

View File

@ -1,4 +1,4 @@
#include "fsfw/hal/linux/uart/UartCookie.h" #include "fsfw_hal/linux/uart/UartCookie.h"
#include <fsfw/serviceinterface/ServiceInterface.h> #include <fsfw/serviceinterface/ServiceInterface.h>

View File

@ -1,6 +1,6 @@
#include "fsfw/FSFW.h" #include "fsfw/FSFW.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/hal/linux/utility.h" #include "fsfw_hal/linux/utility.h"
#include <cerrno> #include <cerrno>
#include <cstring> #include <cstring>

View File

@ -1,10 +1,10 @@
#include "fsfw/hal/stm32h7/devicetest/GyroL3GD20H.h" #include "fsfw_hal/stm32h7/devicetest/GyroL3GD20H.h"
#include "fsfw/hal/stm32h7/spi/mspInit.h" #include "fsfw_hal/stm32h7/spi/mspInit.h"
#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" #include "fsfw_hal/stm32h7/spi/spiDefinitions.h"
#include "fsfw/hal/stm32h7/spi/spiCore.h" #include "fsfw_hal/stm32h7/spi/spiCore.h"
#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" #include "fsfw_hal/stm32h7/spi/spiInterrupts.h"
#include "fsfw/hal/stm32h7/spi/stm32h743ziSpi.h" #include "fsfw_hal/stm32h7/spi/stm32h743ziSpi.h"
#include "fsfw/tasks/TaskFactory.h" #include "fsfw/tasks/TaskFactory.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"

View File

@ -1,4 +1,4 @@
#include <fsfw/hal/stm32h7/dma.h> #include <fsfw_hal/stm32h7/dma.h>
#include <cstdint> #include <cstdint>
#include <cstddef> #include <cstddef>

View File

@ -1,4 +1,4 @@
#include "fsfw/hal/stm32h7/gpio/gpio.h" #include "fsfw_hal/stm32h7/gpio/gpio.h"
#include "stm32h7xx_hal_rcc.h" #include "stm32h7xx_hal_rcc.h"

View File

@ -1,11 +1,11 @@
#include "fsfw/hal/stm32h7/spi/SpiComIF.h" #include "fsfw_hal/stm32h7/spi/SpiComIF.h"
#include "fsfw/hal/stm32h7/spi/SpiCookie.h" #include "fsfw_hal/stm32h7/spi/SpiCookie.h"
#include "fsfw/tasks/SemaphoreFactory.h" #include "fsfw/tasks/SemaphoreFactory.h"
#include "fsfw/hal/stm32h7/spi/spiCore.h" #include "fsfw_hal/stm32h7/spi/spiCore.h"
#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" #include "fsfw_hal/stm32h7/spi/spiInterrupts.h"
#include "fsfw/hal/stm32h7/spi/mspInit.h" #include "fsfw_hal/stm32h7/spi/mspInit.h"
#include "fsfw/hal/stm32h7/gpio/gpio.h" #include "fsfw_hal/stm32h7/gpio/gpio.h"
// FreeRTOS required special Semaphore handling from an ISR. Therefore, we use the concrete // FreeRTOS required special Semaphore handling from an ISR. Therefore, we use the concrete
// instance here, because RTEMS and FreeRTOS are the only relevant OSALs currently // instance here, because RTEMS and FreeRTOS are the only relevant OSALs currently

View File

@ -5,7 +5,7 @@
#include "fsfw/devicehandlers/DeviceCommunicationIF.h" #include "fsfw/devicehandlers/DeviceCommunicationIF.h"
#include "fsfw/objectmanager/SystemObject.h" #include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" #include "fsfw_hal/stm32h7/spi/spiDefinitions.h"
#include "stm32h7xx_hal_spi.h" #include "stm32h7xx_hal_spi.h"
#include "stm32h743xx.h" #include "stm32h743xx.h"

View File

@ -1,4 +1,4 @@
#include "fsfw/hal/stm32h7/spi/SpiCookie.h" #include "fsfw_hal/stm32h7/spi/SpiCookie.h"
SpiCookie::SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, spi::TransferModes transferMode, SpiCookie::SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, spi::TransferModes transferMode,

View File

@ -1,7 +1,7 @@
#include "fsfw/hal/stm32h7/dma.h" #include "fsfw_hal/stm32h7/dma.h"
#include "fsfw/hal/stm32h7/spi/mspInit.h" #include "fsfw_hal/stm32h7/spi/mspInit.h"
#include "fsfw/hal/stm32h7/spi/spiCore.h" #include "fsfw_hal/stm32h7/spi/spiCore.h"
#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" #include "fsfw_hal/stm32h7/spi/spiInterrupts.h"
#include "stm32h743xx.h" #include "stm32h743xx.h"
#include "stm32h7xx_hal_spi.h" #include "stm32h7xx_hal_spi.h"

View File

@ -1,5 +1,5 @@
#include "fsfw/hal/stm32h7/spi/spiCore.h" #include "fsfw_hal/stm32h7/spi/spiCore.h"
#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" #include "fsfw_hal/stm32h7/spi/spiDefinitions.h"
#include <cstdio> #include <cstdio>

View File

@ -1,8 +1,8 @@
#ifndef FSFW_HAL_STM32H7_SPI_SPICORE_H_ #ifndef FSFW_HAL_STM32H7_SPI_SPICORE_H_
#define FSFW_HAL_STM32H7_SPI_SPICORE_H_ #define FSFW_HAL_STM32H7_SPI_SPICORE_H_
#include "fsfw/hal/stm32h7/dma.h" #include "fsfw_hal/stm32h7/dma.h"
#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" #include "fsfw_hal/stm32h7/spi/spiDefinitions.h"
#include "stm32h7xx_hal.h" #include "stm32h7xx_hal.h"
#include "stm32h7xx_hal_dma.h" #include "stm32h7xx_hal_dma.h"

View File

@ -1,4 +1,4 @@
#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" #include "fsfw_hal/stm32h7/spi/spiDefinitions.h"
void spi::assignSpiMode(SpiModes spiMode, SPI_HandleTypeDef& spiHandle) { void spi::assignSpiMode(SpiModes spiMode, SPI_HandleTypeDef& spiHandle) {
switch(spiMode) { switch(spiMode) {

View File

@ -1,5 +1,5 @@
#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" #include "fsfw_hal/stm32h7/spi/spiInterrupts.h"
#include "fsfw/hal/stm32h7/spi/spiCore.h" #include "fsfw_hal/stm32h7/spi/spiCore.h"
#include "stm32h7xx_hal.h" #include "stm32h7xx_hal.h"
#include "stm32h7xx_hal_dma.h" #include "stm32h7xx_hal_dma.h"

View File

@ -1,6 +1,6 @@
#include "fsfw/hal/stm32h7/spi/stm32h743ziSpi.h" #include "fsfw_hal/stm32h7/spi/stm32h743ziSpi.h"
#include "fsfw/hal/stm32h7/spi/spiCore.h" #include "fsfw_hal/stm32h7/spi/spiCore.h"
#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" #include "fsfw_hal/stm32h7/spi/spiInterrupts.h"
#include "stm32h7xx_hal.h" #include "stm32h7xx_hal.h"
#include "stm32h7xx_hal_rcc.h" #include "stm32h7xx_hal_rcc.h"

View File

@ -4,7 +4,7 @@
#include <fsfw/devicehandlers/DeviceHandlerBase.h> #include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <fsfw/events/EventManager.h> #include <fsfw/events/EventManager.h>
#include <fsfw/health/HealthTable.h> #include <fsfw/health/HealthTable.h>
#include <fsfw/tmtcpacket/pus/TmPacketStored.h> #include <fsfw/tmtcpacket/pus/tm/TmPacketStored.h>
#include <fsfw/tmtcservices/CommandingServiceBase.h> #include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h> #include <fsfw/tmtcservices/PusServiceBase.h>
#include <fsfw/internalError/InternalErrorReporter.h> #include <fsfw/internalError/InternalErrorReporter.h>

View File

@ -9,5 +9,10 @@
#cmakedefine FSFW_ADD_COORDINATES #cmakedefine FSFW_ADD_COORDINATES
#cmakedefine FSFW_ADD_PUS #cmakedefine FSFW_ADD_PUS
#cmakedefine FSFW_ADD_MONITORING #cmakedefine FSFW_ADD_MONITORING
#cmakedefine FSFW_ADD_SGP4_PROPAGATOR
#ifndef FSFW_HAL_L3GD20_GYRO_DEBUG
#define FSFW_HAL_L3GD20_GYRO_DEBUG 0
#endif /* FSFW_HAL_L3GD20_GYRO_DEBUG */
#endif /* FSFW_FSFW_H_ */ #endif /* FSFW_FSFW_H_ */

View File

@ -7,7 +7,7 @@
#ifndef PLATFORM_WIN #ifndef PLATFORM_WIN
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#include "fsfw/contrib/sgp4/sgp4unit.h" #include "fsfw-contrib/sgp4/sgp4unit.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h"
class Sgp4Propagator { class Sgp4Propagator {

View File

@ -8,4 +8,9 @@
not enabled with FSFW_ADD_COORDINATES not enabled with FSFW_ADD_COORDINATES
#endif #endif
#ifndef FSFW_ADD_SGP4_PROPAGATOR
#warning Coordinates files were included but SGP4 contributed code compilation was \
not enabled with FSFW_ADD_SGP4_PROPAGATOR
#endif
#endif /* FSFW_SRC_FSFW_COORDINATES_COORDINATESCONF_H_ */ #endif /* FSFW_SRC_FSFW_COORDINATES_COORDINATESCONF_H_ */

View File

@ -12,119 +12,119 @@ MessageQueueId_t EventManagerIF::eventmanagerQueue = MessageQueueIF::NO_QUEUE;
// So a good guess is 75 to a max of 100 pools required for each, which fits well. // So a good guess is 75 to a max of 100 pools required for each, which fits well.
const LocalPool::LocalPoolConfig EventManager::poolConfig = { const LocalPool::LocalPoolConfig EventManager::poolConfig = {
{fsfwconfig::FSFW_EVENTMGMR_MATCHTREE_NODES, {fsfwconfig::FSFW_EVENTMGMR_MATCHTREE_NODES,
sizeof(EventMatchTree::Node)}, sizeof(EventMatchTree::Node)},
{fsfwconfig::FSFW_EVENTMGMT_EVENTIDMATCHERS, {fsfwconfig::FSFW_EVENTMGMT_EVENTIDMATCHERS,
sizeof(EventIdRangeMatcher)}, sizeof(EventIdRangeMatcher)},
{fsfwconfig::FSFW_EVENTMGMR_RANGEMATCHERS, {fsfwconfig::FSFW_EVENTMGMR_RANGEMATCHERS,
sizeof(ReporterRangeMatcher)} sizeof(ReporterRangeMatcher)}
}; };
EventManager::EventManager(object_id_t setObjectId) : EventManager::EventManager(object_id_t setObjectId) :
SystemObject(setObjectId), SystemObject(setObjectId),
factoryBackend(0, poolConfig, false, true) { factoryBackend(0, poolConfig, false, true) {
mutex = MutexFactory::instance()->createMutex(); mutex = MutexFactory::instance()->createMutex();
eventReportQueue = QueueFactory::instance()->createMessageQueue( eventReportQueue = QueueFactory::instance()->createMessageQueue(
MAX_EVENTS_PER_CYCLE, EventMessage::EVENT_MESSAGE_SIZE); MAX_EVENTS_PER_CYCLE, EventMessage::EVENT_MESSAGE_SIZE);
} }
EventManager::~EventManager() { EventManager::~EventManager() {
QueueFactory::instance()->deleteMessageQueue(eventReportQueue); QueueFactory::instance()->deleteMessageQueue(eventReportQueue);
MutexFactory::instance()->deleteMutex(mutex); MutexFactory::instance()->deleteMutex(mutex);
} }
MessageQueueId_t EventManager::getEventReportQueue() { MessageQueueId_t EventManager::getEventReportQueue() {
return eventReportQueue->getId(); return eventReportQueue->getId();
} }
ReturnValue_t EventManager::performOperation(uint8_t opCode) { ReturnValue_t EventManager::performOperation(uint8_t opCode) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
while (result == HasReturnvaluesIF::RETURN_OK) { while (result == HasReturnvaluesIF::RETURN_OK) {
EventMessage message; EventMessage message;
result = eventReportQueue->receiveMessage(&message); result = eventReportQueue->receiveMessage(&message);
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
#if FSFW_OBJ_EVENT_TRANSLATION == 1 #if FSFW_OBJ_EVENT_TRANSLATION == 1
printEvent(&message); printEvent(&message);
#endif #endif
notifyListeners(&message); notifyListeners(&message);
} }
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
void EventManager::notifyListeners(EventMessage* message) { void EventManager::notifyListeners(EventMessage* message) {
lockMutex(); lockMutex();
for (auto iter = listenerList.begin(); iter != listenerList.end(); ++iter) { for (auto iter = listenerList.begin(); iter != listenerList.end(); ++iter) {
if (iter->second.match(message)) { if (iter->second.match(message)) {
MessageQueueSenderIF::sendMessage(iter->first, message, MessageQueueSenderIF::sendMessage(iter->first, message,
message->getSender()); message->getSender());
} }
} }
unlockMutex(); unlockMutex();
} }
ReturnValue_t EventManager::registerListener(MessageQueueId_t listener, ReturnValue_t EventManager::registerListener(MessageQueueId_t listener,
bool forwardAllButSelected) { bool forwardAllButSelected) {
auto result = listenerList.insert( auto result = listenerList.insert(
std::pair<MessageQueueId_t, EventMatchTree>(listener, std::pair<MessageQueueId_t, EventMatchTree>(listener,
EventMatchTree(&factoryBackend, forwardAllButSelected))); EventMatchTree(&factoryBackend, forwardAllButSelected)));
if (!result.second) { if (!result.second) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t EventManager::subscribeToEvent(MessageQueueId_t listener, ReturnValue_t EventManager::subscribeToEvent(MessageQueueId_t listener,
EventId_t event) { EventId_t event) {
return subscribeToEventRange(listener, event); return subscribeToEventRange(listener, event);
} }
ReturnValue_t EventManager::subscribeToAllEventsFrom(MessageQueueId_t listener, ReturnValue_t EventManager::subscribeToAllEventsFrom(MessageQueueId_t listener,
object_id_t object) { object_id_t object) {
return subscribeToEventRange(listener, 0, 0, true, object); return subscribeToEventRange(listener, 0, 0, true, object);
} }
ReturnValue_t EventManager::subscribeToEventRange(MessageQueueId_t listener, ReturnValue_t EventManager::subscribeToEventRange(MessageQueueId_t listener,
EventId_t idFrom, EventId_t idTo, bool idInverted, EventId_t idFrom, EventId_t idTo, bool idInverted,
object_id_t reporterFrom, object_id_t reporterTo, object_id_t reporterFrom, object_id_t reporterTo,
bool reporterInverted) { bool reporterInverted) {
auto iter = listenerList.find(listener); auto iter = listenerList.find(listener);
if (iter == listenerList.end()) { if (iter == listenerList.end()) {
return LISTENER_NOT_FOUND; return LISTENER_NOT_FOUND;
} }
lockMutex(); lockMutex();
ReturnValue_t result = iter->second.addMatch(idFrom, idTo, idInverted, ReturnValue_t result = iter->second.addMatch(idFrom, idTo, idInverted,
reporterFrom, reporterTo, reporterInverted); reporterFrom, reporterTo, reporterInverted);
unlockMutex(); unlockMutex();
return result; return result;
} }
ReturnValue_t EventManager::unsubscribeFromEventRange(MessageQueueId_t listener, ReturnValue_t EventManager::unsubscribeFromEventRange(MessageQueueId_t listener,
EventId_t idFrom, EventId_t idTo, bool idInverted, EventId_t idFrom, EventId_t idTo, bool idInverted,
object_id_t reporterFrom, object_id_t reporterTo, object_id_t reporterFrom, object_id_t reporterTo,
bool reporterInverted) { bool reporterInverted) {
auto iter = listenerList.find(listener); auto iter = listenerList.find(listener);
if (iter == listenerList.end()) { if (iter == listenerList.end()) {
return LISTENER_NOT_FOUND; return LISTENER_NOT_FOUND;
} }
lockMutex(); lockMutex();
ReturnValue_t result = iter->second.removeMatch(idFrom, idTo, idInverted, ReturnValue_t result = iter->second.removeMatch(idFrom, idTo, idInverted,
reporterFrom, reporterTo, reporterInverted); reporterFrom, reporterTo, reporterInverted);
unlockMutex(); unlockMutex();
return result; return result;
} }
void EventManager::lockMutex() { void EventManager::lockMutex() {
mutex->lockMutex(timeoutType, timeoutMs); mutex->lockMutex(timeoutType, timeoutMs);
} }
void EventManager::unlockMutex() { void EventManager::unlockMutex() {
mutex->unlockMutex(); mutex->unlockMutex();
} }
void EventManager::setMutexTimeout(MutexIF::TimeoutType timeoutType, void EventManager::setMutexTimeout(MutexIF::TimeoutType timeoutType,
uint32_t timeoutMs) { uint32_t timeoutMs) {
this->timeoutType = timeoutType; this->timeoutType = timeoutType;
this->timeoutMs = timeoutMs; this->timeoutMs = timeoutMs;
} }
#if FSFW_OBJ_EVENT_TRANSLATION == 1 #if FSFW_OBJ_EVENT_TRANSLATION == 1

View File

@ -11,7 +11,6 @@
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include "queue.h" #include "queue.h"
/** /**
* @brief This class manages sending and receiving of * @brief This class manages sending and receiving of
* message queue messages. * message queue messages.

View File

@ -14,7 +14,7 @@ void utility::printUnixErrorGeneric(const char* const className,
#if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_VERBOSE_LEVEL >= 1
if(outputType == sif::OutputTypes::OUT_ERROR) { if(outputType == sif::OutputTypes::OUT_ERROR) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << className << "::" << function << ":" << failString << " error: " sif::error << className << "::" << function << ": " << failString << " error: "
<< strerror(errno) << std::endl; << strerror(errno) << std::endl;
#else #else
sif::printError("%s::%s: %s error: %s\n", className, function, failString, strerror(errno)); sif::printError("%s::%s: %s error: %s\n", className, function, failString, strerror(errno));
@ -22,7 +22,7 @@ void utility::printUnixErrorGeneric(const char* const className,
} }
else { else {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << className << "::" << function << ":" << failString << " error: " sif::warning << className << "::" << function << ": " << failString << " error: "
<< strerror(errno) << std::endl; << strerror(errno) << std::endl;
#else #else
sif::printWarning("%s::%s: %s error: %s\n", className, function, failString, strerror(errno)); sif::printWarning("%s::%s: %s error: %s\n", className, function, failString, strerror(errno));

View File

@ -1,7 +1,7 @@
#ifndef FSFW_SERVICEINTERFACE_SERVICEINTERFACE_H_ #ifndef FSFW_SERVICEINTERFACE_SERVICEINTERFACE_H_
#define FSFW_SERVICEINTERFACE_SERVICEINTERFACE_H_ #define FSFW_SERVICEINTERFACE_SERVICEINTERFACE_H_
#include <FSFWConfig.h> #include "fsfw/FSFW.h"
#include "serviceInterfaceDefintions.h" #include "serviceInterfaceDefintions.h"
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1

View File

@ -171,9 +171,11 @@ bool ServiceInterfaceBuffer::crAdditionEnabled() const {
return addCrToPreamble; return addCrToPreamble;
} }
#if FSFW_COLORED_OUTPUT == 1
void ServiceInterfaceBuffer::setAsciiColorPrefix(std::string colorPrefix) { void ServiceInterfaceBuffer::setAsciiColorPrefix(std::string colorPrefix) {
this->colorPrefix = colorPrefix; this->colorPrefix = colorPrefix;
} }
#endif
#ifdef UT699 #ifdef UT699
#include "../osal/rtems/Interrupt.h" #include "../osal/rtems/Interrupt.h"

View File

@ -19,9 +19,11 @@ bool ServiceInterfaceStream::crAdditionEnabled() const {
return streambuf.crAdditionEnabled(); return streambuf.crAdditionEnabled();
} }
#if FSFW_COLORED_OUTPUT == 1
void ServiceInterfaceStream::setAsciiColorPrefix(std::string asciiColorCode) { void ServiceInterfaceStream::setAsciiColorPrefix(std::string asciiColorCode) {
streambuf.setAsciiColorPrefix(asciiColorCode); streambuf.setAsciiColorPrefix(asciiColorCode);
} }
#endif
#endif #endif

View File

@ -46,7 +46,9 @@ public:
*/ */
bool crAdditionEnabled() const; bool crAdditionEnabled() const;
#if FSFW_COLORED_OUTPUT == 1
void setAsciiColorPrefix(std::string asciiColorCode); void setAsciiColorPrefix(std::string asciiColorCode);
#endif
protected: protected:
ServiceInterfaceBuffer streambuf; ServiceInterfaceBuffer streambuf;

View File

@ -6,4 +6,4 @@ target_include_directories(${LIB_FSFW_NAME} INTERFACE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
) )
add_subdirectory(fsfw) add_subdirectory(fsfw_tests)

View File

@ -1 +0,0 @@
add_subdirectory(tests)

View File

@ -1,11 +1,11 @@
#include "fsfw/tests/internal/InternalUnitTester.h" #include "fsfw_tests/internal/InternalUnitTester.h"
#include "fsfw/tests/internal/UnittDefinitions.h" #include "fsfw_tests/internal/UnittDefinitions.h"
#include "fsfw/tests/internal/osal/IntTestMq.h" #include "fsfw_tests/internal/osal/IntTestMq.h"
#include "fsfw/tests/internal/osal/IntTestSemaphore.h" #include "fsfw_tests/internal/osal/IntTestSemaphore.h"
#include "fsfw/tests/internal/osal/IntTestMutex.h" #include "fsfw_tests/internal/osal/IntTestMutex.h"
#include "fsfw/tests/internal/serialize/IntTestSerialization.h" #include "fsfw_tests/internal/serialize/IntTestSerialization.h"
#include "fsfw/tests/internal/globalfunctions/TestArrayPrinter.h" #include "fsfw_tests/internal/globalfunctions/TestArrayPrinter.h"
#include <cstdlib> #include <cstdlib>

View File

@ -1,4 +1,4 @@
#include "fsfw/tests/internal/UnittDefinitions.h" #include "fsfw_tests/internal/UnittDefinitions.h"
ReturnValue_t unitt::put_error(std::string errorId) { ReturnValue_t unitt::put_error(std::string errorId) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1

View File

@ -1,4 +1,4 @@
#include "fsfw/tests/internal/globalfunctions/TestArrayPrinter.h" #include "fsfw_tests/internal/globalfunctions/TestArrayPrinter.h"
void arrayprinter::testArrayPrinter() { void arrayprinter::testArrayPrinter() {
{ {

View File

@ -1,5 +1,5 @@
#include "fsfw/tests/internal/osal/IntTestMq.h" #include "fsfw_tests/internal/osal/IntTestMq.h"
#include "fsfw/tests/internal/UnittDefinitions.h" #include "fsfw_tests/internal/UnittDefinitions.h"
#include <fsfw/ipc/MessageQueueIF.h> #include <fsfw/ipc/MessageQueueIF.h>
#include <fsfw/ipc/QueueFactory.h> #include <fsfw/ipc/QueueFactory.h>

Some files were not shown because too many files have changed in this diff Show More