Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f87e234651 | |||
| 066c3c7bb3 |
+1
-3
@@ -26,7 +26,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
|
||||||
- functions to configure pus routing
|
|
||||||
- FreeRTOS monotonic clock which is not subjected to time jumps of the system clock
|
- FreeRTOS monotonic clock which is not subjected to time jumps of the system clock
|
||||||
- add CFDP subsystem ID
|
- add CFDP subsystem ID
|
||||||
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/742
|
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/742
|
||||||
@@ -70,8 +69,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
configurable.
|
configurable.
|
||||||
- Switched to vendored versions for both the Embedded Template Library (ETL) and the
|
- Switched to vendored versions for both the Embedded Template Library (ETL) and the
|
||||||
Catch2 unittesting library.
|
Catch2 unittesting library.
|
||||||
- Increased maximum number of mode tables from 70 to 100
|
|
||||||
- Exposed health table mutex via getter function
|
|
||||||
## Added
|
## Added
|
||||||
|
|
||||||
- `EventManager`: Add function to print all listeners.
|
- `EventManager`: Add function to print all listeners.
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120;
|
|||||||
static constexpr uint8_t FSFW_CSB_FIFO_DEPTH = 6;
|
static constexpr uint8_t FSFW_CSB_FIFO_DEPTH = 6;
|
||||||
|
|
||||||
static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124;
|
static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124;
|
||||||
static constexpr size_t FSFW_PRINT_BUFFER_AMOUNT = 32;
|
|
||||||
|
|
||||||
static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048;
|
static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048;
|
||||||
|
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ else
|
|||||||
echo "No ${cmake_fmt} tool found, not formatting CMake files"
|
echo "No ${cmake_fmt} tool found, not formatting CMake files"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cpp_format="clang-format-19"
|
cpp_format="clang-format"
|
||||||
file_selectors="-iname *.h -o -iname *.cpp -o -iname *.c -o -iname *.tpp"
|
file_selectors="-iname *.h -o -iname *.cpp -o -iname *.c -o -iname *.tpp"
|
||||||
if command -v ${cpp_format} &> /dev/null; then
|
if command -v ${cpp_format} &> /dev/null; then
|
||||||
for dir in ${folder_list[@]}; do
|
for dir in ${folder_list[@]}; do
|
||||||
echo "Auto-formatting ${dir} recursively"
|
echo "Auto-formatting ${dir} recursively"
|
||||||
find ${dir} ${file_selectors} | xargs ${cpp_format} --style=file -i
|
find ${dir} ${file_selectors} | xargs clang-format --style=file -i
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo "No ${cpp_format} tool found, not formatting C++/C files"
|
echo "No ${cpp_format} tool found, not formatting C++/C files"
|
||||||
|
|||||||
@@ -9,9 +9,7 @@
|
|||||||
#include "fsfw/cfdp/pdu/FileDataReader.h"
|
#include "fsfw/cfdp/pdu/FileDataReader.h"
|
||||||
#include "fsfw/cfdp/pdu/FinishedPduCreator.h"
|
#include "fsfw/cfdp/pdu/FinishedPduCreator.h"
|
||||||
#include "fsfw/cfdp/pdu/HeaderReader.h"
|
#include "fsfw/cfdp/pdu/HeaderReader.h"
|
||||||
#include "fsfw/cfdp/pdu/KeepAlivePduCreator.h"
|
|
||||||
#include "fsfw/objectmanager.h"
|
#include "fsfw/objectmanager.h"
|
||||||
#include "fsfw/returnvalues/returnvalue.h"
|
|
||||||
#include "fsfw/tmtcservices/TmTcMessage.h"
|
#include "fsfw/tmtcservices/TmTcMessage.h"
|
||||||
|
|
||||||
using namespace returnvalue;
|
using namespace returnvalue;
|
||||||
@@ -452,19 +450,6 @@ ReturnValue_t cfdp::DestHandler::noticeOfCompletion() {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t cfdp::DestHandler::sendKeepAlivePdu() {
|
|
||||||
Fss progress(transactionParams.progress);
|
|
||||||
KeepAlivePduCreator keepAlivePdu(transactionParams.pduConf, progress);
|
|
||||||
size_t serLen = 0;
|
|
||||||
ReturnValue_t result =
|
|
||||||
keepAlivePdu.serialize(pduBuf.data(), serLen, keepAlivePdu.getSerializedSize());
|
|
||||||
if (result != OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
return pduSender.sendPdu(PduType::FILE_DIRECTIVE, FileDirective::KEEP_ALIVE, pduBuf.data(),
|
|
||||||
serLen);
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t cfdp::DestHandler::sendFinishedPdu() {
|
ReturnValue_t cfdp::DestHandler::sendFinishedPdu() {
|
||||||
FinishedInfo info(transactionParams.conditionCode, transactionParams.deliveryCode,
|
FinishedInfo info(transactionParams.conditionCode, transactionParams.deliveryCode,
|
||||||
transactionParams.deliveryStatus);
|
transactionParams.deliveryStatus);
|
||||||
@@ -511,8 +496,6 @@ const cfdp::TransactionId& cfdp::DestHandler::getTransactionId() const {
|
|||||||
return transactionParams.transactionId;
|
return transactionParams.transactionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t cfdp::DestHandler::getProgress() const { return transactionParams.progress; }
|
|
||||||
|
|
||||||
void cfdp::DestHandler::checkAndHandleError(ReturnValue_t result, uint8_t& errorIdx) {
|
void cfdp::DestHandler::checkAndHandleError(ReturnValue_t result, uint8_t& errorIdx) {
|
||||||
if (result != OK and errorIdx < 3) {
|
if (result != OK and errorIdx < 3) {
|
||||||
fsmRes.errorCodes[errorIdx] = result;
|
fsmRes.errorCodes[errorIdx] = result;
|
||||||
@@ -526,4 +509,4 @@ void cfdp::DestHandler::setEventReporter(EventReportingProxyIF& reporter) {
|
|||||||
|
|
||||||
const cfdp::DestHandlerParams& cfdp::DestHandler::getDestHandlerParams() const {
|
const cfdp::DestHandlerParams& cfdp::DestHandler::getDestHandlerParams() const {
|
||||||
return destParams;
|
return destParams;
|
||||||
}
|
}
|
||||||
@@ -101,8 +101,6 @@ class DestHandler {
|
|||||||
|
|
||||||
[[nodiscard]] CfdpState getCfdpState() const;
|
[[nodiscard]] CfdpState getCfdpState() const;
|
||||||
[[nodiscard]] TransactionStep getTransactionStep() const;
|
[[nodiscard]] TransactionStep getTransactionStep() const;
|
||||||
[[nodiscard]] uint64_t getProgress() const;
|
|
||||||
ReturnValue_t sendKeepAlivePdu();
|
|
||||||
[[nodiscard]] const TransactionId& getTransactionId() const;
|
[[nodiscard]] const TransactionId& getTransactionId() const;
|
||||||
[[nodiscard]] const DestHandlerParams& getDestHandlerParams() const;
|
[[nodiscard]] const DestHandlerParams& getDestHandlerParams() const;
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ class KeepAlivePduCreator : public FileDirectiveCreator {
|
|||||||
|
|
||||||
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||||
Endianness streamEndianness) const override;
|
Endianness streamEndianness) const override;
|
||||||
using FileDirectiveCreator::serialize;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cfdp::Fss& progress;
|
cfdp::Fss& progress;
|
||||||
|
|||||||
@@ -71,8 +71,7 @@ bool AssemblyBase::handleChildrenChangedHealth() {
|
|||||||
if (iter == childrenMap.end()) {
|
if (iter == childrenMap.end()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
HealthState healthState =
|
HealthState healthState = healthHelper.healthTable->getHealth(convertToDeviceObjectId(iter->first));
|
||||||
healthHelper.healthTable->getHealth(convertToDeviceObjectId(iter->first));
|
|
||||||
if (healthState == HasHealthIF::NEEDS_RECOVERY) {
|
if (healthState == HasHealthIF::NEEDS_RECOVERY) {
|
||||||
triggerEvent(TRYING_RECOVERY, iter->first, 0);
|
triggerEvent(TRYING_RECOVERY, iter->first, 0);
|
||||||
recoveryState = RECOVERY_STARTED;
|
recoveryState = RECOVERY_STARTED;
|
||||||
@@ -92,15 +91,16 @@ bool AssemblyBase::handleChildrenChangedHealth() {
|
|||||||
void AssemblyBase::handleChildrenTransition() {
|
void AssemblyBase::handleChildrenTransition() {
|
||||||
if (commandsOutstanding <= 0) {
|
if (commandsOutstanding <= 0) {
|
||||||
switch (internalState) {
|
switch (internalState) {
|
||||||
case STATE_NEED_SECOND_STEP: {
|
case STATE_NEED_SECOND_STEP:
|
||||||
|
{
|
||||||
internalState = STATE_SECOND_STEP;
|
internalState = STATE_SECOND_STEP;
|
||||||
ReturnValue_t result = commandChildren(targetMode, targetSubmode);
|
ReturnValue_t result = commandChildren(targetMode, targetSubmode);
|
||||||
if (result == NEED_SECOND_STEP) {
|
if(result == NEED_SECOND_STEP) {
|
||||||
internalState = STATE_NEED_SECOND_STEP;
|
internalState = STATE_NEED_SECOND_STEP;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case STATE_OVERWRITE_HEALTH: {
|
case STATE_OVERWRITE_HEALTH: {
|
||||||
internalState = STATE_SINGLE_STEP;
|
internalState = STATE_SINGLE_STEP;
|
||||||
ReturnValue_t result = commandChildren(mode, submode);
|
ReturnValue_t result = commandChildren(mode, submode);
|
||||||
if (result == NEED_SECOND_STEP) {
|
if (result == NEED_SECOND_STEP) {
|
||||||
@@ -269,14 +269,15 @@ void AssemblyBase::overwriteDeviceHealth(object_id_t objectId, HasHealthIF::Heal
|
|||||||
triggerEvent(OVERWRITING_HEALTH, objectId, oldHealth);
|
triggerEvent(OVERWRITING_HEALTH, objectId, oldHealth);
|
||||||
internalState = STATE_OVERWRITE_HEALTH;
|
internalState = STATE_OVERWRITE_HEALTH;
|
||||||
modeHelper.setForced(true);
|
modeHelper.setForced(true);
|
||||||
if (childrenMap.find(objectId) != childrenMap.end()) {
|
if(childrenMap.find(objectId) != childrenMap.end()) {
|
||||||
sendHealthCommand(childrenMap.at(objectId).commandQueue, EXTERNAL_CONTROL);
|
sendHealthCommand(childrenMap.at(objectId).commandQueue, EXTERNAL_CONTROL);
|
||||||
} else {
|
} else {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::debug << std::hex << SystemObject::getObjectId() << ": invalid mode table entry"
|
sif::debug << std::hex << SystemObject::getObjectId() << ": invalid mode table entry"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssemblyBase::triggerModeHelperEvents(Mode_t mode, Submode_t submode) {
|
void AssemblyBase::triggerModeHelperEvents(Mode_t mode, Submode_t submode) {
|
||||||
|
|||||||
@@ -145,20 +145,20 @@ void FreshDeviceHandlerBase::setToExternalControl() { setHealth(HealthState::EXT
|
|||||||
|
|
||||||
// System Object overrides.
|
// System Object overrides.
|
||||||
ReturnValue_t FreshDeviceHandlerBase::initialize() {
|
ReturnValue_t FreshDeviceHandlerBase::initialize() {
|
||||||
ReturnValue_t result = modeHelper.initialize();
|
ReturnValue_t result = modeHelper.initialize(); // ModeHelper.initialize() is an empty function, always returns OK
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = healthHelper.initialize();
|
result = healthHelper.initialize();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) { // check if all objects were successfully registered with HEALTHY flag stored in table (otherwise default HEALTHY = HEALTHY)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = actionHelper.initialize(messageQueue);
|
result = actionHelper.initialize(messageQueue);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) { // check if actionHelper got messageQueue assigned to use for its work successfully
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = paramHelper.initialize();
|
result = paramHelper.initialize();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ constexpr EventId_t getEventId(Event event) { return (event & 0xFFFF); }
|
|||||||
|
|
||||||
constexpr EventSeverity_t getSeverity(Event event) { return ((event >> 16) & 0xFF); }
|
constexpr EventSeverity_t getSeverity(Event event) { return ((event >> 16) & 0xFF); }
|
||||||
|
|
||||||
template <uint8_t subsystemId, UniqueEventId_t uniqueEventId, EventSeverity_t eventSeverity>
|
template<uint8_t subsystemId, UniqueEventId_t uniqueEventId, EventSeverity_t eventSeverity>
|
||||||
constexpr Event makeEvent() {
|
constexpr Event makeEvent() {
|
||||||
static_assert(uniqueEventId < 100, "The unique event ID must be smaller than 100!");
|
static_assert(uniqueEventId < 100, "The unique event ID must be smaller than 100!");
|
||||||
return (eventSeverity << 16) + (subsystemId * 100) + uniqueEventId;
|
return (eventSeverity << 16) + (subsystemId * 100) + uniqueEventId;
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ void HealthTable::setMutexTimeout(MutexIF::TimeoutType timeoutType, uint32_t tim
|
|||||||
HealthTable::~HealthTable() { MutexFactory::instance()->deleteMutex(mutex); }
|
HealthTable::~HealthTable() { MutexFactory::instance()->deleteMutex(mutex); }
|
||||||
|
|
||||||
ReturnValue_t HealthTable::registerObject(object_id_t object,
|
ReturnValue_t HealthTable::registerObject(object_id_t object,
|
||||||
HasHealthIF::HealthState initialState) {
|
HasHealthIF::HealthState initilialState) {
|
||||||
if (healthMap.count(object) != 0) {
|
if (healthMap.count(object) != 0) {
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
healthMap.emplace(object, initialState);
|
healthMap.emplace(object, initilialState);
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,5 +112,3 @@ ReturnValue_t HealthTable::iterate(HealthEntry* value, bool reset) {
|
|||||||
mapIterator++;
|
mapIterator++;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
MutexIF* HealthTable::getMutex() { return mutex; }
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class HealthTable : public HealthTableIF, public SystemObject {
|
|||||||
|
|
||||||
/** HealthTableIF overrides */
|
/** HealthTableIF overrides */
|
||||||
virtual ReturnValue_t registerObject(
|
virtual ReturnValue_t registerObject(
|
||||||
object_id_t object, HasHealthIF::HealthState initialState = HasHealthIF::HEALTHY) override;
|
object_id_t object, HasHealthIF::HealthState initilialState = HasHealthIF::HEALTHY) override;
|
||||||
ReturnValue_t removeObject(object_id_t object) override;
|
ReturnValue_t removeObject(object_id_t object) override;
|
||||||
virtual size_t getPrintSize() override;
|
virtual size_t getPrintSize() override;
|
||||||
virtual void printAll(uint8_t* pointer, size_t maxSize) override;
|
virtual void printAll(uint8_t* pointer, size_t maxSize) override;
|
||||||
@@ -28,8 +28,6 @@ class HealthTable : public HealthTableIF, public SystemObject {
|
|||||||
virtual void setHealth(object_id_t object, HasHealthIF::HealthState newState) override;
|
virtual void setHealth(object_id_t object, HasHealthIF::HealthState newState) override;
|
||||||
virtual HasHealthIF::HealthState getHealth(object_id_t) override;
|
virtual HasHealthIF::HealthState getHealth(object_id_t) override;
|
||||||
|
|
||||||
MutexIF* getMutex();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
using HealthMap = std::map<object_id_t, HasHealthIF::HealthState>;
|
using HealthMap = std::map<object_id_t, HasHealthIF::HealthState>;
|
||||||
using HealthEntry = std::pair<object_id_t, HasHealthIF::HealthState>;
|
using HealthEntry = std::pair<object_id_t, HasHealthIF::HealthState>;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class HealthTableIF : public ManagesHealthIF {
|
|||||||
virtual ~HealthTableIF() {}
|
virtual ~HealthTableIF() {}
|
||||||
|
|
||||||
virtual ReturnValue_t registerObject(
|
virtual ReturnValue_t registerObject(
|
||||||
object_id_t object, HasHealthIF::HealthState initialState = HasHealthIF::HEALTHY) = 0;
|
object_id_t object, HasHealthIF::HealthState initilialState = HasHealthIF::HEALTHY) = 0;
|
||||||
|
|
||||||
virtual ReturnValue_t removeObject(object_id_t objectId) = 0;
|
virtual ReturnValue_t removeObject(object_id_t objectId) = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -29,15 +29,13 @@ enum framework_objects : object_id_t {
|
|||||||
// MODE_STORE = 0x53010100,
|
// MODE_STORE = 0x53010100,
|
||||||
EVENT_MANAGER = 0x53030000,
|
EVENT_MANAGER = 0x53030000,
|
||||||
INTERNAL_ERROR_REPORTER = 0x53040000,
|
INTERNAL_ERROR_REPORTER = 0x53040000,
|
||||||
IPC_STORE = 0x534f0300,
|
IPC_STORE = 0x534f0300, // Inter-process communication
|
||||||
// IDs for PUS Packet Communication
|
// IDs for PUS Packet Communication
|
||||||
TC_STORE = 0x534f0100,
|
TC_STORE = 0x534f0100,
|
||||||
TM_STORE = 0x534f0200,
|
TM_STORE = 0x534f0200,
|
||||||
TIME_STAMPER = 0x53500010,
|
TIME_STAMPER = 0x53500010,
|
||||||
VERIFICATION_REPORTER = 0x53500020,
|
VERIFICATION_REPORTER = 0x53500020,
|
||||||
|
|
||||||
SIF_PRINT_TASK = 0x53600000,
|
|
||||||
|
|
||||||
FSFW_OBJECTS_END = 0x53ffffff,
|
FSFW_OBJECTS_END = 0x53ffffff,
|
||||||
NO_OBJECT = 0xFFFFFFFF
|
NO_OBJECT = 0xFFFFFFFF
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ UdpTcPollingTask::UdpTcPollingTask(object_id_t objectId, object_id_t tmtcUdpBrid
|
|||||||
|
|
||||||
[[noreturn]] ReturnValue_t UdpTcPollingTask::performOperation(uint8_t opCode) {
|
[[noreturn]] ReturnValue_t UdpTcPollingTask::performOperation(uint8_t opCode) {
|
||||||
/* Sender Address is cached here. */
|
/* Sender Address is cached here. */
|
||||||
struct sockaddr senderAddress{};
|
struct sockaddr senderAddress {};
|
||||||
socklen_t senderAddressSize = sizeof(senderAddress);
|
socklen_t senderAddressSize = sizeof(senderAddress);
|
||||||
|
|
||||||
/* Poll for new UDP datagrams in permanent loop. */
|
/* Poll for new UDP datagrams in permanent loop. */
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "fsfw/globalfunctions/timevalOperations.h"
|
#include "fsfw/globalfunctions/timevalOperations.h"
|
||||||
#include "fsfw/osal/freertos/Timekeeper.h"
|
|
||||||
#include "fsfw/serviceinterface/ServiceInterfacePrinter.h"
|
#include "fsfw/serviceinterface/ServiceInterfacePrinter.h"
|
||||||
|
#include "fsfw/osal/freertos/Timekeeper.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
|
||||||
// TODO sanitize input?
|
// TODO sanitize input?
|
||||||
@@ -48,7 +48,7 @@ ReturnValue_t Clock::getClock(timeval* time) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Clock::getClockMonotonic(timeval* time) {
|
ReturnValue_t Clock::getClockMonotonic(timeval* time) {
|
||||||
*time = Timekeeper::instance()->getMonotonicClockOffset() + getUptime();
|
*time = Timekeeper::instance()->getMonotonicClockOffset() + getUptime();
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ Timekeeper* Timekeeper::instance() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Timekeeper::setOffset(const timeval& offset) {
|
void Timekeeper::setOffset(const timeval& offset) {
|
||||||
if (not monotonicClockInitialized) {
|
if (not monotonicClockInitialized) {
|
||||||
this->monotonicClockOffset = offset;
|
this->monotonicClockOffset = offset;
|
||||||
monotonicClockInitialized = true;
|
monotonicClockInitialized = true;
|
||||||
}
|
}
|
||||||
this->offset = offset;
|
this->offset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
timeval Timekeeper::ticksToTimeval(TickType_t ticks) {
|
timeval Timekeeper::ticksToTimeval(TickType_t ticks) {
|
||||||
@@ -40,4 +40,6 @@ timeval Timekeeper::ticksToTimeval(TickType_t ticks) {
|
|||||||
|
|
||||||
TickType_t Timekeeper::getTicks() { return xTaskGetTickCount(); }
|
TickType_t Timekeeper::getTicks() { return xTaskGetTickCount(); }
|
||||||
|
|
||||||
const timeval Timekeeper::getMonotonicClockOffset() const { return monotonicClockOffset; }
|
const timeval Timekeeper::getMonotonicClockOffset() const {
|
||||||
|
return monotonicClockOffset;
|
||||||
|
}
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Clock::convertTimeOfDayToTimeval(const TimeOfDay_t* from, timeval* to) {
|
ReturnValue_t Clock::convertTimeOfDayToTimeval(const TimeOfDay_t* from, timeval* to) {
|
||||||
struct tm time_tm{};
|
struct tm time_tm {};
|
||||||
|
|
||||||
time_tm.tm_year = from->year - 1900;
|
time_tm.tm_year = from->year - 1900;
|
||||||
time_tm.tm_mon = from->month - 1;
|
time_tm.tm_mon = from->month - 1;
|
||||||
|
|||||||
@@ -52,6 +52,6 @@ void TaskFactory::printMissedDeadline() {
|
|||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "TaskFactory::printMissedDeadline: " << name << std::endl;
|
sif::warning << "TaskFactory::printMissedDeadline: " << name << std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printWarning("TaskFactory::printMissedDeadline: %s\n", name.c_str());
|
sif::printWarning("TaskFactory::printMissedDeadline: %s\n", name);
|
||||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ ReturnValue_t ParameterHelper::sendParameter(MessageQueueId_t to, uint32_t id,
|
|||||||
ReturnValue_t ParameterHelper::initialize() {
|
ReturnValue_t ParameterHelper::initialize() {
|
||||||
ownerQueueId = owner->getCommandQueue();
|
ownerQueueId = owner->getCommandQueue();
|
||||||
|
|
||||||
storage = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
storage = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE); // get storage pointer for inter-process communication
|
||||||
if (storage == nullptr) {
|
if (storage == nullptr) {
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
#ifndef FSFW_PUS_SERVICE8FUNCTIONMANAGEMENT_H_
|
#ifndef FSFW_PUS_SERVICE8FUNCTIONMANAGEMENT_H_
|
||||||
#define FSFW_PUS_SERVICE8FUNCTIONMANAGEMENT_H_
|
#define FSFW_PUS_SERVICE8FUNCTIONMANAGEMENT_H_
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
#include "fsfw/action/ActionMessage.h"
|
#include "fsfw/action/ActionMessage.h"
|
||||||
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
||||||
|
|
||||||
@@ -37,13 +35,6 @@ class Service8FunctionManagement : public CommandingServiceBase {
|
|||||||
uint16_t commandTimeoutSeconds = 60);
|
uint16_t commandTimeoutSeconds = 60);
|
||||||
~Service8FunctionManagement() override;
|
~Service8FunctionManagement() override;
|
||||||
|
|
||||||
enum class Subservice : uint8_t {
|
|
||||||
//!< [EXPORT] : [COMMAND] Functional commanding
|
|
||||||
COMMAND_DIRECT_COMMANDING = 128,
|
|
||||||
//!< [EXPORT] : [REPLY] Data reply
|
|
||||||
REPLY_DIRECT_COMMANDING_DATA = 130,
|
|
||||||
};
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* CSB abstract functions implementation . See CSB documentation. */
|
/* CSB abstract functions implementation . See CSB documentation. */
|
||||||
ReturnValue_t isValidSubservice(uint8_t subservice) override;
|
ReturnValue_t isValidSubservice(uint8_t subservice) override;
|
||||||
@@ -57,6 +48,13 @@ class Service8FunctionManagement : public CommandingServiceBase {
|
|||||||
bool* isStep) override;
|
bool* isStep) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
enum class Subservice {
|
||||||
|
//!< [EXPORT] : [COMMAND] Functional commanding
|
||||||
|
COMMAND_DIRECT_COMMANDING = 128,
|
||||||
|
//!< [EXPORT] : [REPLY] Data reply
|
||||||
|
REPLY_DIRECT_COMMANDING_DATA = 130,
|
||||||
|
};
|
||||||
|
|
||||||
ReturnValue_t checkInterfaceAndAcquireMessageQueue(MessageQueueId_t* messageQueueToSet,
|
ReturnValue_t checkInterfaceAndAcquireMessageQueue(MessageQueueId_t* messageQueueToSet,
|
||||||
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,
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_
|
#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_
|
||||||
#define FSFW_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_
|
#define FSFW_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
#include "../../action/ActionMessage.h"
|
#include "../../action/ActionMessage.h"
|
||||||
#include "../../objectmanager/SystemObjectIF.h"
|
#include "../../objectmanager/SystemObjectIF.h"
|
||||||
#include "../../returnvalues/returnvalue.h"
|
|
||||||
#include "../../serialize/SerialBufferAdapter.h"
|
#include "../../serialize/SerialBufferAdapter.h"
|
||||||
|
#include "../../serialize/SerialFixedArrayListAdapter.h"
|
||||||
#include "../../serialize/SerialLinkedListAdapter.h"
|
#include "../../serialize/SerialLinkedListAdapter.h"
|
||||||
#include "../../serialize/SerializeAdapter.h"
|
|
||||||
#include "../../serialize/SerializeElement.h"
|
#include "../../serialize/SerializeElement.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,41 +22,14 @@ class DirectCommand
|
|||||||
parametersSize = size;
|
parametersSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectCommand() : parametersSize(0), parameterBuffer(nullptr) {}
|
|
||||||
|
|
||||||
ActionId_t getActionId() const { return actionId; }
|
ActionId_t getActionId() const { return actionId; }
|
||||||
void setActionId(ActionId_t actionId) { this->actionId = actionId; }
|
|
||||||
|
|
||||||
object_id_t getObjectId() const { return objectId; }
|
object_id_t getObjectId() const { return objectId; }
|
||||||
void setObjectId(object_id_t objectId) { this->objectId = objectId; }
|
|
||||||
|
|
||||||
const uint8_t* getParameters() { return parameterBuffer; }
|
const uint8_t* getParameters() { return parameterBuffer; }
|
||||||
// The given pointer is not deallocated and must outlive the DirectCommand!
|
|
||||||
void setParameters(const uint8_t* parameters, uint32_t parametersSize) {
|
|
||||||
this->parameterBuffer = parameters;
|
|
||||||
this->parametersSize = parametersSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t getParametersSize() const { return parametersSize; }
|
uint32_t getParametersSize() const { return parametersSize; }
|
||||||
|
|
||||||
// ^SerializeIF
|
|
||||||
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
|
||||||
Endianness streamEndianness) const override {
|
|
||||||
auto const oldSize = *size;
|
|
||||||
auto result = SerializeAdapter::serialize(&objectId, buffer, size, maxSize, streamEndianness);
|
|
||||||
if (result != returnvalue::OK) return result;
|
|
||||||
result = SerializeAdapter::serialize(&actionId, buffer, size, maxSize - ((*size) - oldSize),
|
|
||||||
streamEndianness);
|
|
||||||
if (result != returnvalue::OK) return result;
|
|
||||||
|
|
||||||
auto remainingSize = maxSize - ((*size) - oldSize);
|
|
||||||
if (remainingSize < parametersSize) return returnvalue::FAILED;
|
|
||||||
memcpy(*buffer, parameterBuffer, parametersSize);
|
|
||||||
*size += parametersSize;
|
|
||||||
|
|
||||||
return returnvalue::OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DirectCommand(const DirectCommand& command);
|
DirectCommand(const DirectCommand& command);
|
||||||
object_id_t objectId = 0;
|
object_id_t objectId = 0;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
target_sources(
|
target_sources(
|
||||||
${LIB_FSFW_NAME}
|
${LIB_FSFW_NAME}
|
||||||
PRIVATE ServiceInterfaceStream.cpp ServiceInterfaceBuffer.cpp
|
PRIVATE ServiceInterfaceStream.cpp ServiceInterfaceBuffer.cpp
|
||||||
ServiceInterfacePrinter.cpp ServiceInterfacePrinterTask.cpp
|
ServiceInterfacePrinter.cpp)
|
||||||
ServiceInterfacePrinterMessage.cpp)
|
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
#include "fsfw/serviceinterface/ServiceInterfacePrinter.h"
|
#include "fsfw/serviceinterface/ServiceInterfacePrinter.h"
|
||||||
|
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
#include "ServiceInterfacePrinterMessage.h"
|
|
||||||
#include "etl/bitset.h"
|
|
||||||
#include "etl/queue.h"
|
|
||||||
#include "fsfw/FSFW.h"
|
#include "fsfw/FSFW.h"
|
||||||
#include "fsfw/ipc/MutexGuard.h"
|
|
||||||
#include "fsfw/ipc/QueueFactory.h"
|
|
||||||
#include "fsfw/serviceinterface/serviceInterfaceDefintions.h"
|
#include "fsfw/serviceinterface/serviceInterfaceDefintions.h"
|
||||||
#include "fsfw/timemanager/Clock.h"
|
#include "fsfw/timemanager/Clock.h"
|
||||||
|
|
||||||
@@ -18,33 +14,11 @@ static bool consoleInitialized = false;
|
|||||||
|
|
||||||
#if FSFW_DISABLE_PRINTOUT == 0
|
#if FSFW_DISABLE_PRINTOUT == 0
|
||||||
|
|
||||||
typedef etl::bitset<fsfwconfig::FSFW_PRINT_BUFFER_AMOUNT> bitset;
|
|
||||||
|
|
||||||
static bool addCrAtEnd = false;
|
static bool addCrAtEnd = false;
|
||||||
static bool initializedAndReady = false;
|
|
||||||
static bool replaceLastCharWithNewline = false;
|
|
||||||
|
|
||||||
bitset bufferState{};
|
uint8_t printBuffer[fsfwconfig::FSFW_PRINT_BUFFER_SIZE];
|
||||||
std::array<char[fsfwconfig::FSFW_PRINT_BUFFER_SIZE], fsfwconfig::FSFW_PRINT_BUFFER_AMOUNT>
|
|
||||||
printBufferArray = {};
|
|
||||||
|
|
||||||
uint32_t droppedMessagesCounter = 0;
|
void fsfwPrint(sif::PrintLevel printType, const char *fmt, va_list arg) {
|
||||||
uint32_t droppedMessagesCounterContinuous = 0;
|
|
||||||
|
|
||||||
MutexIF* bufferMutex;
|
|
||||||
MessageQueueIF* bufferQueue;
|
|
||||||
|
|
||||||
size_t selectFreeBuffer() {
|
|
||||||
MutexGuard guard(bufferMutex, MutexIF::TimeoutType::WAITING, 10);
|
|
||||||
const size_t bufferIdx = bufferState.find_first(false);
|
|
||||||
if (bufferIdx == bitset::npos) {
|
|
||||||
return bitset::npos;
|
|
||||||
}
|
|
||||||
bufferState.set(bufferIdx, true);
|
|
||||||
return bufferIdx;
|
|
||||||
}
|
|
||||||
|
|
||||||
void fsfwPrint(const sif::PrintLevel printType, const char* fmt, va_list arg) {
|
|
||||||
#if defined(WIN32) && FSFW_COLORED_OUTPUT == 1
|
#if defined(WIN32) && FSFW_COLORED_OUTPUT == 1
|
||||||
if (not consoleInitialized) {
|
if (not consoleInitialized) {
|
||||||
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
@@ -56,22 +30,14 @@ void fsfwPrint(const sif::PrintLevel printType, const char* fmt, va_list arg) {
|
|||||||
consoleInitialized = true;
|
consoleInitialized = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
size_t len = 0;
|
||||||
|
char *bufferPosition = reinterpret_cast<char *>(printBuffer);
|
||||||
|
|
||||||
/* Check logger level */
|
/* Check logger level */
|
||||||
if (printType == sif::PrintLevel::NONE or printType > printLevel) {
|
if (printType == sif::PrintLevel::NONE or printType > printLevel) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool isReady = initializedAndReady;
|
|
||||||
const size_t bufferIdx = isReady ? selectFreeBuffer() : 0;
|
|
||||||
if (bufferIdx == bitset::npos) {
|
|
||||||
// This will lose updates, but we are mostly concerned with if we are dropping messages
|
|
||||||
++droppedMessagesCounter;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t len = 0;
|
|
||||||
char* bufferPosition = printBufferArray[bufferIdx];
|
|
||||||
|
|
||||||
/* Log message to terminal */
|
/* Log message to terminal */
|
||||||
|
|
||||||
#if FSFW_COLORED_OUTPUT == 1
|
#if FSFW_COLORED_OUTPUT == 1
|
||||||
@@ -95,6 +61,7 @@ void fsfwPrint(const sif::PrintLevel printType, const char* fmt, va_list arg) {
|
|||||||
if (printType == sif::PrintLevel::WARNING_LEVEL) {
|
if (printType == sif::PrintLevel::WARNING_LEVEL) {
|
||||||
len += sprintf(bufferPosition + len, "WARNING");
|
len += sprintf(bufferPosition + len, "WARNING");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (printType == sif::PrintLevel::ERROR_LEVEL) {
|
if (printType == sif::PrintLevel::ERROR_LEVEL) {
|
||||||
len += sprintf(bufferPosition + len, "ERROR ");
|
len += sprintf(bufferPosition + len, "ERROR ");
|
||||||
}
|
}
|
||||||
@@ -112,108 +79,51 @@ void fsfwPrint(const sif::PrintLevel printType, const char* fmt, va_list arg) {
|
|||||||
(unsigned long)now.minute, (unsigned long)now.second,
|
(unsigned long)now.minute, (unsigned long)now.second,
|
||||||
(unsigned long)now.usecond / 1000);
|
(unsigned long)now.usecond / 1000);
|
||||||
|
|
||||||
len += vsnprintf(bufferPosition + len, sizeof(printBufferArray[bufferIdx]) - len, fmt, arg);
|
len += vsnprintf(bufferPosition + len, sizeof(printBuffer) - len, fmt, arg);
|
||||||
|
|
||||||
if (addCrAtEnd) {
|
if (addCrAtEnd) {
|
||||||
len += sprintf(bufferPosition + len, "\r");
|
len += sprintf(bufferPosition + len, "\r");
|
||||||
}
|
}
|
||||||
|
|
||||||
printBufferArray[bufferIdx][fsfwconfig::FSFW_PRINT_BUFFER_SIZE - 1] = 0;
|
printf("%s", printBuffer);
|
||||||
|
|
||||||
if (replaceLastCharWithNewline) {
|
|
||||||
const size_t stringLength = strlen(bufferPosition);
|
|
||||||
const size_t lastCharPosition =
|
|
||||||
etl::min(stringLength - 1, fsfwconfig::FSFW_PRINT_BUFFER_SIZE - 3);
|
|
||||||
const char lastChar = printBufferArray[bufferIdx][lastCharPosition];
|
|
||||||
if (!(lastChar == '\n' or lastChar == '\r')) {
|
|
||||||
printBufferArray[bufferIdx][lastCharPosition + 1] = '\n';
|
|
||||||
printBufferArray[bufferIdx][lastCharPosition + 2] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isReady) {
|
|
||||||
ServiceInterfacePrinterMessage message(bufferIdx);
|
|
||||||
bufferQueue->sendToDefault(&message);
|
|
||||||
} else {
|
|
||||||
printf("%s", printBufferArray[bufferIdx]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sif::setToAddCrAtEnd(const bool addCrAtEnd_) { addCrAtEnd = addCrAtEnd_; }
|
void sif::printInfo(const char *fmt, ...) {
|
||||||
|
|
||||||
void sif::setReplaceLastCharWithNewline(const bool replace) {
|
|
||||||
replaceLastCharWithNewline = replace;
|
|
||||||
}
|
|
||||||
|
|
||||||
void sif::printInfo(const char* fmt, ...) {
|
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
fsfwPrint(sif::PrintLevel::INFO_LEVEL, fmt, args);
|
fsfwPrint(sif::PrintLevel::INFO_LEVEL, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sif::printWarning(const char* fmt, ...) {
|
void sif::printWarning(const char *fmt, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
fsfwPrint(sif::PrintLevel::WARNING_LEVEL, fmt, args);
|
fsfwPrint(sif::PrintLevel::WARNING_LEVEL, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sif::printDebug(const char* fmt, ...) {
|
void sif::printDebug(const char *fmt, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
fsfwPrint(sif::PrintLevel::DEBUG_LEVEL, fmt, args);
|
fsfwPrint(sif::PrintLevel::DEBUG_LEVEL, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sif::printError(const char* fmt, ...) {
|
void sif::setToAddCrAtEnd(bool addCrAtEnd_) { addCrAtEnd = addCrAtEnd_; }
|
||||||
|
|
||||||
|
void sif::printError(const char *fmt, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
fsfwPrint(sif::PrintLevel::ERROR_LEVEL, fmt, args);
|
fsfwPrint(sif::PrintLevel::ERROR_LEVEL, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sif::printCallback() {
|
|
||||||
if (!initializedAndReady) {
|
|
||||||
initializedAndReady = true;
|
|
||||||
}
|
|
||||||
uint32_t bitmask = 0;
|
|
||||||
ServiceInterfacePrinterMessage message;
|
|
||||||
while (bufferQueue->receiveMessage(&message) == returnvalue::OK) {
|
|
||||||
const size_t bufferIdx = message.getBufferIndex();
|
|
||||||
bitmask |= 1 << bufferIdx;
|
|
||||||
printf("%s", printBufferArray[bufferIdx]);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
MutexGuard guard(bufferMutex, MutexIF::TimeoutType::BLOCKING);
|
|
||||||
bufferState &= ~bitmask;
|
|
||||||
}
|
|
||||||
const uint32_t droppedMessages = droppedMessagesCounter;
|
|
||||||
droppedMessagesCounter = 0;
|
|
||||||
droppedMessagesCounterContinuous += droppedMessages;
|
|
||||||
if (droppedMessages != 0) {
|
|
||||||
sif::printError("ServiceInterfacePrinter: Dropped ca. %i messages\n", droppedMessages);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void sif::init() {
|
|
||||||
bufferMutex = MutexFactory::instance()->createMutex();
|
|
||||||
bufferQueue = QueueFactory::instance()->createMessageQueue(fsfwconfig::FSFW_PRINT_BUFFER_AMOUNT);
|
|
||||||
bufferQueue->setDefaultDestination(bufferQueue->getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t sif::getDroppedMessagesCount() { return droppedMessagesCounterContinuous; }
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void sif::printInfo(const char* fmt, ...) {}
|
void sif::printInfo(const char *fmt, ...) {}
|
||||||
void sif::printWarning(const char* fmt, ...) {}
|
void sif::printWarning(const char *fmt, ...) {}
|
||||||
void sif::printDebug(const char* fmt, ...) {}
|
void sif::printDebug(const char *fmt, ...) {}
|
||||||
void sif::printError(const char* fmt, ...) {}
|
void sif::printError(const char *fmt, ...) {}
|
||||||
|
|
||||||
void sif::printCallback() {}
|
|
||||||
void sif::init() {}
|
|
||||||
uint32_t sif::getDroppedMessagesCount() { return 0; }
|
|
||||||
|
|
||||||
#endif /* FSFW_DISABLE_PRINTOUT == 0 */
|
#endif /* FSFW_DISABLE_PRINTOUT == 0 */
|
||||||
|
|
||||||
|
|||||||
@@ -39,11 +39,6 @@ PrintLevel getPrintLevel();
|
|||||||
|
|
||||||
void setToAddCrAtEnd(bool addCrAtEnd_);
|
void setToAddCrAtEnd(bool addCrAtEnd_);
|
||||||
|
|
||||||
/**
|
|
||||||
* Replaces the last char of a print buffer with a newline
|
|
||||||
*/
|
|
||||||
void setReplaceLastCharWithNewline(bool replace);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These functions can be used like the C stdio printf and forward the
|
* These functions can be used like the C stdio printf and forward the
|
||||||
* supplied formatted string arguments to a printf function.
|
* supplied formatted string arguments to a printf function.
|
||||||
@@ -56,21 +51,6 @@ void printWarning(const char* fmt, ...);
|
|||||||
void printDebug(const char* fmt, ...);
|
void printDebug(const char* fmt, ...);
|
||||||
void printError(const char* fmt, ...);
|
void printError(const char* fmt, ...);
|
||||||
|
|
||||||
/**
|
|
||||||
* This function is to be called periodically by a dedicated print task.
|
|
||||||
*/
|
|
||||||
void printCallback();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the global state for the print task.
|
|
||||||
*/
|
|
||||||
void init();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the total estimated number of dropped messages
|
|
||||||
*/
|
|
||||||
uint32_t getDroppedMessagesCount();
|
|
||||||
|
|
||||||
} // namespace sif
|
} // namespace sif
|
||||||
|
|
||||||
#endif /* FSFW_SERVICEINTERFACE_SERVICEINTERFACEPRINTER */
|
#endif /* FSFW_SERVICEINTERFACE_SERVICEINTERFACEPRINTER */
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
#include "ServiceInterfacePrinterMessage.h"
|
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
ServiceInterfacePrinterMessage::ServiceInterfacePrinterMessage(const size_t bufferIdx) {
|
|
||||||
this->MessageQueueMessage::setMessageSize(sizeof(bufferIdx));
|
|
||||||
this->setBufferIndex(bufferIdx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ServiceInterfacePrinterMessage::setBufferIndex(const size_t bufferIdx) {
|
|
||||||
std::memcpy(this->getData(), &bufferIdx, sizeof(bufferIdx));
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t ServiceInterfacePrinterMessage::getBufferIndex() {
|
|
||||||
size_t tempIdx;
|
|
||||||
std::memcpy(&tempIdx, this->getData(), sizeof(size_t));
|
|
||||||
return tempIdx;
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include "fsfw/ipc/MessageQueueMessage.h"
|
|
||||||
|
|
||||||
class ServiceInterfacePrinterMessage : public MessageQueueMessage {
|
|
||||||
public:
|
|
||||||
ServiceInterfacePrinterMessage() = default;
|
|
||||||
explicit ServiceInterfacePrinterMessage(size_t bufferIdx);
|
|
||||||
size_t getBufferIndex();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void setBufferIndex(size_t bufferIdx);
|
|
||||||
};
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#include "ServiceInterfacePrinterTask.h"
|
|
||||||
|
|
||||||
#include "ServiceInterfacePrinter.h"
|
|
||||||
#include "fsfw/objectmanager/SystemObject.h"
|
|
||||||
|
|
||||||
ServiceInterfacePrinterTask::ServiceInterfacePrinterTask(object_id_t objectId)
|
|
||||||
: SystemObject(objectId) {
|
|
||||||
sif::init();
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t ServiceInterfacePrinterTask::performOperation(uint8_t operationCode) {
|
|
||||||
sif::printCallback();
|
|
||||||
return returnvalue::OK;
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "fsfw/objectmanager/SystemObject.h"
|
|
||||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
|
||||||
|
|
||||||
class ServiceInterfacePrinterTask : public ExecutableObjectIF, public SystemObject {
|
|
||||||
public:
|
|
||||||
explicit ServiceInterfacePrinterTask(object_id_t objectId);
|
|
||||||
ReturnValue_t performOperation(uint8_t operationCode) override;
|
|
||||||
};
|
|
||||||
@@ -99,7 +99,7 @@ class Subsystem : public SubsystemBase, public HasModeSequenceIF {
|
|||||||
EntryPointer entries;
|
EntryPointer entries;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint8_t MAX_NUMBER_OF_TABLES_OR_SEQUENCES = 100;
|
static const uint8_t MAX_NUMBER_OF_TABLES_OR_SEQUENCES = 70;
|
||||||
|
|
||||||
static const uint8_t MAX_LENGTH_OF_TABLE_OR_SEQUENCE = 20;
|
static const uint8_t MAX_LENGTH_OF_TABLE_OR_SEQUENCE = 20;
|
||||||
|
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ void SubsystemBase::executeTable(HybridIterator<ModeListEntry> tableIter, Submod
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (healthHelper.healthTable->hasHealth(convertToDeviceObjectId(object))) {
|
if (healthHelper.healthTable->hasHealth(convertToDeviceObjectId(object))) {
|
||||||
|
|
||||||
switch (healthHelper.healthTable->getHealth(convertToDeviceObjectId(object))) {
|
switch (healthHelper.healthTable->getHealth(convertToDeviceObjectId(object))) {
|
||||||
case NEEDS_RECOVERY:
|
case NEEDS_RECOVERY:
|
||||||
case FAULTY:
|
case FAULTY:
|
||||||
@@ -353,4 +354,6 @@ ReturnValue_t SubsystemBase::registerChild(object_id_t childObjectId, MessageQue
|
|||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
object_id_t SubsystemBase::convertToDeviceObjectId(object_id_t id) { return id; }
|
object_id_t SubsystemBase::convertToDeviceObjectId(object_id_t id) {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
@@ -113,8 +113,8 @@ class SubsystemBase : public SystemObject,
|
|||||||
* We need to know the target Submode, as children are able to inherit the submode
|
* We need to know the target Submode, as children are able to inherit the submode
|
||||||
* Still, we have a default for all child implementations which do not use submode inheritance
|
* Still, we have a default for all child implementations which do not use submode inheritance
|
||||||
*/
|
*/
|
||||||
virtual void executeTable(HybridIterator<ModeListEntry> tableIter,
|
void executeTable(HybridIterator<ModeListEntry> tableIter,
|
||||||
Submode_t targetSubmode = SUBMODE_NONE);
|
Submode_t targetSubmode = SUBMODE_NONE);
|
||||||
|
|
||||||
ReturnValue_t updateChildMode(MessageQueueId_t queue, Mode_t mode, Submode_t submode);
|
ReturnValue_t updateChildMode(MessageQueueId_t queue, Mode_t mode, Submode_t submode);
|
||||||
ReturnValue_t updateChildModeByObjId(object_id_t objectId, Mode_t mode, Submode_t submode);
|
ReturnValue_t updateChildModeByObjId(object_id_t objectId, Mode_t mode, Submode_t submode);
|
||||||
|
|||||||
@@ -18,10 +18,6 @@ PusDistributor::PusDistributor(uint16_t setApid, object_id_t setObjectId, Storag
|
|||||||
|
|
||||||
PusDistributor::~PusDistributor() = default;
|
PusDistributor::~PusDistributor() = default;
|
||||||
|
|
||||||
void PusDistributor::setVerificationReporter(object_id_t verificationReporter_) {
|
|
||||||
verificationReporter = verificationReporter_;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t PusDistributor::selectDestination(MessageQueueId_t& destId) {
|
ReturnValue_t PusDistributor::selectDestination(MessageQueueId_t& destId) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1 && PUS_DISTRIBUTOR_DEBUGGING == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1 && PUS_DISTRIBUTOR_DEBUGGING == 1
|
||||||
store_address_t storeId = currentMessage.getStorageId();
|
store_address_t storeId = currentMessage.getStorageId();
|
||||||
@@ -135,7 +131,8 @@ ReturnValue_t PusDistributor::initialize() {
|
|||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
if (verifyChannel == nullptr) {
|
if (verifyChannel == nullptr) {
|
||||||
verifyChannel = ObjectManager::instance()->get<VerificationReporterIF>(verificationReporter);
|
verifyChannel =
|
||||||
|
ObjectManager::instance()->get<VerificationReporterIF>(objects::VERIFICATION_REPORTER);
|
||||||
if (verifyChannel == nullptr) {
|
if (verifyChannel == nullptr) {
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,10 +43,6 @@ class PusDistributor : public TcDistributorBase,
|
|||||||
[[nodiscard]] MessageQueueId_t getRequestQueue() const override;
|
[[nodiscard]] MessageQueueId_t getRequestQueue() const override;
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
[[nodiscard]] uint32_t getIdentifier() const override;
|
[[nodiscard]] uint32_t getIdentifier() const override;
|
||||||
/**
|
|
||||||
* @brief Can be used to set the verification reporter if another than the default should be used
|
|
||||||
*/
|
|
||||||
void setVerificationReporter(object_id_t verificationReporter_);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct ServiceInfo {
|
struct ServiceInfo {
|
||||||
@@ -79,8 +75,6 @@ class PusDistributor : public TcDistributorBase,
|
|||||||
*/
|
*/
|
||||||
ReturnValue_t tcStatus;
|
ReturnValue_t tcStatus;
|
||||||
|
|
||||||
object_id_t verificationReporter = objects::VERIFICATION_REPORTER;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method reads the packet service, checks if such a service is
|
* This method reads the packet service, checks if such a service is
|
||||||
* registered and forwards the packet to the destination.
|
* registered and forwards the packet to the destination.
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ ReturnValue_t CommandingServiceBase::initialize() {
|
|||||||
|
|
||||||
if (verificationReporter == nullptr) {
|
if (verificationReporter == nullptr) {
|
||||||
verificationReporter =
|
verificationReporter =
|
||||||
ObjectManager::instance()->get<VerificationReporterIF>(verificationReporterId);
|
ObjectManager::instance()->get<VerificationReporterIF>(objects::VERIFICATION_REPORTER);
|
||||||
if (verificationReporter == nullptr) {
|
if (verificationReporter == nullptr) {
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
@@ -136,10 +136,6 @@ ReturnValue_t CommandingServiceBase::initialize() {
|
|||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandingServiceBase::setVerificationReporter(object_id_t verificationReporterId_) {
|
|
||||||
verificationReporterId = verificationReporterId_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CommandingServiceBase::handleCommandQueue() {
|
void CommandingServiceBase::handleCommandQueue() {
|
||||||
CommandMessage reply;
|
CommandMessage reply;
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
|
|||||||
@@ -126,8 +126,6 @@ class CommandingServiceBase : public SystemObject,
|
|||||||
|
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
void setVerificationReporter(object_id_t verificationReporterId_);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of ExecutableObjectIF function
|
* Implementation of ExecutableObjectIF function
|
||||||
*
|
*
|
||||||
@@ -264,8 +262,6 @@ class CommandingServiceBase : public SystemObject,
|
|||||||
|
|
||||||
const uint16_t timeoutSeconds;
|
const uint16_t timeoutSeconds;
|
||||||
|
|
||||||
object_id_t verificationReporterId = objects::VERIFICATION_REPORTER;
|
|
||||||
|
|
||||||
PusTcReader tcReader;
|
PusTcReader tcReader;
|
||||||
TmStoreHelper tmStoreHelper;
|
TmStoreHelper tmStoreHelper;
|
||||||
TmSendHelper tmSendHelper;
|
TmSendHelper tmSendHelper;
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ ReturnValue_t PusServiceBase::initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (psbParams.pusDistributor == nullptr) {
|
if (psbParams.pusDistributor == nullptr) {
|
||||||
psbParams.pusDistributor = ObjectManager::instance()->get<PusDistributorIF>(pusDistributor);
|
psbParams.pusDistributor = ObjectManager::instance()->get<PusDistributorIF>(PUS_DISTRIBUTOR);
|
||||||
if (psbParams.pusDistributor != nullptr) {
|
if (psbParams.pusDistributor != nullptr) {
|
||||||
registerService(*psbParams.pusDistributor);
|
registerService(*psbParams.pusDistributor);
|
||||||
}
|
}
|
||||||
@@ -126,7 +126,7 @@ ReturnValue_t PusServiceBase::initialize() {
|
|||||||
|
|
||||||
if (psbParams.verifReporter == nullptr) {
|
if (psbParams.verifReporter == nullptr) {
|
||||||
psbParams.verifReporter =
|
psbParams.verifReporter =
|
||||||
ObjectManager::instance()->get<VerificationReporterIF>(verificationReporter);
|
ObjectManager::instance()->get<VerificationReporterIF>(objects::VERIFICATION_REPORTER);
|
||||||
if (psbParams.verifReporter == nullptr) {
|
if (psbParams.verifReporter == nullptr) {
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
@@ -134,14 +134,6 @@ ReturnValue_t PusServiceBase::initialize() {
|
|||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PusServiceBase::setPusDistributor(object_id_t pusDistributor_) {
|
|
||||||
pusDistributor = pusDistributor_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PusServiceBase::setVerificationReporter(object_id_t verificationReporter_) {
|
|
||||||
verificationReporter = verificationReporter_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PusServiceBase::setTcPool(StorageManagerIF& tcPool) { psbParams.tcPool = &tcPool; }
|
void PusServiceBase::setTcPool(StorageManagerIF& tcPool) { psbParams.tcPool = &tcPool; }
|
||||||
|
|
||||||
void PusServiceBase::setErrorReporter(InternalErrorReporterIF& errReporter_) {
|
void PusServiceBase::setErrorReporter(InternalErrorReporterIF& errReporter_) {
|
||||||
|
|||||||
@@ -201,9 +201,6 @@ class PusServiceBase : public ExecutableObjectIF,
|
|||||||
void setTaskIF(PeriodicTaskIF* taskHandle) override;
|
void setTaskIF(PeriodicTaskIF* taskHandle) override;
|
||||||
[[nodiscard]] const char* getName() const override;
|
[[nodiscard]] const char* getName() const override;
|
||||||
|
|
||||||
void setPusDistributor(object_id_t pusDistributor_);
|
|
||||||
void setVerificationReporter(object_id_t verificationReporter_);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief Handle to the underlying task
|
* @brief Handle to the underlying task
|
||||||
@@ -231,9 +228,6 @@ class PusServiceBase : public ExecutableObjectIF,
|
|||||||
static object_id_t PACKET_DESTINATION;
|
static object_id_t PACKET_DESTINATION;
|
||||||
static object_id_t PUS_DISTRIBUTOR;
|
static object_id_t PUS_DISTRIBUTOR;
|
||||||
|
|
||||||
object_id_t pusDistributor = PUS_DISTRIBUTOR;
|
|
||||||
object_id_t verificationReporter = objects::VERIFICATION_REPORTER;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleRequestQueue();
|
void handleRequestQueue();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class CommandExecutor {
|
|||||||
int currentFd = 0;
|
int currentFd = 0;
|
||||||
bool printOutput = true;
|
bool printOutput = true;
|
||||||
std::vector<char> readVec;
|
std::vector<char> readVec;
|
||||||
struct pollfd waiter{};
|
struct pollfd waiter {};
|
||||||
SimpleRingBuffer* ringBuffer = nullptr;
|
SimpleRingBuffer* ringBuffer = nullptr;
|
||||||
DynamicFIFO<uint16_t>* sizesFifo = nullptr;
|
DynamicFIFO<uint16_t>* sizesFifo = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ TEST_CASE("PUS TM Reader", "[pus-tm-reader]") {
|
|||||||
readerPtr->setTimeReader(&timeStamperAndReader);
|
readerPtr->setTimeReader(&timeStamperAndReader);
|
||||||
deleteReader = true;
|
deleteReader = true;
|
||||||
}
|
}
|
||||||
REQUIRE(not*readerPtr);
|
REQUIRE(not *readerPtr);
|
||||||
REQUIRE(readerPtr->isNull());
|
REQUIRE(readerPtr->isNull());
|
||||||
REQUIRE(readerPtr->parseDataWithCrcCheck() == returnvalue::OK);
|
REQUIRE(readerPtr->parseDataWithCrcCheck() == returnvalue::OK);
|
||||||
REQUIRE(not readerPtr->isNull());
|
REQUIRE(not readerPtr->isNull());
|
||||||
|
|||||||
Reference in New Issue
Block a user