rename namespace

This commit is contained in:
Robin Müller 2022-07-21 18:21:10 +02:00
parent 0981ee6f7e
commit affde6bad5
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
9 changed files with 17 additions and 19 deletions

View File

@ -146,7 +146,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;

View File

@ -122,7 +122,7 @@ ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
MutexGuard helper(timeMutex); MutexGuard helper(timeMutex);
// gmtime writes its output in a global buffer which is not Thread Safe // gmtime writes its output in a global buffer which is not Thread Safe
// Therefore we have to use a Mutex here // Therefore we have to use a Mutex here
struct tm* timeInfo; struct telemetry* timeInfo;
timeInfo = gmtime(&timeUnix.tv_sec); timeInfo = gmtime(&timeUnix.tv_sec);
time->year = timeInfo->tm_year + 1900; time->year = timeInfo->tm_year + 1900;
time->month = timeInfo->tm_mon + 1; time->month = timeInfo->tm_mon + 1;
@ -136,7 +136,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) {
tm fromTm; telemetry fromTm;
// Note: Fails for years before AD // Note: Fails for years before AD
fromTm.tm_year = from->year - 1900; fromTm.tm_year = from->year - 1900;
fromTm.tm_mon = from->month - 1; fromTm.tm_mon = from->month - 1;

View File

@ -17,12 +17,12 @@ ReturnValue_t Service17Test::handleRequest(uint8_t subservice) {
switch (subservice) { switch (subservice) {
case Subservice::CONNECTION_TEST: { case Subservice::CONNECTION_TEST: {
storeHelper.preparePacket(serviceId, Subservice::CONNECTION_TEST_REPORT, packetSubCounter); storeHelper.preparePacket(serviceId, Subservice::CONNECTION_TEST_REPORT, packetSubCounter);
return tm::storeAndSendTmPacket(storeHelper, sendHelper); return telemetry::storeAndSendTmPacket(storeHelper, sendHelper);
} }
case Subservice::EVENT_TRIGGER_TEST: { case Subservice::EVENT_TRIGGER_TEST: {
storeHelper.preparePacket(serviceId, Subservice::CONNECTION_TEST_REPORT, packetSubCounter++); storeHelper.preparePacket(serviceId, Subservice::CONNECTION_TEST_REPORT, packetSubCounter++);
triggerEvent(TEST, 1234, 5678); triggerEvent(TEST, 1234, 5678);
return tm::storeAndSendTmPacket(storeHelper, sendHelper); return telemetry::storeAndSendTmPacket(storeHelper, sendHelper);
} }
default: default:
return AcceptsTelecommandsIF::INVALID_SUBSERVICE; return AcceptsTelecommandsIF::INVALID_SUBSERVICE;

View File

@ -70,7 +70,7 @@ ReturnValue_t Service1TelecommandVerification::generateFailureReport(
message->getParameter1(), message->getParameter2()); message->getParameter1(), message->getParameter2());
storeHelper.preparePacket(serviceId, message->getReportId(), packetSubCounter++); storeHelper.preparePacket(serviceId, message->getReportId(), packetSubCounter++);
storeHelper.setSourceDataSerializable(&report); storeHelper.setSourceDataSerializable(&report);
return tm::storeAndSendTmPacket(storeHelper, sendHelper); return telemetry::storeAndSendTmPacket(storeHelper, sendHelper);
} }
ReturnValue_t Service1TelecommandVerification::generateSuccessReport( ReturnValue_t Service1TelecommandVerification::generateSuccessReport(
@ -79,7 +79,7 @@ ReturnValue_t Service1TelecommandVerification::generateSuccessReport(
message->getTcSequenceControl(), message->getStep()); message->getTcSequenceControl(), message->getStep());
storeHelper.preparePacket(serviceId, message->getReportId(), packetSubCounter++); storeHelper.preparePacket(serviceId, message->getReportId(), packetSubCounter++);
storeHelper.setSourceDataSerializable(&report); storeHelper.setSourceDataSerializable(&report);
return tm::storeAndSendTmPacket(storeHelper, sendHelper); return telemetry::storeAndSendTmPacket(storeHelper, sendHelper);
} }
ReturnValue_t Service1TelecommandVerification::initialize() { ReturnValue_t Service1TelecommandVerification::initialize() {

View File

@ -49,7 +49,7 @@ ReturnValue_t Service5EventReporting::generateEventReport(EventMessage message)
message.getParameter2()); message.getParameter2());
storeHelper.preparePacket(serviceId, message.getSeverity(), packetSubCounter); storeHelper.preparePacket(serviceId, message.getSeverity(), packetSubCounter);
storeHelper.setSourceDataSerializable(&report); storeHelper.setSourceDataSerializable(&report);
ReturnValue_t result = tm::storeAndSendTmPacket(storeHelper, sendHelper); ReturnValue_t result = telemetry::storeAndSendTmPacket(storeHelper, sendHelper);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "Service5EventReporting::generateEventReport: " sif::warning << "Service5EventReporting::generateEventReport: "

View File

@ -5,7 +5,6 @@
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/tcdistribution/PUSDistributorIF.h" #include "fsfw/tcdistribution/PUSDistributorIF.h"
#include "fsfw/tmtcpacket/pus/tc.h" #include "fsfw/tmtcpacket/pus/tc.h"
#include "fsfw/tmtcpacket/pus/tm.h"
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h" #include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
#include "fsfw/tmtcservices/TmTcMessage.h" #include "fsfw/tmtcservices/TmTcMessage.h"
#include "fsfw/tmtcservices/tcHelpers.h" #include "fsfw/tmtcservices/tcHelpers.h"
@ -290,7 +289,7 @@ ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, const uint
size_t sourceDataLen) { size_t sourceDataLen) {
tmStoreHelper.preparePacket(service, subservice, tmPacketCounter); tmStoreHelper.preparePacket(service, subservice, tmPacketCounter);
tmStoreHelper.setSourceDataRaw(sourceData, sourceDataLen); tmStoreHelper.setSourceDataRaw(sourceData, sourceDataLen);
ReturnValue_t result = tm::storeAndSendTmPacket(tmStoreHelper, tmSendHelper); ReturnValue_t result = telemetry::storeAndSendTmPacket(tmStoreHelper, tmSendHelper);
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
this->tmPacketCounter++; this->tmPacketCounter++;
} }
@ -299,10 +298,10 @@ ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, const uint
ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, object_id_t objectId, ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, object_id_t objectId,
const uint8_t* data, size_t dataLen) { const uint8_t* data, size_t dataLen) {
tm::SourceDataWithObjectIdPrefix dataWithObjId(objectId, data, dataLen); telemetry::SourceDataWithObjectIdPrefix dataWithObjId(objectId, data, dataLen);
tmStoreHelper.preparePacket(service, subservice, tmPacketCounter); tmStoreHelper.preparePacket(service, subservice, tmPacketCounter);
tmStoreHelper.setSourceDataSerializable(&dataWithObjId); tmStoreHelper.setSourceDataSerializable(&dataWithObjId);
ReturnValue_t result = tm::storeAndSendTmPacket(tmStoreHelper, tmSendHelper); ReturnValue_t result = telemetry::storeAndSendTmPacket(tmStoreHelper, tmSendHelper);
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
this->tmPacketCounter++; this->tmPacketCounter++;
} }
@ -312,7 +311,7 @@ ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, object_id_
ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, SerializeIF* sourceData) { ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, SerializeIF* sourceData) {
tmStoreHelper.preparePacket(service, subservice, tmPacketCounter); tmStoreHelper.preparePacket(service, subservice, tmPacketCounter);
tmStoreHelper.setSourceDataSerializable(sourceData); tmStoreHelper.setSourceDataSerializable(sourceData);
ReturnValue_t result = tm::storeAndSendTmPacket(tmStoreHelper, tmSendHelper); ReturnValue_t result = telemetry::storeAndSendTmPacket(tmStoreHelper, tmSendHelper);
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
this->tmPacketCounter++; this->tmPacketCounter++;
} }

View File

@ -15,9 +15,6 @@
#include "fsfw/storagemanager/StorageManagerIF.h" #include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/tasks/ExecutableObjectIF.h" #include "fsfw/tasks/ExecutableObjectIF.h"
class TcPacketStoredBase;
class TcPacketStoredPus;
namespace Factory { namespace Factory {
void setStaticFrameworkObjectIds(); void setStaticFrameworkObjectIds();
} }

View File

@ -1,6 +1,7 @@
#include "tmHelpers.h" #include "tmHelpers.h"
ReturnValue_t tm::storeAndSendTmPacket(TmStoreHelper &storeHelper, TmSendHelper &sendHelper) { ReturnValue_t telemetry::storeAndSendTmPacket(TmStoreHelper &storeHelper,
TmSendHelper &sendHelper) {
storeHelper.addPacketToStore(); storeHelper.addPacketToStore();
ReturnValue_t result = sendHelper.sendPacket(storeHelper.getCurrentAddr()); ReturnValue_t result = sendHelper.sendPacket(storeHelper.getCurrentAddr());
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {

View File

@ -4,7 +4,8 @@
#include "TmSendHelper.h" #include "TmSendHelper.h"
#include "TmStoreHelper.h" #include "TmStoreHelper.h"
namespace tm { // I'd prefer to use tm, but there have been nameclashes with the tm struct
namespace telemetry {
ReturnValue_t storeAndSendTmPacket(TmStoreHelper& storeHelper, TmSendHelper& sendHelper); ReturnValue_t storeAndSendTmPacket(TmStoreHelper& storeHelper, TmSendHelper& sendHelper);
@ -42,6 +43,6 @@ class SourceDataWithObjectIdPrefix : public SerializeIF {
size_t srcDataLen; size_t srcDataLen;
}; };
} // namespace tm } // namespace telemetry
#endif // FSFW_TMTCSERVICES_TMHELPERS_H_ #endif // FSFW_TMTCSERVICES_TMHELPERS_H_