some fixes and tweaks

This commit is contained in:
Robin Müller 2021-05-12 10:54:10 +02:00
parent 413ff0d1b9
commit e1c91f82b7
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
3 changed files with 35 additions and 19 deletions

View File

@ -2,7 +2,7 @@
#include "EventMessage.h" #include "EventMessage.h"
#include <FSFWConfig.h> #include <FSFWConfig.h>
#include "../serviceinterface/ServiceInterfaceStream.h" #include "../serviceinterface/ServiceInterface.h"
#include "../ipc/QueueFactory.h" #include "../ipc/QueueFactory.h"
#include "../ipc/MutexFactory.h" #include "../ipc/MutexFactory.h"
@ -120,23 +120,39 @@ ReturnValue_t EventManager::unsubscribeFromEventRange(MessageQueueId_t listener,
void EventManager::printEvent(EventMessage* message) { void EventManager::printEvent(EventMessage* message) {
const char *string = 0; const char *string = 0;
switch (message->getSeverity()) { switch (message->getSeverity()) {
case severity::INFO: case severity::INFO: {
#if DEBUG_INFO_EVENT == 1 #if FSFW_DEBUG_INFO == 1
string = translateObject(message->getReporter()); string = translateObject(message->getReporter());
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "EVENT: "; sif::info << "EVENT: ";
if (string != 0) { if (string != 0) {
sif::info << string; sif::info << string;
} else { }
sif::info << "0x" << std::hex << message->getReporter() << std::dec; else {
} sif::info << "0x" << std::hex << std::setfill('0') << std::setw(8) <<
sif::info << " reported " << translateEvents(message->getEvent()) << " (" message->getReporter() << std::setfill(' ') << std::dec;
<< std::dec << message->getEventId() << std::hex << ") P1: 0x" }
<< message->getParameter1() << " P2: 0x" sif::info << " reported " << translateEvents(message->getEvent()) << " ("
<< message->getParameter2() << std::dec << std::endl; << std::dec << message->getEventId() << std::hex << ") P1: 0x"
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ << message->getParameter1() << " P2: 0x"
<< message->getParameter2() << std::dec << std::endl;
#else
const char totalString[140] = {};
if (string != 0) {
snprintf((char*) totalString, sizeof(totalString),"Event: %s", string);
}
else {
snprintf((char*) totalString, sizeof(totalString),"Event: 0x%08x",
message->getReporter());
}
snprintf((char*) totalString, sizeof(totalString),
" reported %s | ID %d | P1: 0x%x | P2: 0x%x\n", translateEvents(message->getEvent()),
message->getEventId(), message->getParameter1(), message->getParameter2());
sif::printInfo("%s", totalString);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */
#endif /* DEBUG_INFO_EVENT == 1 */ #endif /* DEBUG_INFO_EVENT == 1 */
break; break;
}
default: default:
string = translateObject(message->getReporter()); string = translateObject(message->getReporter());
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1

View File

@ -4,7 +4,7 @@
#include "frameworkObjects.h" #include "frameworkObjects.h"
#include "SystemObjectIF.h" #include "SystemObjectIF.h"
#include "../returnvalues/HasReturnvaluesIF.h" #include "../returnvalues/HasReturnvaluesIF.h"
#include "../serviceinterface/ServiceInterfaceStream.h" #include "../serviceinterface/ServiceInterface.h"
/** /**
* @brief This class provides an interface to the global object manager. * @brief This class provides an interface to the global object manager.

View File

@ -5,9 +5,9 @@
#include "serviceInterfaceDefintions.h" #include "serviceInterfaceDefintions.h"
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
#include <fsfw/serviceinterface/ServiceInterfaceStream.h> #include "ServiceInterfaceStream.h"
#else #else
#include <fsfw/serviceinterface/ServiceInterfacePrinter.h> #include "ServiceInterfacePrinter.h"
#endif #endif
#endif /* FSFW_SERVICEINTERFACE_SERVICEINTERFACE_H_ */ #endif /* FSFW_SERVICEINTERFACE_SERVICEINTERFACE_H_ */