more ref replacements

This commit is contained in:
Robin Müller 2022-07-25 11:26:45 +02:00
parent 973d4ee8a5
commit e2ad37e3e6
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
18 changed files with 23 additions and 23 deletions

View File

@ -96,13 +96,13 @@ ReturnValue_t CService200ModeCommanding::handleReply(const CommandMessage *reply
ReturnValue_t CService200ModeCommanding::prepareModeReply(const CommandMessage *reply, ReturnValue_t CService200ModeCommanding::prepareModeReply(const CommandMessage *reply,
object_id_t objectId) { object_id_t objectId) {
ModePacket modeReplyPacket(objectId, ModeMessage::getMode(reply), ModeMessage::getSubmode(reply)); ModePacket modeReplyPacket(objectId, ModeMessage::getMode(reply), ModeMessage::getSubmode(reply));
return sendTmPacket(Subservice::REPLY_MODE_REPLY, &modeReplyPacket); return sendTmPacket(Subservice::REPLY_MODE_REPLY, modeReplyPacket);
} }
ReturnValue_t CService200ModeCommanding::prepareWrongModeReply(const CommandMessage *reply, ReturnValue_t CService200ModeCommanding::prepareWrongModeReply(const CommandMessage *reply,
object_id_t objectId) { object_id_t objectId) {
ModePacket wrongModeReply(objectId, ModeMessage::getMode(reply), ModeMessage::getSubmode(reply)); ModePacket wrongModeReply(objectId, ModeMessage::getMode(reply), ModeMessage::getSubmode(reply));
ReturnValue_t result = sendTmPacket(Subservice::REPLY_WRONG_MODE_REPLY, &wrongModeReply); ReturnValue_t result = sendTmPacket(Subservice::REPLY_WRONG_MODE_REPLY, wrongModeReply);
if (result == RETURN_OK) { if (result == RETURN_OK) {
// We want to produce an error here in any case because the mode was not correct // We want to produce an error here in any case because the mode was not correct
return RETURN_FAILED; return RETURN_FAILED;
@ -113,7 +113,7 @@ ReturnValue_t CService200ModeCommanding::prepareWrongModeReply(const CommandMess
ReturnValue_t CService200ModeCommanding::prepareCantReachModeReply(const CommandMessage *reply, ReturnValue_t CService200ModeCommanding::prepareCantReachModeReply(const CommandMessage *reply,
object_id_t objectId) { object_id_t objectId) {
CantReachModePacket cantReachModePacket(objectId, ModeMessage::getCantReachModeReason(reply)); CantReachModePacket cantReachModePacket(objectId, ModeMessage::getCantReachModeReason(reply));
ReturnValue_t result = sendTmPacket(Subservice::REPLY_CANT_REACH_MODE, &cantReachModePacket); ReturnValue_t result = sendTmPacket(Subservice::REPLY_CANT_REACH_MODE, cantReachModePacket);
if (result == RETURN_OK) { if (result == RETURN_OK) {
// We want to produce an error here in any case because the mode was not reached // We want to produce an error here in any case because the mode was not reached
return RETURN_FAILED; return RETURN_FAILED;

View File

@ -102,5 +102,5 @@ ReturnValue_t CService201HealthCommanding::handleReply(const CommandMessage *rep
auto health = static_cast<uint8_t>(HealthMessage::getHealth(reply)); auto health = static_cast<uint8_t>(HealthMessage::getHealth(reply));
auto oldHealth = static_cast<uint8_t>(HealthMessage::getOldHealth(reply)); auto oldHealth = static_cast<uint8_t>(HealthMessage::getOldHealth(reply));
HealthSetReply healthSetReply(health, oldHealth); HealthSetReply healthSetReply(health, oldHealth);
return sendTmPacket(Subservice::REPLY_HEALTH_SET, &healthSetReply); return sendTmPacket(Subservice::REPLY_HEALTH_SET, healthSetReply);
} }

View File

@ -69,7 +69,7 @@ ReturnValue_t Service1TelecommandVerification::generateFailureReport(
message->getTcSequenceControl(), message->getStep(), message->getErrorCode(), message->getTcSequenceControl(), message->getStep(), message->getErrorCode(),
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 telemetry::storeAndSendTmPacket(storeHelper, sendHelper); return telemetry::storeAndSendTmPacket(storeHelper, sendHelper);
} }
@ -78,7 +78,7 @@ ReturnValue_t Service1TelecommandVerification::generateSuccessReport(
SuccessReport report(message->getReportId(), message->getTcPacketId(), SuccessReport report(message->getReportId(), message->getTcPacketId(),
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 telemetry::storeAndSendTmPacket(storeHelper, sendHelper); return telemetry::storeAndSendTmPacket(storeHelper, sendHelper);
} }

View File

@ -177,7 +177,7 @@ ReturnValue_t Service20ParameterManagement::handleReply(const CommandMessage* re
ParameterId_t parameterId = ParameterMessage::getParameterId(reply); ParameterId_t parameterId = ParameterMessage::getParameterId(reply);
ParameterDumpReply parameterReply(objectId, parameterId, parameterData.second.data(), ParameterDumpReply parameterReply(objectId, parameterId, parameterData.second.data(),
parameterData.second.size()); parameterData.second.size());
sendTmPacket(static_cast<uint8_t>(Subservice::PARAMETER_DUMP_REPLY), &parameterReply); sendTmPacket(static_cast<uint8_t>(Subservice::PARAMETER_DUMP_REPLY), parameterReply);
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
default: default:

View File

@ -48,7 +48,7 @@ ReturnValue_t Service5EventReporting::generateEventReport(EventMessage message)
EventReport report(message.getEventId(), message.getReporter(), message.getParameter1(), EventReport report(message.getEventId(), message.getReporter(), message.getParameter1(),
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 = telemetry::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

View File

@ -138,7 +138,7 @@ ReturnValue_t Service8FunctionManagement::handleDataReply(const CommandMessage*
return result; return result;
} }
DataReply dataReply(objectId, actionId, buffer, size); DataReply dataReply(objectId, actionId, buffer, size);
result = sendTmPacket(static_cast<uint8_t>(Subservice::REPLY_DIRECT_COMMANDING_DATA), &dataReply); result = sendTmPacket(static_cast<uint8_t>(Subservice::REPLY_DIRECT_COMMANDING_DATA), dataReply);
auto deletionResult = ipcStore->deleteData(storeId); auto deletionResult = ipcStore->deleteData(storeId);
if (deletionResult != HasReturnvaluesIF::RETURN_OK) { if (deletionResult != HasReturnvaluesIF::RETURN_OK) {

View File

@ -7,6 +7,6 @@ class CustomUserDataIF {
public: public:
virtual ~CustomUserDataIF() = default; virtual ~CustomUserDataIF() = default;
virtual ReturnValue_t setRawUserData(const uint8_t* data, size_t len) = 0; virtual ReturnValue_t setRawUserData(const uint8_t* data, size_t len) = 0;
virtual ReturnValue_t setSerializableUserData(SerializeIF* serializable) = 0; virtual ReturnValue_t setSerializableUserData(SerializeIF& serializable) = 0;
}; };
#endif // FSFW_TMTCPACKET_CREATORDATAIF_H #endif // FSFW_TMTCPACKET_CREATORDATAIF_H

View File

@ -45,9 +45,9 @@ struct DataWrapper {
dataUnion.raw.len = bufPair.second; dataUnion.raw.len = bufPair.second;
} }
void setSerializable(SerializeIF* serializable) { void setSerializable(SerializeIF& serializable) {
type = DataTypes::SERIALIZABLE; type = DataTypes::SERIALIZABLE;
dataUnion.serializable = serializable; dataUnion.serializable = &serializable;
} }
}; };

View File

@ -101,7 +101,7 @@ ReturnValue_t PusTcCreator::setRawUserData(const uint8_t *data, size_t len) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t PusTcCreator::setSerializableUserData(SerializeIF *serializable) { ReturnValue_t PusTcCreator::setSerializableUserData(SerializeIF& serializable) {
// TODO: Check length field? // TODO: Check length field?
pusParams.dataWrapper.setSerializable(serializable); pusParams.dataWrapper.setSerializable(serializable);
updateSpLengthField(); updateSpLengthField();

View File

@ -47,7 +47,7 @@ class PusTcCreator : public PusTcIF, public SerializeIF, public CustomUserDataIF
[[nodiscard]] uint8_t getSubService() const override; [[nodiscard]] uint8_t getSubService() const override;
[[nodiscard]] uint16_t getSourceId() const override; [[nodiscard]] uint16_t getSourceId() const override;
ReturnValue_t setRawUserData(const uint8_t *data, size_t len) override; ReturnValue_t setRawUserData(const uint8_t *data, size_t len) override;
ReturnValue_t setSerializableUserData(SerializeIF *serializable) override; ReturnValue_t setSerializableUserData(SerializeIF& serializable) override;
private: private:
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,

View File

@ -128,7 +128,7 @@ ReturnValue_t PusTmCreator::setRawUserData(const uint8_t* data, size_t len) {
updateSpLengthField(); updateSpLengthField();
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t PusTmCreator::setSerializableUserData(SerializeIF* serializable) { ReturnValue_t PusTmCreator::setSerializableUserData(SerializeIF& serializable) {
pusParams.dataWrapper.setSerializable(serializable); pusParams.dataWrapper.setSerializable(serializable);
updateSpLengthField(); updateSpLengthField();
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;

View File

@ -69,7 +69,7 @@ class PusTmCreator : public SerializeIF, public PusTmIF, public CustomUserDataIF
Endianness streamEndianness) override; Endianness streamEndianness) override;
[[nodiscard]] TimeStamperIF* getTimestamper() const; [[nodiscard]] TimeStamperIF* getTimestamper() const;
ReturnValue_t setRawUserData(const uint8_t* data, size_t len) override; ReturnValue_t setRawUserData(const uint8_t* data, size_t len) override;
ReturnValue_t setSerializableUserData(SerializeIF* serializable) override; ReturnValue_t setSerializableUserData(SerializeIF& serializable) override;
private: private:
void setup(); void setup();

View File

@ -300,7 +300,7 @@ ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, object_id_
const uint8_t* data, size_t dataLen) { const uint8_t* data, size_t dataLen) {
telemetry::DataWithObjectIdPrefix dataWithObjId(objectId, data, dataLen); telemetry::DataWithObjectIdPrefix dataWithObjId(objectId, data, dataLen);
tmStoreHelper.preparePacket(service, subservice, tmPacketCounter); tmStoreHelper.preparePacket(service, subservice, tmPacketCounter);
tmStoreHelper.setSourceDataSerializable(&dataWithObjId); tmStoreHelper.setSourceDataSerializable(dataWithObjId);
ReturnValue_t result = telemetry::storeAndSendTmPacket(tmStoreHelper, tmSendHelper); ReturnValue_t result = telemetry::storeAndSendTmPacket(tmStoreHelper, tmSendHelper);
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
this->tmPacketCounter++; this->tmPacketCounter++;
@ -308,7 +308,7 @@ ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, object_id_
return result; return result;
} }
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 = telemetry::storeAndSendTmPacket(tmStoreHelper, tmSendHelper); ReturnValue_t result = telemetry::storeAndSendTmPacket(tmStoreHelper, tmSendHelper);

View File

@ -313,7 +313,7 @@ class CommandingServiceBase : public SystemObject,
* @param content This is a pointer to the serialized packet * @param content This is a pointer to the serialized packet
* @param header Serialize IF header which will be placed before content * @param header Serialize IF header which will be placed before content
*/ */
ReturnValue_t sendTmPacket(uint8_t subservice, SerializeIF* sourceData); ReturnValue_t sendTmPacket(uint8_t subservice, SerializeIF& sourceData);
void checkAndExecuteFifo(CommandMapIter& iter); void checkAndExecuteFifo(CommandMapIter& iter);

View File

@ -38,7 +38,7 @@ ReturnValue_t TmStoreHelper::setSourceDataRaw(const uint8_t* data, size_t len) {
return creator.setRawUserData(data, len); return creator.setRawUserData(data, len);
} }
ReturnValue_t TmStoreHelper::setSourceDataSerializable(SerializeIF* serializable) { ReturnValue_t TmStoreHelper::setSourceDataSerializable(SerializeIF& serializable) {
return creator.setSerializableUserData(serializable); return creator.setSerializableUserData(serializable);
} }

View File

@ -19,7 +19,7 @@ class TmStoreHelper {
void setTimeStamper(TimeStamperIF& timeStamper); void setTimeStamper(TimeStamperIF& timeStamper);
[[nodiscard]] const store_address_t& getCurrentAddr() const; [[nodiscard]] const store_address_t& getCurrentAddr() const;
ReturnValue_t setSourceDataRaw(const uint8_t* data, size_t len); ReturnValue_t setSourceDataRaw(const uint8_t* data, size_t len);
ReturnValue_t setSourceDataSerializable(SerializeIF* serializable); ReturnValue_t setSourceDataSerializable(SerializeIF& serializable);
void setApid(uint16_t apid); void setApid(uint16_t apid);
StorageManagerIF* getTmStore(); StorageManagerIF* getTmStore();
void setTmStore(StorageManagerIF& store); void setTmStore(StorageManagerIF& store);

View File

@ -85,7 +85,7 @@ TEST_CASE("PUS TC Creator", "[pus-tc-creator]") {
SECTION("Test with Application Data Serializable") { SECTION("Test with Application Data Serializable") {
auto& params = creator.getPusParams(); auto& params = creator.getPusParams();
auto simpleSer = SimpleSerializable(); auto simpleSer = SimpleSerializable();
creator.setSerializableUserData(&simpleSer); creator.setSerializableUserData(simpleSer);
REQUIRE(creator.getSerializedSize() == 16); REQUIRE(creator.getSerializedSize() == 16);
REQUIRE(creator.serialize(&dataPtr, &serLen, buf.size()) == HasReturnvaluesIF::RETURN_OK); REQUIRE(creator.serialize(&dataPtr, &serLen, buf.size()) == HasReturnvaluesIF::RETURN_OK);
REQUIRE(serLen == 16); REQUIRE(serLen == 16);

View File

@ -113,7 +113,7 @@ TEST_CASE("PUS TM Creator", "[pus-tm-creator]") {
SECTION("Serialize with Serializable") { SECTION("Serialize with Serializable") {
auto simpleSer = SimpleSerializable(); auto simpleSer = SimpleSerializable();
creator.setSerializableUserData(&simpleSer); creator.setSerializableUserData(simpleSer);
REQUIRE(creator.getFullPacketLen() == 25); REQUIRE(creator.getFullPacketLen() == 25);
REQUIRE(creator.serialize(&dataPtr, &serLen, buf.size()) == HasReturnvaluesIF::RETURN_OK); REQUIRE(creator.serialize(&dataPtr, &serLen, buf.size()) == HasReturnvaluesIF::RETURN_OK);
REQUIRE(buf[20] == 1); REQUIRE(buf[20] == 1);