Compare commits
4 Commits
mueller/re
...
meier/upst
Author | SHA1 | Date | |
---|---|---|---|
b96f5a2552 | |||
ec8e5cc123 | |||
298f764298 | |||
2e76250209 |
@ -74,6 +74,7 @@ set(FSFW_ETL_LIB_MAJOR_VERSION
|
|||||||
set(FSFW_ETL_LIB_VERSION
|
set(FSFW_ETL_LIB_VERSION
|
||||||
${FSFW_ETL_LIB_MAJOR_VERSION}.28.0
|
${FSFW_ETL_LIB_MAJOR_VERSION}.28.0
|
||||||
CACHE STRING "ETL library exact version requirement")
|
CACHE STRING "ETL library exact version requirement")
|
||||||
|
set(FSFW_ETL_LINK_TARGET etl::etl)
|
||||||
|
|
||||||
set(FSFW_CATCH2_LIB_MAJOR_VERSION
|
set(FSFW_CATCH2_LIB_MAJOR_VERSION
|
||||||
3
|
3
|
||||||
@ -82,15 +83,6 @@ set(FSFW_CATCH2_LIB_VERSION
|
|||||||
v${FSFW_CATCH2_LIB_MAJOR_VERSION}.0.0-preview5
|
v${FSFW_CATCH2_LIB_MAJOR_VERSION}.0.0-preview5
|
||||||
CACHE STRING "Catch2 library exact version requirement")
|
CACHE STRING "Catch2 library exact version requirement")
|
||||||
|
|
||||||
set(FSFW_FMT_LIB_NAME fmt)
|
|
||||||
set(FSFW_FMT_LINK_TARGET fmt::fmt)
|
|
||||||
set(FSFW_FMT_LIB_MAJOR_VERSION
|
|
||||||
8
|
|
||||||
CACHE STRING "{fmt} library major version requirement")
|
|
||||||
set(FSFW_FMT_LIB_VERSION
|
|
||||||
${FSFW_FMT_LIB_MAJOR_VERSION}.1.1
|
|
||||||
CACHE STRING "{fmt} library exact version requirement")
|
|
||||||
|
|
||||||
# Keep this off by default for now. See PR:
|
# Keep this off by default for now. See PR:
|
||||||
# https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/616 for information which
|
# https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/616 for information which
|
||||||
# keeping this on by default is problematic
|
# keeping this on by default is problematic
|
||||||
@ -177,11 +169,11 @@ if(FSFW_BUILD_TESTS)
|
|||||||
|
|
||||||
project(${FSFW_TEST_TGT} CXX C)
|
project(${FSFW_TEST_TGT} CXX C)
|
||||||
add_executable(${FSFW_TEST_TGT})
|
add_executable(${FSFW_TEST_TGT})
|
||||||
|
|
||||||
if(IPO_SUPPORTED AND FSFW_ENABLE_IPO)
|
if(IPO_SUPPORTED AND FSFW_ENABLE_IPO)
|
||||||
set_property(TARGET ${FSFW_TEST_TGT} PROPERTY INTERPROCEDURAL_OPTIMIZATION
|
set_property(TARGET ${FSFW_TEST_TGT} PROPERTY INTERPROCEDURAL_OPTIMIZATION
|
||||||
TRUE)
|
TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FSFW_TESTS_GEN_COV)
|
if(FSFW_TESTS_GEN_COV)
|
||||||
message(STATUS "${MSG_PREFIX} Generating coverage data for the library")
|
message(STATUS "${MSG_PREFIX} Generating coverage data for the library")
|
||||||
message(STATUS "${MSG_PREFIX} Targets linking against ${LIB_FSFW_NAME} "
|
message(STATUS "${MSG_PREFIX} Targets linking against ${LIB_FSFW_NAME} "
|
||||||
@ -191,7 +183,7 @@ if(FSFW_BUILD_TESTS)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "${MSG_PREFIX} Finding and/or etl (Embedded Template Library)")
|
message(STATUS "${MSG_PREFIX} Finding and/or providing ETL library")
|
||||||
|
|
||||||
# Check whether the user has already installed ETL first
|
# Check whether the user has already installed ETL first
|
||||||
find_package(${FSFW_ETL_LIB_NAME} ${FSFW_ETL_LIB_MAJOR_VERSION} QUIET)
|
find_package(${FSFW_ETL_LIB_NAME} ${FSFW_ETL_LIB_MAJOR_VERSION} QUIET)
|
||||||
@ -211,26 +203,6 @@ if(NOT ${FSFW_ETL_LIB_NAME}_FOUND)
|
|||||||
list(APPEND FSFW_FETCH_CONTENT_TARGETS ${FSFW_ETL_LIB_NAME})
|
list(APPEND FSFW_FETCH_CONTENT_TARGETS ${FSFW_ETL_LIB_NAME})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "Finding and/or providing {fmt} formatting library")
|
|
||||||
|
|
||||||
# Check whether the user has already installed ETL first
|
|
||||||
find_package(fmt ${FSFW_FMT_LIB_MAJOR_VERSION} QUIET)
|
|
||||||
# Not installed, so use FetchContent to download and provide etl
|
|
||||||
if(NOT ${FSFW_FMT_LIB_NAME}_FOUND)
|
|
||||||
message(
|
|
||||||
STATUS
|
|
||||||
"No {fmt} installation was found with find_package. Installing and providing "
|
|
||||||
"{fmt} with FindPackage")
|
|
||||||
include(FetchContent)
|
|
||||||
|
|
||||||
FetchContent_Declare(
|
|
||||||
${FSFW_FMT_LIB_NAME}
|
|
||||||
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
|
|
||||||
GIT_TAG ${FSFW_FMT_LIB_VERSION})
|
|
||||||
|
|
||||||
list(APPEND FSFW_FETCH_CONTENT_TARGETS ${FSFW_FMT_LIB_NAME})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# The documentation for FetchContent recommends declaring all the dependencies
|
# The documentation for FetchContent recommends declaring all the dependencies
|
||||||
# before making them available. We make all declared dependency available here
|
# before making them available. We make all declared dependency available here
|
||||||
# after their declaration
|
# after their declaration
|
||||||
@ -240,7 +212,7 @@ if(FSFW_FETCH_CONTENT_TARGETS)
|
|||||||
add_library(${FSFW_ETL_LINK_TARGET} ALIAS ${FSFW_ETL_LIB_NAME})
|
add_library(${FSFW_ETL_LINK_TARGET} ALIAS ${FSFW_ETL_LIB_NAME})
|
||||||
endif()
|
endif()
|
||||||
if(TARGET Catch2)
|
if(TARGET Catch2)
|
||||||
# Fixes regression -preview4, to be confirmed in later releases. Related
|
# Fixes regression -preview4, to be confirmed in later releases Related
|
||||||
# GitHub issue: https://github.com/catchorg/Catch2/issues/2417
|
# GitHub issue: https://github.com/catchorg/Catch2/issues/2417
|
||||||
set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "")
|
set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "")
|
||||||
endif()
|
endif()
|
||||||
@ -473,8 +445,9 @@ target_include_directories(
|
|||||||
|
|
||||||
target_compile_options(${LIB_FSFW_NAME} PRIVATE ${FSFW_WARNING_FLAGS}
|
target_compile_options(${LIB_FSFW_NAME} PRIVATE ${FSFW_WARNING_FLAGS}
|
||||||
${COMPILER_FLAGS})
|
${COMPILER_FLAGS})
|
||||||
|
|
||||||
target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${FSFW_ADDITIONAL_LINK_LIBS})
|
target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${FSFW_ADDITIONAL_LINK_LIBS})
|
||||||
target_link_libraries(${LIB_FSFW_NAME} PUBLIC ${FSFW_ETL_LINK_TARGET} ${FSFW_FMT_LINK_TARGET})
|
target_link_libraries(${LIB_FSFW_NAME} PUBLIC ${FSFW_ETL_LINK_TARGET})
|
||||||
|
|
||||||
string(
|
string(
|
||||||
CONCAT
|
CONCAT
|
||||||
@ -484,13 +457,6 @@ string(
|
|||||||
"Target OSAL: ${FSFW_OS_NAME}\n"
|
"Target OSAL: ${FSFW_OS_NAME}\n"
|
||||||
"######################################################################\n")
|
"######################################################################\n")
|
||||||
|
|
||||||
# The additional / is important to remove the last character from the path. Note
|
|
||||||
# that it does not matter if the OS uses / or \, because we are only saving the
|
|
||||||
# path size.
|
|
||||||
string(LENGTH "${CMAKE_SOURCE_DIR}/" FSFW_SOURCE_PATH_SIZE)
|
|
||||||
target_compile_definitions(
|
|
||||||
${LIB_FSFW_NAME} PRIVATE "-DFSFW_SOURCE_PATH_SIZE=${FSFW_SOURCE_PATH_SIZE}")
|
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${LIB_FSFW_NAME}
|
TARGET ${LIB_FSFW_NAME}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "fsfw/action.h"
|
#include "fsfw/action.h"
|
||||||
#include "fsfw/ipc/MessageQueueSenderIF.h"
|
#include "fsfw/ipc/MessageQueueSenderIF.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue)
|
ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue)
|
||||||
: owner(setOwner), queueToUse(useThisQueue) {}
|
: owner(setOwner), queueToUse(useThisQueue) {}
|
||||||
@ -28,7 +28,13 @@ ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (queueToUse == nullptr) {
|
if (queueToUse == nullptr) {
|
||||||
FSFW_LOGW("{}", "initialize: No queue set\n");
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "ActionHelper::initialize: No queue set" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("ActionHelper::initialize: No queue set\n");
|
||||||
|
#endif
|
||||||
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +96,14 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
|
|||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
ReturnValue_t result = ipcStore->getFreeElement(&storeAddress, maxSize, &dataPtr);
|
ReturnValue_t result = ipcStore->getFreeElement(&storeAddress, maxSize, &dataPtr);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGWT("{}", "reportData: Getting free element from IPC store failed\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "ActionHelper::reportData: Getting free element from IPC store failed!"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"ActionHelper::reportData: Getting free element from IPC "
|
||||||
|
"store failed!\n");
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = data->serialize(&dataPtr, &size, maxSize, SerializeIF::Endianness::BIG);
|
result = data->serialize(&dataPtr, &size, maxSize, SerializeIF::Endianness::BIG);
|
||||||
@ -125,7 +138,11 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
|
|||||||
store_address_t storeAddress;
|
store_address_t storeAddress;
|
||||||
ReturnValue_t result = ipcStore->addData(&storeAddress, data, dataSize);
|
ReturnValue_t result = ipcStore->addData(&storeAddress, data, dataSize);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGWT("{}", "reportData: Adding data to IPC store failed\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "ActionHelper::reportData: Adding data to IPC store failed!" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("ActionHelper::reportData: Adding data to IPC store failed!\n");
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include "fsfw/ipc/CommandMessage.h"
|
#include "fsfw/ipc/CommandMessage.h"
|
||||||
#include "fsfw/ipc/QueueFactory.h"
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
#include "fsfw/storagemanager/storeAddress.h"
|
#include "fsfw/storagemanager/storeAddress.h"
|
||||||
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
|
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
|
||||||
|
|
||||||
@ -29,7 +28,13 @@ ReturnValue_t CFDPHandler::initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CFDPHandler::handleRequest(store_address_t storeId) {
|
ReturnValue_t CFDPHandler::handleRequest(store_address_t storeId) {
|
||||||
FSFW_LOGDT("{}", "CFDPHandler::handleRequest\n");
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::debug << "CFDPHandler::handleRequest" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printDebug("CFDPHandler::handleRequest\n");
|
||||||
|
#endif /* !FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
|
#endif
|
||||||
|
|
||||||
// TODO read out packet from store using storeId
|
// TODO read out packet from store using storeId
|
||||||
|
|
||||||
|
@ -50,9 +50,17 @@ ReturnValue_t EofPduDeserializer::parseData() {
|
|||||||
if (info.getConditionCode() != cfdp::ConditionCode::NO_ERROR) {
|
if (info.getConditionCode() != cfdp::ConditionCode::NO_ERROR) {
|
||||||
EntityIdTlv* tlvPtr = info.getFaultLoc();
|
EntityIdTlv* tlvPtr = info.getFaultLoc();
|
||||||
if (tlvPtr == nullptr) {
|
if (tlvPtr == nullptr) {
|
||||||
FSFW_LOGW("{}",
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
"parseData: Ca not deserialize fault location,"
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
" given TLV pointer invalid\n");
|
sif::warning << "EofPduDeserializer::parseData: Ca not deserialize fault location,"
|
||||||
|
" given TLV pointer invalid"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"EofPduDeserializer::parseData: Ca not deserialize fault location,"
|
||||||
|
" given TLV pointer invalid");
|
||||||
|
#endif
|
||||||
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
result = tlvPtr->deSerialize(&bufPtr, &deserLen, endianness);
|
result = tlvPtr->deSerialize(&bufPtr, &deserLen, endianness);
|
||||||
|
@ -7,7 +7,13 @@
|
|||||||
cfdp::VarLenField::VarLenField(cfdp::WidthInBytes width, size_t value) : VarLenField() {
|
cfdp::VarLenField::VarLenField(cfdp::WidthInBytes width, size_t value) : VarLenField() {
|
||||||
ReturnValue_t result = this->setValue(width, value);
|
ReturnValue_t result = this->setValue(width, value);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGW("{}", "cfdp::VarLenField: Setting value failed\n");
|
#if FSFW_DISABLE_PRINTOUT == 0
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "cfdp::VarLenField: Setting value failed" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("cfdp::VarLenField: Setting value failed\n");
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include <fsfw/cfdp/tlv/Tlv.h>
|
#include <fsfw/cfdp/tlv/Tlv.h>
|
||||||
#include <fsfw/cfdp/tlv/TlvIF.h>
|
#include <fsfw/cfdp/tlv/TlvIF.h>
|
||||||
#include <fsfw/serialize/SerializeIF.h>
|
#include <fsfw/serialize/SerializeIF.h>
|
||||||
#include <fsfw/serviceinterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@ -128,7 +128,17 @@ class FilestoreTlvBase : public TlvIF {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void secondFileNameMissing() const {
|
void secondFileNameMissing() const {
|
||||||
FSFW_LOGWT("{}", "secondFileNameMissing: Second file name required but TLV pointer not set\n");
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "FilestoreRequestTlv::deSerialize: Second file name required"
|
||||||
|
" but TLV pointer not set"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"FilestoreRequestTlv::deSerialize: Second file name required"
|
||||||
|
" but TLV pointer not set\n");
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
FilestoreActionCode getActionCode() const { return actionCode; }
|
FilestoreActionCode getActionCode() const { return actionCode; }
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "fsfw/datalinklayer/Clcw.h"
|
#include "fsfw/datalinklayer/Clcw.h"
|
||||||
|
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
Clcw::Clcw() {
|
Clcw::Clcw() {
|
||||||
content.raw = 0;
|
content.raw = 0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "fsfw/datalinklayer/DataLinkLayer.h"
|
#include "fsfw/datalinklayer/DataLinkLayer.h"
|
||||||
|
|
||||||
#include "fsfw/globalfunctions/CRC.h"
|
#include "fsfw/globalfunctions/CRC.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
DataLinkLayer::DataLinkLayer(uint8_t* set_frame_buffer, ClcwIF* setClcw,
|
DataLinkLayer::DataLinkLayer(uint8_t* set_frame_buffer, ClcwIF* setClcw,
|
||||||
uint8_t set_start_sequence_length, uint16_t set_scid)
|
uint8_t set_start_sequence_length, uint16_t set_scid)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "fsfw/ipc/QueueFactory.h"
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||||
#include "fsfw/tmtcpacket/SpacePacketBase.h"
|
#include "fsfw/tmtcpacket/SpacePacketBase.h"
|
||||||
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
|
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "fsfw/datalinklayer/TcTransferFrame.h"
|
#include "fsfw/datalinklayer/TcTransferFrame.h"
|
||||||
|
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
TcTransferFrame::TcTransferFrame() { frame = nullptr; }
|
TcTransferFrame::TcTransferFrame() { frame = nullptr; }
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "fsfw/globalfunctions/CRC.h"
|
#include "fsfw/globalfunctions/CRC.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
TcTransferFrameLocal::TcTransferFrameLocal(bool bypass, bool controlCommand, uint16_t scid,
|
TcTransferFrameLocal::TcTransferFrameLocal(bool bypass, bool controlCommand, uint16_t scid,
|
||||||
uint8_t vcId, uint8_t sequenceNumber,
|
uint8_t vcId, uint8_t sequenceNumber,
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "fsfw/datalinklayer/VirtualChannelReception.h"
|
#include "fsfw/datalinklayer/VirtualChannelReception.h"
|
||||||
|
|
||||||
#include "fsfw/datalinklayer/BCFrame.h"
|
#include "fsfw/datalinklayer/BCFrame.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
VirtualChannelReception::VirtualChannelReception(uint8_t setChannelId,
|
VirtualChannelReception::VirtualChannelReception(uint8_t setChannelId,
|
||||||
uint8_t setSlidingWindowWidth)
|
uint8_t setSlidingWindowWidth)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "fsfw/datapool/ReadCommitIFAttorney.h"
|
#include "fsfw/datapool/ReadCommitIFAttorney.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
PoolDataSetBase::PoolDataSetBase(PoolVariableIF** registeredVariablesArray,
|
PoolDataSetBase::PoolDataSetBase(PoolVariableIF** registeredVariablesArray,
|
||||||
const size_t maxFillCount)
|
const size_t maxFillCount)
|
||||||
@ -17,15 +17,27 @@ ReturnValue_t PoolDataSetBase::registerVariable(PoolVariableIF* variable) {
|
|||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
if (state != States::STATE_SET_UNINITIALISED) {
|
if (state != States::STATE_SET_UNINITIALISED) {
|
||||||
FSFW_LOGW("{}", "registerVariable: Call made in wrong position\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "DataSet::registerVariable: Call made in wrong position." << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError("DataSet::registerVariable: Call made in wrong position.");
|
||||||
|
#endif
|
||||||
return DataSetIF::DATA_SET_UNINITIALISED;
|
return DataSetIF::DATA_SET_UNINITIALISED;
|
||||||
}
|
}
|
||||||
if (variable == nullptr) {
|
if (variable == nullptr) {
|
||||||
FSFW_LOGW("{}", "registerVariable: Pool variable is nullptr\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "DataSet::registerVariable: Pool variable is nullptr." << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError("DataSet::registerVariable: Pool variable is nullptr.\n");
|
||||||
|
#endif
|
||||||
return DataSetIF::POOL_VAR_NULL;
|
return DataSetIF::POOL_VAR_NULL;
|
||||||
}
|
}
|
||||||
if (fillCount >= maxFillCount) {
|
if (fillCount >= maxFillCount) {
|
||||||
FSFW_LOGW("{}", "registerVariable: DataSet is full\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "DataSet::registerVariable: DataSet is full." << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError("DataSet::registerVariable: DataSet is full.\n");
|
||||||
|
#endif
|
||||||
return DataSetIF::DATA_SET_FULL;
|
return DataSetIF::DATA_SET_FULL;
|
||||||
}
|
}
|
||||||
registeredVariables[fillCount] = variable;
|
registeredVariables[fillCount] = variable;
|
||||||
@ -47,7 +59,15 @@ ReturnValue_t PoolDataSetBase::read(MutexIF::TimeoutType timeoutType, uint32_t l
|
|||||||
state = States::STATE_SET_WAS_READ;
|
state = States::STATE_SET_WAS_READ;
|
||||||
unlockDataPool();
|
unlockDataPool();
|
||||||
} else {
|
} else {
|
||||||
FSFW_LOGWT("{}", "read: Call made in wrong position. commit call might be missing\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "PoolDataSetBase::read: Call made in wrong position. Don't forget to "
|
||||||
|
"commit member datasets!"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"PoolDataSetBase::read: Call made in wrong position. Don't forget to "
|
||||||
|
"commit member datasets!\n");
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
result = SET_WAS_ALREADY_READ;
|
result = SET_WAS_ALREADY_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "fsfw/globalfunctions/arrayprinter.h"
|
#include "fsfw/globalfunctions/arrayprinter.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
PoolEntry<T>::PoolEntry(uint8_t len, bool setValid) : length(len), valid(setValid) {
|
PoolEntry<T>::PoolEntry(uint8_t len, bool setValid) : length(len), valid(setValid) {
|
||||||
@ -70,7 +70,13 @@ void PoolEntry<T>::print() {
|
|||||||
} else {
|
} else {
|
||||||
validString = "Invalid";
|
validString = "Invalid";
|
||||||
}
|
}
|
||||||
FSFW_LOGI("PoolEntry Info. Validity {}\n", validString);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::info << "PoolEntry information." << std::endl;
|
||||||
|
sif::info << "PoolEntry validity: " << validString << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printInfo("PoolEntry information.\n");
|
||||||
|
sif::printInfo("PoolEntry validity: %s\n", validString);
|
||||||
|
#endif
|
||||||
arrayprinter::print(reinterpret_cast<uint8_t*>(address), getByteSize());
|
arrayprinter::print(reinterpret_cast<uint8_t*>(address), getByteSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#ifndef FSFW_DATAPOOL_POOLREADHELPER_H_
|
#ifndef FSFW_DATAPOOL_POOLREADHELPER_H_
|
||||||
#define FSFW_DATAPOOL_POOLREADHELPER_H_
|
#define FSFW_DATAPOOL_POOLREADHELPER_H_
|
||||||
|
|
||||||
|
#include <FSFWConfig.h>
|
||||||
|
|
||||||
|
#include "../serviceinterface/ServiceInterface.h"
|
||||||
#include "ReadCommitIF.h"
|
#include "ReadCommitIF.h"
|
||||||
#include "fsfw/FSFW.h"
|
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Helper class to read data sets or pool variables
|
* @brief Helper class to read data sets or pool variables
|
||||||
@ -17,7 +18,13 @@ class PoolReadGuard {
|
|||||||
if (readObject != nullptr) {
|
if (readObject != nullptr) {
|
||||||
readResult = readObject->read(timeoutType, mutexTimeout);
|
readResult = readObject->read(timeoutType, mutexTimeout);
|
||||||
if (readResult != HasReturnvaluesIF::RETURN_OK) {
|
if (readResult != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGW("{}", "ctor: Read failed\n");
|
#if FSFW_VERBOSE_LEVEL == 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "PoolReadHelper: Read failed!" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError("PoolReadHelper: Read failed!\n");
|
||||||
|
#endif /* FSFW_PRINT_VERBOSITY_LEVEL == 1 */
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
#include "../datapool/PoolEntryIF.h"
|
#include "../datapool/PoolEntryIF.h"
|
||||||
#include "../housekeeping/HousekeepingMessage.h"
|
#include "../housekeeping/HousekeepingMessage.h"
|
||||||
#include "../ipc/MessageQueueSenderIF.h"
|
#include "../ipc/MessageQueueSenderIF.h"
|
||||||
|
#include "../serviceinterface/ServiceInterface.h"
|
||||||
#include "LocalDataPoolManager.h"
|
#include "LocalDataPoolManager.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
#include "localPoolDefinitions.h"
|
#include "localPoolDefinitions.h"
|
||||||
|
|
||||||
class AccessPoolManagerIF;
|
class AccessPoolManagerIF;
|
||||||
@ -166,7 +166,15 @@ class HasLocalDataPoolIF {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual LocalPoolObjectBase* getPoolObjectHandle(lp_id_t localPoolId) {
|
virtual LocalPoolObjectBase* getPoolObjectHandle(lp_id_t localPoolId) {
|
||||||
FSFW_LOGW("{}", "HasLocalDataPoolIF::getPoolObjectHandle: Not overriden. Returning nullptr\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "HasLocalDataPoolIF::getPoolObjectHandle: Not overriden. "
|
||||||
|
"Returning nullptr!"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"HasLocalDataPoolIF::getPoolObjectHandle: "
|
||||||
|
"Not overriden. Returning nullptr!\n");
|
||||||
|
#endif
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "fsfw/FSFW.h"
|
|
||||||
#include "fsfw/datapoollocal.h"
|
#include "fsfw/datapoollocal.h"
|
||||||
#include "fsfw/housekeeping/AcceptsHkPacketsIF.h"
|
#include "fsfw/housekeeping/AcceptsHkPacketsIF.h"
|
||||||
#include "fsfw/housekeeping/HousekeepingSetPacket.h"
|
#include "fsfw/housekeeping/HousekeepingSetPacket.h"
|
||||||
@ -22,15 +21,15 @@ LocalDataPoolManager::LocalDataPoolManager(HasLocalDataPoolIF* owner, MessageQue
|
|||||||
bool appendValidityBuffer)
|
bool appendValidityBuffer)
|
||||||
: appendValidityBuffer(appendValidityBuffer) {
|
: appendValidityBuffer(appendValidityBuffer) {
|
||||||
if (owner == nullptr) {
|
if (owner == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "ctor", HasReturnvaluesIF::RETURN_FAILED,
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "LocalDataPoolManager",
|
||||||
"Invalid supplied owner");
|
HasReturnvaluesIF::RETURN_FAILED, "Invalid supplied owner");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this->owner = owner;
|
this->owner = owner;
|
||||||
mutex = MutexFactory::instance()->createMutex();
|
mutex = MutexFactory::instance()->createMutex();
|
||||||
if (mutex == nullptr) {
|
if (mutex == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::ERROR, "ctor", HasReturnvaluesIF::RETURN_FAILED,
|
printWarningOrError(sif::OutputTypes::OUT_ERROR, "LocalDataPoolManager",
|
||||||
"Could not create mutex");
|
HasReturnvaluesIF::RETURN_FAILED, "Could not create mutex");
|
||||||
}
|
}
|
||||||
|
|
||||||
hkQueue = queueToUse;
|
hkQueue = queueToUse;
|
||||||
@ -45,25 +44,25 @@ LocalDataPoolManager::~LocalDataPoolManager() {
|
|||||||
ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) {
|
ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) {
|
||||||
if (queueToUse == nullptr) {
|
if (queueToUse == nullptr) {
|
||||||
/* Error, all destinations invalid */
|
/* Error, all destinations invalid */
|
||||||
printWarningOrError(sif::LogLevel::ERROR, "initialize", QUEUE_OR_DESTINATION_INVALID);
|
printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize", QUEUE_OR_DESTINATION_INVALID);
|
||||||
}
|
}
|
||||||
hkQueue = queueToUse;
|
hkQueue = queueToUse;
|
||||||
|
|
||||||
ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
||||||
if (ipcStore == nullptr) {
|
if (ipcStore == nullptr) {
|
||||||
/* Error, all destinations invalid */
|
/* Error, all destinations invalid */
|
||||||
printWarningOrError(sif::LogLevel::ERROR, "initialize", HasReturnvaluesIF::RETURN_FAILED,
|
printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize", HasReturnvaluesIF::RETURN_FAILED,
|
||||||
"Could not set IPC store.");
|
"Could not set IPC store.");
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defaultHkDestination != objects::NO_OBJECT) {
|
if (defaultHkDestination != objects::NO_OBJECT) {
|
||||||
auto* hkPacketReceiver =
|
AcceptsHkPacketsIF* hkPacketReceiver =
|
||||||
ObjectManager::instance()->get<AcceptsHkPacketsIF>(defaultHkDestination);
|
ObjectManager::instance()->get<AcceptsHkPacketsIF>(defaultHkDestination);
|
||||||
if (hkPacketReceiver != nullptr) {
|
if (hkPacketReceiver != nullptr) {
|
||||||
hkDestinationId = hkPacketReceiver->getHkQueue();
|
hkDestinationId = hkPacketReceiver->getHkQueue();
|
||||||
} else {
|
} else {
|
||||||
printWarningOrError(sif::LogLevel::ERROR, "initialize", QUEUE_OR_DESTINATION_INVALID);
|
printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize", QUEUE_OR_DESTINATION_INVALID);
|
||||||
return QUEUE_OR_DESTINATION_INVALID;
|
return QUEUE_OR_DESTINATION_INVALID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,7 +84,7 @@ ReturnValue_t LocalDataPoolManager::initializeHousekeepingPoolEntriesOnce() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "initializeHousekeepingPoolEntriesOnce",
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "initializeHousekeepingPoolEntriesOnce",
|
||||||
HasReturnvaluesIF::RETURN_FAILED, "The map should only be initialized once");
|
HasReturnvaluesIF::RETURN_FAILED, "The map should only be initialized once");
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
@ -151,7 +150,8 @@ ReturnValue_t LocalDataPoolManager::handleNotificationUpdate(HkReceiver& receive
|
|||||||
LocalPoolObjectBase* poolObj =
|
LocalPoolObjectBase* poolObj =
|
||||||
HasLocalDpIFManagerAttorney::getPoolObjectHandle(owner, receiver.dataId.localPoolId);
|
HasLocalDpIFManagerAttorney::getPoolObjectHandle(owner, receiver.dataId.localPoolId);
|
||||||
if (poolObj == nullptr) {
|
if (poolObj == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "handleNotificationUpdate", POOLOBJECT_NOT_FOUND);
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "handleNotificationUpdate",
|
||||||
|
POOLOBJECT_NOT_FOUND);
|
||||||
return POOLOBJECT_NOT_FOUND;
|
return POOLOBJECT_NOT_FOUND;
|
||||||
}
|
}
|
||||||
if (poolObj->hasChanged()) {
|
if (poolObj->hasChanged()) {
|
||||||
@ -170,7 +170,8 @@ ReturnValue_t LocalDataPoolManager::handleNotificationUpdate(HkReceiver& receive
|
|||||||
LocalPoolDataSetBase* dataSet =
|
LocalPoolDataSetBase* dataSet =
|
||||||
HasLocalDpIFManagerAttorney::getDataSetHandle(owner, receiver.dataId.sid);
|
HasLocalDpIFManagerAttorney::getDataSetHandle(owner, receiver.dataId.sid);
|
||||||
if (dataSet == nullptr) {
|
if (dataSet == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "handleNotificationUpdate", DATASET_NOT_FOUND);
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "handleNotificationUpdate",
|
||||||
|
DATASET_NOT_FOUND);
|
||||||
return DATASET_NOT_FOUND;
|
return DATASET_NOT_FOUND;
|
||||||
}
|
}
|
||||||
if (dataSet->hasChanged()) {
|
if (dataSet->hasChanged()) {
|
||||||
@ -198,7 +199,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
|
|||||||
LocalPoolObjectBase* poolObj =
|
LocalPoolObjectBase* poolObj =
|
||||||
HasLocalDpIFManagerAttorney::getPoolObjectHandle(owner, receiver.dataId.localPoolId);
|
HasLocalDpIFManagerAttorney::getPoolObjectHandle(owner, receiver.dataId.localPoolId);
|
||||||
if (poolObj == nullptr) {
|
if (poolObj == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "handleNotificationSnapshot",
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "handleNotificationSnapshot",
|
||||||
POOLOBJECT_NOT_FOUND);
|
POOLOBJECT_NOT_FOUND);
|
||||||
return POOLOBJECT_NOT_FOUND;
|
return POOLOBJECT_NOT_FOUND;
|
||||||
}
|
}
|
||||||
@ -234,7 +235,8 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
|
|||||||
LocalPoolDataSetBase* dataSet =
|
LocalPoolDataSetBase* dataSet =
|
||||||
HasLocalDpIFManagerAttorney::getDataSetHandle(owner, receiver.dataId.sid);
|
HasLocalDpIFManagerAttorney::getDataSetHandle(owner, receiver.dataId.sid);
|
||||||
if (dataSet == nullptr) {
|
if (dataSet == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "handleNotificationSnapshot", DATASET_NOT_FOUND);
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "handleNotificationSnapshot",
|
||||||
|
DATASET_NOT_FOUND);
|
||||||
return DATASET_NOT_FOUND;
|
return DATASET_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,9 +245,9 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare and send update snapshot */
|
/* Prepare and send update snapshot */
|
||||||
timeval now{};
|
timeval now;
|
||||||
Clock::getClock_timeval(&now);
|
Clock::getClock_timeval(&now);
|
||||||
CCSDSTime::CDS_short cds{};
|
CCSDSTime::CDS_short cds;
|
||||||
CCSDSTime::convertToCcsds(&cds, &now);
|
CCSDSTime::convertToCcsds(&cds, &now);
|
||||||
HousekeepingSnapshot updatePacket(
|
HousekeepingSnapshot updatePacket(
|
||||||
reinterpret_cast<uint8_t*>(&cds), sizeof(cds),
|
reinterpret_cast<uint8_t*>(&cds), sizeof(cds),
|
||||||
@ -340,7 +342,7 @@ ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid, bool e
|
|||||||
AcceptsHkPacketsIF* hkReceiverObject =
|
AcceptsHkPacketsIF* hkReceiverObject =
|
||||||
ObjectManager::instance()->get<AcceptsHkPacketsIF>(packetDestination);
|
ObjectManager::instance()->get<AcceptsHkPacketsIF>(packetDestination);
|
||||||
if (hkReceiverObject == nullptr) {
|
if (hkReceiverObject == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "subscribeForPeriodicPacket",
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "subscribeForPeriodicPacket",
|
||||||
QUEUE_OR_DESTINATION_INVALID);
|
QUEUE_OR_DESTINATION_INVALID);
|
||||||
return QUEUE_OR_DESTINATION_INVALID;
|
return QUEUE_OR_DESTINATION_INVALID;
|
||||||
}
|
}
|
||||||
@ -366,9 +368,10 @@ ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid, bool e
|
|||||||
ReturnValue_t LocalDataPoolManager::subscribeForUpdatePacket(sid_t sid, bool isDiagnostics,
|
ReturnValue_t LocalDataPoolManager::subscribeForUpdatePacket(sid_t sid, bool isDiagnostics,
|
||||||
bool reportingEnabled,
|
bool reportingEnabled,
|
||||||
object_id_t packetDestination) {
|
object_id_t packetDestination) {
|
||||||
auto* hkReceiverObject = ObjectManager::instance()->get<AcceptsHkPacketsIF>(packetDestination);
|
AcceptsHkPacketsIF* hkReceiverObject =
|
||||||
|
ObjectManager::instance()->get<AcceptsHkPacketsIF>(packetDestination);
|
||||||
if (hkReceiverObject == nullptr) {
|
if (hkReceiverObject == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "subscribeForPeriodicPacket",
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "subscribeForPeriodicPacket",
|
||||||
QUEUE_OR_DESTINATION_INVALID);
|
QUEUE_OR_DESTINATION_INVALID);
|
||||||
return QUEUE_OR_DESTINATION_INVALID;
|
return QUEUE_OR_DESTINATION_INVALID;
|
||||||
}
|
}
|
||||||
@ -521,7 +524,8 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* me
|
|||||||
case (HousekeepingMessage::GENERATE_ONE_DIAGNOSTICS_REPORT): {
|
case (HousekeepingMessage::GENERATE_ONE_DIAGNOSTICS_REPORT): {
|
||||||
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
||||||
if (dataSet == nullptr) {
|
if (dataSet == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "handleHousekeepingMessage", DATASET_NOT_FOUND);
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "handleHousekeepingMessage",
|
||||||
|
DATASET_NOT_FOUND);
|
||||||
return DATASET_NOT_FOUND;
|
return DATASET_NOT_FOUND;
|
||||||
}
|
}
|
||||||
if (command == HousekeepingMessage::GENERATE_ONE_PARAMETER_REPORT and
|
if (command == HousekeepingMessage::GENERATE_ONE_PARAMETER_REPORT and
|
||||||
@ -584,7 +588,8 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* me
|
|||||||
ReturnValue_t LocalDataPoolManager::printPoolEntry(lp_id_t localPoolId) {
|
ReturnValue_t LocalDataPoolManager::printPoolEntry(lp_id_t localPoolId) {
|
||||||
auto poolIter = localPoolMap.find(localPoolId);
|
auto poolIter = localPoolMap.find(localPoolId);
|
||||||
if (poolIter == localPoolMap.end()) {
|
if (poolIter == localPoolMap.end()) {
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "printPoolEntry", localpool::POOL_ENTRY_NOT_FOUND);
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "printPoolEntry",
|
||||||
|
localpool::POOL_ENTRY_NOT_FOUND);
|
||||||
return localpool::POOL_ENTRY_NOT_FOUND;
|
return localpool::POOL_ENTRY_NOT_FOUND;
|
||||||
}
|
}
|
||||||
poolIter->second->print();
|
poolIter->second->print();
|
||||||
@ -601,7 +606,8 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
|
|||||||
MessageQueueId_t destination) {
|
MessageQueueId_t destination) {
|
||||||
if (dataSet == nullptr) {
|
if (dataSet == nullptr) {
|
||||||
/* Configuration error. */
|
/* Configuration error. */
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "generateHousekeepingPacket", DATASET_NOT_FOUND);
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "generateHousekeepingPacket",
|
||||||
|
DATASET_NOT_FOUND);
|
||||||
return DATASET_NOT_FOUND;
|
return DATASET_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -624,14 +630,14 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
|
|||||||
|
|
||||||
if (hkQueue == nullptr) {
|
if (hkQueue == nullptr) {
|
||||||
/* Error, no queue available to send packet with. */
|
/* Error, no queue available to send packet with. */
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "generateHousekeepingPacket",
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "generateHousekeepingPacket",
|
||||||
QUEUE_OR_DESTINATION_INVALID);
|
QUEUE_OR_DESTINATION_INVALID);
|
||||||
return QUEUE_OR_DESTINATION_INVALID;
|
return QUEUE_OR_DESTINATION_INVALID;
|
||||||
}
|
}
|
||||||
if (destination == MessageQueueIF::NO_QUEUE) {
|
if (destination == MessageQueueIF::NO_QUEUE) {
|
||||||
if (hkDestinationId == MessageQueueIF::NO_QUEUE) {
|
if (hkDestinationId == MessageQueueIF::NO_QUEUE) {
|
||||||
/* Error, all destinations invalid */
|
/* Error, all destinations invalid */
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "generateHousekeepingPacket",
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "generateHousekeepingPacket",
|
||||||
QUEUE_OR_DESTINATION_INVALID);
|
QUEUE_OR_DESTINATION_INVALID);
|
||||||
}
|
}
|
||||||
destination = hkDestinationId;
|
destination = hkDestinationId;
|
||||||
@ -665,7 +671,8 @@ void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) {
|
|||||||
sid_t sid = receiver.dataId.sid;
|
sid_t sid = receiver.dataId.sid;
|
||||||
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
||||||
if (dataSet == nullptr) {
|
if (dataSet == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "performPeriodicHkGeneration", DATASET_NOT_FOUND);
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "performPeriodicHkGeneration",
|
||||||
|
DATASET_NOT_FOUND);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -688,7 +695,12 @@ void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) {
|
|||||||
ReturnValue_t result = generateHousekeepingPacket(sid, dataSet, true);
|
ReturnValue_t result = generateHousekeepingPacket(sid, dataSet, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
/* Configuration error */
|
/* Configuration error */
|
||||||
FSFW_LOGWT("performPeriodicHkOperation: HK generation failed\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "LocalDataPoolManager::performPeriodicHkOperation: HK generation failed."
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("LocalDataPoolManager::performPeriodicHkOperation: HK generation failed.\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,7 +708,8 @@ ReturnValue_t LocalDataPoolManager::togglePeriodicGeneration(sid_t sid, bool ena
|
|||||||
bool isDiagnostics) {
|
bool isDiagnostics) {
|
||||||
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
||||||
if (dataSet == nullptr) {
|
if (dataSet == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "togglePeriodicGeneration", DATASET_NOT_FOUND);
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "togglePeriodicGeneration",
|
||||||
|
DATASET_NOT_FOUND);
|
||||||
return DATASET_NOT_FOUND;
|
return DATASET_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -718,7 +731,8 @@ ReturnValue_t LocalDataPoolManager::changeCollectionInterval(sid_t sid, float ne
|
|||||||
bool isDiagnostics) {
|
bool isDiagnostics) {
|
||||||
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
||||||
if (dataSet == nullptr) {
|
if (dataSet == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "changeCollectionInterval", DATASET_NOT_FOUND);
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "changeCollectionInterval",
|
||||||
|
DATASET_NOT_FOUND);
|
||||||
return DATASET_NOT_FOUND;
|
return DATASET_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -743,7 +757,8 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool i
|
|||||||
/* Get and check dataset first. */
|
/* Get and check dataset first. */
|
||||||
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
||||||
if (dataSet == nullptr) {
|
if (dataSet == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "performPeriodicHkGeneration", DATASET_NOT_FOUND);
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "performPeriodicHkGeneration",
|
||||||
|
DATASET_NOT_FOUND);
|
||||||
return DATASET_NOT_FOUND;
|
return DATASET_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -764,7 +779,7 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool i
|
|||||||
store_address_t storeId;
|
store_address_t storeId;
|
||||||
ReturnValue_t result = ipcStore->getFreeElement(&storeId, expectedSize, &storePtr);
|
ReturnValue_t result = ipcStore->getFreeElement(&storeId, expectedSize, &storePtr);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
printWarningOrError(sif::LogLevel::ERROR, "generateSetStructurePacket",
|
printWarningOrError(sif::OutputTypes::OUT_ERROR, "generateSetStructurePacket",
|
||||||
HasReturnvaluesIF::RETURN_FAILED,
|
HasReturnvaluesIF::RETURN_FAILED,
|
||||||
"Could not get free element from IPC store.");
|
"Could not get free element from IPC store.");
|
||||||
return result;
|
return result;
|
||||||
@ -778,7 +793,7 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool i
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (expectedSize != size) {
|
if (expectedSize != size) {
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "generateSetStructurePacket",
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "generateSetStructurePacket",
|
||||||
HasReturnvaluesIF::RETURN_FAILED,
|
HasReturnvaluesIF::RETURN_FAILED,
|
||||||
"Expected size is not equal to serialized size");
|
"Expected size is not equal to serialized size");
|
||||||
}
|
}
|
||||||
@ -811,8 +826,9 @@ MutexIF* LocalDataPoolManager::getLocalPoolMutex() { return this->mutex; }
|
|||||||
|
|
||||||
object_id_t LocalDataPoolManager::getCreatorObjectId() const { return owner->getObjectId(); }
|
object_id_t LocalDataPoolManager::getCreatorObjectId() const { return owner->getObjectId(); }
|
||||||
|
|
||||||
void LocalDataPoolManager::printWarningOrError(sif::LogLevel outputType, const char* functionName,
|
void LocalDataPoolManager::printWarningOrError(sif::OutputTypes outputType,
|
||||||
ReturnValue_t error, const char* errorPrint) {
|
const char* functionName, ReturnValue_t error,
|
||||||
|
const char* errorPrint) {
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
if (errorPrint == nullptr) {
|
if (errorPrint == nullptr) {
|
||||||
if (error == DATASET_NOT_FOUND) {
|
if (error == DATASET_NOT_FOUND) {
|
||||||
@ -820,7 +836,7 @@ void LocalDataPoolManager::printWarningOrError(sif::LogLevel outputType, const c
|
|||||||
} else if (error == POOLOBJECT_NOT_FOUND) {
|
} else if (error == POOLOBJECT_NOT_FOUND) {
|
||||||
errorPrint = "Pool Object not found";
|
errorPrint = "Pool Object not found";
|
||||||
} else if (error == HasReturnvaluesIF::RETURN_FAILED) {
|
} else if (error == HasReturnvaluesIF::RETURN_FAILED) {
|
||||||
if (outputType == sif::LogLevel::WARNING) {
|
if (outputType == sif::OutputTypes::OUT_WARNING) {
|
||||||
errorPrint = "Generic Warning";
|
errorPrint = "Generic Warning";
|
||||||
} else {
|
} else {
|
||||||
errorPrint = "Generic error";
|
errorPrint = "Generic error";
|
||||||
@ -840,10 +856,24 @@ void LocalDataPoolManager::printWarningOrError(sif::LogLevel outputType, const c
|
|||||||
objectId = owner->getObjectId();
|
objectId = owner->getObjectId();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outputType == sif::LogLevel::WARNING) {
|
if (outputType == sif::OutputTypes::OUT_WARNING) {
|
||||||
FSFW_LOGWT("{} | Object ID {} | {}\n", functionName, objectId, errorPrint);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
} else if (outputType == sif::LogLevel::ERROR) {
|
sif::warning << "LocalDataPoolManager::" << functionName << ": Object ID 0x" << std::setw(8)
|
||||||
FSFW_LOGET("{} | Object ID {} | {}\n", functionName, objectId, errorPrint);
|
<< std::setfill('0') << std::hex << objectId << " | " << errorPrint << std::dec
|
||||||
|
<< std::setfill(' ') << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n", functionName, objectId,
|
||||||
|
errorPrint);
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
|
} else if (outputType == sif::OutputTypes::OUT_ERROR) {
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "LocalDataPoolManager::" << functionName << ": Object ID 0x" << std::setw(8)
|
||||||
|
<< std::setfill('0') << std::hex << objectId << " | " << errorPrint << std::dec
|
||||||
|
<< std::setfill(' ') << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n", functionName, objectId,
|
||||||
|
errorPrint);
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
}
|
}
|
||||||
#endif /* #if FSFW_VERBOSE_LEVEL >= 1 */
|
#endif /* #if FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include "fsfw/ipc/MutexGuard.h"
|
#include "fsfw/ipc/MutexGuard.h"
|
||||||
#include "fsfw/ipc/MutexIF.h"
|
#include "fsfw/ipc/MutexIF.h"
|
||||||
#include "fsfw/objectmanager/SystemObjectIF.h"
|
#include "fsfw/objectmanager/SystemObjectIF.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
namespace Factory {
|
namespace Factory {
|
||||||
void setStaticFrameworkObjectIds();
|
void setStaticFrameworkObjectIds();
|
||||||
@ -375,7 +375,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
|
|||||||
ReturnValue_t handleNotificationSnapshot(HkReceiver& hkReceiver, ReturnValue_t& status);
|
ReturnValue_t handleNotificationSnapshot(HkReceiver& hkReceiver, ReturnValue_t& status);
|
||||||
ReturnValue_t addUpdateToStore(HousekeepingSnapshot& updatePacket, store_address_t& storeId);
|
ReturnValue_t addUpdateToStore(HousekeepingSnapshot& updatePacket, store_address_t& storeId);
|
||||||
|
|
||||||
void printWarningOrError(sif::LogLevel outputType, const char* functionName,
|
void printWarningOrError(sif::OutputTypes outputType, const char* functionName,
|
||||||
ReturnValue_t errorCode = HasReturnvaluesIF::RETURN_FAILED,
|
ReturnValue_t errorCode = HasReturnvaluesIF::RETURN_FAILED,
|
||||||
const char* errorPrint = nullptr);
|
const char* errorPrint = nullptr);
|
||||||
};
|
};
|
||||||
@ -389,13 +389,14 @@ inline ReturnValue_t LocalDataPoolManager::fetchPoolEntry(lp_id_t localPoolId,
|
|||||||
|
|
||||||
auto poolIter = localPoolMap.find(localPoolId);
|
auto poolIter = localPoolMap.find(localPoolId);
|
||||||
if (poolIter == localPoolMap.end()) {
|
if (poolIter == localPoolMap.end()) {
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "fetchPoolEntry", localpool::POOL_ENTRY_NOT_FOUND);
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "fetchPoolEntry",
|
||||||
|
localpool::POOL_ENTRY_NOT_FOUND);
|
||||||
return localpool::POOL_ENTRY_NOT_FOUND;
|
return localpool::POOL_ENTRY_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
*poolEntry = dynamic_cast<PoolEntry<T>*>(poolIter->second);
|
*poolEntry = dynamic_cast<PoolEntry<T>*>(poolIter->second);
|
||||||
if (*poolEntry == nullptr) {
|
if (*poolEntry == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "fetchPoolEntry",
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "fetchPoolEntry",
|
||||||
localpool::POOL_ENTRY_TYPE_CONFLICT);
|
localpool::POOL_ENTRY_TYPE_CONFLICT);
|
||||||
return localpool::POOL_ENTRY_TYPE_CONFLICT;
|
return localpool::POOL_ENTRY_TYPE_CONFLICT;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "fsfw/housekeeping/PeriodicHousekeepingHelper.h"
|
#include "fsfw/housekeeping/PeriodicHousekeepingHelper.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/serialize/SerializeAdapter.h"
|
#include "fsfw/serialize/SerializeAdapter.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "internal/HasLocalDpIFUserAttorney.h"
|
#include "internal/HasLocalDpIFUserAttorney.h"
|
||||||
|
|
||||||
LocalPoolDataSetBase::LocalPoolDataSetBase(HasLocalDataPoolIF *hkOwner, uint32_t setId,
|
LocalPoolDataSetBase::LocalPoolDataSetBase(HasLocalDataPoolIF *hkOwner, uint32_t setId,
|
||||||
@ -16,7 +16,14 @@ LocalPoolDataSetBase::LocalPoolDataSetBase(HasLocalDataPoolIF *hkOwner, uint32_t
|
|||||||
: PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) {
|
: PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) {
|
||||||
if (hkOwner == nullptr) {
|
if (hkOwner == nullptr) {
|
||||||
// Configuration error.
|
// Configuration error.
|
||||||
FSFW_LOGW("{}", "LocalPoolDataSetBase::LocalPoolDataSetBase: Owner invalid\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "LocalPoolDataSetBase::LocalPoolDataSetBase: Owner "
|
||||||
|
<< "invalid!" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError(
|
||||||
|
"LocalPoolDataSetBase::LocalPoolDataSetBase: Owner "
|
||||||
|
"invalid!\n\r");
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AccessPoolManagerIF *accessor = HasLocalDpIFUserAttorney::getAccessorHandle(hkOwner);
|
AccessPoolManagerIF *accessor = HasLocalDpIFUserAttorney::getAccessorHandle(hkOwner);
|
||||||
@ -179,7 +186,14 @@ ReturnValue_t LocalPoolDataSetBase::serializeLocalPoolIds(uint8_t **buffer, size
|
|||||||
auto result =
|
auto result =
|
||||||
SerializeAdapter::serialize(¤tPoolId, buffer, size, maxSize, streamEndianness);
|
SerializeAdapter::serialize(¤tPoolId, buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGW("{}", "serializeLocalPoolIds: Serialization error\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "LocalPoolDataSetBase::serializeLocalPoolIds: "
|
||||||
|
<< "Serialization error!" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"LocalPoolDataSetBase::serializeLocalPoolIds: "
|
||||||
|
"Serialization error!\n\r");
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,17 +4,22 @@
|
|||||||
#include "fsfw/datapoollocal/HasLocalDataPoolIF.h"
|
#include "fsfw/datapoollocal/HasLocalDataPoolIF.h"
|
||||||
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
#include "internal/HasLocalDpIFUserAttorney.h"
|
#include "internal/HasLocalDpIFUserAttorney.h"
|
||||||
|
|
||||||
LocalPoolObjectBase::LocalPoolObjectBase(lp_id_t poolId, HasLocalDataPoolIF* hkOwner,
|
LocalPoolObjectBase::LocalPoolObjectBase(lp_id_t poolId, HasLocalDataPoolIF* hkOwner,
|
||||||
DataSetIF* dataSet, pool_rwm_t setReadWriteMode)
|
DataSetIF* dataSet, pool_rwm_t setReadWriteMode)
|
||||||
: localPoolId(poolId), readWriteMode(setReadWriteMode) {
|
: localPoolId(poolId), readWriteMode(setReadWriteMode) {
|
||||||
if (poolId == PoolVariableIF::NO_PARAMETER) {
|
if (poolId == PoolVariableIF::NO_PARAMETER) {
|
||||||
FSFW_LOGWT("{}", "ctor: Invalid pool ID, has NO_PARAMETER value\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "LocalPoolVar<T>::LocalPoolVar: 0 passed as pool ID, "
|
||||||
|
<< "which is the NO_PARAMETER value!" << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (hkOwner == nullptr) {
|
if (hkOwner == nullptr) {
|
||||||
FSFW_LOGET("{}", "ctor: Supplied pool owner is a invalid\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "LocalPoolVar<T>::LocalPoolVar: The supplied pool "
|
||||||
|
<< "owner is a invalid!" << std::endl;
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AccessPoolManagerIF* poolManAccessor = HasLocalDpIFUserAttorney::getAccessorHandle(hkOwner);
|
AccessPoolManagerIF* poolManAccessor = HasLocalDpIFUserAttorney::getAccessorHandle(hkOwner);
|
||||||
@ -29,14 +34,28 @@ LocalPoolObjectBase::LocalPoolObjectBase(object_id_t poolOwner, lp_id_t poolId,
|
|||||||
pool_rwm_t setReadWriteMode)
|
pool_rwm_t setReadWriteMode)
|
||||||
: localPoolId(poolId), readWriteMode(setReadWriteMode) {
|
: localPoolId(poolId), readWriteMode(setReadWriteMode) {
|
||||||
if (poolId == PoolVariableIF::NO_PARAMETER) {
|
if (poolId == PoolVariableIF::NO_PARAMETER) {
|
||||||
FSFW_LOGWT("{}", "ctor: Invalid pool ID, has NO_PARAMETER value\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "LocalPoolVar<T>::LocalPoolVar: 0 passed as pool ID, "
|
||||||
|
"which is the NO_PARAMETER value!"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"LocalPoolVar<T>::LocalPoolVar: 0 passed as pool ID, "
|
||||||
|
"which is the NO_PARAMETER value!\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
auto* hkOwner = ObjectManager::instance()->get<HasLocalDataPoolIF>(poolOwner);
|
HasLocalDataPoolIF* hkOwner = ObjectManager::instance()->get<HasLocalDataPoolIF>(poolOwner);
|
||||||
if (hkOwner == nullptr) {
|
if (hkOwner == nullptr) {
|
||||||
FSFW_LOGWT(
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
"ctor: The supplied pool owner {:#010x} did not implement the correct interface "
|
sif::error << "LocalPoolVariable: The supplied pool owner 0x" << std::hex << poolOwner
|
||||||
"HasLocalDataPoolIF\n",
|
<< std::dec << " did not implement the correct interface "
|
||||||
|
<< "HasLocalDataPoolIF" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError(
|
||||||
|
"LocalPoolVariable: The supplied pool owner 0x%08x did not implement the correct "
|
||||||
|
"interface HasLocalDataPoolIF\n",
|
||||||
poolOwner);
|
poolOwner);
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,6 +89,7 @@ void LocalPoolObjectBase::setReadWriteMode(pool_rwm_t newReadWriteMode) {
|
|||||||
|
|
||||||
void LocalPoolObjectBase::reportReadCommitError(const char* variableType, ReturnValue_t error,
|
void LocalPoolObjectBase::reportReadCommitError(const char* variableType, ReturnValue_t error,
|
||||||
bool read, object_id_t objectId, lp_id_t lpId) {
|
bool read, object_id_t objectId, lp_id_t lpId) {
|
||||||
|
#if FSFW_DISABLE_PRINTOUT == 0
|
||||||
const char* variablePrintout = variableType;
|
const char* variablePrintout = variableType;
|
||||||
if (variablePrintout == nullptr) {
|
if (variablePrintout == nullptr) {
|
||||||
variablePrintout = "Unknown Type";
|
variablePrintout = "Unknown Type";
|
||||||
@ -94,6 +114,13 @@ void LocalPoolObjectBase::reportReadCommitError(const char* variableType, Return
|
|||||||
errMsg = "Unknown error code";
|
errMsg = "Unknown error code";
|
||||||
}
|
}
|
||||||
|
|
||||||
FSFW_LOGW("{}: {} call | {} | Owner: {:#010x} | LPID: \n", variablePrintout, type, errMsg,
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << variablePrintout << ": " << type << " call | " << errMsg << " | Owner: 0x"
|
||||||
|
<< std::hex << std::setw(8) << std::setfill('0') << objectId << std::dec
|
||||||
|
<< " LPID: " << lpId << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("%s: %s call | %s | Owner: 0x%08x LPID: %lu\n", variablePrintout, type, errMsg,
|
||||||
objectId, lpId);
|
objectId, lpId);
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
|
#endif /* FSFW_DISABLE_PRINTOUT == 0 */
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
#include "../datapool/PoolVariableIF.h"
|
#include "../datapool/PoolVariableIF.h"
|
||||||
#include "../objectmanager/ObjectManagerIF.h"
|
#include "../objectmanager/ObjectManagerIF.h"
|
||||||
#include "../serialize/SerializeAdapter.h"
|
#include "../serialize/SerializeAdapter.h"
|
||||||
|
#include "../serviceinterface/ServiceInterface.h"
|
||||||
#include "AccessLocalPoolF.h"
|
#include "AccessLocalPoolF.h"
|
||||||
#include "HasLocalDataPoolIF.h"
|
#include "HasLocalDataPoolIF.h"
|
||||||
#include "LocalDataPoolManager.h"
|
#include "LocalDataPoolManager.h"
|
||||||
#include "LocalPoolObjectBase.h"
|
#include "LocalPoolObjectBase.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
#include "internal/LocalDpManagerAttorney.h"
|
#include "internal/LocalDpManagerAttorney.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
#include "../datapool/PoolVariableIF.h"
|
#include "../datapool/PoolVariableIF.h"
|
||||||
#include "../datapoollocal/LocalDataPoolManager.h"
|
#include "../datapoollocal/LocalDataPoolManager.h"
|
||||||
#include "../serialize/SerializeAdapter.h"
|
#include "../serialize/SerializeAdapter.h"
|
||||||
|
#include "../serviceinterface/ServiceInterface.h"
|
||||||
#include "LocalPoolObjectBase.h"
|
#include "LocalPoolObjectBase.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
#include "internal/LocalDpManagerAttorney.h"
|
#include "internal/LocalDpManagerAttorney.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,48 +5,47 @@
|
|||||||
#error Include LocalPoolVector.h before LocalPoolVector.tpp!
|
#error Include LocalPoolVector.h before LocalPoolVector.tpp!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template <typename T, uint16_t vectorSize>
|
||||||
inline LocalPoolVector<T, vectorSize>::LocalPoolVector(
|
inline LocalPoolVector<T, vectorSize>::LocalPoolVector(HasLocalDataPoolIF* hkOwner, lp_id_t poolId,
|
||||||
HasLocalDataPoolIF* hkOwner, lp_id_t poolId, DataSetIF* dataSet,
|
DataSetIF* dataSet,
|
||||||
pool_rwm_t setReadWriteMode):
|
pool_rwm_t setReadWriteMode)
|
||||||
LocalPoolObjectBase(poolId, hkOwner, dataSet, setReadWriteMode) {}
|
: LocalPoolObjectBase(poolId, hkOwner, dataSet, setReadWriteMode) {}
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template <typename T, uint16_t vectorSize>
|
||||||
inline LocalPoolVector<T, vectorSize>::LocalPoolVector(object_id_t poolOwner,
|
inline LocalPoolVector<T, vectorSize>::LocalPoolVector(object_id_t poolOwner, lp_id_t poolId,
|
||||||
lp_id_t poolId, DataSetIF *dataSet, pool_rwm_t setReadWriteMode):
|
DataSetIF* dataSet,
|
||||||
LocalPoolObjectBase(poolOwner, poolId, dataSet, setReadWriteMode) {}
|
pool_rwm_t setReadWriteMode)
|
||||||
|
: LocalPoolObjectBase(poolOwner, poolId, dataSet, setReadWriteMode) {}
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template <typename T, uint16_t vectorSize>
|
||||||
inline LocalPoolVector<T, vectorSize>::LocalPoolVector(gp_id_t globalPoolId,
|
inline LocalPoolVector<T, vectorSize>::LocalPoolVector(gp_id_t globalPoolId, DataSetIF* dataSet,
|
||||||
DataSetIF *dataSet, pool_rwm_t setReadWriteMode):
|
pool_rwm_t setReadWriteMode)
|
||||||
LocalPoolObjectBase(globalPoolId.objectId, globalPoolId.localPoolId,
|
: LocalPoolObjectBase(globalPoolId.objectId, globalPoolId.localPoolId, dataSet,
|
||||||
dataSet, setReadWriteMode) {}
|
setReadWriteMode) {}
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template <typename T, uint16_t vectorSize>
|
||||||
inline ReturnValue_t LocalPoolVector<T, vectorSize>::read(
|
inline ReturnValue_t LocalPoolVector<T, vectorSize>::read(MutexIF::TimeoutType timeoutType,
|
||||||
MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) {
|
uint32_t timeoutMs) {
|
||||||
MutexGuard(LocalDpManagerAttorney::getMutexHandle(*hkManager), timeoutType, timeoutMs);
|
MutexGuard(LocalDpManagerAttorney::getMutexHandle(*hkManager), timeoutType, timeoutMs);
|
||||||
return readWithoutLock();
|
return readWithoutLock();
|
||||||
}
|
}
|
||||||
template<typename T, uint16_t vectorSize>
|
template <typename T, uint16_t vectorSize>
|
||||||
inline ReturnValue_t LocalPoolVector<T, vectorSize>::readWithoutLock() {
|
inline ReturnValue_t LocalPoolVector<T, vectorSize>::readWithoutLock() {
|
||||||
if(readWriteMode == pool_rwm_t::VAR_WRITE) {
|
if (readWriteMode == pool_rwm_t::VAR_WRITE) {
|
||||||
object_id_t targetObjectId = hkManager->getCreatorObjectId();
|
object_id_t targetObjectId = hkManager->getCreatorObjectId();
|
||||||
reportReadCommitError("LocalPoolVector",
|
reportReadCommitError("LocalPoolVector", PoolVariableIF::INVALID_READ_WRITE_MODE, true,
|
||||||
PoolVariableIF::INVALID_READ_WRITE_MODE, true, targetObjectId,
|
targetObjectId, localPoolId);
|
||||||
localPoolId);
|
|
||||||
return PoolVariableIF::INVALID_READ_WRITE_MODE;
|
return PoolVariableIF::INVALID_READ_WRITE_MODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
PoolEntry<T>* poolEntry = nullptr;
|
PoolEntry<T>* poolEntry = nullptr;
|
||||||
ReturnValue_t result = LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId,
|
ReturnValue_t result =
|
||||||
&poolEntry);
|
LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId, &poolEntry);
|
||||||
memset(this->value, 0, vectorSize * sizeof(T));
|
memset(this->value, 0, vectorSize * sizeof(T));
|
||||||
|
|
||||||
if(result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
object_id_t targetObjectId = hkManager->getCreatorObjectId();
|
object_id_t targetObjectId = hkManager->getCreatorObjectId();
|
||||||
reportReadCommitError("LocalPoolVector", result, true, targetObjectId,
|
reportReadCommitError("LocalPoolVector", result, true, targetObjectId, localPoolId);
|
||||||
localPoolId);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::memcpy(this->value, poolEntry->getDataPtr(), poolEntry->getByteSize());
|
std::memcpy(this->value, poolEntry->getDataPtr(), poolEntry->getByteSize());
|
||||||
@ -54,36 +53,35 @@ inline ReturnValue_t LocalPoolVector<T, vectorSize>::readWithoutLock() {
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template <typename T, uint16_t vectorSize>
|
||||||
inline ReturnValue_t LocalPoolVector<T, vectorSize>::commit(bool valid,
|
inline ReturnValue_t LocalPoolVector<T, vectorSize>::commit(bool valid,
|
||||||
MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) {
|
MutexIF::TimeoutType timeoutType,
|
||||||
|
uint32_t timeoutMs) {
|
||||||
this->setValid(valid);
|
this->setValid(valid);
|
||||||
return commit(timeoutType, timeoutMs);
|
return commit(timeoutType, timeoutMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template <typename T, uint16_t vectorSize>
|
||||||
inline ReturnValue_t LocalPoolVector<T, vectorSize>::commit(
|
inline ReturnValue_t LocalPoolVector<T, vectorSize>::commit(MutexIF::TimeoutType timeoutType,
|
||||||
MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) {
|
uint32_t timeoutMs) {
|
||||||
MutexGuard(LocalDpManagerAttorney::getMutexHandle(*hkManager), timeoutType, timeoutMs);
|
MutexGuard(LocalDpManagerAttorney::getMutexHandle(*hkManager), timeoutType, timeoutMs);
|
||||||
return commitWithoutLock();
|
return commitWithoutLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template <typename T, uint16_t vectorSize>
|
||||||
inline ReturnValue_t LocalPoolVector<T, vectorSize>::commitWithoutLock() {
|
inline ReturnValue_t LocalPoolVector<T, vectorSize>::commitWithoutLock() {
|
||||||
if(readWriteMode == pool_rwm_t::VAR_READ) {
|
if (readWriteMode == pool_rwm_t::VAR_READ) {
|
||||||
object_id_t targetObjectId = hkManager->getCreatorObjectId();
|
object_id_t targetObjectId = hkManager->getCreatorObjectId();
|
||||||
reportReadCommitError("LocalPoolVector",
|
reportReadCommitError("LocalPoolVector", PoolVariableIF::INVALID_READ_WRITE_MODE, false,
|
||||||
PoolVariableIF::INVALID_READ_WRITE_MODE, false, targetObjectId,
|
targetObjectId, localPoolId);
|
||||||
localPoolId);
|
|
||||||
return PoolVariableIF::INVALID_READ_WRITE_MODE;
|
return PoolVariableIF::INVALID_READ_WRITE_MODE;
|
||||||
}
|
}
|
||||||
PoolEntry<T>* poolEntry = nullptr;
|
PoolEntry<T>* poolEntry = nullptr;
|
||||||
ReturnValue_t result = LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId,
|
ReturnValue_t result =
|
||||||
&poolEntry);
|
LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId, &poolEntry);
|
||||||
if(result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
object_id_t targetObjectId = hkManager->getCreatorObjectId();
|
object_id_t targetObjectId = hkManager->getCreatorObjectId();
|
||||||
reportReadCommitError("LocalPoolVector", result, false, targetObjectId,
|
reportReadCommitError("LocalPoolVector", result, false, targetObjectId, localPoolId);
|
||||||
localPoolId);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::memcpy(poolEntry->getDataPtr(), this->value, poolEntry->getByteSize());
|
std::memcpy(poolEntry->getDataPtr(), this->value, poolEntry->getByteSize());
|
||||||
@ -91,36 +89,51 @@ inline ReturnValue_t LocalPoolVector<T, vectorSize>::commitWithoutLock() {
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template <typename T, uint16_t vectorSize>
|
||||||
inline T& LocalPoolVector<T, vectorSize>::operator [](size_t i) {
|
inline T& LocalPoolVector<T, vectorSize>::operator[](size_t i) {
|
||||||
if(i < vectorSize) {
|
if (i < vectorSize) {
|
||||||
return value[i];
|
return value[i];
|
||||||
}
|
}
|
||||||
// If this happens, I have to set some value. I consider this
|
// If this happens, I have to set some value. I consider this
|
||||||
// a configuration error, but I wont exit here.
|
// a configuration error, but I wont exit here.
|
||||||
FSFW_LOGW("LocalPoolVector: Invalid index. Setting or returning last value\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "LocalPoolVector: Invalid index. Setting or returning"
|
||||||
|
" last value!"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"LocalPoolVector: Invalid index. Setting or returning"
|
||||||
|
" last value!\n");
|
||||||
|
#endif
|
||||||
return value[vectorSize - 1];
|
return value[vectorSize - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template <typename T, uint16_t vectorSize>
|
||||||
inline const T& LocalPoolVector<T, vectorSize>::operator [](size_t i) const {
|
inline const T& LocalPoolVector<T, vectorSize>::operator[](size_t i) const {
|
||||||
if(i < vectorSize) {
|
if (i < vectorSize) {
|
||||||
return value[i];
|
return value[i];
|
||||||
}
|
}
|
||||||
// If this happens, I have to set some value. I consider this
|
// If this happens, I have to set some value. I consider this
|
||||||
// a configuration error, but I wont exit here.
|
// a configuration error, but I wont exit here.
|
||||||
FSFW_LOGW("LocalPoolVector: Invalid index. Setting or returning last value\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "LocalPoolVector: Invalid index. Setting or returning"
|
||||||
|
" last value!"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"LocalPoolVector: Invalid index. Setting or returning"
|
||||||
|
" last value!\n");
|
||||||
|
#endif
|
||||||
return value[vectorSize - 1];
|
return value[vectorSize - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template <typename T, uint16_t vectorSize>
|
||||||
inline ReturnValue_t LocalPoolVector<T, vectorSize>::serialize(uint8_t** buffer,
|
inline ReturnValue_t LocalPoolVector<T, vectorSize>::serialize(
|
||||||
size_t* size, size_t maxSize,
|
uint8_t** buffer, size_t* size, size_t maxSize,
|
||||||
SerializeIF::Endianness streamEndianness) const {
|
SerializeIF::Endianness streamEndianness) const {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
||||||
for (uint16_t i = 0; i < vectorSize; i++) {
|
for (uint16_t i = 0; i < vectorSize; i++) {
|
||||||
result = SerializeAdapter::serialize(&(value[i]), buffer, size,
|
result = SerializeAdapter::serialize(&(value[i]), buffer, size, maxSize, streamEndianness);
|
||||||
maxSize, streamEndianness);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -128,19 +141,17 @@ inline ReturnValue_t LocalPoolVector<T, vectorSize>::serialize(uint8_t** buffer,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template <typename T, uint16_t vectorSize>
|
||||||
inline size_t LocalPoolVector<T, vectorSize>::getSerializedSize() const {
|
inline size_t LocalPoolVector<T, vectorSize>::getSerializedSize() const {
|
||||||
return vectorSize * SerializeAdapter::getSerializedSize(value);
|
return vectorSize * SerializeAdapter::getSerializedSize(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template <typename T, uint16_t vectorSize>
|
||||||
inline ReturnValue_t LocalPoolVector<T, vectorSize>::deSerialize(
|
inline ReturnValue_t LocalPoolVector<T, vectorSize>::deSerialize(
|
||||||
const uint8_t** buffer, size_t* size,
|
const uint8_t** buffer, size_t* size, SerializeIF::Endianness streamEndianness) {
|
||||||
SerializeIF::Endianness streamEndianness) {
|
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
||||||
for (uint16_t i = 0; i < vectorSize; i++) {
|
for (uint16_t i = 0; i < vectorSize; i++) {
|
||||||
result = SerializeAdapter::deSerialize(&(value[i]), buffer, size,
|
result = SerializeAdapter::deSerialize(&(value[i]), buffer, size, streamEndianness);
|
||||||
streamEndianness);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -149,13 +160,12 @@ inline ReturnValue_t LocalPoolVector<T, vectorSize>::deSerialize(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
template<typename T, uint16_t vectorSize>
|
template <typename T, uint16_t vectorSize>
|
||||||
inline std::ostream& operator<< (std::ostream &out,
|
inline std::ostream& operator<<(std::ostream& out, const LocalPoolVector<T, vectorSize>& var) {
|
||||||
const LocalPoolVector<T, vectorSize> &var) {
|
|
||||||
out << "Vector: [";
|
out << "Vector: [";
|
||||||
for(int i = 0;i < vectorSize; i++) {
|
for (int i = 0; i < vectorSize; i++) {
|
||||||
out << var.value[i];
|
out << var.value[i];
|
||||||
if(i < vectorSize - 1) {
|
if (i < vectorSize - 1) {
|
||||||
out << ", ";
|
out << ", ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "fsfw/ipc/MessageQueueMessage.h"
|
#include "fsfw/ipc/MessageQueueMessage.h"
|
||||||
#include "fsfw/ipc/QueueFactory.h"
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||||
#include "fsfw/subsystem/SubsystemBase.h"
|
#include "fsfw/subsystem/SubsystemBase.h"
|
||||||
#include "fsfw/thermal/ThermalComponentIF.h"
|
#include "fsfw/thermal/ThermalComponentIF.h"
|
||||||
@ -45,16 +45,16 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, object_id_t device
|
|||||||
cookieInfo.state = COOKIE_UNUSED;
|
cookieInfo.state = COOKIE_UNUSED;
|
||||||
cookieInfo.pendingCommand = deviceCommandMap.end();
|
cookieInfo.pendingCommand = deviceCommandMap.end();
|
||||||
if (comCookie == nullptr) {
|
if (comCookie == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::ERROR, "DeviceHandlerBase", HasReturnvaluesIF::RETURN_FAILED,
|
printWarningOrError(sif::OutputTypes::OUT_ERROR, "DeviceHandlerBase",
|
||||||
"Invalid cookie");
|
HasReturnvaluesIF::RETURN_FAILED, "Invalid cookie");
|
||||||
}
|
}
|
||||||
if (this->fdirInstance == nullptr) {
|
if (this->fdirInstance == nullptr) {
|
||||||
this->fdirInstance = new DeviceHandlerFailureIsolation(setObjectId, defaultFdirParentId);
|
this->fdirInstance = new DeviceHandlerFailureIsolation(setObjectId, defaultFdirParentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceHandlerBase::setHkDestination(object_id_t hkDestination_) {
|
void DeviceHandlerBase::setHkDestination(object_id_t hkDestination) {
|
||||||
this->hkDestination = hkDestination_;
|
this->hkDestination = hkDestination;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceHandlerBase::setThermalStateRequestPoolIds(lp_id_t thermalStatePoolId,
|
void DeviceHandlerBase::setThermalStateRequestPoolIds(lp_id_t thermalStatePoolId,
|
||||||
@ -132,34 +132,42 @@ ReturnValue_t DeviceHandlerBase::initialize() {
|
|||||||
communicationInterface =
|
communicationInterface =
|
||||||
ObjectManager::instance()->get<DeviceCommunicationIF>(deviceCommunicationId);
|
ObjectManager::instance()->get<DeviceCommunicationIF>(deviceCommunicationId);
|
||||||
if (communicationInterface == nullptr) {
|
if (communicationInterface == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::ERROR, "initialize", ObjectManagerIF::CHILD_INIT_FAILED,
|
printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize",
|
||||||
"Passed communication IF invalid");
|
ObjectManagerIF::CHILD_INIT_FAILED, "Passed communication IF invalid");
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = communicationInterface->initializeInterface(comCookie);
|
result = communicationInterface->initializeInterface(comCookie);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
printWarningOrError(sif::LogLevel::ERROR, "initialize", ObjectManagerIF::CHILD_INIT_FAILED,
|
printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize",
|
||||||
"ComIF initialization failed");
|
ObjectManagerIF::CHILD_INIT_FAILED, "ComIF initialization failed");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
||||||
if (IPCStore == nullptr) {
|
if (IPCStore == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::ERROR, "initialize", ObjectManagerIF::CHILD_INIT_FAILED,
|
printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize",
|
||||||
"IPC Store not set up");
|
ObjectManagerIF::CHILD_INIT_FAILED, "IPC Store not set up");
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rawDataReceiverId != objects::NO_OBJECT) {
|
if (rawDataReceiverId != objects::NO_OBJECT) {
|
||||||
auto* rawReceiver = ObjectManager::instance()->get<AcceptsDeviceResponsesIF>(rawDataReceiverId);
|
AcceptsDeviceResponsesIF* rawReceiver =
|
||||||
|
ObjectManager::instance()->get<AcceptsDeviceResponsesIF>(rawDataReceiverId);
|
||||||
|
|
||||||
if (rawReceiver == nullptr) {
|
if (rawReceiver == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::ERROR, "initialize", ObjectManagerIF::CHILD_INIT_FAILED,
|
printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize",
|
||||||
|
ObjectManagerIF::CHILD_INIT_FAILED,
|
||||||
"Raw receiver object ID set but no valid object found.");
|
"Raw receiver object ID set but no valid object found.");
|
||||||
FSFW_LOGE("{}",
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
"Make sure the raw receiver object is set up properly "
|
sif::error << "Make sure the raw receiver object is set up properly"
|
||||||
"and implements AcceptsDeviceResponsesIF");
|
" and implements AcceptsDeviceResponsesIF"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError(
|
||||||
|
"Make sure the raw receiver object is set up "
|
||||||
|
"properly and implements AcceptsDeviceResponsesIF\n");
|
||||||
|
#endif
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
defaultRawReceiver = rawReceiver->getDeviceQueue();
|
defaultRawReceiver = rawReceiver->getDeviceQueue();
|
||||||
@ -168,11 +176,17 @@ ReturnValue_t DeviceHandlerBase::initialize() {
|
|||||||
if (powerSwitcherId != objects::NO_OBJECT) {
|
if (powerSwitcherId != objects::NO_OBJECT) {
|
||||||
powerSwitcher = ObjectManager::instance()->get<PowerSwitchIF>(powerSwitcherId);
|
powerSwitcher = ObjectManager::instance()->get<PowerSwitchIF>(powerSwitcherId);
|
||||||
if (powerSwitcher == nullptr) {
|
if (powerSwitcher == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::ERROR, "initialize", ObjectManagerIF::CHILD_INIT_FAILED,
|
printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize",
|
||||||
|
ObjectManagerIF::CHILD_INIT_FAILED,
|
||||||
"Power switcher set but no valid object found.");
|
"Power switcher set but no valid object found.");
|
||||||
FSFW_LOGE("{}",
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "Make sure the power switcher object is set up "
|
||||||
|
<< "properly and implements PowerSwitchIF" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError(
|
||||||
"Make sure the power switcher object is set up "
|
"Make sure the power switcher object is set up "
|
||||||
"properly and implements PowerSwitchIF\n");
|
"properly and implements PowerSwitchIF\n");
|
||||||
|
#endif
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -314,7 +328,8 @@ void DeviceHandlerBase::doStateMachine() {
|
|||||||
sprintf(printout, "Transition timeout (%lu) occured !",
|
sprintf(printout, "Transition timeout (%lu) occured !",
|
||||||
static_cast<unsigned long>(childTransitionDelay));
|
static_cast<unsigned long>(childTransitionDelay));
|
||||||
/* Common configuration error for development, so print it */
|
/* Common configuration error for development, so print it */
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "doStateMachine", RETURN_FAILED, printout);
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "doStateMachine", RETURN_FAILED,
|
||||||
|
printout);
|
||||||
#endif
|
#endif
|
||||||
triggerEvent(MODE_TRANSITION_FAILED, childTransitionFailure, 0);
|
triggerEvent(MODE_TRANSITION_FAILED, childTransitionFailure, 0);
|
||||||
setMode(transitionSourceMode, transitionSourceSubMode);
|
setMode(transitionSourceMode, transitionSourceSubMode);
|
||||||
@ -619,8 +634,8 @@ void DeviceHandlerBase::replyToReply(const DeviceCommandId_t command, DeviceRepl
|
|||||||
}
|
}
|
||||||
DeviceCommandInfo* info = &replyInfo.command->second;
|
DeviceCommandInfo* info = &replyInfo.command->second;
|
||||||
if (info == nullptr) {
|
if (info == nullptr) {
|
||||||
printWarningOrError(sif::LogLevel::ERROR, "replyToReply", HasReturnvaluesIF::RETURN_FAILED,
|
printWarningOrError(sif::OutputTypes::OUT_ERROR, "replyToReply",
|
||||||
"Command pointer not found");
|
HasReturnvaluesIF::RETURN_FAILED, "Command pointer not found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -761,7 +776,7 @@ void DeviceHandlerBase::parseReply(const uint8_t* receivedData, size_t receivedD
|
|||||||
case RETURN_OK:
|
case RETURN_OK:
|
||||||
handleReply(receivedData, foundId, foundLen);
|
handleReply(receivedData, foundId, foundLen);
|
||||||
if (foundLen == 0) {
|
if (foundLen == 0) {
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "parseReply",
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "parseReply",
|
||||||
ObjectManagerIF::CHILD_INIT_FAILED,
|
ObjectManagerIF::CHILD_INIT_FAILED,
|
||||||
"Found length is one, parsing might be stuck");
|
"Found length is one, parsing might be stuck");
|
||||||
}
|
}
|
||||||
@ -773,12 +788,14 @@ void DeviceHandlerBase::parseReply(const uint8_t* receivedData, size_t receivedD
|
|||||||
triggerEvent(DEVICE_INTERPRETING_REPLY_FAILED, result, foundId);
|
triggerEvent(DEVICE_INTERPRETING_REPLY_FAILED, result, foundId);
|
||||||
}
|
}
|
||||||
if (foundLen == 0) {
|
if (foundLen == 0) {
|
||||||
printWarningOrError(sif::LogLevel::ERROR, "parseReply",
|
printWarningOrError(sif::OutputTypes::OUT_ERROR, "parseReply",
|
||||||
ObjectManagerIF::CHILD_INIT_FAILED,
|
ObjectManagerIF::CHILD_INIT_FAILED,
|
||||||
"Power switcher set but no valid object found.");
|
"Power switcher set but no valid object found.");
|
||||||
FSFW_LOGW("{}",
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
"DeviceHandlerBase::parseReply: foundLen is 0! "
|
sif::warning << "DeviceHandlerBase::parseReply: foundLen is 0!"
|
||||||
"Packet parsing will be stuck\n");
|
" Packet parsing will be stuck."
|
||||||
|
<< std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1319,7 +1336,7 @@ ReturnValue_t DeviceHandlerBase::executeAction(ActionId_t actionId, MessageQueue
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceHandlerBase::buildInternalCommand() {
|
void DeviceHandlerBase::buildInternalCommand(void) {
|
||||||
/* Neither raw nor direct could build a command */
|
/* Neither raw nor direct could build a command */
|
||||||
ReturnValue_t result = NOTHING_TO_SEND;
|
ReturnValue_t result = NOTHING_TO_SEND;
|
||||||
DeviceCommandId_t deviceCommandId = NO_COMMAND_ID;
|
DeviceCommandId_t deviceCommandId = NO_COMMAND_ID;
|
||||||
@ -1327,7 +1344,7 @@ void DeviceHandlerBase::buildInternalCommand() {
|
|||||||
result = buildNormalDeviceCommand(&deviceCommandId);
|
result = buildNormalDeviceCommand(&deviceCommandId);
|
||||||
if (result == BUSY) {
|
if (result == BUSY) {
|
||||||
/* So we can track misconfigurations */
|
/* So we can track misconfigurations */
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "buildInternalCommand",
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "buildInternalCommand",
|
||||||
HasReturnvaluesIF::RETURN_FAILED, "Busy.");
|
HasReturnvaluesIF::RETURN_FAILED, "Busy.");
|
||||||
/* No need to report this */
|
/* No need to report this */
|
||||||
result = NOTHING_TO_SEND;
|
result = NOTHING_TO_SEND;
|
||||||
@ -1345,14 +1362,14 @@ void DeviceHandlerBase::buildInternalCommand() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (result == RETURN_OK) {
|
if (result == RETURN_OK) {
|
||||||
auto iter = deviceCommandMap.find(deviceCommandId);
|
DeviceCommandMap::iterator iter = deviceCommandMap.find(deviceCommandId);
|
||||||
if (iter == deviceCommandMap.end()) {
|
if (iter == deviceCommandMap.end()) {
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
char output[36];
|
char output[36];
|
||||||
sprintf(output, "Command 0x%08x unknown", static_cast<unsigned int>(deviceCommandId));
|
sprintf(output, "Command 0x%08x unknown", static_cast<unsigned int>(deviceCommandId));
|
||||||
// so we can track misconfigurations
|
// so we can track misconfigurations
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "buildInternalCommand", COMMAND_NOT_SUPPORTED,
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "buildInternalCommand",
|
||||||
output);
|
COMMAND_NOT_SUPPORTED, output);
|
||||||
#endif
|
#endif
|
||||||
result = COMMAND_NOT_SUPPORTED;
|
result = COMMAND_NOT_SUPPORTED;
|
||||||
} else if (iter->second.isExecuting) {
|
} else if (iter->second.isExecuting) {
|
||||||
@ -1360,7 +1377,7 @@ void DeviceHandlerBase::buildInternalCommand() {
|
|||||||
char output[36];
|
char output[36];
|
||||||
sprintf(output, "Command 0x%08x is executing", static_cast<unsigned int>(deviceCommandId));
|
sprintf(output, "Command 0x%08x is executing", static_cast<unsigned int>(deviceCommandId));
|
||||||
// so we can track misconfigurations
|
// so we can track misconfigurations
|
||||||
printWarningOrError(sif::LogLevel::WARNING, "buildInternalCommand",
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "buildInternalCommand",
|
||||||
HasReturnvaluesIF::RETURN_FAILED, output);
|
HasReturnvaluesIF::RETURN_FAILED, output);
|
||||||
#endif
|
#endif
|
||||||
// this is an internal command, no need to report a failure here,
|
// this is an internal command, no need to report a failure here,
|
||||||
@ -1381,7 +1398,7 @@ void DeviceHandlerBase::buildInternalCommand() {
|
|||||||
ReturnValue_t DeviceHandlerBase::buildChildRawCommand() { return NOTHING_TO_SEND; }
|
ReturnValue_t DeviceHandlerBase::buildChildRawCommand() { return NOTHING_TO_SEND; }
|
||||||
|
|
||||||
uint8_t DeviceHandlerBase::getReplyDelayCycles(DeviceCommandId_t deviceCommand) {
|
uint8_t DeviceHandlerBase::getReplyDelayCycles(DeviceCommandId_t deviceCommand) {
|
||||||
auto iter = deviceReplyMap.find(deviceCommand);
|
DeviceReplyMap::iterator iter = deviceReplyMap.find(deviceCommand);
|
||||||
if (iter == deviceReplyMap.end()) {
|
if (iter == deviceReplyMap.end()) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (iter->second.countdown != nullptr) {
|
} else if (iter->second.countdown != nullptr) {
|
||||||
@ -1496,13 +1513,13 @@ void DeviceHandlerBase::setNormalDatapoolEntriesInvalid() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceHandlerBase::printWarningOrError(sif::LogLevel errorType, const char* functionName,
|
void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType, const char* functionName,
|
||||||
ReturnValue_t errorCode, const char* errorPrint) {
|
ReturnValue_t errorCode, const char* errorPrint) {
|
||||||
if (errorPrint == nullptr) {
|
if (errorPrint == nullptr) {
|
||||||
if (errorCode == ObjectManagerIF::CHILD_INIT_FAILED) {
|
if (errorCode == ObjectManagerIF::CHILD_INIT_FAILED) {
|
||||||
errorPrint = "Initialization error";
|
errorPrint = "Initialization error";
|
||||||
} else if (errorCode == HasReturnvaluesIF::RETURN_FAILED) {
|
} else if (errorCode == HasReturnvaluesIF::RETURN_FAILED) {
|
||||||
if (errorType == sif::LogLevel::WARNING) {
|
if (errorType == sif::OutputTypes::OUT_WARNING) {
|
||||||
errorPrint = "Generic Warning";
|
errorPrint = "Generic Warning";
|
||||||
} else {
|
} else {
|
||||||
errorPrint = "Generic Error";
|
errorPrint = "Generic Error";
|
||||||
@ -1515,12 +1532,24 @@ void DeviceHandlerBase::printWarningOrError(sif::LogLevel errorType, const char*
|
|||||||
functionName = "unknown function";
|
functionName = "unknown function";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errorType == sif::LogLevel::WARNING) {
|
if (errorType == sif::OutputTypes::OUT_WARNING) {
|
||||||
FSFW_LOGWT("{} | Object ID {:#010x} | {}", functionName, SystemObject::getObjectId(),
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
errorPrint);
|
sif::warning << "DeviceHandlerBase::" << functionName << ": Object ID 0x" << std::hex
|
||||||
} else if (errorType == sif::LogLevel::ERROR) {
|
<< std::setw(8) << std::setfill('0') << this->getObjectId() << " | " << errorPrint
|
||||||
FSFW_LOGET("{} | Object ID {:#010x} | {}", functionName, SystemObject::getObjectId(),
|
<< std::dec << std::setfill(' ') << std::endl;
|
||||||
errorPrint);
|
#else
|
||||||
|
sif::printWarning("DeviceHandlerBase::%s: Object ID 0x%08x | %s\n", functionName,
|
||||||
|
this->getObjectId(), errorPrint);
|
||||||
|
#endif
|
||||||
|
} else if (errorType == sif::OutputTypes::OUT_ERROR) {
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "DeviceHandlerBase::" << functionName << ": Object ID 0x" << std::hex
|
||||||
|
<< std::setw(8) << std::setfill('0') << this->getObjectId() << " | " << errorPrint
|
||||||
|
<< std::dec << std::setfill(' ') << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError("DeviceHandlerBase::%s: Object ID 0x%08x | %s\n", functionName,
|
||||||
|
this->getObjectId(), errorPrint);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
#include "fsfw/parameters/ParameterHelper.h"
|
#include "fsfw/parameters/ParameterHelper.h"
|
||||||
#include "fsfw/power/PowerSwitchIF.h"
|
#include "fsfw/power/PowerSwitchIF.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
#include "fsfw/serviceinterface/serviceInterfaceDefintions.h"
|
||||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
#include "fsfw/tasks/PeriodicTaskIF.h"
|
#include "fsfw/tasks/PeriodicTaskIF.h"
|
||||||
|
|
||||||
@ -1304,7 +1305,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
|
|||||||
* @param errorCode
|
* @param errorCode
|
||||||
* @param errorPrint
|
* @param errorPrint
|
||||||
*/
|
*/
|
||||||
void printWarningOrError(sif::LogLevel errorType, const char *functionName,
|
void printWarningOrError(sif::OutputTypes errorType, const char *functionName,
|
||||||
ReturnValue_t errorCode = HasReturnvaluesIF::RETURN_FAILED,
|
ReturnValue_t errorCode = HasReturnvaluesIF::RETURN_FAILED,
|
||||||
const char *errorPrint = nullptr);
|
const char *errorPrint = nullptr);
|
||||||
};
|
};
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "fsfw/modes/HasModesIF.h"
|
#include "fsfw/modes/HasModesIF.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/power/Fuse.h"
|
#include "fsfw/power/Fuse.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
||||||
#include "fsfw/thermal/ThermalComponentIF.h"
|
#include "fsfw/thermal/ThermalComponentIF.h"
|
||||||
|
|
||||||
object_id_t DeviceHandlerFailureIsolation::powerConfirmationId = objects::NO_OBJECT;
|
object_id_t DeviceHandlerFailureIsolation::powerConfirmationId = objects::NO_OBJECT;
|
||||||
@ -163,10 +163,15 @@ void DeviceHandlerFailureIsolation::clearFaultCounters() {
|
|||||||
ReturnValue_t DeviceHandlerFailureIsolation::initialize() {
|
ReturnValue_t DeviceHandlerFailureIsolation::initialize() {
|
||||||
ReturnValue_t result = FailureIsolationBase::initialize();
|
ReturnValue_t result = FailureIsolationBase::initialize();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGE("{}", "initialize: Could not initialize FailureIsolationBase\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "DeviceHandlerFailureIsolation::initialize: Could not"
|
||||||
|
" initialize FailureIsolationBase."
|
||||||
|
<< std::endl;
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
auto* power = ObjectManager::instance()->get<ConfirmsFailuresIF>(powerConfirmationId);
|
ConfirmsFailuresIF* power =
|
||||||
|
ObjectManager::instance()->get<ConfirmsFailuresIF>(powerConfirmationId);
|
||||||
if (power != nullptr) {
|
if (power != nullptr) {
|
||||||
powerConfirmation = power->getEventReceptionQueue();
|
powerConfirmation = power->getEventReceptionQueue();
|
||||||
}
|
}
|
||||||
@ -239,7 +244,10 @@ bool DeviceHandlerFailureIsolation::isFdirInActionOrAreWeFaulty(EventMessage* ev
|
|||||||
|
|
||||||
if (owner == nullptr) {
|
if (owner == nullptr) {
|
||||||
// Configuration error.
|
// Configuration error.
|
||||||
FSFW_LOGE("isFdirInActionOrAreWeFaulty: Owner not set\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "DeviceHandlerFailureIsolation::"
|
||||||
|
<< "isFdirInActionOrAreWeFaulty: Owner not set!" << std::endl;
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,17 +124,17 @@ void EventManager::printEvent(EventMessage* message) {
|
|||||||
switch (message->getSeverity()) {
|
switch (message->getSeverity()) {
|
||||||
case severity::INFO: {
|
case severity::INFO: {
|
||||||
#if FSFW_DEBUG_INFO == 1
|
#if FSFW_DEBUG_INFO == 1
|
||||||
printUtility(sif::LogLevel::INFO, message);
|
printUtility(sif::OutputTypes::OUT_INFO, message);
|
||||||
#endif /* DEBUG_INFO_EVENT == 1 */
|
#endif /* DEBUG_INFO_EVENT == 1 */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
printUtility(sif::LogLevel::DEBUG, message);
|
printUtility(sif::OutputTypes::OUT_DEBUG, message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventManager::printUtility(sif::LogLevel printType, EventMessage* message) {
|
void EventManager::printUtility(sif::OutputTypes printType, EventMessage* message) {
|
||||||
const char* string = 0;
|
const char* string = 0;
|
||||||
if (printType == sif::OutputTypes::OUT_INFO) {
|
if (printType == sif::OutputTypes::OUT_INFO) {
|
||||||
string = translateObject(message->getReporter());
|
string = translateObject(message->getReporter());
|
||||||
|
@ -6,12 +6,12 @@
|
|||||||
#include "../ipc/MessageQueueIF.h"
|
#include "../ipc/MessageQueueIF.h"
|
||||||
#include "../ipc/MutexIF.h"
|
#include "../ipc/MutexIF.h"
|
||||||
#include "../objectmanager/SystemObject.h"
|
#include "../objectmanager/SystemObject.h"
|
||||||
|
#include "../serviceinterface/ServiceInterface.h"
|
||||||
#include "../storagemanager/LocalPool.h"
|
#include "../storagemanager/LocalPool.h"
|
||||||
#include "../tasks/ExecutableObjectIF.h"
|
#include "../tasks/ExecutableObjectIF.h"
|
||||||
#include "EventManagerIF.h"
|
#include "EventManagerIF.h"
|
||||||
#include "FSFWConfig.h"
|
#include "FSFWConfig.h"
|
||||||
#include "eventmatching/EventMatchTree.h"
|
#include "eventmatching/EventMatchTree.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
|
|
||||||
#if FSFW_OBJ_EVENT_TRANSLATION == 1
|
#if FSFW_OBJ_EVENT_TRANSLATION == 1
|
||||||
// forward declaration, should be implemented by mission
|
// forward declaration, should be implemented by mission
|
||||||
@ -64,7 +64,7 @@ class EventManager : public EventManagerIF, public ExecutableObjectIF, public Sy
|
|||||||
|
|
||||||
#if FSFW_OBJ_EVENT_TRANSLATION == 1
|
#if FSFW_OBJ_EVENT_TRANSLATION == 1
|
||||||
void printEvent(EventMessage* message);
|
void printEvent(EventMessage* message);
|
||||||
void printUtility(sif::LogLevel printType, EventMessage* message);
|
void printUtility(sif::OutputTypes printType, EventMessage* message);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void lockMutex();
|
void lockMutex();
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
#include "../ipc/MessageQueueIF.h"
|
#include "../ipc/MessageQueueIF.h"
|
||||||
#include "../ipc/MessageQueueSenderIF.h"
|
#include "../ipc/MessageQueueSenderIF.h"
|
||||||
#include "../objectmanager/ObjectManager.h"
|
#include "../objectmanager/ObjectManager.h"
|
||||||
|
#include "../serviceinterface/ServiceInterface.h"
|
||||||
#include "EventMessage.h"
|
#include "EventMessage.h"
|
||||||
#include "eventmatching/eventmatching.h"
|
#include "eventmatching/eventmatching.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
|
|
||||||
class EventManagerIF {
|
class EventManagerIF {
|
||||||
public:
|
public:
|
||||||
@ -40,9 +40,19 @@ class EventManagerIF {
|
|||||||
|
|
||||||
static void triggerEvent(EventMessage* message, MessageQueueId_t sentFrom = 0) {
|
static void triggerEvent(EventMessage* message, MessageQueueId_t sentFrom = 0) {
|
||||||
if (eventmanagerQueue == MessageQueueIF::NO_QUEUE) {
|
if (eventmanagerQueue == MessageQueueIF::NO_QUEUE) {
|
||||||
auto* eventmanager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
|
EventManagerIF* eventmanager =
|
||||||
|
ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
|
||||||
if (eventmanager == nullptr) {
|
if (eventmanager == nullptr) {
|
||||||
FSFW_LOGW("{}", "EventManagerIF::triggerEvent: EventManager invalid or not found\n");
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "EventManagerIF::triggerEvent: EventManager invalid or not found!"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"EventManagerIF::triggerEvent: "
|
||||||
|
"EventManager invalid or not found!");
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
eventmanagerQueue = eventmanager->getEventReportQueue();
|
eventmanagerQueue = eventmanager->getEventReportQueue();
|
||||||
|
@ -28,9 +28,13 @@ FailureIsolationBase::~FailureIsolationBase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FailureIsolationBase::initialize() {
|
ReturnValue_t FailureIsolationBase::initialize() {
|
||||||
auto* manager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
|
EventManagerIF* manager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
|
||||||
if (manager == nullptr) {
|
if (manager == nullptr) {
|
||||||
FSFW_LOGE("{}", "initialize: Event Manager has not been initialized\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "FailureIsolationBase::initialize: Event Manager has not"
|
||||||
|
" been initialized!"
|
||||||
|
<< std::endl;
|
||||||
|
#endif
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
ReturnValue_t result = manager->registerListener(eventQueue->getId());
|
ReturnValue_t result = manager->registerListener(eventQueue->getId());
|
||||||
@ -44,20 +48,27 @@ ReturnValue_t FailureIsolationBase::initialize() {
|
|||||||
}
|
}
|
||||||
owner = ObjectManager::instance()->get<HasHealthIF>(ownerId);
|
owner = ObjectManager::instance()->get<HasHealthIF>(ownerId);
|
||||||
if (owner == nullptr) {
|
if (owner == nullptr) {
|
||||||
FSFW_LOGE(
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
"FailureIsolationBase::intialize: Owner object {:#010x} invalid. "
|
sif::error << "FailureIsolationBase::intialize: Owner object "
|
||||||
"Does it implement HasHealthIF?\n",
|
"invalid. Make sure it implements HasHealthIF"
|
||||||
ownerId);
|
<< std::endl;
|
||||||
|
#endif
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (faultTreeParent != objects::NO_OBJECT) {
|
if (faultTreeParent != objects::NO_OBJECT) {
|
||||||
auto* parentIF = ObjectManager::instance()->get<ConfirmsFailuresIF>(faultTreeParent);
|
ConfirmsFailuresIF* parentIF =
|
||||||
|
ObjectManager::instance()->get<ConfirmsFailuresIF>(faultTreeParent);
|
||||||
if (parentIF == nullptr) {
|
if (parentIF == nullptr) {
|
||||||
FSFW_LOGW(
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
"intialize: Parent object {:#010x} invalid. Does it implement ConfirmsFailuresIF?\n",
|
sif::error << "FailureIsolationBase::intialize: Parent object"
|
||||||
faultTreeParent);
|
<< "invalid." << std::endl;
|
||||||
|
#endif
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "Make sure it implements ConfirmsFailuresIF." << std::endl;
|
||||||
|
#endif
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
eventQueue->setDefaultDestination(parentIF->getEventReceptionQueue());
|
eventQueue->setDefaultDestination(parentIF->getEventReceptionQueue());
|
||||||
}
|
}
|
||||||
|
@ -3,16 +3,31 @@
|
|||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
void arrayprinter::print(const uint8_t *data, size_t size, OutputType type, bool printInfo,
|
void arrayprinter::print(const uint8_t *data, size_t size, OutputType type, bool printInfo,
|
||||||
size_t maxCharPerLine) {
|
size_t maxCharPerLine) {
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
FSFW_LOGI("{}", "Size is zero, nothing to print\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::info << "Size is zero, nothing to print" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printInfo("Size is zero, nothing to print\n");
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FSFW_LOGI("Printing data with size {}:\n", size);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
if (printInfo) {
|
||||||
|
sif::info << "Printing data with size " << size << ": " << std::endl;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#if FSFW_NO_C99_IO == 1
|
||||||
|
sif::printInfo("Printing data with size %lu: \n", static_cast<unsigned long>(size));
|
||||||
|
#else
|
||||||
|
sif::printInfo("Printing data with size %zu: \n", size);
|
||||||
|
#endif /* FSFW_NO_C99_IO == 1 */
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
|
|
||||||
if (type == OutputType::HEX) {
|
if (type == OutputType::HEX) {
|
||||||
arrayprinter::printHex(data, size, maxCharPerLine);
|
arrayprinter::printHex(data, size, maxCharPerLine);
|
||||||
} else if (type == OutputType::DEC) {
|
} else if (type == OutputType::DEC) {
|
||||||
@ -23,99 +38,99 @@ void arrayprinter::print(const uint8_t *data, size_t size, OutputType type, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
void arrayprinter::printHex(const uint8_t *data, size_t size, size_t maxCharPerLine) {
|
void arrayprinter::printHex(const uint8_t *data, size_t size, size_t maxCharPerLine) {
|
||||||
//#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
// if (sif::info.crAdditionEnabled()) {
|
if (sif::info.crAdditionEnabled()) {
|
||||||
// std::cout << "\r" << std::endl;
|
std::cout << "\r" << std::endl;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// std::cout << "hex [" << std::setfill('0') << std::hex;
|
std::cout << "hex [" << std::setfill('0') << std::hex;
|
||||||
// for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
// std::cout << std::setw(2) << static_cast<int>(data[i]);
|
std::cout << std::setw(2) << static_cast<int>(data[i]);
|
||||||
// if (i < size - 1) {
|
if (i < size - 1) {
|
||||||
// std::cout << ",";
|
std::cout << ",";
|
||||||
// if (i > 0 and (i + 1) % maxCharPerLine == 0) {
|
if (i > 0 and (i + 1) % maxCharPerLine == 0) {
|
||||||
// std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// std::cout << std::dec << std::setfill(' ');
|
std::cout << std::dec << std::setfill(' ');
|
||||||
// std::cout << "]" << std::endl;
|
std::cout << "]" << std::endl;
|
||||||
//#else
|
#else
|
||||||
// // General format: 0x01, 0x02, 0x03 so it is number of chars times 6
|
// General format: 0x01, 0x02, 0x03 so it is number of chars times 6
|
||||||
// // plus line break plus small safety margin.
|
// plus line break plus small safety margin.
|
||||||
// char printBuffer[(size + 1) * 7 + 1] = {};
|
char printBuffer[(size + 1) * 7 + 1] = {};
|
||||||
// size_t currentPos = 0;
|
size_t currentPos = 0;
|
||||||
// for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
// // To avoid buffer overflows.
|
// To avoid buffer overflows.
|
||||||
// if (sizeof(printBuffer) - currentPos <= 7) {
|
if (sizeof(printBuffer) - currentPos <= 7) {
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// currentPos += snprintf(printBuffer + currentPos, 6, "%02x", data[i]);
|
currentPos += snprintf(printBuffer + currentPos, 6, "%02x", data[i]);
|
||||||
// if (i < size - 1) {
|
if (i < size - 1) {
|
||||||
// currentPos += sprintf(printBuffer + currentPos, ",");
|
currentPos += sprintf(printBuffer + currentPos, ",");
|
||||||
// if ((i + 1) % maxCharPerLine == 0) {
|
if ((i + 1) % maxCharPerLine == 0) {
|
||||||
// currentPos += sprintf(printBuffer + currentPos, "\n");
|
currentPos += sprintf(printBuffer + currentPos, "\n");
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//#if FSFW_DISABLE_PRINTOUT == 0
|
#if FSFW_DISABLE_PRINTOUT == 0
|
||||||
// printf("hex [%s]\n", printBuffer);
|
printf("hex [%s]\n", printBuffer);
|
||||||
//#endif /* FSFW_DISABLE_PRINTOUT == 0 */
|
#endif /* FSFW_DISABLE_PRINTOUT == 0 */
|
||||||
//#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void arrayprinter::printDec(const uint8_t *data, size_t size, size_t maxCharPerLine) {
|
void arrayprinter::printDec(const uint8_t *data, size_t size, size_t maxCharPerLine) {
|
||||||
//#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
// if (sif::info.crAdditionEnabled()) {
|
if (sif::info.crAdditionEnabled()) {
|
||||||
// std::cout << "\r" << std::endl;
|
std::cout << "\r" << std::endl;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// std::cout << "dec [" << std::dec;
|
std::cout << "dec [" << std::dec;
|
||||||
// for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
// std::cout << static_cast<int>(data[i]);
|
std::cout << static_cast<int>(data[i]);
|
||||||
// if (i < size - 1) {
|
if (i < size - 1) {
|
||||||
// std::cout << ",";
|
std::cout << ",";
|
||||||
// if (i > 0 and (i + 1) % maxCharPerLine == 0) {
|
if (i > 0 and (i + 1) % maxCharPerLine == 0) {
|
||||||
// std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// std::cout << "]" << std::endl;
|
std::cout << "]" << std::endl;
|
||||||
//#else
|
#else
|
||||||
// // General format: 32,243,-12 so it is number of chars times 4
|
// General format: 32,243,-12 so it is number of chars times 4
|
||||||
// // plus line break plus small safety margin.
|
// plus line break plus small safety margin.
|
||||||
// uint16_t expectedLines = ceil((double)size / maxCharPerLine);
|
uint16_t expectedLines = ceil((double)size / maxCharPerLine);
|
||||||
// char printBuffer[size * 4 + 1 + expectedLines] = {};
|
char printBuffer[size * 4 + 1 + expectedLines] = {};
|
||||||
// size_t currentPos = 0;
|
size_t currentPos = 0;
|
||||||
// for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
// // To avoid buffer overflows.
|
// To avoid buffer overflows.
|
||||||
// if (sizeof(printBuffer) - currentPos <= 4) {
|
if (sizeof(printBuffer) - currentPos <= 4) {
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// currentPos += snprintf(printBuffer + currentPos, 4, "%d", data[i]);
|
currentPos += snprintf(printBuffer + currentPos, 4, "%d", data[i]);
|
||||||
// if (i < size - 1) {
|
if (i < size - 1) {
|
||||||
// currentPos += sprintf(printBuffer + currentPos, ",");
|
currentPos += sprintf(printBuffer + currentPos, ",");
|
||||||
// if ((i + 1) % maxCharPerLine == 0) {
|
if ((i + 1) % maxCharPerLine == 0) {
|
||||||
// currentPos += sprintf(printBuffer + currentPos, "\n");
|
currentPos += sprintf(printBuffer + currentPos, "\n");
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//#if FSFW_DISABLE_PRINTOUT == 0
|
#if FSFW_DISABLE_PRINTOUT == 0
|
||||||
// printf("dec [%s]\n", printBuffer);
|
printf("dec [%s]\n", printBuffer);
|
||||||
//#endif /* FSFW_DISABLE_PRINTOUT == 0 */
|
#endif /* FSFW_DISABLE_PRINTOUT == 0 */
|
||||||
//#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void arrayprinter::printBin(const uint8_t *data, size_t size) {
|
void arrayprinter::printBin(const uint8_t *data, size_t size) {
|
||||||
//#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
// for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
// sif::info << "Byte " << i + 1 << ": 0b" << std::bitset<8>(data[i]) << std::endl;
|
sif::info << "Byte " << i + 1 << ": 0b" << std::bitset<8>(data[i]) << std::endl;
|
||||||
// }
|
}
|
||||||
//#else
|
#else
|
||||||
// for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
// sif::printInfo("Byte %d: 0b" BYTE_TO_BINARY_PATTERN "\n", i + 1, BYTE_TO_BINARY(data[i]));
|
sif::printInfo("Byte %d: 0b" BYTE_TO_BINARY_PATTERN "\n", i + 1, BYTE_TO_BINARY(data[i]));
|
||||||
// }
|
}
|
||||||
//#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "fsfw/health/HealthHelper.h"
|
#include "fsfw/health/HealthHelper.h"
|
||||||
|
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
HealthHelper::HealthHelper(HasHealthIF* owner, object_id_t objectId)
|
HealthHelper::HealthHelper(HasHealthIF* owner, object_id_t objectId)
|
||||||
: objectId(objectId), owner(owner) {}
|
: objectId(objectId), owner(owner) {}
|
||||||
@ -35,12 +35,20 @@ ReturnValue_t HealthHelper::initialize() {
|
|||||||
eventSender = ObjectManager::instance()->get<EventReportingProxyIF>(objectId);
|
eventSender = ObjectManager::instance()->get<EventReportingProxyIF>(objectId);
|
||||||
|
|
||||||
if (healthTable == nullptr) {
|
if (healthTable == nullptr) {
|
||||||
FSFW_LOGE("{}", "initialize: Health table object needs to be created in factory\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "HealthHelper::initialize: Health table object needs"
|
||||||
|
"to be created in factory."
|
||||||
|
<< std::endl;
|
||||||
|
#endif
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eventSender == nullptr) {
|
if (eventSender == nullptr) {
|
||||||
FSFW_LOGE("{}", "initialize: Owner has to implement ReportingProxyIF\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "HealthHelper::initialize: Owner has to implement "
|
||||||
|
"ReportingProxyIF."
|
||||||
|
<< std::endl;
|
||||||
|
#endif
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +77,9 @@ void HealthHelper::informParent(HasHealthIF::HealthState health,
|
|||||||
HealthMessage::setHealthMessage(&information, HealthMessage::HEALTH_INFO, health, oldHealth);
|
HealthMessage::setHealthMessage(&information, HealthMessage::HEALTH_INFO, health, oldHealth);
|
||||||
if (MessageQueueSenderIF::sendMessage(parentQueue, &information, owner->getCommandQueue()) !=
|
if (MessageQueueSenderIF::sendMessage(parentQueue, &information, owner->getCommandQueue()) !=
|
||||||
HasReturnvaluesIF::RETURN_OK) {
|
HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGWT("informParent: Object ID {:#010x} | Sending health reply failed\n", objectId);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::debug << "HealthHelper::informParent: sending health reply failed." << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +96,10 @@ void HealthHelper::handleSetHealthCommand(CommandMessage* command) {
|
|||||||
}
|
}
|
||||||
if (MessageQueueSenderIF::sendMessage(command->getSender(), &reply, owner->getCommandQueue()) !=
|
if (MessageQueueSenderIF::sendMessage(command->getSender(), &reply, owner->getCommandQueue()) !=
|
||||||
HasReturnvaluesIF::RETURN_OK) {
|
HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGWT("handleSetHealthCommand: Object ID {:#010x} | Sending health reply failed\n",
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
objectId);
|
sif::debug << "HealthHelper::handleHealthCommand: sending health "
|
||||||
|
"reply failed."
|
||||||
|
<< std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include "fsfw/ipc/MutexFactory.h"
|
#include "fsfw/ipc/MutexFactory.h"
|
||||||
#include "fsfw/ipc/MutexGuard.h"
|
#include "fsfw/ipc/MutexGuard.h"
|
||||||
#include "fsfw/serialize/SerializeAdapter.h"
|
#include "fsfw/serialize/SerializeAdapter.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
|
|
||||||
HealthTable::HealthTable(object_id_t objectid) : SystemObject(objectid) {
|
HealthTable::HealthTable(object_id_t objectid) : SystemObject(objectid) {
|
||||||
mutex = MutexFactory::instance()->createMutex();
|
mutex = MutexFactory::instance()->createMutex();
|
||||||
@ -78,7 +77,13 @@ void HealthTable::printAll(uint8_t* pointer, size_t maxSize) {
|
|||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
SerializeAdapter::serialize(&count, &pointer, &size, maxSize, SerializeIF::Endianness::BIG);
|
SerializeAdapter::serialize(&count, &pointer, &size, maxSize, SerializeIF::Endianness::BIG);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGW("{}", "printAll: Serialization of health table failed\n");
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "HealthTable::printAll: Serialization of health table failed" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("HealthTable::printAll: Serialization of health table failed\n");
|
||||||
|
#endif
|
||||||
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (const auto& health : healthMap) {
|
for (const auto& health : healthMap) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "fsfw/datapool/PoolReadGuard.h"
|
#include "fsfw/datapool/PoolReadGuard.h"
|
||||||
#include "fsfw/ipc/MutexFactory.h"
|
#include "fsfw/ipc/MutexFactory.h"
|
||||||
#include "fsfw/ipc/QueueFactory.h"
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
InternalErrorReporter::InternalErrorReporter(object_id_t setObjectId, uint32_t messageQueueDepth)
|
InternalErrorReporter::InternalErrorReporter(object_id_t setObjectId, uint32_t messageQueueDepth)
|
||||||
: SystemObject(setObjectId),
|
: SystemObject(setObjectId),
|
||||||
@ -34,8 +34,18 @@ ReturnValue_t InternalErrorReporter::performOperation(uint8_t opCode) {
|
|||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
if (diagnosticPrintout) {
|
if (diagnosticPrintout) {
|
||||||
if ((newQueueHits > 0) or (newTmHits > 0) or (newStoreHits > 0)) {
|
if ((newQueueHits > 0) or (newTmHits > 0) or (newStoreHits > 0)) {
|
||||||
FSFW_LOGW("performOperation: Errors occured\nQueue {} | TM {} | Store {}\n", newQueueHits,
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
newTmHits, newStoreHits);
|
sif::debug << "InternalErrorReporter::performOperation: Errors "
|
||||||
|
<< "occured!" << std::endl;
|
||||||
|
sif::debug << "Queue errors: " << newQueueHits << std::endl;
|
||||||
|
sif::debug << "TM errors: " << newTmHits << std::endl;
|
||||||
|
sif::debug << "Store errors: " << newStoreHits << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printDebug("InternalErrorReporter::performOperation: Errors occured!\n");
|
||||||
|
sif::printDebug("Queue errors: %lu\n", static_cast<unsigned int>(newQueueHits));
|
||||||
|
sif::printDebug("TM errors: %lu\n", static_cast<unsigned int>(newTmHits));
|
||||||
|
sif::printDebug("Store errors: %lu\n", static_cast<unsigned int>(newStoreHits));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "fsfw/globalfunctions/arrayprinter.h"
|
#include "fsfw/globalfunctions/arrayprinter.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
MessageQueueMessage::MessageQueueMessage() : messageSize(getMinimumMessageSize()) {
|
MessageQueueMessage::MessageQueueMessage() : messageSize(getMinimumMessageSize()) {
|
||||||
memset(this->internalBuffer, 0, sizeof(this->internalBuffer));
|
memset(this->internalBuffer, 0, sizeof(this->internalBuffer));
|
||||||
@ -15,7 +15,11 @@ MessageQueueMessage::MessageQueueMessage(uint8_t* data, size_t size)
|
|||||||
memcpy(this->getData(), data, size);
|
memcpy(this->getData(), data, size);
|
||||||
this->messageSize = this->HEADER_SIZE + size;
|
this->messageSize = this->HEADER_SIZE + size;
|
||||||
} else {
|
} else {
|
||||||
FSFW_LOGW("{}", "ctor: Passed size larger than maximum allowed size! Setting content to 0\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "MessageQueueMessage: Passed size larger than maximum"
|
||||||
|
"allowed size! Setting content to 0"
|
||||||
|
<< std::endl;
|
||||||
|
#endif
|
||||||
memset(this->internalBuffer, 0, sizeof(this->internalBuffer));
|
memset(this->internalBuffer, 0, sizeof(this->internalBuffer));
|
||||||
this->messageSize = this->HEADER_SIZE;
|
this->messageSize = this->HEADER_SIZE;
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
#ifndef FRAMEWORK_IPC_MUTEXGUARD_H_
|
#ifndef FRAMEWORK_IPC_MUTEXGUARD_H_
|
||||||
#define FRAMEWORK_IPC_MUTEXGUARD_H_
|
#define FRAMEWORK_IPC_MUTEXGUARD_H_
|
||||||
|
|
||||||
#include <fmt/core.h>
|
#include "../serviceinterface/ServiceInterface.h"
|
||||||
|
#include "MutexFactory.h"
|
||||||
#include "fsfw/ipc/MutexIF.h"
|
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
|
|
||||||
class MutexGuard {
|
class MutexGuard {
|
||||||
public:
|
public:
|
||||||
@ -12,17 +10,35 @@ class MutexGuard {
|
|||||||
uint32_t timeoutMs = 0)
|
uint32_t timeoutMs = 0)
|
||||||
: internalMutex(mutex) {
|
: internalMutex(mutex) {
|
||||||
if (mutex == nullptr) {
|
if (mutex == nullptr) {
|
||||||
// It's tricky to use the error functions defined in the service interface
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
// because those functions require the mutex guard themselves
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
fmt::print("ERROR | Passed mutex is invalid\n");
|
sif::error << "MutexGuard: Passed mutex is invalid!" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError("MutexGuard: Passed mutex is invalid!\n");
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
result = mutex->lockMutex(timeoutType, timeoutMs);
|
result = mutex->lockMutex(timeoutType, timeoutMs);
|
||||||
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
if (result == MutexIF::MUTEX_TIMEOUT) {
|
if (result == MutexIF::MUTEX_TIMEOUT) {
|
||||||
fmt::print("ERROR | Lock of mutex failed with timeout of {} milliseconds\n", timeoutMs);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "MutexGuard: Lock of mutex failed with timeout of " << timeoutMs
|
||||||
|
<< " milliseconds!" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError("MutexGuard: Lock of mutex failed with timeout of %lu milliseconds\n",
|
||||||
|
timeoutMs);
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
|
|
||||||
} else if (result != HasReturnvaluesIF::RETURN_OK) {
|
} else if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
fmt::print("ERROR | Lock of Mutex failed with code {}\n", result);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "MutexGuard: Lock of Mutex failed with code " << result << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError("MutexGuard: Lock of Mutex failed with code %d\n", result);
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t getLockResult() const { return result; }
|
ReturnValue_t getLockResult() const { return result; }
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "fsfw/memory/MemoryMessage.h"
|
#include "fsfw/memory/MemoryMessage.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/serialize/EndianConverter.h"
|
#include "fsfw/serialize/EndianConverter.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
MemoryHelper::MemoryHelper(HasMemoryIF* workOnThis, MessageQueueIF* useThisQueue)
|
MemoryHelper::MemoryHelper(HasMemoryIF* workOnThis, MessageQueueIF* useThisQueue)
|
||||||
: workOnThis(workOnThis),
|
: workOnThis(workOnThis),
|
||||||
@ -17,7 +17,9 @@ ReturnValue_t MemoryHelper::handleMemoryCommand(CommandMessage* message) {
|
|||||||
lastSender = message->getSender();
|
lastSender = message->getSender();
|
||||||
lastCommand = message->getCommand();
|
lastCommand = message->getCommand();
|
||||||
if (busy) {
|
if (busy) {
|
||||||
FSFW_LOGW("{}", "MemoryHelper: Busy\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::debug << "MemHelper: Busy!" << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
switch (lastCommand) {
|
switch (lastCommand) {
|
||||||
case MemoryMessage::CMD_MEMORY_DUMP:
|
case MemoryMessage::CMD_MEMORY_DUMP:
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "fsfw/ipc/MessageQueueSenderIF.h"
|
#include "fsfw/ipc/MessageQueueSenderIF.h"
|
||||||
#include "fsfw/modes/HasModesIF.h"
|
#include "fsfw/modes/HasModesIF.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
ModeHelper::ModeHelper(HasModesIF* owner)
|
ModeHelper::ModeHelper(HasModesIF* owner)
|
||||||
: commandedMode(HasModesIF::MODE_OFF),
|
: commandedMode(HasModesIF::MODE_OFF),
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
#include "../serialize/SerialFixedArrayListAdapter.h"
|
#include "../serialize/SerialFixedArrayListAdapter.h"
|
||||||
#include "../serialize/SerialLinkedListAdapter.h"
|
#include "../serialize/SerialLinkedListAdapter.h"
|
||||||
#include "../serialize/SerializeElement.h"
|
#include "../serialize/SerializeElement.h"
|
||||||
|
#include "../serviceinterface/ServiceInterface.h"
|
||||||
#include "../timemanager/TimeStamperIF.h"
|
#include "../timemanager/TimeStamperIF.h"
|
||||||
#include "HasMonitorsIF.h"
|
#include "HasMonitorsIF.h"
|
||||||
#include "MonitoringIF.h"
|
#include "MonitoringIF.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
#include "monitoringConf.h"
|
#include "monitoringConf.h"
|
||||||
|
|
||||||
namespace Factory {
|
namespace Factory {
|
||||||
@ -81,7 +81,11 @@ class MonitoringReportContent : public SerialLinkedListAdapter<SerializeIF> {
|
|||||||
if (timeStamper == nullptr) {
|
if (timeStamper == nullptr) {
|
||||||
timeStamper = ObjectManager::instance()->get<TimeStamperIF>(timeStamperId);
|
timeStamper = ObjectManager::instance()->get<TimeStamperIF>(timeStamperId);
|
||||||
if (timeStamper == nullptr) {
|
if (timeStamper == nullptr) {
|
||||||
FSFW_LOGET("{}", "checkAndSetStamper: Stamper not found\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "MonitoringReportContent::checkAndSetStamper: "
|
||||||
|
"Stamper not found!"
|
||||||
|
<< std::endl;
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
|
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
@ -36,10 +36,17 @@ ReturnValue_t ObjectManager::insert(object_id_t id, SystemObjectIF* object) {
|
|||||||
// sif::debug << "ObjectManager::insert: Object " << std::hex
|
// sif::debug << "ObjectManager::insert: Object " << std::hex
|
||||||
// << (int)id << std::dec << " inserted." << std::endl;
|
// << (int)id << std::dec << " inserted." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return ObjectManager::RETURN_OK;
|
return this->RETURN_OK;
|
||||||
} else {
|
} else {
|
||||||
FSFW_LOGET("ObjectManager::insert: Object ID {:#010x} is already in use\nTerminating program\n",
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
static_cast<uint32_t>(id));
|
sif::error << "ObjectManager::insert: Object ID " << std::hex << static_cast<uint32_t>(id)
|
||||||
|
<< std::dec << " is already in use!" << std::endl;
|
||||||
|
sif::error << "Terminating program" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError("ObjectManager::insert: Object ID 0x%08x is already in use!\n",
|
||||||
|
static_cast<unsigned int>(id));
|
||||||
|
sif::printError("Terminating program");
|
||||||
|
#endif
|
||||||
// This is very severe and difficult to handle in other places.
|
// This is very severe and difficult to handle in other places.
|
||||||
std::exit(INSERTION_FAILED);
|
std::exit(INSERTION_FAILED);
|
||||||
}
|
}
|
||||||
@ -54,7 +61,10 @@ ReturnValue_t ObjectManager::remove(object_id_t id) {
|
|||||||
#endif
|
#endif
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
} else {
|
} else {
|
||||||
FSFW_LOGW("removeObject: Requested object {:#010x} not found\n", id);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "ObjectManager::removeObject: Requested object " << std::hex << (int)id
|
||||||
|
<< std::dec << " not found." << std::endl;
|
||||||
|
#endif
|
||||||
return NOT_FOUND;
|
return NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,44 +79,64 @@ SystemObjectIF* ObjectManager::getSystemObject(object_id_t id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ObjectManager::initialize() {
|
void ObjectManager::initialize() {
|
||||||
if (objectFactoryFunction != nullptr) {
|
if (objectFactoryFunction == nullptr) {
|
||||||
objectFactoryFunction(factoryArgs);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "ObjectManager::initialize: Passed produceObjects "
|
||||||
|
"functions is nullptr!"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError("ObjectManager::initialize: Passed produceObjects functions is nullptr!\n");
|
||||||
|
#endif
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
objectFactoryFunction(factoryArgs);
|
||||||
ReturnValue_t result = RETURN_FAILED;
|
ReturnValue_t result = RETURN_FAILED;
|
||||||
uint32_t errorCount = 0;
|
uint32_t errorCount = 0;
|
||||||
for (auto const& it : objectList) {
|
for (auto const& it : objectList) {
|
||||||
result = it.second->initialize();
|
result = it.second->initialize();
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
object_id_t var = it.first;
|
object_id_t var = it.first;
|
||||||
FSFW_LOGWT("initialize: Object {:#010x} failed to initialize with code {:#06x}\n", var,
|
sif::error << "ObjectManager::initialize: Object 0x" << std::hex << std::setw(8)
|
||||||
result);
|
<< std::setfill('0') << var
|
||||||
|
<< " failed to "
|
||||||
|
"initialize with code 0x"
|
||||||
|
<< result << std::dec << std::setfill(' ') << std::endl;
|
||||||
|
#endif
|
||||||
errorCount++;
|
errorCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (errorCount > 0) {
|
if (errorCount > 0) {
|
||||||
FSFW_LOGWT("{}", "initialize: Counted failed initializations\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "ObjectManager::ObjectManager: Counted " << errorCount
|
||||||
|
<< " failed initializations." << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
// Init was successful. Now check successful interconnections.
|
// Init was successful. Now check successful interconnections.
|
||||||
errorCount = 0;
|
errorCount = 0;
|
||||||
for (auto const& it : objectList) {
|
for (auto const& it : objectList) {
|
||||||
result = it.second->checkObjectConnections();
|
result = it.second->checkObjectConnections();
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
FSFW_LOGE("initialize: Object {:#010x} connection check failed with code {:#06x}\n", it.first,
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
result);
|
sif::error << "ObjectManager::ObjectManager: Object 0x" << std::hex << (int)it.first
|
||||||
|
<< " connection check failed with code 0x" << result << std::dec << std::endl;
|
||||||
|
#endif
|
||||||
errorCount++;
|
errorCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (errorCount > 0) {
|
if (errorCount > 0) {
|
||||||
FSFW_LOGE("{}", "ObjectManager::ObjectManager: Counted {} failed connection checks\n",
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
errorCount);
|
sif::error << "ObjectManager::ObjectManager: Counted " << errorCount
|
||||||
|
<< " failed connection checks." << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectManager::printList() {
|
void ObjectManager::printList() {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::info("ObjectManager: Object List contains:\n");
|
sif::debug << "ObjectManager: Object List contains:" << std::endl;
|
||||||
for (auto const& it : objectList) {
|
for (auto const& it : objectList) {
|
||||||
sif::info("{:#010x} | {:#010x}\n", it.first, fmt::ptr(it.second));
|
sif::debug << std::hex << it.first << " | " << it.second << std::endl;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
#define FSFW_OBJECTMANAGER_OBJECTMANAGERIF_H_
|
#define FSFW_OBJECTMANAGER_OBJECTMANAGERIF_H_
|
||||||
|
|
||||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
|
#include "../serviceinterface/ServiceInterface.h"
|
||||||
#include "SystemObjectIF.h"
|
#include "SystemObjectIF.h"
|
||||||
#include "frameworkObjects.h"
|
#include "frameworkObjects.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class provides an interface to the global object manager.
|
* @brief This class provides an interface to the global object manager.
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "fsfw/ipc/MutexGuard.h"
|
#include "fsfw/ipc/MutexGuard.h"
|
||||||
#include "fsfw/osal/common/TcpTmTcBridge.h"
|
#include "fsfw/osal/common/TcpTmTcBridge.h"
|
||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
#ifdef PLATFORM_WIN
|
#ifdef PLATFORM_WIN
|
||||||
|
|
||||||
@ -21,13 +21,17 @@ TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination, ob
|
|||||||
: TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
|
: TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
|
||||||
mutex = MutexFactory::instance()->createMutex();
|
mutex = MutexFactory::instance()->createMutex();
|
||||||
// Connection is always up, TM is requested by connecting to server and receiving packets
|
// Connection is always up, TM is requested by connecting to server and receiving packets
|
||||||
TmTcBridge::registerCommConnect();
|
registerCommConnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t TcpTmTcBridge::initialize() {
|
ReturnValue_t TcpTmTcBridge::initialize() {
|
||||||
ReturnValue_t result = TmTcBridge::initialize();
|
ReturnValue_t result = TmTcBridge::initialize();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGE("TcpTmTcBridge::initialize: TmTcBridge initialization failed\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "TcpTmTcBridge::initialize: TmTcBridge initialization failed!" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError("TcpTmTcBridge::initialize: TmTcBridge initialization failed!\n");
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "fsfw/ipc/MutexGuard.h"
|
#include "fsfw/ipc/MutexGuard.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
#include "fsfw/tmtcservices/SpacePacketParser.h"
|
#include "fsfw/tmtcservices/SpacePacketParser.h"
|
||||||
#include "fsfw/tmtcservices/TmTcMessage.h"
|
#include "fsfw/tmtcservices/TmTcMessage.h"
|
||||||
@ -56,7 +56,11 @@ ReturnValue_t TcpTmTcServer::initialize() {
|
|||||||
}
|
}
|
||||||
tcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
|
tcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
|
||||||
if (tcStore == nullptr) {
|
if (tcStore == nullptr) {
|
||||||
FSFW_LOGE("TcpTmTcServer::initialize: TC store uninitialized\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "TcpTmTcServer::initialize: TC store uninitialized!" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError("TcpTmTcServer::initialize: TC store uninitialized!\n");
|
||||||
|
#endif
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +205,11 @@ void TcpTmTcServer::handleServerOperation(socket_t& connSocket) {
|
|||||||
|
|
||||||
ReturnValue_t TcpTmTcServer::handleTcReception(uint8_t* spacePacket, size_t packetSize) {
|
ReturnValue_t TcpTmTcServer::handleTcReception(uint8_t* spacePacket, size_t packetSize) {
|
||||||
if (wiretappingEnabled) {
|
if (wiretappingEnabled) {
|
||||||
FSFW_LOGI("Received TC:\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::info << "Received TC:" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printInfo("Received TC:\n");
|
||||||
|
#endif
|
||||||
arrayprinter::print(spacePacket, packetSize);
|
arrayprinter::print(spacePacket, packetSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +219,17 @@ ReturnValue_t TcpTmTcServer::handleTcReception(uint8_t* spacePacket, size_t pack
|
|||||||
store_address_t storeId;
|
store_address_t storeId;
|
||||||
ReturnValue_t result = tcStore->addData(&storeId, spacePacket, packetSize);
|
ReturnValue_t result = tcStore->addData(&storeId, spacePacket, packetSize);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGWT("handleTcReception: Data storage with packet size {} failed\n", packetSize);
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "TcpTmTcServer::handleServerOperation: Data storage with packet size"
|
||||||
|
<< packetSize << " failed" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"TcpTmTcServer::handleServerOperation: Data storage with packet size %d "
|
||||||
|
"failed\n",
|
||||||
|
packetSize);
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,7 +237,17 @@ ReturnValue_t TcpTmTcServer::handleTcReception(uint8_t* spacePacket, size_t pack
|
|||||||
|
|
||||||
result = MessageQueueSenderIF::sendMessage(targetTcDestination, &message);
|
result = MessageQueueSenderIF::sendMessage(targetTcDestination, &message);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGWT("handleTcReception: Sending message to queue failed\n");
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "TcpTmTcServer::handleServerOperation: "
|
||||||
|
" Sending message to queue failed"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"TcpTmTcServer::handleServerOperation: "
|
||||||
|
" Sending message to queue failed\n");
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
tcStore->deleteData(storeId);
|
tcStore->deleteData(storeId);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -249,7 +277,11 @@ ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket, bool& tmSent)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (wiretappingEnabled) {
|
if (wiretappingEnabled) {
|
||||||
FSFW_LOGI("Sending TM:");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::info << "Sending TM:" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printInfo("Sending TM:\n");
|
||||||
|
#endif
|
||||||
arrayprinter::print(storeAccessor.data(), storeAccessor.size());
|
arrayprinter::print(storeAccessor.data(), storeAccessor.size());
|
||||||
}
|
}
|
||||||
ssize_t retval = send(connSocket, reinterpret_cast<const char*>(storeAccessor.data()),
|
ssize_t retval = send(connSocket, reinterpret_cast<const char*>(storeAccessor.data()),
|
||||||
@ -274,14 +306,31 @@ ReturnValue_t TcpTmTcServer::handleTcRingBufferData(size_t availableReadData) {
|
|||||||
size_t readAmount = availableReadData;
|
size_t readAmount = availableReadData;
|
||||||
lastRingBufferSize = availableReadData;
|
lastRingBufferSize = availableReadData;
|
||||||
if (readAmount >= ringBuffer.getMaxSize()) {
|
if (readAmount >= ringBuffer.getMaxSize()) {
|
||||||
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
// Possible configuration error, too much data or/and data coming in too fast,
|
// Possible configuration error, too much data or/and data coming in too fast,
|
||||||
// requiring larger buffers
|
// requiring larger buffers
|
||||||
FSFW_LOGWT("handleTcRingBufferData: Ring buffer reached fill count\n");
|
sif::warning << "TcpTmTcServer::handleServerOperation: Ring buffer reached "
|
||||||
|
<< "fill count" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"TcpTmTcServer::handleServerOperation: Ring buffer reached "
|
||||||
|
"fill count");
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (readAmount >= receptionBuffer.size()) {
|
if (readAmount >= receptionBuffer.size()) {
|
||||||
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
// Possible configuration error, too much data or/and data coming in too fast,
|
// Possible configuration error, too much data or/and data coming in too fast,
|
||||||
// requiring larger buffers
|
// requiring larger buffers
|
||||||
FSFW_LOGWT("handleTcRingBufferData: Reception buffer too small\n");
|
sif::warning << "TcpTmTcServer::handleServerOperation: "
|
||||||
|
"Reception buffer too small "
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("TcpTmTcServer::handleServerOperation: Reception buffer too small\n");
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
readAmount = receptionBuffer.size();
|
readAmount = receptionBuffer.size();
|
||||||
}
|
}
|
||||||
ringBuffer.readData(receptionBuffer.data(), readAmount, true);
|
ringBuffer.readData(receptionBuffer.data(), readAmount, true);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/osal/common/tcpipHelpers.h"
|
#include "fsfw/osal/common/tcpipHelpers.h"
|
||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
#ifdef PLATFORM_WIN
|
#ifdef PLATFORM_WIN
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
@ -51,7 +51,9 @@ UdpTcPollingTask::UdpTcPollingTask(object_id_t objectId, object_id_t tmtcUdpBrid
|
|||||||
receptionFlags, &senderAddress, &senderAddressSize);
|
receptionFlags, &senderAddress, &senderAddressSize);
|
||||||
if (bytesReceived == SOCKET_ERROR) {
|
if (bytesReceived == SOCKET_ERROR) {
|
||||||
/* Handle error */
|
/* Handle error */
|
||||||
FSFW_LOGW("performOperation: Reception error\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "UdpTcPollingTask::performOperation: Reception error." << std::endl;
|
||||||
|
#endif
|
||||||
tcpip::handleError(tcpip::Protocol::UDP, tcpip::ErrorSources::RECVFROM_CALL, 1000);
|
tcpip::handleError(tcpip::Protocol::UDP, tcpip::ErrorSources::RECVFROM_CALL, 1000);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -79,7 +81,12 @@ ReturnValue_t UdpTcPollingTask::handleSuccessfullTcRead(size_t bytesRead) {
|
|||||||
|
|
||||||
ReturnValue_t result = tcStore->addData(&storeId, receptionBuffer.data(), bytesRead);
|
ReturnValue_t result = tcStore->addData(&storeId, receptionBuffer.data(), bytesRead);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGWT("handleSuccessfullTcRead: Data storage failed. Packet size {}\n", bytesRead);
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "UdpTcPollingTask::transferPusToSoftwareBus: Data storage failed." << std::endl;
|
||||||
|
sif::warning << "Packet size: " << bytesRead << std::endl;
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +94,13 @@ ReturnValue_t UdpTcPollingTask::handleSuccessfullTcRead(size_t bytesRead) {
|
|||||||
|
|
||||||
result = MessageQueueSenderIF::sendMessage(targetTcDestination, &message);
|
result = MessageQueueSenderIF::sendMessage(targetTcDestination, &message);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGWT("handleSuccessfullTcRead: Sending message to queue failed\n");
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "UdpTcPollingTask::handleSuccessfullTcRead: "
|
||||||
|
" Sending message to queue failed"
|
||||||
|
<< std::endl;
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
tcStore->deleteData(storeId);
|
tcStore->deleteData(storeId);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -96,13 +109,17 @@ ReturnValue_t UdpTcPollingTask::handleSuccessfullTcRead(size_t bytesRead) {
|
|||||||
ReturnValue_t UdpTcPollingTask::initialize() {
|
ReturnValue_t UdpTcPollingTask::initialize() {
|
||||||
tcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
|
tcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
|
||||||
if (tcStore == nullptr) {
|
if (tcStore == nullptr) {
|
||||||
FSFW_LOGE("initialize: TC store uninitialized\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "UdpTcPollingTask::initialize: TC store uninitialized!" << std::endl;
|
||||||
|
#endif
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmtcBridge = ObjectManager::instance()->get<UdpTmTcBridge>(tmtcBridgeId);
|
tmtcBridge = ObjectManager::instance()->get<UdpTmTcBridge>(tmtcBridgeId);
|
||||||
if (tmtcBridge == nullptr) {
|
if (tmtcBridge == nullptr) {
|
||||||
FSFW_LOGE("initialize: Invalid TMTC bridge object\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "UdpTcPollingTask::initialize: Invalid TMTC bridge object!" << std::endl;
|
||||||
|
#endif
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +158,11 @@ void UdpTcPollingTask::setTimeout(double timeoutSeconds) {
|
|||||||
tval = timevalOperations::toTimeval(timeoutSeconds);
|
tval = timevalOperations::toTimeval(timeoutSeconds);
|
||||||
int result = setsockopt(serverSocket, SOL_SOCKET, SO_RCVTIMEO, &tval, sizeof(receptionTimeout));
|
int result = setsockopt(serverSocket, SOL_SOCKET, SO_RCVTIMEO, &tval, sizeof(receptionTimeout));
|
||||||
if (result == -1) {
|
if (result == -1) {
|
||||||
FSFW_LOGW("setTimeout: Setting receive timeout failed with {} | {}", errno, strerror(errno));
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "TcSocketPollingTask::TcSocketPollingTask: Setting "
|
||||||
|
"receive timeout failed with "
|
||||||
|
<< strerror(errno) << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "fsfw/ipc/MutexGuard.h"
|
#include "fsfw/ipc/MutexGuard.h"
|
||||||
#include "fsfw/osal/common/tcpipHelpers.h"
|
#include "fsfw/osal/common/tcpipHelpers.h"
|
||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
#ifdef PLATFORM_WIN
|
#ifdef PLATFORM_WIN
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
@ -36,11 +36,13 @@ UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
|
|||||||
ReturnValue_t UdpTmTcBridge::initialize() {
|
ReturnValue_t UdpTmTcBridge::initialize() {
|
||||||
ReturnValue_t result = TmTcBridge::initialize();
|
ReturnValue_t result = TmTcBridge::initialize();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGE("initialize: TmTcBridge initialization failed\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "UdpTmTcBridge::initialize: TmTcBridge initialization failed!" << std::endl;
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PLATFORM_WIN
|
#ifdef _WIN32
|
||||||
/* Initiates Winsock DLL. */
|
/* Initiates Winsock DLL. */
|
||||||
WSAData wsaData;
|
WSAData wsaData;
|
||||||
WORD wVersionRequested = MAKEWORD(2, 2);
|
WORD wVersionRequested = MAKEWORD(2, 2);
|
||||||
@ -118,7 +120,9 @@ ReturnValue_t UdpTmTcBridge::sendTm(const uint8_t *data, size_t dataLen) {
|
|||||||
ssize_t bytesSent = sendto(serverSocket, reinterpret_cast<const char *>(data), dataLen, flags,
|
ssize_t bytesSent = sendto(serverSocket, reinterpret_cast<const char *>(data), dataLen, flags,
|
||||||
&clientAddress, clientAddressLen);
|
&clientAddress, clientAddressLen);
|
||||||
if (bytesSent == SOCKET_ERROR) {
|
if (bytesSent == SOCKET_ERROR) {
|
||||||
FSFW_LOGWT("sendTm: Send operation failed\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "TmTcUdpBridge::sendTm: Send operation failed." << std::endl;
|
||||||
|
#endif
|
||||||
tcpip::handleError(tcpip::Protocol::UDP, tcpip::ErrorSources::SENDTO_CALL);
|
tcpip::handleError(tcpip::Protocol::UDP, tcpip::ErrorSources::SENDTO_CALL);
|
||||||
}
|
}
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1 && FSFW_UDP_SEND_WIRETAPPING_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1 && FSFW_UDP_SEND_WIRETAPPING_ENABLED == 1
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
#include "fsfw/osal/common/tcpipCommon.h"
|
#include "fsfw/osal/common/tcpipCommon.h"
|
||||||
|
|
||||||
#include <cerrno>
|
|
||||||
|
|
||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
#ifdef PLATFORM_WIN
|
#ifdef PLATFORM_WIN
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
@ -50,20 +48,28 @@ void tcpip::printAddress(struct sockaddr *addr) {
|
|||||||
const char *stringPtr = NULL;
|
const char *stringPtr = NULL;
|
||||||
switch (addr->sa_family) {
|
switch (addr->sa_family) {
|
||||||
case AF_INET: {
|
case AF_INET: {
|
||||||
auto *addrIn = reinterpret_cast<struct sockaddr_in *>(addr);
|
struct sockaddr_in *addrIn = reinterpret_cast<struct sockaddr_in *>(addr);
|
||||||
stringPtr = inet_ntop(AF_INET, &(addrIn->sin_addr), ipAddress, INET_ADDRSTRLEN);
|
stringPtr = inet_ntop(AF_INET, &(addrIn->sin_addr), ipAddress, INET_ADDRSTRLEN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AF_INET6: {
|
case AF_INET6: {
|
||||||
auto *addrIn = reinterpret_cast<struct sockaddr_in6 *>(addr);
|
struct sockaddr_in6 *addrIn = reinterpret_cast<struct sockaddr_in6 *>(addr);
|
||||||
stringPtr = inet_ntop(AF_INET6, &(addrIn->sin6_addr), ipAddress, INET6_ADDRSTRLEN);
|
stringPtr = inet_ntop(AF_INET6, &(addrIn->sin6_addr), ipAddress, INET6_ADDRSTRLEN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (stringPtr == nullptr) {
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
FSFW_LOGDT("Could not convert IP address to text representation, error code {} | {}", errno,
|
if (stringPtr == NULL) {
|
||||||
strerror(errno));
|
sif::debug << "Could not convert IP address to text representation, error code " << errno
|
||||||
|
<< std::endl;
|
||||||
} else {
|
} else {
|
||||||
FSFW_LOGDT("IP Address Sender {}\n", ipAddress);
|
sif::debug << "IP Address Sender: " << ipAddress << std::endl;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (stringPtr == NULL) {
|
||||||
|
sif::printDebug("Could not convert IP address to text representation, error code %d\n", errno);
|
||||||
|
} else {
|
||||||
|
sif::printDebug("IP Address Sender: %s\n", ipAddress);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "fsfw/osal/freertos/BinSemaphUsingTask.h"
|
#include "fsfw/osal/freertos/BinSemaphUsingTask.h"
|
||||||
|
|
||||||
#include "fsfw/osal/freertos/TaskManagement.h"
|
#include "fsfw/osal/freertos/TaskManagement.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
#if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || tskKERNEL_VERSION_MAJOR > 8
|
#if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || tskKERNEL_VERSION_MAJOR > 8
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "fsfw/osal/freertos/BinarySemaphore.h"
|
#include "fsfw/osal/freertos/BinarySemaphore.h"
|
||||||
|
|
||||||
#include "fsfw/osal/freertos/TaskManagement.h"
|
#include "fsfw/osal/freertos/TaskManagement.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
BinarySemaphore::BinarySemaphore() {
|
BinarySemaphore::BinarySemaphore() {
|
||||||
handle = xSemaphoreCreateBinary();
|
handle = xSemaphoreCreateBinary();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "fsfw/osal/freertos/CountingSemaphUsingTask.h"
|
#include "fsfw/osal/freertos/CountingSemaphUsingTask.h"
|
||||||
|
|
||||||
#include "fsfw/osal/freertos/TaskManagement.h"
|
#include "fsfw/osal/freertos/TaskManagement.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
#if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || tskKERNEL_VERSION_MAJOR > 8
|
#if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || tskKERNEL_VERSION_MAJOR > 8
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "fsfw/osal/freertos/TaskManagement.h"
|
#include "fsfw/osal/freertos/TaskManagement.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "semphr.h"
|
#include "semphr.h"
|
||||||
|
|
||||||
// Make sure #define configUSE_COUNTING_SEMAPHORES 1 is set in
|
// Make sure #define configUSE_COUNTING_SEMAPHORES 1 is set in
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "fsfw/osal/freertos/FixedTimeslotTask.h"
|
#include "fsfw/osal/freertos/FixedTimeslotTask.h"
|
||||||
|
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface.h"
|
||||||
|
|
||||||
const size_t PeriodicTaskIF::MINIMUM_STACK_SIZE = configMINIMAL_STACK_SIZE;
|
const size_t PeriodicTaskIF::MINIMUM_STACK_SIZE = configMINIMAL_STACK_SIZE;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/osal/freertos/QueueMapManager.h"
|
#include "fsfw/osal/freertos/QueueMapManager.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize, MqArgs* args)
|
MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize, MqArgs* args)
|
||||||
: MessageQueueBase(MessageQueueIF::NO_QUEUE, MessageQueueIF::NO_QUEUE, args),
|
: MessageQueueBase(MessageQueueIF::NO_QUEUE, MessageQueueIF::NO_QUEUE, args),
|
||||||
@ -14,10 +14,9 @@ MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize, MqArgs* a
|
|||||||
sif::error << "Specified Message Depth: " << messageDepth << std::endl;
|
sif::error << "Specified Message Depth: " << messageDepth << std::endl;
|
||||||
sif::error << "Specified Maximum Message Size: " << maxMessageSize << std::endl;
|
sif::error << "Specified Maximum Message Size: " << maxMessageSize << std::endl;
|
||||||
#else
|
#else
|
||||||
// TODO: FMTLOG
|
sif::printError("MessageQueue::MessageQueue: Creation failed\n");
|
||||||
// sif::printError("MessageQueue::MessageQueue: Creation failed\n");
|
sif::printError("Specified Message Depth: %d\n", messageDepth);
|
||||||
// sif::printError("Specified Message Depth: %d\n", messageDepth);
|
sif::printError("Specified Maximum Message Size: %d\n", maxMessageSize);
|
||||||
// sif::printError("Specified Maximum Message Size: %d\n", maxMessageSize);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
QueueMapManager::instance()->addMessageQueue(handle, &id);
|
QueueMapManager::instance()->addMessageQueue(handle, &id);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "fsfw/osal/freertos/Mutex.h"
|
#include "fsfw/osal/freertos/Mutex.h"
|
||||||
|
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
Mutex::Mutex() {
|
Mutex::Mutex() {
|
||||||
handle = xSemaphoreCreateMutex();
|
handle = xSemaphoreCreateMutex();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "fsfw/osal/freertos/PeriodicTask.h"
|
#include "fsfw/osal/freertos/PeriodicTask.h"
|
||||||
|
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
|
|
||||||
PeriodicTask::PeriodicTask(const char* name, TaskPriority setPriority, TaskStackSize setStack,
|
PeriodicTask::PeriodicTask(const char* name, TaskPriority setPriority, TaskStackSize setStack,
|
||||||
|
@ -30,10 +30,9 @@ ReturnValue_t QueueMapManager::addMessageQueue(QueueHandle_t queue, MessageQueue
|
|||||||
"inside the map!"
|
"inside the map!"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
#else
|
#else
|
||||||
// TODO: FMTLOG
|
sif::printError(
|
||||||
// sif::printError(
|
"QueueMapManager::addMessageQueue This ID is already "
|
||||||
// "QueueMapManager::addMessageQueue This ID is already "
|
"inside the map!\n");
|
||||||
// "inside the map!\n");
|
|
||||||
#endif
|
#endif
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
@ -52,9 +51,8 @@ QueueHandle_t QueueMapManager::getMessageQueue(MessageQueueId_t messageQueueId)
|
|||||||
sif::warning << "QueueMapManager::getQueueHandle: The ID " << messageQueueId
|
sif::warning << "QueueMapManager::getQueueHandle: The ID " << messageQueueId
|
||||||
<< " does not exists in the map!" << std::endl;
|
<< " does not exists in the map!" << std::endl;
|
||||||
#else
|
#else
|
||||||
// TODO: FMTLOG
|
sif::printWarning("QueueMapManager::getQueueHandle: The ID %d does not exist in the map!\n",
|
||||||
// sif::printWarning("QueueMapManager::getQueueHandle: The ID %d does not exist in the map!\n",
|
messageQueueId);
|
||||||
// messageQueueId);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "fsfw/osal/freertos/BinarySemaphore.h"
|
#include "fsfw/osal/freertos/BinarySemaphore.h"
|
||||||
#include "fsfw/osal/freertos/CountingSemaphUsingTask.h"
|
#include "fsfw/osal/freertos/CountingSemaphUsingTask.h"
|
||||||
#include "fsfw/osal/freertos/CountingSemaphore.h"
|
#include "fsfw/osal/freertos/CountingSemaphore.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr;
|
SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr;
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "fsfw/ipc/MutexGuard.h"
|
#include "fsfw/ipc/MutexGuard.h"
|
||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
#if defined(PLATFORM_WIN)
|
#if defined(PLATFORM_WIN)
|
||||||
#include <sysinfoapi.h>
|
#include <sysinfoapi.h>
|
||||||
@ -14,24 +14,36 @@
|
|||||||
|
|
||||||
using SystemClock = std::chrono::system_clock;
|
using SystemClock = std::chrono::system_clock;
|
||||||
|
|
||||||
uint32_t Clock::getTicksPerSecond() {
|
uint32_t Clock::getTicksPerSecond(void) {
|
||||||
FSFW_LOGW("getTicksPerSecond: Not implemented for host OSAL\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "Clock::getTicksPerSecond: Not implemented for host OSAL" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("Clock::getTicksPerSecond: Not implemented for host OSAL\n");
|
||||||
|
#endif
|
||||||
/* To avoid division by zero */
|
/* To avoid division by zero */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Clock::setClock(const TimeOfDay_t* time) {
|
ReturnValue_t Clock::setClock(const TimeOfDay_t* time) {
|
||||||
// I don't know why someone would need to set a clock which is probably perfectly fine on a
|
/* I don't know why someone would need to set a clock which is probably perfectly fine on a
|
||||||
// host system with internet access so this is not implemented for now.
|
host system with internet access so this is not implemented for now. */
|
||||||
FSFW_LOGI("Clock::setClock: Not implemented for host OSAL\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
sif::warning << "Clock::setClock: Not implemented for host OSAL" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("Clock::setClock: Not implemented for host OSAL\n");
|
||||||
|
#endif
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Clock::setClock(const timeval* time) {
|
ReturnValue_t Clock::setClock(const timeval* time) {
|
||||||
// I don't know why someone would need to set a clock which is probably perfectly fine on a
|
/* I don't know why someone would need to set a clock which is probably perfectly fine on a
|
||||||
// host system with internet access so this is not implemented for now.
|
host system with internet access so this is not implemented for now. */
|
||||||
FSFW_LOGI("Clock::setClock: Not implemented for host OSAL\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
sif::warning << "Clock::setClock: Not implemented for host OSAL" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("Clock::setClock: Not implemented for host OSAL\n");
|
||||||
|
#endif
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Clock::getClock_timeval(timeval* time) {
|
ReturnValue_t Clock::getClock_timeval(timeval* time) {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "fsfw/osal/host/Mutex.h"
|
#include "fsfw/osal/host/Mutex.h"
|
||||||
#include "fsfw/osal/host/taskHelpers.h"
|
#include "fsfw/osal/host/taskHelpers.h"
|
||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
|
|
||||||
#if defined(PLATFORM_WIN)
|
#if defined(PLATFORM_WIN)
|
||||||
@ -52,7 +52,11 @@ void FixedTimeslotTask::taskEntryPoint(void* argument) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->taskFunctionality();
|
this->taskFunctionality();
|
||||||
FSFW_LOGET("taskEntryPoint: Returned from taskFunctionality\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::debug << "FixedTimeslotTask::taskEntryPoint: "
|
||||||
|
"Returned from taskFunctionality."
|
||||||
|
<< std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FixedTimeslotTask::startTask() {
|
ReturnValue_t FixedTimeslotTask::startTask() {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "fsfw/ipc/MutexGuard.h"
|
#include "fsfw/ipc/MutexGuard.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/osal/host/QueueMapManager.h"
|
#include "fsfw/osal/host/QueueMapManager.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize, MqArgs* args)
|
MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize, MqArgs* args)
|
||||||
: MessageQueueBase(MessageQueueIF::NO_QUEUE, MessageQueueIF::NO_QUEUE, args),
|
: MessageQueueBase(MessageQueueIF::NO_QUEUE, MessageQueueIF::NO_QUEUE, args),
|
||||||
@ -15,7 +15,11 @@ MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize, MqArgs* a
|
|||||||
queueLock = MutexFactory::instance()->createMutex();
|
queueLock = MutexFactory::instance()->createMutex();
|
||||||
auto result = QueueMapManager::instance()->addMessageQueue(this, &id);
|
auto result = QueueMapManager::instance()->addMessageQueue(this, &id);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGET("ctor: Could not be created\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "MessageQueue::MessageQueue: Could not be created" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError("MessageQueue::MessageQueue: Could not be created\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "fsfw/osal/host/Mutex.h"
|
#include "fsfw/osal/host/Mutex.h"
|
||||||
|
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
Mutex::Mutex() = default;
|
Mutex::Mutex() {}
|
||||||
|
|
||||||
ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType, uint32_t timeoutMs) {
|
ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType, uint32_t timeoutMs) {
|
||||||
if (timeoutType == TimeoutType::BLOCKING) {
|
if (timeoutType == TimeoutType::BLOCKING) {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "fsfw/osal/host/Mutex.h"
|
#include "fsfw/osal/host/Mutex.h"
|
||||||
#include "fsfw/osal/host/taskHelpers.h"
|
#include "fsfw/osal/host/taskHelpers.h"
|
||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
#if defined(PLATFORM_WIN)
|
#if defined(PLATFORM_WIN)
|
||||||
#include <processthreadsapi.h>
|
#include <processthreadsapi.h>
|
||||||
@ -49,7 +49,11 @@ void PeriodicTask::taskEntryPoint(void* argument) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->taskFunctionality();
|
this->taskFunctionality();
|
||||||
FSFW_LOGE("taskEntryPoint: Returned from taskFunctionality\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::debug << "PeriodicTask::taskEntryPoint: "
|
||||||
|
"Returned from taskFunctionality."
|
||||||
|
<< std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PeriodicTask::startTask() {
|
ReturnValue_t PeriodicTask::startTask() {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "fsfw/ipc/MessageQueueMessageIF.h"
|
#include "fsfw/ipc/MessageQueueMessageIF.h"
|
||||||
#include "fsfw/ipc/MessageQueueSenderIF.h"
|
#include "fsfw/ipc/MessageQueueSenderIF.h"
|
||||||
#include "fsfw/osal/host/MessageQueue.h"
|
#include "fsfw/osal/host/MessageQueue.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
QueueFactory* QueueFactory::factoryInstance = nullptr;
|
QueueFactory* QueueFactory::factoryInstance = nullptr;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "fsfw/ipc/MutexFactory.h"
|
#include "fsfw/ipc/MutexFactory.h"
|
||||||
#include "fsfw/ipc/MutexGuard.h"
|
#include "fsfw/ipc/MutexGuard.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
QueueMapManager* QueueMapManager::mqManagerInstance = nullptr;
|
QueueMapManager* QueueMapManager::mqManagerInstance = nullptr;
|
||||||
|
|
||||||
@ -30,10 +30,15 @@ ReturnValue_t QueueMapManager::addMessageQueue(MessageQueueIF* queueToInsert,
|
|||||||
auto returnPair = queueMap.emplace(currentId, queueToInsert);
|
auto returnPair = queueMap.emplace(currentId, queueToInsert);
|
||||||
if (not returnPair.second) {
|
if (not returnPair.second) {
|
||||||
/* This should never happen for the atomic variable. */
|
/* This should never happen for the atomic variable. */
|
||||||
FSFW_LOGE(
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
"QueueMapManager::addMessageQueue The ID {} is already "
|
sif::error << "QueueMapManager::addMessageQueue This ID is already "
|
||||||
"inside the map\n",
|
"inside the map!"
|
||||||
currentId);
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError(
|
||||||
|
"QueueMapManager::addMessageQueue This ID is already "
|
||||||
|
"inside the map!\n");
|
||||||
|
#endif
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
if (id != nullptr) {
|
if (id != nullptr) {
|
||||||
@ -47,7 +52,13 @@ MessageQueueIF* QueueMapManager::getMessageQueue(MessageQueueId_t messageQueueId
|
|||||||
if (queueIter != queueMap.end()) {
|
if (queueIter != queueMap.end()) {
|
||||||
return queueIter->second;
|
return queueIter->second;
|
||||||
} else {
|
} else {
|
||||||
FSFW_LOGWT("getMessageQueue: The ID does not exists in the map\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "QueueMapManager::getQueueHandle: The ID " << messageQueueId
|
||||||
|
<< " does not exists in the map!" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("QueueMapManager::getQueueHandle: The ID %d does not exist in the map!\n",
|
||||||
|
messageQueueId);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "fsfw/tasks/SemaphoreFactory.h"
|
#include "fsfw/tasks/SemaphoreFactory.h"
|
||||||
|
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr;
|
SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr;
|
||||||
|
|
||||||
@ -17,14 +17,22 @@ SemaphoreFactory* SemaphoreFactory::instance() {
|
|||||||
|
|
||||||
SemaphoreIF* SemaphoreFactory::createBinarySemaphore(uint32_t arguments) {
|
SemaphoreIF* SemaphoreFactory::createBinarySemaphore(uint32_t arguments) {
|
||||||
// Just gonna wait for full C++20 for now.
|
// Just gonna wait for full C++20 for now.
|
||||||
FSFW_LOGE("SemaphoreFactory: Binary Semaphore not implemented yet. Returning nullptr!\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "SemaphoreFactory: Binary Semaphore not implemented yet."
|
||||||
|
" Returning nullptr!\n"
|
||||||
|
<< std::flush;
|
||||||
|
#endif
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SemaphoreIF* SemaphoreFactory::createCountingSemaphore(const uint8_t maxCount, uint8_t initCount,
|
SemaphoreIF* SemaphoreFactory::createCountingSemaphore(const uint8_t maxCount, uint8_t initCount,
|
||||||
uint32_t arguments) {
|
uint32_t arguments) {
|
||||||
// Just gonna wait for full C++20 for now.
|
// Just gonna wait for full C++20 for now.
|
||||||
FSFW_LOGE("SemaphoreFactory: Counting Semaphore not implemented yet. Returning nullptr!\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "SemaphoreFactory: Counting Semaphore not implemented yet."
|
||||||
|
" Returning nullptr!\n"
|
||||||
|
<< std::flush;
|
||||||
|
#endif
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "fsfw/osal/host/PeriodicTask.h"
|
#include "fsfw/osal/host/PeriodicTask.h"
|
||||||
#include "fsfw/osal/host/taskHelpers.h"
|
#include "fsfw/osal/host/taskHelpers.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/tasks/PeriodicTaskIF.h"
|
#include "fsfw/tasks/PeriodicTaskIF.h"
|
||||||
|
|
||||||
TaskFactory* TaskFactory::factoryInstance = new TaskFactory();
|
TaskFactory* TaskFactory::factoryInstance = new TaskFactory();
|
||||||
@ -47,5 +47,9 @@ ReturnValue_t TaskFactory::delayTask(uint32_t delayMs) {
|
|||||||
|
|
||||||
void TaskFactory::printMissedDeadline() {
|
void TaskFactory::printMissedDeadline() {
|
||||||
std::string name = tasks::getTaskName(std::this_thread::get_id());
|
std::string name = tasks::getTaskName(std::this_thread::get_id());
|
||||||
FSFW_LOGW("printMissedDeadline: {}\n", name);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "TaskFactory::printMissedDeadline: " << name << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("TaskFactory::printMissedDeadline: %s\n", name);
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#include "fsfw/osal/common/tcpipHelpers.h"
|
#include "fsfw/osal/common/tcpipHelpers.h"
|
||||||
|
|
||||||
#include <cerrno>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
|
||||||
void tcpip::handleError(Protocol protocol, ErrorSources errorSrc, dur_millis_t sleepDuration) {
|
void tcpip::handleError(Protocol protocol, ErrorSources errorSrc, dur_millis_t sleepDuration) {
|
||||||
@ -95,9 +96,15 @@ void tcpip::handleError(Protocol protocol, ErrorSources errorSrc, dur_millis_t s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FSFW_LOGWT("tcpip::handleError: {} | {} | {}\n", protocolString, errorSrcString, infoString);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "tcpip::handleError: " << protocolString << " | " << errorSrcString << " | "
|
||||||
|
<< infoString << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("tcpip::handleError: %s | %s | %s\n", protocolString.c_str(),
|
||||||
|
errorSrcString.c_str(), infoString.c_str());
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
|
|
||||||
if (sleepDuration > 0) {
|
if (sleepDuration > 0) {
|
||||||
TaskFactory::delayTask(sleepDuration);
|
TaskFactory::instance()->delayTask(sleepDuration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/parameters/ParameterMessage.h"
|
#include "fsfw/parameters/ParameterMessage.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
|
|
||||||
ParameterHelper::ParameterHelper(ReceivesParameterMessagesIF* owner) : owner(owner) {}
|
ParameterHelper::ParameterHelper(ReceivesParameterMessagesIF* owner) : owner(owner) {}
|
||||||
|
|
||||||
@ -44,9 +43,10 @@ ReturnValue_t ParameterHelper::handleParameterMessage(CommandMessage* message) {
|
|||||||
ConstStorageAccessor accessor(storeId);
|
ConstStorageAccessor accessor(storeId);
|
||||||
result = storage->getData(storeId, accessor);
|
result = storage->getData(storeId, accessor);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGE("{}",
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
"ParameterHelper::handleParameterMessage: Getting store data failed for "
|
sif::error << "ParameterHelper::handleParameterMessage: Getting"
|
||||||
"load command\n");
|
<< " store data failed for load command." << std::endl;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "fsfw/parameters/ParameterWrapper.h"
|
#include "fsfw/parameters/ParameterWrapper.h"
|
||||||
|
|
||||||
#include "fsfw/FSFW.h"
|
#include "fsfw/FSFW.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
ParameterWrapper::ParameterWrapper() : pointsToStream(false), type(Type::UNKNOWN_TYPE) {}
|
ParameterWrapper::ParameterWrapper() : pointsToStream(false), type(Type::UNKNOWN_TYPE) {}
|
||||||
|
|
||||||
@ -209,23 +209,47 @@ ReturnValue_t ParameterWrapper::set(const uint8_t *stream, size_t streamSize,
|
|||||||
ReturnValue_t ParameterWrapper::copyFrom(const ParameterWrapper *from,
|
ReturnValue_t ParameterWrapper::copyFrom(const ParameterWrapper *from,
|
||||||
uint16_t startWritingAtIndex) {
|
uint16_t startWritingAtIndex) {
|
||||||
if (data == nullptr) {
|
if (data == nullptr) {
|
||||||
FSFW_LOGWT("{}", "copyFrom: Called on read-only variable\n");
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "ParameterWrapper::copyFrom: Called on read-only variable!" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("ParameterWrapper::copyFrom: Called on read-only variable!\n");
|
||||||
|
#endif
|
||||||
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
return READONLY;
|
return READONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (from->readonlyData == nullptr) {
|
if (from->readonlyData == nullptr) {
|
||||||
FSFW_LOGWT("{}", "copyFrom: Source not set\n");
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "ParameterWrapper::copyFrom: Source not set!" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("ParameterWrapper::copyFrom: Source not set!\n");
|
||||||
|
#endif
|
||||||
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
return SOURCE_NOT_SET;
|
return SOURCE_NOT_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type != from->type) {
|
if (type != from->type) {
|
||||||
FSFW_LOGW("{}", "copyFrom: Datatype missmatch\n");
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "ParameterWrapper::copyFrom: Datatype missmatch!" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("ParameterWrapper::copyFrom: Datatype missmatch!\n");
|
||||||
|
#endif
|
||||||
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
return DATATYPE_MISSMATCH;
|
return DATATYPE_MISSMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The smallest allowed value for rows and columns is one.
|
// The smallest allowed value for rows and columns is one.
|
||||||
if (rows == 0 or columns == 0) {
|
if (rows == 0 or columns == 0) {
|
||||||
FSFW_LOGW("{}", "ParameterWrapper::copyFrom: Columns or rows zero\n");
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "ParameterWrapper::copyFrom: Columns or rows zero!" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("ParameterWrapper::copyFrom: Columns or rows zero!\n");
|
||||||
|
#endif
|
||||||
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
return COLUMN_OR_ROWS_ZERO;
|
return COLUMN_OR_ROWS_ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "definitions.h"
|
#include "definitions.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
PowerSwitcher::PowerSwitcher(PowerSwitchIF* switcher, power::Switch_t setSwitch1,
|
PowerSwitcher::PowerSwitcher(PowerSwitchIF* switcher, power::Switch_t setSwitch1,
|
||||||
power::Switch_t setSwitch2, PowerSwitcher::State_t setStartState)
|
power::Switch_t setSwitch2, PowerSwitcher::State_t setStartState)
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/pus/servicepackets/Service200Packets.h"
|
#include "fsfw/pus/servicepackets/Service200Packets.h"
|
||||||
#include "fsfw/serialize/SerialLinkedListAdapter.h"
|
#include "fsfw/serialize/SerialLinkedListAdapter.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
CService200ModeCommanding::CService200ModeCommanding(object_id_t objectId, uint16_t apid,
|
CService200ModeCommanding::CService200ModeCommanding(object_id_t objectId, uint16_t apid,
|
||||||
uint8_t serviceId, uint8_t numParallelCommands,
|
uint8_t serviceId, uint8_t numParallelCommands,
|
||||||
@ -13,7 +13,7 @@ CService200ModeCommanding::CService200ModeCommanding(object_id_t objectId, uint1
|
|||||||
: CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) {
|
: CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CService200ModeCommanding::~CService200ModeCommanding() = default;
|
CService200ModeCommanding::~CService200ModeCommanding() {}
|
||||||
|
|
||||||
ReturnValue_t CService200ModeCommanding::isValidSubservice(uint8_t subservice) {
|
ReturnValue_t CService200ModeCommanding::isValidSubservice(uint8_t subservice) {
|
||||||
switch (subservice) {
|
switch (subservice) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "fsfw/health/HealthMessage.h"
|
#include "fsfw/health/HealthMessage.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/pus/servicepackets/Service201Packets.h"
|
#include "fsfw/pus/servicepackets/Service201Packets.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
CService201HealthCommanding::CService201HealthCommanding(object_id_t objectId, uint16_t apid,
|
CService201HealthCommanding::CService201HealthCommanding(object_id_t objectId, uint16_t apid,
|
||||||
uint8_t serviceId,
|
uint8_t serviceId,
|
||||||
@ -20,7 +20,9 @@ ReturnValue_t CService201HealthCommanding::isValidSubservice(uint8_t subservice)
|
|||||||
case (Subservice::COMMAND_ANNOUNCE_HEALTH_ALL):
|
case (Subservice::COMMAND_ANNOUNCE_HEALTH_ALL):
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
default:
|
default:
|
||||||
FSFW_LOGWT("Invalid Subservice\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "Invalid Subservice" << std::endl;
|
||||||
|
#endif
|
||||||
return AcceptsTelecommandsIF::INVALID_SUBSERVICE;
|
return AcceptsTelecommandsIF::INVALID_SUBSERVICE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,11 @@ template <size_t MAX_NUM_TCS>
|
|||||||
inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleRequest(
|
inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleRequest(
|
||||||
uint8_t subservice) {
|
uint8_t subservice) {
|
||||||
if (debugMode) {
|
if (debugMode) {
|
||||||
FSFW_LOGI("PUS11::handleRequest: Handling request {}\n", static_cast<int>(subservice));
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::info << "PUS11::handleRequest: Handling request " << static_cast<int>(subservice);
|
||||||
|
#else
|
||||||
|
sif::printInfo("PUS11::handleRequest: Handling request %d\n", subservice);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
// Get de-serialized Timestamp
|
// Get de-serialized Timestamp
|
||||||
const uint8_t *data = currentPacket.getApplicationData();
|
const uint8_t *data = currentPacket.getApplicationData();
|
||||||
@ -84,7 +88,11 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::performService
|
|||||||
return sendRet;
|
return sendRet;
|
||||||
}
|
}
|
||||||
if (debugMode) {
|
if (debugMode) {
|
||||||
FSFW_LOGIT("Released TC & erased it from TC map\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::info << "Released TC & erased it from TC map" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printInfo("Released TC & erased it from TC map\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
telecommandMap.erase(it++);
|
telecommandMap.erase(it++);
|
||||||
} else if (deleteExpiredTcWhenDisabled) {
|
} else if (deleteExpiredTcWhenDisabled) {
|
||||||
@ -123,8 +131,13 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleResetCom
|
|||||||
for (auto it = telecommandMap.begin(); it != telecommandMap.end(); it++) {
|
for (auto it = telecommandMap.begin(); it != telecommandMap.end(); it++) {
|
||||||
ReturnValue_t result = tcStore->deleteData(it->second.storeAddr);
|
ReturnValue_t result = tcStore->deleteData(it->second.storeAddr);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
// This should not happen
|
// This should not happen
|
||||||
FSFW_LOGW("Service11TelecommandScheduling::handleRequestDeleting: Deletion failed\n");
|
sif::warning << "Service11TelecommandScheduling::handleRequestDeleting: Deletion failed"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("Service11TelecommandScheduling::handleRequestDeleting: Deletion failed\n");
|
||||||
|
#endif
|
||||||
triggerEvent(TC_DELETION_FAILED, (it->second.requestId >> 32) & 0xffffffff,
|
triggerEvent(TC_DELETION_FAILED, (it->second.requestId >> 32) & 0xffffffff,
|
||||||
it->second.requestId & 0xffffffff);
|
it->second.requestId & 0xffffffff);
|
||||||
}
|
}
|
||||||
@ -147,8 +160,15 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doInsertActivi
|
|||||||
timeval tNow = {};
|
timeval tNow = {};
|
||||||
Clock::getClock_timeval(&tNow);
|
Clock::getClock_timeval(&tNow);
|
||||||
if (timestamp - tNow.tv_sec <= RELEASE_TIME_MARGIN_SECONDS) {
|
if (timestamp - tNow.tv_sec <= RELEASE_TIME_MARGIN_SECONDS) {
|
||||||
FSFW_LOGW("Service11TelecommandScheduling::doInsertActivity: "
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
"Release time too close to current time\n");
|
sif::warning << "Service11TelecommandScheduling::doInsertActivity: Release time too close to "
|
||||||
|
"current time"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"Service11TelecommandScheduling::doInsertActivity: Release time too close to current "
|
||||||
|
"time\n");
|
||||||
|
#endif
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +176,13 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doInsertActivi
|
|||||||
store_address_t addr{};
|
store_address_t addr{};
|
||||||
if (tcStore->addData(&addr, data, size) != RETURN_OK ||
|
if (tcStore->addData(&addr, data, size) != RETURN_OK ||
|
||||||
addr.raw == storeId::INVALID_STORE_ADDRESS) {
|
addr.raw == storeId::INVALID_STORE_ADDRESS) {
|
||||||
FSFW_LOGET("Service11TelecommandScheduling::doInsertActivity: Adding data to TC Store failed\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "Service11TelecommandScheduling::doInsertActivity: Adding data to TC Store failed"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError(
|
||||||
|
"Service11TelecommandScheduling::doInsertActivity: Adding data to TC Store failed\n");
|
||||||
|
#endif
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +199,11 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doInsertActivi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (debugMode) {
|
if (debugMode) {
|
||||||
FSFW_LOGI("PUS11::doInsertActivity: Inserted into Multimap:\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::info << "PUS11::doInsertActivity: Inserted into Multimap:" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printInfo("PUS11::doInsertActivity: Inserted into Multimap:\n");
|
||||||
|
#endif
|
||||||
debugPrintMultimapContent();
|
debugPrintMultimapContent();
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
@ -191,7 +221,11 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doDeleteActivi
|
|||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
if (debugMode) {
|
if (debugMode) {
|
||||||
FSFW_LOGI("PUS11::doDeleteActivity: requestId: {}\n", requestId);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::info << "PUS11::doDeleteActivity: requestId: " << requestId << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printInfo("PUS11::doDeleteActivity: requestId: %d\n", requestId);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
TcMapIter tcToDelete; // handle to the TC to be deleted, can be used if counter is valid
|
TcMapIter tcToDelete; // handle to the TC to be deleted, can be used if counter is valid
|
||||||
@ -206,20 +240,37 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doDeleteActivi
|
|||||||
|
|
||||||
// check if 1 explicit TC is found via request ID
|
// check if 1 explicit TC is found via request ID
|
||||||
if (tcToDeleteCount == 0 || tcToDeleteCount > 1) {
|
if (tcToDeleteCount == 0 || tcToDeleteCount > 1) {
|
||||||
FSFW_LOGW("Service11TelecommandScheduling::doDeleteActivity: No or more than 1 TC found. "
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
"Cannot explicitly delete TC\n");
|
sif::warning << "Service11TelecommandScheduling::doDeleteActivity: No or more than 1 TC found. "
|
||||||
|
"Cannot explicitly delete TC"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"Service11TelecommandScheduling::doDeleteActivity: No or more than 1 TC found. "
|
||||||
|
"Cannot explicitly delete TC");
|
||||||
|
#endif
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete packet from store
|
// delete packet from store
|
||||||
if (tcStore->deleteData(tcToDelete->second.storeAddr) != RETURN_OK) {
|
if (tcStore->deleteData(tcToDelete->second.storeAddr) != RETURN_OK) {
|
||||||
FSFW_LOGET("Service11TelecommandScheduling::doDeleteActivity: Could not delete TC from Store\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "Service11TelecommandScheduling::doDeleteActivity: Could not delete TC from Store"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError(
|
||||||
|
"Service11TelecommandScheduling::doDeleteActivity: Could not delete TC from Store\n");
|
||||||
|
#endif
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
telecommandMap.erase(tcToDelete);
|
telecommandMap.erase(tcToDelete);
|
||||||
if (debugMode) {
|
if (debugMode) {
|
||||||
FSFW_LOGI("PUS11::doDeleteActivity: Deleted TC from map\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::info << "PUS11::doDeleteActivity: Deleted TC from map" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printInfo("PUS11::doDeleteActivity: Deleted TC from map\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
@ -241,8 +292,15 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doFilterDelete
|
|||||||
for (TcMapIter it = itBegin; it != itEnd; it++) {
|
for (TcMapIter it = itBegin; it != itEnd; it++) {
|
||||||
// delete packet from store
|
// delete packet from store
|
||||||
if (tcStore->deleteData(it->second.storeAddr) != RETURN_OK) {
|
if (tcStore->deleteData(it->second.storeAddr) != RETURN_OK) {
|
||||||
FSFW_LOGET("Service11TelecommandScheduling::doFilterDeleteActivity: Could not delete TC "
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
"from Store\n");
|
sif::error << "Service11TelecommandScheduling::doFilterDeleteActivity: Could not delete TC "
|
||||||
|
"from Store"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError(
|
||||||
|
"Service11TelecommandScheduling::doFilterDeleteActivity: Could not delete TC from "
|
||||||
|
"Store\n");
|
||||||
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
deletedTCs++;
|
deletedTCs++;
|
||||||
@ -258,7 +316,11 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doFilterDelete
|
|||||||
telecommandMap.erase(itBegin, itEnd);
|
telecommandMap.erase(itBegin, itEnd);
|
||||||
|
|
||||||
if (debugMode) {
|
if (debugMode) {
|
||||||
FSFW_LOGI("PUS11::doFilterDeleteActivity: Deleted {} TCs\n", deletedTCs);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::info << "PUS11::doFilterDeleteActivity: Deleted " << deletedTCs << " TCs" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printInfo("PUS11::doFilterDeleteActivity: Deleted %d TCs\n", deletedTCs);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
@ -285,7 +347,11 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doTimeshiftAct
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (debugMode) {
|
if (debugMode) {
|
||||||
FSFW_LOGI("PUS11::doTimeshiftActivity: requestId: {}\n", requestId);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::info << "PUS11::doTimeshiftActivity: requestId: " << requestId << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printInfo("PUS11::doTimeshiftActivity: requestId: %d\n", requestId);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Despite having C++17 ETL multimap has no member function extract :(
|
// NOTE: Despite having C++17 ETL multimap has no member function extract :(
|
||||||
@ -301,9 +367,17 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doTimeshiftAct
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tcToTimeshiftCount == 0 || tcToTimeshiftCount > 1) {
|
if (tcToTimeshiftCount == 0 || tcToTimeshiftCount > 1) {
|
||||||
FSFW_LOGW("Service11TelecommandScheduling::doTimeshiftActivity: Either 0 or more than 1 "
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "Service11TelecommandScheduling::doTimeshiftActivity: Either 0 or more than 1 "
|
||||||
"TCs found. No explicit timeshifting "
|
"TCs found. No explicit timeshifting "
|
||||||
"possible\n");
|
"possible"
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"Service11TelecommandScheduling::doTimeshiftActivity: Either 0 or more than 1 TCs found. "
|
||||||
|
"No explicit timeshifting possible\n");
|
||||||
|
#endif
|
||||||
return TIMESHIFTING_NOT_POSSIBLE;
|
return TIMESHIFTING_NOT_POSSIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +392,11 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doTimeshiftAct
|
|||||||
telecommandMap.insert(std::make_pair(tempKey, tempTc));
|
telecommandMap.insert(std::make_pair(tempKey, tempTc));
|
||||||
|
|
||||||
if (debugMode) {
|
if (debugMode) {
|
||||||
FSFW_LOGI("PUS11::doTimeshiftActivity: Shifted TC\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::info << "PUS11::doTimeshiftActivity: Shifted TC" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printDebug("PUS11::doTimeshiftActivity: Shifted TC\n");
|
||||||
|
#endif
|
||||||
debugPrintMultimapContent();
|
debugPrintMultimapContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,7 +439,12 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doFilterTimesh
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (debugMode) {
|
if (debugMode) {
|
||||||
FSFW_LOGI("PUS11::doFilterTimeshiftActivity: shiftedItemsCount: {}\n", shiftedItemsCount);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::info << "PUS11::doFilterTimeshiftActivity: shiftedItemsCount: " << shiftedItemsCount
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printInfo("PUS11::doFilterTimeshiftActivity: shiftedItemsCount: %d\n", shiftedItemsCount);
|
||||||
|
#endif
|
||||||
debugPrintMultimapContent();
|
debugPrintMultimapContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,7 +604,11 @@ template <size_t MAX_NUM_TCS>
|
|||||||
inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleInvalidData(
|
inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleInvalidData(
|
||||||
const char *ctx) {
|
const char *ctx) {
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
FSFW_LOGW("Service11TelecommandScheduling::{}: Invalid buffer\n", ctx);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "Service11TelecommandScheduling:: " << ctx << ": Invalid buffer" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("Service11TelecommandScheduling::%s: Invalid buffer\n", ctx);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
@ -529,10 +616,20 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleInvalidD
|
|||||||
template <size_t MAX_NUM_TCS>
|
template <size_t MAX_NUM_TCS>
|
||||||
inline void Service11TelecommandScheduling<MAX_NUM_TCS>::debugPrintMultimapContent() const {
|
inline void Service11TelecommandScheduling<MAX_NUM_TCS>::debugPrintMultimapContent() const {
|
||||||
#if FSFW_DISABLE_PRINTOUT == 0
|
#if FSFW_DISABLE_PRINTOUT == 0
|
||||||
FSFW_LOGD("Service11TelecommandScheduling::debugPrintMultimapContent: Multimap Content\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::debug << "Service11TelecommandScheduling::debugPrintMultimapContent: Multimap Content"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printDebug("Service11TelecommandScheduling::debugPrintMultimapContent: Multimap Content\n");
|
||||||
|
#endif
|
||||||
for (const auto &dit : telecommandMap) {
|
for (const auto &dit : telecommandMap) {
|
||||||
FSFW_LOGD("[{}]: Request ID: {} | Store Address: {}\n", dit.first, dit.second.requestId,
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
dit.second.storeAddr.raw);
|
sif::debug << "[" << dit.first << "]: Request ID: " << dit.second.requestId << " | "
|
||||||
|
<< "Store Address: " << dit.second.storeAddr.raw << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printDebug("[%d]: Request ID: %d | Store Address: %d\n", dit.first, dit.second.requestId,
|
||||||
|
dit.second.storeAddr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
#include "fsfw/FSFW.h"
|
#include "fsfw/FSFW.h"
|
||||||
#include "fsfw/objectmanager/SystemObject.h"
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/tmtcpacket/pus/tm/TmPacketStored.h"
|
#include "fsfw/tmtcpacket/pus/tm/TmPacketStored.h"
|
||||||
|
|
||||||
Service17Test::Service17Test(object_id_t objectId, uint16_t apid, uint8_t serviceId)
|
Service17Test::Service17Test(object_id_t objectId, uint16_t apid, uint8_t serviceId)
|
||||||
: PusServiceBase(objectId, apid, serviceId), packetSubCounter(0) {}
|
: PusServiceBase(objectId, apid, serviceId), packetSubCounter(0) {}
|
||||||
|
|
||||||
Service17Test::~Service17Test() = default;
|
Service17Test::~Service17Test() {}
|
||||||
|
|
||||||
ReturnValue_t Service17Test::handleRequest(uint8_t subservice) {
|
ReturnValue_t Service17Test::handleRequest(uint8_t subservice) {
|
||||||
switch (subservice) {
|
switch (subservice) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "fsfw/ipc/QueueFactory.h"
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/pus/servicepackets/Service1Packets.h"
|
#include "fsfw/pus/servicepackets/Service1Packets.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/tmtcpacket/pus/tm/TmPacketStored.h"
|
#include "fsfw/tmtcpacket/pus/tm/TmPacketStored.h"
|
||||||
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
|
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
|
||||||
#include "fsfw/tmtcservices/PusVerificationReport.h"
|
#include "fsfw/tmtcservices/PusVerificationReport.h"
|
||||||
@ -53,9 +53,11 @@ ReturnValue_t Service1TelecommandVerification::sendVerificationReport(
|
|||||||
result = generateSuccessReport(message);
|
result = generateSuccessReport(message);
|
||||||
}
|
}
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGE(
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
"Service1TelecommandVerification::sendVerificationReport: "
|
sif::error << "Service1TelecommandVerification::sendVerificationReport: "
|
||||||
"Sending verification packet failed\n");
|
"Sending verification packet failed !"
|
||||||
|
<< std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -89,9 +91,15 @@ ReturnValue_t Service1TelecommandVerification::generateSuccessReport(
|
|||||||
|
|
||||||
ReturnValue_t Service1TelecommandVerification::initialize() {
|
ReturnValue_t Service1TelecommandVerification::initialize() {
|
||||||
// Get target object for TC verification messages
|
// Get target object for TC verification messages
|
||||||
auto* funnel = ObjectManager::instance()->get<AcceptsTelemetryIF>(targetDestination);
|
AcceptsTelemetryIF* funnel =
|
||||||
|
ObjectManager::instance()->get<AcceptsTelemetryIF>(targetDestination);
|
||||||
if (funnel == nullptr) {
|
if (funnel == nullptr) {
|
||||||
FSFW_LOGE("initialize: Specified TM funnel invalid. Does it implement AcceptsTelemetryIF?\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "Service1TelecommandVerification::initialize: Specified"
|
||||||
|
" TM funnel invalid. Make sure it is set up and implements"
|
||||||
|
" AcceptsTelemetryIF."
|
||||||
|
<< std::endl;
|
||||||
|
#endif
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
tmQueue->setDefaultDestination(funnel->getReportReceptionQueue());
|
tmQueue->setDefaultDestination(funnel->getReportReceptionQueue());
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "fsfw/parameters/ParameterMessage.h"
|
#include "fsfw/parameters/ParameterMessage.h"
|
||||||
#include "fsfw/parameters/ReceivesParameterMessagesIF.h"
|
#include "fsfw/parameters/ReceivesParameterMessagesIF.h"
|
||||||
#include "fsfw/pus/servicepackets/Service20Packets.h"
|
#include "fsfw/pus/servicepackets/Service20Packets.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
Service20ParameterManagement::Service20ParameterManagement(object_id_t objectId, uint16_t apid,
|
Service20ParameterManagement::Service20ParameterManagement(object_id_t objectId, uint16_t apid,
|
||||||
uint8_t serviceId,
|
uint8_t serviceId,
|
||||||
@ -14,7 +14,7 @@ Service20ParameterManagement::Service20ParameterManagement(object_id_t objectId,
|
|||||||
: CommandingServiceBase(objectId, apid, serviceId, numberOfParallelCommands,
|
: CommandingServiceBase(objectId, apid, serviceId, numberOfParallelCommands,
|
||||||
commandTimeoutSeconds) {}
|
commandTimeoutSeconds) {}
|
||||||
|
|
||||||
Service20ParameterManagement::~Service20ParameterManagement() = default;
|
Service20ParameterManagement::~Service20ParameterManagement() {}
|
||||||
|
|
||||||
ReturnValue_t Service20ParameterManagement::isValidSubservice(uint8_t subservice) {
|
ReturnValue_t Service20ParameterManagement::isValidSubservice(uint8_t subservice) {
|
||||||
switch (static_cast<Subservice>(subservice)) {
|
switch (static_cast<Subservice>(subservice)) {
|
||||||
@ -22,7 +22,11 @@ ReturnValue_t Service20ParameterManagement::isValidSubservice(uint8_t subservice
|
|||||||
case Subservice::PARAMETER_DUMP:
|
case Subservice::PARAMETER_DUMP:
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
default:
|
default:
|
||||||
FSFW_LOGE("Invalid Subservice {} for Service 20\n", subservice);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "Invalid Subservice for Service 20" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError("Invalid Subservice for Service 20\n");
|
||||||
|
#endif
|
||||||
return AcceptsTelecommandsIF::INVALID_SUBSERVICE;
|
return AcceptsTelecommandsIF::INVALID_SUBSERVICE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -44,21 +48,38 @@ ReturnValue_t Service20ParameterManagement::checkAndAcquireTargetID(object_id_t*
|
|||||||
size_t tcDataLen) {
|
size_t tcDataLen) {
|
||||||
if (SerializeAdapter::deSerialize(objectIdToSet, &tcData, &tcDataLen,
|
if (SerializeAdapter::deSerialize(objectIdToSet, &tcData, &tcDataLen,
|
||||||
SerializeIF::Endianness::BIG) != HasReturnvaluesIF::RETURN_OK) {
|
SerializeIF::Endianness::BIG) != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGE("checkAndAcquireTargetID: Invalid data\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "Service20ParameterManagement::checkAndAcquireTargetID: "
|
||||||
|
<< "Invalid data." << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError(
|
||||||
|
"Service20ParameterManagement::"
|
||||||
|
"checkAndAcquireTargetID: Invalid data.\n");
|
||||||
|
#endif
|
||||||
return CommandingServiceBase::INVALID_TC;
|
return CommandingServiceBase::INVALID_TC;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Service20ParameterManagement::checkInterfaceAndAcquireMessageQueue(
|
ReturnValue_t Service20ParameterManagement::checkInterfaceAndAcquireMessageQueue(
|
||||||
MessageQueueId_t* messageQueueToSet, const object_id_t* objectId) {
|
MessageQueueId_t* messageQueueToSet, object_id_t* objectId) {
|
||||||
// check ReceivesParameterMessagesIF property of target
|
// check ReceivesParameterMessagesIF property of target
|
||||||
auto* possibleTarget = ObjectManager::instance()->get<ReceivesParameterMessagesIF>(*objectId);
|
ReceivesParameterMessagesIF* possibleTarget =
|
||||||
|
ObjectManager::instance()->get<ReceivesParameterMessagesIF>(*objectId);
|
||||||
if (possibleTarget == nullptr) {
|
if (possibleTarget == nullptr) {
|
||||||
FSFW_LOGE(
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
"checkInterfaceAndAcquire: Can't retrieve message queue | Object ID {:#010x}\n"
|
sif::error << "Service20ParameterManagement::checkInterfaceAndAcquire"
|
||||||
"Does it implement ReceivesParameterMessagesIF?\n",
|
<< "MessageQueue: Can't access object" << std::endl;
|
||||||
*objectId);
|
sif::error << "Object ID: " << std::hex << objectId << std::dec << std::endl;
|
||||||
|
sif::error << "Make sure it implements ReceivesParameterMessagesIF!" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError(
|
||||||
|
"Service20ParameterManagement::checkInterfaceAndAcquire"
|
||||||
|
"MessageQueue: Can't access object\n");
|
||||||
|
sif::printError("Object ID: 0x%08x\n", *objectId);
|
||||||
|
sif::printError("Make sure it implements ReceivesParameterMessagesIF!\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
return CommandingServiceBase::INVALID_OBJECT;
|
return CommandingServiceBase::INVALID_OBJECT;
|
||||||
}
|
}
|
||||||
*messageQueueToSet = possibleTarget->getCommandQueue();
|
*messageQueueToSet = possibleTarget->getCommandQueue();
|
||||||
|
@ -37,7 +37,7 @@ class Service20ParameterManagement : public CommandingServiceBase {
|
|||||||
ReturnValue_t checkAndAcquireTargetID(object_id_t* objectIdToSet, const uint8_t* tcData,
|
ReturnValue_t checkAndAcquireTargetID(object_id_t* objectIdToSet, const uint8_t* tcData,
|
||||||
size_t tcDataLen);
|
size_t tcDataLen);
|
||||||
ReturnValue_t checkInterfaceAndAcquireMessageQueue(MessageQueueId_t* messageQueueToSet,
|
ReturnValue_t checkInterfaceAndAcquireMessageQueue(MessageQueueId_t* messageQueueToSet,
|
||||||
const object_id_t* objectId);
|
object_id_t* objectId);
|
||||||
ReturnValue_t prepareDirectCommand(CommandMessage* message, const uint8_t* tcData,
|
ReturnValue_t prepareDirectCommand(CommandMessage* message, const uint8_t* tcData,
|
||||||
size_t tcDataLen);
|
size_t tcDataLen);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "fsfw/serialize/EndianConverter.h"
|
#include "fsfw/serialize/EndianConverter.h"
|
||||||
#include "fsfw/serialize/SerialLinkedListAdapter.h"
|
#include "fsfw/serialize/SerialLinkedListAdapter.h"
|
||||||
#include "fsfw/serialize/SerializeAdapter.h"
|
#include "fsfw/serialize/SerializeAdapter.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||||
|
|
||||||
Service2DeviceAccess::Service2DeviceAccess(object_id_t objectId, uint16_t apid, uint8_t serviceId,
|
Service2DeviceAccess::Service2DeviceAccess(object_id_t objectId, uint16_t apid, uint8_t serviceId,
|
||||||
@ -25,7 +25,9 @@ ReturnValue_t Service2DeviceAccess::isValidSubservice(uint8_t subservice) {
|
|||||||
case Subservice::COMMAND_TOGGLE_WIRETAPPING:
|
case Subservice::COMMAND_TOGGLE_WIRETAPPING:
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
default:
|
default:
|
||||||
FSFW_LOGW("Invalid Subservice {}\n", subservice);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "Invalid Subservice" << std::endl;
|
||||||
|
#endif
|
||||||
return AcceptsTelecommandsIF::INVALID_SUBSERVICE;
|
return AcceptsTelecommandsIF::INVALID_SUBSERVICE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,8 +118,11 @@ void Service2DeviceAccess::handleUnrequestedReply(CommandMessage* reply) {
|
|||||||
sendWiretappingTm(reply, static_cast<uint8_t>(Subservice::REPLY_RAW));
|
sendWiretappingTm(reply, static_cast<uint8_t>(Subservice::REPLY_RAW));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
FSFW_LOGET("handleUnrequestedReply: Unknown message with command ID {}\n",
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
reply->getCommand());
|
sif::error << "Unknown message in Service2DeviceAccess::"
|
||||||
|
"handleUnrequestedReply with command ID "
|
||||||
|
<< reply->getCommand() << std::endl;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Must be reached by all cases to clear message
|
// Must be reached by all cases to clear message
|
||||||
@ -132,8 +137,11 @@ void Service2DeviceAccess::sendWiretappingTm(CommandMessage* reply, uint8_t subs
|
|||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
ReturnValue_t result = IPCStore->getData(storeAddress, &data, &size);
|
ReturnValue_t result = IPCStore->getData(storeAddress, &data, &size);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGW("sendWiretappingTm: Data Lost in handleUnrequestedReply with failure ID {:#06x}\n",
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
result);
|
sif::error << "Service2DeviceAccess::sendWiretappingTm: Data Lost in "
|
||||||
|
"handleUnrequestedReply with failure ID "
|
||||||
|
<< result << std::endl;
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,15 @@ ReturnValue_t Service3Housekeeping::handleReply(const CommandMessage* reply,
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FSFW_LOGW("handleReply: Invalid reply with reply command {}\n", command);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "Service3Housekeeping::handleReply: Invalid reply with "
|
||||||
|
<< "reply command " << command << "!" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"Service3Housekeeping::handleReply: Invalid reply with "
|
||||||
|
"reply command %hu!\n",
|
||||||
|
command);
|
||||||
|
#endif
|
||||||
return CommandingServiceBase::INVALID_REPLY;
|
return CommandingServiceBase::INVALID_REPLY;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
@ -233,20 +241,39 @@ void Service3Housekeeping::handleUnrequestedReply(CommandMessage* reply) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case (HousekeepingMessage::HK_REQUEST_SUCCESS):
|
case (HousekeepingMessage::HK_REQUEST_SUCCESS): {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case (HousekeepingMessage::HK_REQUEST_FAILURE): {
|
case (HousekeepingMessage::HK_REQUEST_FAILURE): {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
FSFW_LOGW("handleUnrequestedReply: Invalid reply with reply command {}\n", command);
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "Service3Housekeeping::handleUnrequestedReply: Invalid reply with reply "
|
||||||
|
"command "
|
||||||
|
<< command << "!" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"Service3Housekeeping::handleUnrequestedReply: Invalid reply with "
|
||||||
|
"reply command %hu!\n",
|
||||||
|
command);
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
/* Configuration error */
|
/* Configuration error */
|
||||||
FSFW_LOGWT("handleUnrequestedReply: Could not generate reply\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "Service3Housekeeping::handleUnrequestedReply: Could not generate reply!"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"Service3Housekeeping::handleUnrequestedReply: "
|
||||||
|
"Could not generate reply!\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "fsfw/ipc/QueueFactory.h"
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/pus/servicepackets/Service5Packets.h"
|
#include "fsfw/pus/servicepackets/Service5Packets.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/tmtcpacket/pus/tm/TmPacketStored.h"
|
#include "fsfw/tmtcpacket/pus/tm/TmPacketStored.h"
|
||||||
|
|
||||||
Service5EventReporting::Service5EventReporting(object_id_t objectId, uint16_t apid,
|
Service5EventReporting::Service5EventReporting(object_id_t objectId, uint16_t apid,
|
||||||
@ -36,7 +36,9 @@ ReturnValue_t Service5EventReporting::performService() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FSFW_LOGWT("generateEventReport: Too many events\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "Service5EventReporting::generateEventReport: Too many events" << std::endl;
|
||||||
|
#endif
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +55,15 @@ ReturnValue_t Service5EventReporting::generateEventReport(EventMessage message)
|
|||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
tmPacket.sendPacket(requestQueue->getDefaultDestination(), requestQueue->getId());
|
tmPacket.sendPacket(requestQueue->getDefaultDestination(), requestQueue->getId());
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGW("generateEventReport: Could not send TM packet\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "Service5EventReporting::generateEventReport: "
|
||||||
|
"Could not send TM packet"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning(
|
||||||
|
"Service5EventReporting::generateEventReport: "
|
||||||
|
"Could not send TM packet\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "fsfw/objectmanager/SystemObjectIF.h"
|
#include "fsfw/objectmanager/SystemObjectIF.h"
|
||||||
#include "fsfw/pus/servicepackets/Service8Packets.h"
|
#include "fsfw/pus/servicepackets/Service8Packets.h"
|
||||||
#include "fsfw/serialize/SerializeAdapter.h"
|
#include "fsfw/serialize/SerializeAdapter.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
Service8FunctionManagement::Service8FunctionManagement(object_id_t objectId, uint16_t apid,
|
Service8FunctionManagement::Service8FunctionManagement(object_id_t objectId, uint16_t apid,
|
||||||
uint8_t serviceId,
|
uint8_t serviceId,
|
||||||
@ -65,7 +65,10 @@ ReturnValue_t Service8FunctionManagement::prepareDirectCommand(CommandMessage* m
|
|||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
if (tcDataLen < sizeof(object_id_t) + sizeof(ActionId_t)) {
|
if (tcDataLen < sizeof(object_id_t) + sizeof(ActionId_t)) {
|
||||||
FSFW_LOGWT("prepareDirectCommand: TC size smaller thant minimum size of direct command\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::debug << "Service8FunctionManagement::prepareDirectCommand:"
|
||||||
|
<< " TC size smaller thant minimum size of direct command." << std::endl;
|
||||||
|
#endif
|
||||||
return CommandingServiceBase::INVALID_TC;
|
return CommandingServiceBase::INVALID_TC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +132,9 @@ ReturnValue_t Service8FunctionManagement::handleDataReply(const CommandMessage*
|
|||||||
const uint8_t* buffer = nullptr;
|
const uint8_t* buffer = nullptr;
|
||||||
ReturnValue_t result = IPCStore->getData(storeId, &buffer, &size);
|
ReturnValue_t result = IPCStore->getData(storeId, &buffer, &size);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
FSFW_LOGWT("Service 8: Could not retrieve data for data reply\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "Service 8: Could not retrieve data for data reply" << std::endl;
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
DataReply dataReply(objectId, actionId, buffer, size);
|
DataReply dataReply(objectId, actionId, buffer, size);
|
||||||
@ -137,7 +142,10 @@ ReturnValue_t Service8FunctionManagement::handleDataReply(const CommandMessage*
|
|||||||
|
|
||||||
auto deletionResult = IPCStore->deleteData(storeId);
|
auto deletionResult = IPCStore->deleteData(storeId);
|
||||||
if (deletionResult != HasReturnvaluesIF::RETURN_OK) {
|
if (deletionResult != HasReturnvaluesIF::RETURN_OK) {
|
||||||
FSFW_LOGWT("Service8FunctionManagement::handleReply: Deletion of data in pool failed\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "Service8FunctionManagement::handleReply: Deletion"
|
||||||
|
<< " of data in pool failed." << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
#include "fsfw/events/EventManagerIF.h"
|
#include "fsfw/events/EventManagerIF.h"
|
||||||
#include "fsfw/pus/servicepackets/Service9Packets.h"
|
#include "fsfw/pus/servicepackets/Service9Packets.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/timemanager/CCSDSTime.h"
|
#include "fsfw/timemanager/CCSDSTime.h"
|
||||||
|
|
||||||
Service9TimeManagement::Service9TimeManagement(object_id_t objectId, uint16_t apid,
|
Service9TimeManagement::Service9TimeManagement(object_id_t objectId, uint16_t apid,
|
||||||
uint8_t serviceId)
|
uint8_t serviceId)
|
||||||
: PusServiceBase(objectId, apid, serviceId) {}
|
: PusServiceBase(objectId, apid, serviceId) {}
|
||||||
|
|
||||||
Service9TimeManagement::~Service9TimeManagement() = default;
|
Service9TimeManagement::~Service9TimeManagement() {}
|
||||||
|
|
||||||
ReturnValue_t Service9TimeManagement::performService() { return RETURN_OK; }
|
ReturnValue_t Service9TimeManagement::performService() { return RETURN_OK; }
|
||||||
|
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE20PACKETS_H_
|
#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE20PACKETS_H_
|
||||||
#define FSFW_PUS_SERVICEPACKETS_SERVICE20PACKETS_H_
|
#define FSFW_PUS_SERVICEPACKETS_SERVICE20PACKETS_H_
|
||||||
|
|
||||||
|
#include <FSFWConfig.h>
|
||||||
#include <fsfw/parameters/HasParametersIF.h>
|
#include <fsfw/parameters/HasParametersIF.h>
|
||||||
#include <fsfw/serialize/SerialBufferAdapter.h>
|
#include <fsfw/serialize/SerialBufferAdapter.h>
|
||||||
#include <fsfw/serialize/SerialLinkedListAdapter.h>
|
#include <fsfw/serialize/SerialLinkedListAdapter.h>
|
||||||
#include <fsfw/serialize/SerializeElement.h>
|
#include <fsfw/serialize/SerializeElement.h>
|
||||||
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
#include "fsfw/FSFW.h"
|
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class encapsulates the packets sent to the PUS service 20 or sent by the
|
* @brief This class encapsulates the packets sent to the PUS service 20 or sent by the
|
||||||
@ -27,9 +26,15 @@ class ParameterCommand
|
|||||||
*/
|
*/
|
||||||
ParameterCommand(uint8_t* storePointer, size_t parameterDataLen)
|
ParameterCommand(uint8_t* storePointer, size_t parameterDataLen)
|
||||||
: parameterBuffer(storePointer, parameterDataLen) {
|
: parameterBuffer(storePointer, parameterDataLen) {
|
||||||
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
if (parameterDataLen == 0) {
|
if (parameterDataLen == 0) {
|
||||||
FSFW_LOGWT("ParameterCommand: Parameter data length is 0\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "ParameterCommand: Parameter data length is 0" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("ParameterCommand: Parameter data length is 0!\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
setLoadLinks();
|
setLoadLinks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "../../action/ActionMessage.h"
|
#include "../../action/ActionMessage.h"
|
||||||
#include "../../objectmanager/SystemObjectIF.h"
|
#include "../../objectmanager/SystemObjectIF.h"
|
||||||
#include "../../serialize/SerialLinkedListAdapter.h"
|
#include "../../serialize/SerialLinkedListAdapter.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Subservice 128
|
* @brief Subservice 128
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
template <typename count_t>
|
template <typename count_t>
|
||||||
SerialBufferAdapter<count_t>::SerialBufferAdapter(const uint8_t* buffer, count_t bufferLength,
|
SerialBufferAdapter<count_t>::SerialBufferAdapter(const uint8_t* buffer, count_t bufferLength,
|
||||||
@ -95,7 +95,11 @@ ReturnValue_t SerialBufferAdapter<count_t>::deSerialize(const uint8_t** buffer,
|
|||||||
template <typename count_t>
|
template <typename count_t>
|
||||||
uint8_t* SerialBufferAdapter<count_t>::getBuffer() {
|
uint8_t* SerialBufferAdapter<count_t>::getBuffer() {
|
||||||
if (buffer == nullptr) {
|
if (buffer == nullptr) {
|
||||||
FSFW_LOGW("{}", "getBuffer: Wrong access function for stored type. Use getConstBuffer\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "Wrong access function for stored type !"
|
||||||
|
" Use getConstBuffer()."
|
||||||
|
<< std::endl;
|
||||||
|
#endif
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return buffer;
|
return buffer;
|
||||||
@ -104,7 +108,11 @@ uint8_t* SerialBufferAdapter<count_t>::getBuffer() {
|
|||||||
template <typename count_t>
|
template <typename count_t>
|
||||||
const uint8_t* SerialBufferAdapter<count_t>::getConstBuffer() const {
|
const uint8_t* SerialBufferAdapter<count_t>::getConstBuffer() const {
|
||||||
if (constBuffer == nullptr) {
|
if (constBuffer == nullptr) {
|
||||||
FSFW_LOGE("{}", "getConstBuffer: Buffers are unitialized\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "SerialBufferAdapter::getConstBuffer:"
|
||||||
|
" Buffers are unitialized!"
|
||||||
|
<< std::endl;
|
||||||
|
#endif
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return constBuffer;
|
return constBuffer;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#ifndef FSFW_SRC_FSFW_SERVICEINTERFACE_H_
|
#ifndef FSFW_SRC_FSFW_SERVICEINTERFACE_H_
|
||||||
#define FSFW_SRC_FSFW_SERVICEINTERFACE_H_
|
#define FSFW_SRC_FSFW_SERVICEINTERFACE_H_
|
||||||
|
|
||||||
#include "serviceinterface/fmtWrapper.h"
|
#include "serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
#endif /* FSFW_SRC_FSFW_SERVICEINTERFACE_H_ */
|
#endif /* FSFW_SRC_FSFW_SERVICEINTERFACE_H_ */
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PRIVATE
|
target_sources(
|
||||||
fmtWrapper.cpp
|
${LIB_FSFW_NAME}
|
||||||
)
|
PRIVATE ServiceInterfaceStream.cpp ServiceInterfaceBuffer.cpp
|
||||||
|
ServiceInterfacePrinter.cpp)
|
||||||
|
@ -57,10 +57,10 @@ class ServiceInterfaceStream : public std::ostream {
|
|||||||
// Forward declaration of interface streams. These should be instantiated in
|
// Forward declaration of interface streams. These should be instantiated in
|
||||||
// main. They can then be used like std::cout or std::cerr.
|
// main. They can then be used like std::cout or std::cerr.
|
||||||
namespace sif {
|
namespace sif {
|
||||||
// extern ServiceInterfaceStream debug;
|
extern ServiceInterfaceStream debug;
|
||||||
// extern ServiceInterfaceStream info;
|
extern ServiceInterfaceStream info;
|
||||||
// extern ServiceInterfaceStream warning;
|
extern ServiceInterfaceStream warning;
|
||||||
// extern ServiceInterfaceStream error;
|
extern ServiceInterfaceStream error;
|
||||||
} // namespace sif
|
} // namespace sif
|
||||||
|
|
||||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
@ -1,24 +0,0 @@
|
|||||||
#include "fmtWrapper.h"
|
|
||||||
|
|
||||||
#include "fsfw/ipc/MutexFactory.h"
|
|
||||||
|
|
||||||
std::array<char, 524> sif::PRINT_BUF = {};
|
|
||||||
MutexIF* sif::PRINT_MUTEX = nullptr;
|
|
||||||
|
|
||||||
const char* sif::PREFIX_ARR[4] = {DEBUG_PREFIX, INFO_PREFIX, WARNING_PREFIX, ERROR_PREFIX};
|
|
||||||
|
|
||||||
ReturnValue_t sif::initialize() {
|
|
||||||
sif::PRINT_MUTEX = MutexFactory::instance()->createMutex();
|
|
||||||
if (sif::PRINT_MUTEX == nullptr) {
|
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
|
||||||
}
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t sif::writeTypePrefix(LogLevel level) {
|
|
||||||
auto idx = static_cast<unsigned int>(level);
|
|
||||||
const auto result =
|
|
||||||
fmt::format_to_n(PRINT_BUF.begin(), PRINT_BUF.size() - 1,
|
|
||||||
fmt::runtime(fmt::format(fg(LOG_COLOR_ARR[idx]), PREFIX_ARR[idx])));
|
|
||||||
return result.size;
|
|
||||||
}
|
|
@ -1,248 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <fmt/chrono.h>
|
|
||||||
#include <fmt/color.h>
|
|
||||||
#include <fmt/compile.h>
|
|
||||||
#include <fmt/core.h>
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
#include "fsfw/ipc/MutexIF.h"
|
|
||||||
#include "fsfw/timemanager/Clock.h"
|
|
||||||
|
|
||||||
// Takes from stackoverflow to display relative paths:
|
|
||||||
// https://stackoverflow.com/questions/8487986/file-macro-shows-full-path
|
|
||||||
#ifdef FSFW_SOURCE_PATH_SIZE
|
|
||||||
#define __FILENAME_REL__ (((const char*)__FILE__ + SOURCE_PATH_SIZE))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
|
|
||||||
|
|
||||||
namespace sif {
|
|
||||||
|
|
||||||
extern std::array<char, 524> PRINT_BUF;
|
|
||||||
extern MutexIF* PRINT_MUTEX;
|
|
||||||
|
|
||||||
static const char INFO_PREFIX[] = "INFO";
|
|
||||||
static const char DEBUG_PREFIX[] = "DEBUG";
|
|
||||||
static const char WARNING_PREFIX[] = "WARNING";
|
|
||||||
static const char ERROR_PREFIX[] = "ERROR";
|
|
||||||
|
|
||||||
enum class LogLevel : unsigned int { DEBUG = 0, INFO = 1, WARNING = 2, ERROR = 3 };
|
|
||||||
|
|
||||||
extern const char* PREFIX_ARR[4];
|
|
||||||
|
|
||||||
static const std::array<fmt::color, 4> LOG_COLOR_ARR = {
|
|
||||||
fmt::color::deep_sky_blue, fmt::color::forest_green, fmt::color::orange_red, fmt::color::red};
|
|
||||||
|
|
||||||
ReturnValue_t initialize();
|
|
||||||
|
|
||||||
size_t writeTypePrefix(LogLevel level);
|
|
||||||
|
|
||||||
template <typename... T>
|
|
||||||
size_t logTraced(LogLevel level, const char* file, unsigned int line, bool timed,
|
|
||||||
fmt::format_string<T...> fmt, T&&... args) noexcept {
|
|
||||||
if (PRINT_MUTEX == nullptr) {
|
|
||||||
fmt::print("ERRROR | {} | Please call sif::initialize at program startup\n", __FILENAME__);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
auto fsfwret = PRINT_MUTEX->lockMutex();
|
|
||||||
if (fsfwret != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
fmt::print("ERROR | {} | Locking print mutex failed", __FILENAME__);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
size_t bufPos = writeTypePrefix(level);
|
|
||||||
auto currentIter = PRINT_BUF.begin() + bufPos;
|
|
||||||
if (timed) {
|
|
||||||
Clock::TimeOfDay_t logTime;
|
|
||||||
Clock::getDateAndTime(&logTime);
|
|
||||||
const auto result = fmt::format_to_n(currentIter, PRINT_BUF.size() - 1 - bufPos,
|
|
||||||
" | {}[l.{}] | {:02}:{:02}:{:02}.{:03} | {}", file, line,
|
|
||||||
logTime.hour, logTime.minute, logTime.second,
|
|
||||||
logTime.usecond / 1000, fmt::format(fmt, args...));
|
|
||||||
bufPos += result.size;
|
|
||||||
} else {
|
|
||||||
const auto result =
|
|
||||||
fmt::format_to_n(currentIter, PRINT_BUF.size() - 1 - bufPos, " | {}[l.{}] | {}", file,
|
|
||||||
line, fmt::format(fmt, args...));
|
|
||||||
bufPos += result.size;
|
|
||||||
}
|
|
||||||
PRINT_BUF[bufPos] = '\0';
|
|
||||||
fmt::print(fmt::runtime(PRINT_BUF.data()));
|
|
||||||
PRINT_MUTEX->unlockMutex();
|
|
||||||
return bufPos;
|
|
||||||
} catch (const fmt::v8::format_error& e) {
|
|
||||||
fmt::print("ERROR | {} | Printing failed with error: {}\n", __FILENAME__, e.what());
|
|
||||||
PRINT_MUTEX->unlockMutex();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename... T>
|
|
||||||
size_t log(LogLevel level, bool timed, fmt::format_string<T...> fmt, T&&... args) noexcept {
|
|
||||||
if (PRINT_MUTEX == nullptr) {
|
|
||||||
fmt::print("ERROR | {} | Please call sif::initialize at program startup\n", __FILENAME__);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
auto fsfwret = PRINT_MUTEX->lockMutex();
|
|
||||||
if (fsfwret != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
fmt::print("ERROR | {} | Locking print mutex failed", __FILENAME__);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
size_t bufPos = writeTypePrefix(level);
|
|
||||||
auto currentIter = PRINT_BUF.begin() + bufPos;
|
|
||||||
if (timed) {
|
|
||||||
Clock::TimeOfDay_t logTime;
|
|
||||||
Clock::getDateAndTime(&logTime);
|
|
||||||
const auto result = fmt::format_to_n(
|
|
||||||
currentIter, PRINT_BUF.size() - bufPos, " | {:02}:{:02}:{:02}.{:03} | {}", logTime.hour,
|
|
||||||
logTime.minute, logTime.second, logTime.usecond / 1000, fmt::format(fmt, args...));
|
|
||||||
bufPos += result.size;
|
|
||||||
} else {
|
|
||||||
const auto result = fmt::format_to_n(currentIter, PRINT_BUF.size() - bufPos, " | {}",
|
|
||||||
fmt::format(fmt, args...));
|
|
||||||
bufPos += result.size;
|
|
||||||
}
|
|
||||||
PRINT_BUF[bufPos] = '\0';
|
|
||||||
fmt::print(fmt::runtime(PRINT_BUF.data()));
|
|
||||||
PRINT_MUTEX->unlockMutex();
|
|
||||||
return bufPos;
|
|
||||||
} catch (const fmt::v8::format_error& e) {
|
|
||||||
PRINT_MUTEX->unlockMutex();
|
|
||||||
fmt::print("Printing failed with error: {}\n", e.what());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename... T>
|
|
||||||
void debug(fmt::format_string<T...> fmt, T&&... args) noexcept {
|
|
||||||
log(LogLevel::DEBUG, false, fmt, args...);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename... T>
|
|
||||||
void debug_t(fmt::format_string<T...> fmt, T&&... args) noexcept {
|
|
||||||
log(LogLevel::DEBUG, true, fmt, args...);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Debug logger with source file information
|
|
||||||
*/
|
|
||||||
template <typename... T>
|
|
||||||
void debug_s(const char* file, unsigned int line, fmt::format_string<T...> fmt,
|
|
||||||
T&&... args) noexcept {
|
|
||||||
logTraced(LogLevel::DEBUG, file, line, false, fmt, args...);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Debug logger with source file information and timestamp
|
|
||||||
*/
|
|
||||||
template <typename... T>
|
|
||||||
void debug_st(const char* file, unsigned int line, fmt::format_string<T...> fmt,
|
|
||||||
T&&... args) noexcept {
|
|
||||||
logTraced(LogLevel::DEBUG, file, line, true, fmt, args...);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Info logger with time stamp
|
|
||||||
*/
|
|
||||||
template <typename... T>
|
|
||||||
void info_t(fmt::format_string<T...> fmt, T&&... args) {
|
|
||||||
log(LogLevel::INFO, true, fmt, args...);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Info logger
|
|
||||||
*/
|
|
||||||
template <typename... T>
|
|
||||||
void info(fmt::format_string<T...> fmt, T&&... args) {
|
|
||||||
log(LogLevel::INFO, false, fmt, args...);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename... T>
|
|
||||||
void warning(fmt::format_string<T...> fmt, T&&... args) {
|
|
||||||
log(LogLevel::ERROR, false, fmt, args...);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Warning logger with time stamp
|
|
||||||
*/
|
|
||||||
template <typename... T>
|
|
||||||
void warning_t(fmt::format_string<T...> fmt, T&&... args) {
|
|
||||||
log(LogLevel::ERROR, true, fmt, args...);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Warning logger with file/line number prefix
|
|
||||||
*/
|
|
||||||
template <typename... T>
|
|
||||||
void warning_s(const char* file, unsigned int line, fmt::format_string<T...> fmt, T&&... args) {
|
|
||||||
logTraced(LogLevel::WARNING, file, line, false, fmt, args...);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Warning logger with timestamp and source file information
|
|
||||||
*/
|
|
||||||
template <typename... T>
|
|
||||||
void warning_st(const char* file, unsigned int line, fmt::format_string<T...> fmt, T&&... args) {
|
|
||||||
logTraced(LogLevel::WARNING, file, line, true, fmt, args...);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename... T>
|
|
||||||
void error(fmt::format_string<T...> fmt, T&&... args) {
|
|
||||||
log(LogLevel::ERROR, false, fmt, args...);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Error logger with timestamp
|
|
||||||
*/
|
|
||||||
template <typename... T>
|
|
||||||
void error_t(fmt::format_string<T...> fmt, T&&... args) {
|
|
||||||
log(LogLevel::ERROR, true, fmt, args...);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Error logger with source file information
|
|
||||||
*/
|
|
||||||
template <typename... T>
|
|
||||||
void error_s(const char* file, unsigned int line, fmt::format_string<T...> fmt, T&&... args) {
|
|
||||||
logTraced(LogLevel::ERROR, file, line, false, fmt, args...);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Error logger with timestamp and source file information
|
|
||||||
*/
|
|
||||||
template <typename... T>
|
|
||||||
void error_st(const char* file, unsigned int line, fmt::format_string<T...> fmt, T&&... args) {
|
|
||||||
logTraced(LogLevel::ERROR, file, line, true, fmt, args...);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace sif
|
|
||||||
|
|
||||||
// Helper macros to simplify calling the logger functions
|
|
||||||
// The macros postfixed with T are the log variant with timing information
|
|
||||||
|
|
||||||
#define FSFW_LOGI(...) sif::info(__VA_ARGS__)
|
|
||||||
#define FSFW_LOGIT(...) sif::info_t(__VA_ARGS__)
|
|
||||||
|
|
||||||
#define FSFW_LOGD(...) sif::debug_s(__FILENAME__, __LINE__, __VA_ARGS__)
|
|
||||||
#define FSFW_LOGDT(...) sif::debug_st(__FILENAME__, __LINE__, __VA_ARGS__)
|
|
||||||
|
|
||||||
#define FSFW_LOGW(...) sif::warning_s(__FILENAME__, __LINE__, __VA_ARGS__)
|
|
||||||
#define FSFW_LOGWT(...) sif::warning_st(__FILENAME__, __LINE__, __VA_ARGS__)
|
|
||||||
|
|
||||||
#define FSFW_LOGE(...) sif::error_s(__FILENAME__, __LINE__, __VA_ARGS__)
|
|
||||||
#define FSFW_LOGET(...) sif::error_st(__FILENAME__, __LINE__, __VA_ARGS__)
|
|
||||||
|
|
||||||
// Using those reduced binary size marginally..
|
|
||||||
|
|
||||||
//#define FSFW_LOGD(...) sif::debug(__VA_ARGS__)
|
|
||||||
//#define FSFW_LOGDT(...) sif::debug_t(__VA_ARGS__)
|
|
||||||
|
|
||||||
//#define FSFW_LOGW(...) sif::warning(__VA_ARGS__)
|
|
||||||
//#define FSFW_LOGWT(...) sif::warning_t(__VA_ARGS__)
|
|
||||||
|
|
||||||
//#define FSFW_LOGE(...) sif::error(__VA_ARGS__)
|
|
||||||
//#define FSFW_LOGET(...) sif::error(__VA_ARGS__)
|
|
@ -3,7 +3,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "fsfw/globalfunctions/arrayprinter.h"
|
#include "fsfw/globalfunctions/arrayprinter.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
||||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||||
|
|
||||||
ConstStorageAccessor::ConstStorageAccessor(store_address_t storeId) : storeId(storeId) {}
|
ConstStorageAccessor::ConstStorageAccessor(store_address_t storeId) : storeId(storeId) {}
|
||||||
@ -46,14 +46,18 @@ const uint8_t* ConstStorageAccessor::data() const { return constDataPointer; }
|
|||||||
|
|
||||||
size_t ConstStorageAccessor::size() const {
|
size_t ConstStorageAccessor::size() const {
|
||||||
if (internalState == AccessState::UNINIT) {
|
if (internalState == AccessState::UNINIT) {
|
||||||
FSFW_LOGW("{}", "size: Not initialized\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "StorageAccessor: Not initialized!" << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return size_;
|
return size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ConstStorageAccessor::getDataCopy(uint8_t* pointer, size_t maxSize) {
|
ReturnValue_t ConstStorageAccessor::getDataCopy(uint8_t* pointer, size_t maxSize) {
|
||||||
if (internalState == AccessState::UNINIT) {
|
if (internalState == AccessState::UNINIT) {
|
||||||
FSFW_LOGW("{}", "getDataCopy: Not initialized\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "StorageAccessor: Not initialized!" << std::endl;
|
||||||
|
#endif
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
if (size_ > maxSize) {
|
if (size_ > maxSize) {
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include "fsfw/FSFW.h"
|
#include "fsfw/FSFW.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
|
|
||||||
LocalPool::LocalPool(object_id_t setObjectId, const LocalPoolConfig& poolConfig, bool registered,
|
LocalPool::LocalPool(object_id_t setObjectId, const LocalPoolConfig& poolConfig, bool registered,
|
||||||
bool spillsToHigherPools)
|
bool spillsToHigherPools)
|
||||||
@ -12,7 +11,10 @@ LocalPool::LocalPool(object_id_t setObjectId, const LocalPoolConfig& poolConfig,
|
|||||||
NUMBER_OF_SUBPOOLS(poolConfig.size()),
|
NUMBER_OF_SUBPOOLS(poolConfig.size()),
|
||||||
spillsToHigherPools(spillsToHigherPools) {
|
spillsToHigherPools(spillsToHigherPools) {
|
||||||
if (NUMBER_OF_SUBPOOLS == 0) {
|
if (NUMBER_OF_SUBPOOLS == 0) {
|
||||||
FSFW_LOGW("{}", "ctor: Passed pool configuration is invalid, 0 subpools\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "LocalPool::LocalPool: Passed pool configuration is "
|
||||||
|
<< " invalid!" << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
max_subpools_t index = 0;
|
max_subpools_t index = 0;
|
||||||
for (const auto& currentPoolConfig : poolConfig) {
|
for (const auto& currentPoolConfig : poolConfig) {
|
||||||
@ -125,8 +127,9 @@ ReturnValue_t LocalPool::deleteData(store_address_t storeId) {
|
|||||||
sizeLists[storeId.poolIndex][storeId.packetIndex] = STORAGE_FREE;
|
sizeLists[storeId.poolIndex][storeId.packetIndex] = STORAGE_FREE;
|
||||||
} else {
|
} else {
|
||||||
// pool_index or packet_index is too large
|
// pool_index or packet_index is too large
|
||||||
FSFW_LOGWT("Object ID {} | deleteData: Illegal store ID, no deletion\n",
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
SystemObject::getObjectId());
|
sif::error << "LocalPool::deleteData: Illegal store ID, no deletion!" << std::endl;
|
||||||
|
#endif
|
||||||
status = ILLEGAL_STORAGE_ID;
|
status = ILLEGAL_STORAGE_ID;
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
@ -175,10 +178,11 @@ ReturnValue_t LocalPool::initialize() {
|
|||||||
// Check if any pool size is large than the maximum allowed.
|
// Check if any pool size is large than the maximum allowed.
|
||||||
for (uint8_t count = 0; count < NUMBER_OF_SUBPOOLS; count++) {
|
for (uint8_t count = 0; count < NUMBER_OF_SUBPOOLS; count++) {
|
||||||
if (elementSizes[count] >= STORAGE_FREE) {
|
if (elementSizes[count] >= STORAGE_FREE) {
|
||||||
FSFW_LOGW(
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
"LocalPool::initialize: Pool is too large- "
|
sif::error << "LocalPool::initialize: Pool is too large! "
|
||||||
"Max. allowed size is: {}\n",
|
"Max. allowed size is: "
|
||||||
STORAGE_FREE - 1);
|
<< (STORAGE_FREE - 1) << std::endl;
|
||||||
|
#endif
|
||||||
return StorageManagerIF::POOL_TOO_LARGE;
|
return StorageManagerIF::POOL_TOO_LARGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,7 +203,10 @@ ReturnValue_t LocalPool::reserveSpace(const size_t size, store_address_t* storeI
|
|||||||
bool ignoreFault) {
|
bool ignoreFault) {
|
||||||
ReturnValue_t status = getSubPoolIndex(size, &storeId->poolIndex);
|
ReturnValue_t status = getSubPoolIndex(size, &storeId->poolIndex);
|
||||||
if (status != RETURN_OK) {
|
if (status != RETURN_OK) {
|
||||||
FSFW_LOGW("ID {:#010x} | reserveSpace: Packet too large\n", SystemObject::getObjectId());
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "LocalPool( " << std::hex << getObjectId() << std::dec
|
||||||
|
<< " )::reserveSpace: Packet too large." << std::endl;
|
||||||
|
#endif
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
status = findEmpty(storeId->poolIndex, &storeId->packetIndex);
|
status = findEmpty(storeId->poolIndex, &storeId->packetIndex);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "fsfw/internalerror/InternalErrorReporterIF.h"
|
#include "fsfw/internalerror/InternalErrorReporterIF.h"
|
||||||
#include "fsfw/objectmanager/ObjectManagerIF.h"
|
#include "fsfw/objectmanager/ObjectManagerIF.h"
|
||||||
#include "fsfw/objectmanager/SystemObject.h"
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
||||||
#include "fsfw/storagemanager/StorageAccessor.h"
|
#include "fsfw/storagemanager/StorageAccessor.h"
|
||||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||||
|
|
||||||
StorageAccessor::StorageAccessor(store_address_t storeId) : ConstStorageAccessor(storeId) {}
|
StorageAccessor::StorageAccessor(store_address_t storeId) : ConstStorageAccessor(storeId) {}
|
||||||
@ -23,7 +23,9 @@ StorageAccessor::StorageAccessor(StorageAccessor&& other)
|
|||||||
|
|
||||||
ReturnValue_t StorageAccessor::getDataCopy(uint8_t* pointer, size_t maxSize) {
|
ReturnValue_t StorageAccessor::getDataCopy(uint8_t* pointer, size_t maxSize) {
|
||||||
if (internalState == AccessState::UNINIT) {
|
if (internalState == AccessState::UNINIT) {
|
||||||
FSFW_LOGW("{}", "getDataCopy: Not initialized\n");
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "StorageAccessor: Not initialized!" << std::endl;
|
||||||
|
#endif
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
if (size_ > maxSize) {
|
if (size_ > maxSize) {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user